From a663f65bccb760530b8cb9f3171cace8b695f3ea Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Tue, 10 Mar 2020 07:51:57 +0100 Subject: [PATCH 01/23] Harden creation of child processes (#55697) Add general protection against RCE vulnerabilities similar to the one described in CVE-2019-7609. Closes #49605 --- .eslintrc.js | 10 + package.json | 2 + scripts/test_hardening.js | 41 ++ src/setup_node_env/harden.js | 24 + src/setup_node_env/index.js | 1 + src/setup_node_env/patches/child_process.js | 76 +++ tasks/config/run.js | 6 + tasks/jenkins.js | 1 + test/harden/_echo.sh | 3 + test/harden/_fork.js | 20 + test/harden/child_process.js | 587 ++++++++++++++++++++ yarn.lock | 48 +- 12 files changed, 809 insertions(+), 10 deletions(-) create mode 100644 scripts/test_hardening.js create mode 100644 src/setup_node_env/harden.js create mode 100644 src/setup_node_env/patches/child_process.js create mode 100755 test/harden/_echo.sh create mode 100644 test/harden/_fork.js create mode 100644 test/harden/child_process.js diff --git a/.eslintrc.js b/.eslintrc.js index a678243e4f07a..b730b88a1b9cf 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -514,6 +514,16 @@ module.exports = { }, }, + /** + * Harden specific rules + */ + { + files: ['test/harden/*.js'], + rules: { + 'mocha/handle-done-callback': 'off', // TODO: Find a way to disable all mocha rules + }, + }, + /** * APM overrides */ diff --git a/package.json b/package.json index 9f12f04223103..7a815856c3d5c 100644 --- a/package.json +++ b/package.json @@ -246,6 +246,7 @@ "regenerator-runtime": "^0.13.3", "regression": "2.0.1", "request": "^2.88.0", + "require-in-the-middle": "^5.0.2", "reselect": "^4.0.0", "resize-observer-polyfill": "^1.5.0", "rison-node": "1.0.2", @@ -480,6 +481,7 @@ "strip-ansi": "^3.0.1", "supertest": "^3.1.0", "supertest-as-promised": "^4.0.2", + "tape": "^4.13.0", "tree-kill": "^1.2.2", "typescript": "3.7.2", "typings-tester": "^0.3.2", diff --git a/scripts/test_hardening.js b/scripts/test_hardening.js new file mode 100644 index 0000000000000..c0a20a9ff6cb4 --- /dev/null +++ b/scripts/test_hardening.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +var execFileSync = require('child_process').execFileSync; +var path = require('path'); +var syncGlob = require('glob').sync; +var program = require('commander'); + +program + .name('node scripts/test_hardening.js') + .arguments('[file...]') + .description( + 'Run the tests in test/harden directory. If no files are provided, all files within the directory will be run.' + ) + .action(function(globs) { + if (globs.length === 0) globs.push(path.join('test', 'harden', '*')); + globs.forEach(function(glob) { + syncGlob(glob).forEach(function(filename) { + if (path.basename(filename)[0] === '_') return; + console.log(process.argv[0], filename); + execFileSync(process.argv[0], [filename], { stdio: 'inherit' }); + }); + }); + }) + .parse(process.argv); diff --git a/src/setup_node_env/harden.js b/src/setup_node_env/harden.js new file mode 100644 index 0000000000000..466cbfa0d92cf --- /dev/null +++ b/src/setup_node_env/harden.js @@ -0,0 +1,24 @@ +/* + * 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. + */ + +var hook = require('require-in-the-middle'); + +hook(['child_process'], function(exports, name) { + return require(`./patches/${name}`)(exports); // eslint-disable-line import/no-dynamic-require +}); diff --git a/src/setup_node_env/index.js b/src/setup_node_env/index.js index 897b7e617d8e1..0f51f47572be6 100644 --- a/src/setup_node_env/index.js +++ b/src/setup_node_env/index.js @@ -17,6 +17,7 @@ * under the License. */ +require('./harden'); // this require MUST be executed before any others require('symbol-observable'); require('./root'); require('./node_version_validator'); diff --git a/src/setup_node_env/patches/child_process.js b/src/setup_node_env/patches/child_process.js new file mode 100644 index 0000000000000..b89190d8085e6 --- /dev/null +++ b/src/setup_node_env/patches/child_process.js @@ -0,0 +1,76 @@ +/* + * 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. + */ + +// Ensure, when spawning a new child process, that the `options` and the +// `options.env` object passed to the child process function doesn't inherit +// from `Object.prototype`. This protects against similar RCE vulnerabilities +// as described in CVE-2019-7609 +module.exports = function(cp) { + // The `exec` function is currently just a wrapper around `execFile`. So for + // now there's no need to patch it. If this changes in the future, our tests + // will fail and we can uncomment the line below. + // + // cp.exec = new Proxy(cp.exec, { apply: patchOptions() }); + + cp.execFile = new Proxy(cp.execFile, { apply: patchOptions(true) }); + cp.fork = new Proxy(cp.fork, { apply: patchOptions(true) }); + cp.spawn = new Proxy(cp.spawn, { apply: patchOptions(true) }); + cp.execFileSync = new Proxy(cp.execFileSync, { apply: patchOptions(true) }); + cp.execSync = new Proxy(cp.execSync, { apply: patchOptions() }); + cp.spawnSync = new Proxy(cp.spawnSync, { apply: patchOptions(true) }); + + return cp; +}; + +function patchOptions(hasArgs) { + return function apply(target, thisArg, args) { + var pos = 1; + if (pos === args.length) { + // fn(arg1) + args[pos] = prototypelessSpawnOpts(); + } else if (pos < args.length) { + if (hasArgs && (Array.isArray(args[pos]) || args[pos] == null)) { + // fn(arg1, args, ...) + pos++; + } + + if (typeof args[pos] === 'object' && args[pos] !== null) { + // fn(arg1, {}, ...) + // fn(arg1, args, {}, ...) + args[pos] = prototypelessSpawnOpts(args[pos]); + } else if (args[pos] == null) { + // fn(arg1, null/undefined, ...) + // fn(arg1, args, null/undefined, ...) + args[pos] = prototypelessSpawnOpts(); + } else if (typeof args[pos] === 'function') { + // fn(arg1, callback) + // fn(arg1, args, callback) + args.splice(pos, 0, prototypelessSpawnOpts()); + } + } + + return target.apply(thisArg, args); + }; +} + +function prototypelessSpawnOpts(obj) { + var prototypelessObj = Object.assign(Object.create(null), obj); + prototypelessObj.env = Object.assign(Object.create(null), prototypelessObj.env || process.env); + return prototypelessObj; +} diff --git a/tasks/config/run.js b/tasks/config/run.js index a47634a93ef14..a1b98422af4f3 100644 --- a/tasks/config/run.js +++ b/tasks/config/run.js @@ -210,6 +210,12 @@ module.exports = function(grunt) { args: ['scripts/notice', '--validate'], }), + test_hardening: scriptWithGithubChecks({ + title: 'Node.js hardening tests', + cmd: NODE, + args: ['scripts/test_hardening.js'], + }), + apiIntegrationTests: scriptWithGithubChecks({ title: 'API integration tests', cmd: NODE, diff --git a/tasks/jenkins.js b/tasks/jenkins.js index b40908c9b56c3..2225abc7d04df 100644 --- a/tasks/jenkins.js +++ b/tasks/jenkins.js @@ -37,6 +37,7 @@ module.exports = function(grunt) { 'run:test_jest_integration', 'run:test_projects', 'run:test_karma_ci', + 'run:test_hardening', 'run:apiIntegrationTests', ]); }; diff --git a/test/harden/_echo.sh b/test/harden/_echo.sh new file mode 100755 index 0000000000000..a0114be41d1d7 --- /dev/null +++ b/test/harden/_echo.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +echo $POLLUTED$custom diff --git a/test/harden/_fork.js b/test/harden/_fork.js new file mode 100644 index 0000000000000..c088737f02e6d --- /dev/null +++ b/test/harden/_fork.js @@ -0,0 +1,20 @@ +/* + * 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. + */ + +console.log(`${process.env.POLLUTED || ''}${process.env.custom || ''}`); diff --git a/test/harden/child_process.js b/test/harden/child_process.js new file mode 100644 index 0000000000000..11e2eeb07e0b6 --- /dev/null +++ b/test/harden/child_process.js @@ -0,0 +1,587 @@ +/* + * 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. + */ + +require('../../src/setup_node_env'); + +const cp = require('child_process'); +const path = require('path'); +const test = require('tape'); + +Object.prototype.POLLUTED = 'polluted!'; // eslint-disable-line no-extend-native + +const notSet = [null, undefined]; + +test.onFinish(() => { + delete Object.prototype.POLLUTED; +}); + +test('test setup ok', t => { + t.equal({}.POLLUTED, 'polluted!'); + t.end(); +}); + +// TODO: fork() has been omitted as it doesn't validate its arguments in +// Node.js 10 and will throw an internal error asynchronously. This is fixed in +// newer versions. See https://github.com/elastic/kibana/issues/59628 +const functions = ['exec', 'execFile', 'spawn', 'execFileSync', 'execSync', 'spawnSync']; +for (const name of functions) { + test(`${name}()`, t => { + t.throws(() => cp[name](), /argument must be of type string/); + t.end(); + }); +} + +{ + const command = 'echo $POLLUTED$custom'; + + test('exec(command)', t => { + assertProcess(t, cp.exec(command)); + }); + + test('exec(command, callback)', t => { + cp.exec(command, (err, stdout, stderr) => { + t.error(err); + t.equal(stdout.trim(), ''); + t.equal(stderr.trim(), ''); + t.end(); + }); + }); + + test('exec(command, options)', t => { + assertProcess(t, cp.exec(command, {})); + }); + + test('exec(command, options) - with custom env', t => { + assertProcess(t, cp.exec(command, { env: { custom: 'custom' } }), { stdout: 'custom' }); + }); + + test('exec(command, options, callback)', t => { + cp.exec(command, {}, (err, stdout, stderr) => { + t.error(err); + t.equal(stdout.trim(), ''); + t.equal(stderr.trim(), ''); + t.end(); + }); + }); + + test('exec(command, options, callback) - with custom env', t => { + cp.exec(command, { env: { custom: 'custom' } }, (err, stdout, stderr) => { + t.error(err); + t.equal(stdout.trim(), 'custom'); + t.equal(stderr.trim(), ''); + t.end(); + }); + }); + + for (const unset of notSet) { + test(`exec(command, ${unset})`, t => { + assertProcess(t, cp.exec(command, unset)); + }); + + test(`exec(command, ${unset}, callback)`, t => { + cp.exec(command, unset, (err, stdout, stderr) => { + t.error(err); + t.equal(stdout.trim(), ''); + t.equal(stderr.trim(), ''); + t.end(); + }); + }); + } +} + +{ + const file = path.join('test', 'harden', '_echo.sh'); + + test('execFile(file)', t => { + assertProcess(t, cp.execFile(file)); + }); + + test('execFile(file, args)', t => { + assertProcess(t, cp.execFile(file, [])); + }); + + test('execFile(file, callback)', t => { + cp.execFile(file, (err, stdout, stderr) => { + t.error(err); + t.equal(stdout.trim(), ''); + t.equal(stderr.trim(), ''); + t.end(); + }); + }); + + test('execFile(file, options)', t => { + assertProcess(t, cp.execFile(file, {})); + }); + + test('execFile(file, options) - with custom env', t => { + assertProcess(t, cp.execFile(file, { env: { custom: 'custom' } }), { stdout: 'custom' }); + }); + + test('execFile(file, options, callback)', t => { + cp.execFile(file, {}, (err, stdout, stderr) => { + t.error(err); + t.equal(stdout.trim(), ''); + t.equal(stderr.trim(), ''); + t.end(); + }); + }); + + test('execFile(file, options, callback) - with custom env', t => { + cp.execFile(file, { env: { custom: 'custom' } }, (err, stdout, stderr) => { + t.error(err); + t.equal(stdout.trim(), 'custom'); + t.equal(stderr.trim(), ''); + t.end(); + }); + }); + + test('execFile(file, args, callback)', t => { + cp.execFile(file, [], (err, stdout, stderr) => { + t.error(err); + t.equal(stdout.trim(), ''); + t.equal(stderr.trim(), ''); + t.end(); + }); + }); + + test('execFile(file, args, options)', t => { + assertProcess(t, cp.execFile(file, [], {})); + }); + + test('execFile(file, args, options) - with custom env', t => { + assertProcess(t, cp.execFile(file, [], { env: { custom: 'custom' } }), { stdout: 'custom' }); + }); + + test('execFile(file, args, options, callback)', t => { + cp.execFile(file, [], {}, (err, stdout, stderr) => { + t.error(err); + t.equal(stdout.trim(), ''); + t.equal(stderr.trim(), ''); + t.end(); + }); + }); + + test('execFile(file, args, options, callback) - with custom env', t => { + cp.execFile(file, [], { env: { custom: 'custom' } }, (err, stdout, stderr) => { + t.error(err); + t.equal(stdout.trim(), 'custom'); + t.equal(stderr.trim(), ''); + t.end(); + }); + }); + + for (const unset of notSet) { + test(`execFile(file, ${unset})`, t => { + assertProcess(t, cp.execFile(file, unset)); + }); + + test(`execFile(file, ${unset}, ${unset})`, t => { + assertProcess(t, cp.execFile(file, unset, unset)); + }); + + test(`execFile(file, ${unset}, callback)`, t => { + cp.execFile(file, unset, (err, stdout, stderr) => { + t.error(err); + t.equal(stdout.trim(), ''); + t.equal(stderr.trim(), ''); + t.end(); + }); + }); + + test(`execFile(file, ${unset}, ${unset}, callback)`, t => { + cp.execFile(file, unset, unset, (err, stdout, stderr) => { + t.error(err); + t.equal(stdout.trim(), ''); + t.equal(stderr.trim(), ''); + t.end(); + }); + }); + + test(`execFile(file, ${unset}, options)`, t => { + assertProcess(t, cp.execFile(file, unset, {})); + }); + } +} + +{ + const modulePath = path.join('test', 'harden', '_fork.js'); + + // NOTE: Forked processes don't have any stdout we can monitor without providing options + test.skip('fork(modulePath)', t => { + assertProcess(t, cp.fork(modulePath)); + }); + + // NOTE: Forked processes don't have any stdout we can monitor without providing options + test.skip('execFile(file, args)', t => { + assertProcess(t, cp.fork(modulePath, [])); + }); + + test('fork(modulePath, options)', t => { + assertProcess( + t, + cp.fork(modulePath, { + stdio: ['pipe', 'pipe', 'pipe', 'ipc'], + }) + ); + }); + + test('fork(modulePath, options) - with custom env', t => { + assertProcess( + t, + cp.fork(modulePath, { + stdio: ['pipe', 'pipe', 'pipe', 'ipc'], + env: { custom: 'custom' }, + }), + { stdout: 'custom' } + ); + }); + + test('fork(modulePath, args, options)', t => { + assertProcess( + t, + cp.fork(modulePath, [], { + stdio: ['pipe', 'pipe', 'pipe', 'ipc'], + }) + ); + }); + + test('fork(modulePath, args, options) - with custom env', t => { + assertProcess( + t, + cp.fork(modulePath, [], { + stdio: ['pipe', 'pipe', 'pipe', 'ipc'], + env: { custom: 'custom' }, + }), + { stdout: 'custom' } + ); + }); + + for (const unset of notSet) { + // NOTE: Forked processes don't have any stdout we can monitor without providing options + test.skip(`fork(modulePath, ${unset})`, t => { + assertProcess(t, cp.fork(modulePath, unset)); + }); + + // NOTE: Forked processes don't have any stdout we can monitor without providing options + test.skip(`fork(modulePath, ${unset}, ${unset})`, t => { + assertProcess(t, cp.fork(modulePath, unset, unset)); + }); + + test(`fork(modulePath, ${unset}, options)`, t => { + assertProcess( + t, + cp.fork(modulePath, unset, { + stdio: ['pipe', 'pipe', 'pipe', 'ipc'], + }) + ); + }); + } +} + +{ + const command = path.join('test', 'harden', '_echo.sh'); + + test('spawn(command)', t => { + assertProcess(t, cp.spawn(command)); + }); + + test('spawn(command, args)', t => { + assertProcess(t, cp.spawn(command, [])); + }); + + test('spawn(command, options)', t => { + assertProcess(t, cp.spawn(command, {})); + }); + + test('spawn(command, options) - with custom env', t => { + assertProcess(t, cp.spawn(command, { env: { custom: 'custom' } }), { stdout: 'custom' }); + }); + + test('spawn(command, args, options)', t => { + assertProcess(t, cp.spawn(command, [], {})); + }); + + test('spawn(command, args, options) - with custom env', t => { + assertProcess(t, cp.spawn(command, [], { env: { custom: 'custom' } }), { stdout: 'custom' }); + }); + + for (const unset of notSet) { + test(`spawn(command, ${unset})`, t => { + assertProcess(t, cp.spawn(command, unset)); + }); + + test(`spawn(command, ${unset}, ${unset})`, t => { + assertProcess(t, cp.spawn(command, unset, unset)); + }); + + test(`spawn(command, ${unset}, options)`, t => { + assertProcess(t, cp.spawn(command, unset, {})); + }); + } +} + +{ + const file = path.join('test', 'harden', '_echo.sh'); + + test('execFileSync(file)', t => { + t.equal( + cp + .execFileSync(file) + .toString() + .trim(), + '' + ); + t.end(); + }); + + test('execFileSync(file, args)', t => { + t.equal( + cp + .execFileSync(file, []) + .toString() + .trim(), + '' + ); + t.end(); + }); + + test('execFileSync(file, options)', t => { + t.equal( + cp + .execFileSync(file, {}) + .toString() + .trim(), + '' + ); + t.end(); + }); + + test('execFileSync(file, options) - with custom env', t => { + t.equal( + cp + .execFileSync(file, { env: { custom: 'custom' } }) + .toString() + .trim(), + 'custom' + ); + t.end(); + }); + + test('execFileSync(file, args, options)', t => { + t.equal( + cp + .execFileSync(file, [], {}) + .toString() + .trim(), + '' + ); + t.end(); + }); + + test('execFileSync(file, args, options) - with custom env', t => { + t.equal( + cp + .execFileSync(file, [], { env: { custom: 'custom' } }) + .toString() + .trim(), + 'custom' + ); + t.end(); + }); + + for (const unset of notSet) { + test(`execFileSync(file, ${unset})`, t => { + t.equal( + cp + .execFileSync(file, unset) + .toString() + .trim(), + '' + ); + t.end(); + }); + + test(`execFileSync(file, ${unset}, ${unset})`, t => { + t.equal( + cp + .execFileSync(file, unset, unset) + .toString() + .trim(), + '' + ); + t.end(); + }); + + test(`execFileSync(file, ${unset}, options)`, t => { + t.equal( + cp + .execFileSync(file, unset, {}) + .toString() + .trim(), + '' + ); + t.end(); + }); + } +} + +{ + const command = 'echo $POLLUTED$custom'; + + test('execSync(command)', t => { + t.equal( + cp + .execSync(command) + .toString() + .trim(), + '' + ); + t.end(); + }); + + test('execSync(command, options)', t => { + t.equal( + cp + .execSync(command, {}) + .toString() + .trim(), + '' + ); + t.end(); + }); + + test('execSync(command, options) - with custom env', t => { + t.equal( + cp + .execSync(command, { env: { custom: 'custom' } }) + .toString() + .trim(), + 'custom' + ); + t.end(); + }); + + for (const unset of notSet) { + test(`execSync(command, ${unset})`, t => { + t.equal( + cp + .execSync(command, unset) + .toString() + .trim(), + '' + ); + t.end(); + }); + } +} + +{ + const command = path.join('test', 'harden', '_echo.sh'); + + test('spawnSync(command)', t => { + const result = cp.spawnSync(command); + t.error(result.error); + t.equal(result.stdout.toString().trim(), ''); + t.equal(result.stderr.toString().trim(), ''); + t.end(); + }); + + test('spawnSync(command, args)', t => { + const result = cp.spawnSync(command, []); + t.error(result.error); + t.equal(result.stdout.toString().trim(), ''); + t.equal(result.stderr.toString().trim(), ''); + t.end(); + }); + + test('spawnSync(command, options)', t => { + const result = cp.spawnSync(command, {}); + t.error(result.error); + t.equal(result.stdout.toString().trim(), ''); + t.equal(result.stderr.toString().trim(), ''); + t.end(); + }); + + test('spawnSync(command, options) - with custom env', t => { + const result = cp.spawnSync(command, { env: { custom: 'custom' } }); + t.error(result.error); + t.equal(result.stdout.toString().trim(), 'custom'); + t.equal(result.stderr.toString().trim(), ''); + t.end(); + }); + + test('spawnSync(command, args, options)', t => { + const result = cp.spawnSync(command, [], {}); + t.error(result.error); + t.equal(result.stdout.toString().trim(), ''); + t.equal(result.stderr.toString().trim(), ''); + t.end(); + }); + + test('spawnSync(command, args, options) - with custom env', t => { + const result = cp.spawnSync(command, [], { env: { custom: 'custom' } }); + t.error(result.error); + t.equal(result.stdout.toString().trim(), 'custom'); + t.equal(result.stderr.toString().trim(), ''); + t.end(); + }); + + for (const unset of notSet) { + test(`spawnSync(command, ${unset})`, t => { + const result = cp.spawnSync(command, unset); + t.error(result.error); + t.equal(result.stdout.toString().trim(), ''); + t.equal(result.stderr.toString().trim(), ''); + t.end(); + }); + + test(`spawnSync(command, ${unset}, ${unset})`, t => { + const result = cp.spawnSync(command, unset, unset); + t.error(result.error); + t.equal(result.stdout.toString().trim(), ''); + t.equal(result.stderr.toString().trim(), ''); + t.end(); + }); + + test(`spawnSync(command, ${unset}, options)`, t => { + const result = cp.spawnSync(command, unset, {}); + t.error(result.error); + t.equal(result.stdout.toString().trim(), ''); + t.equal(result.stderr.toString().trim(), ''); + t.end(); + }); + } +} + +function assertProcess(t, cmd, { stdout = '' } = {}) { + t.plan(2); + + cmd.stdout.on('data', data => { + t.equal(data.toString().trim(), stdout); + }); + + cmd.stderr.on('data', data => { + t.fail(`Unexpected data on STDERR: "${data}"`); + }); + + cmd.on('close', code => { + t.equal(code, 0); + t.end(); + }); +} diff --git a/yarn.lock b/yarn.lock index 1cf77d50d7dbb..fbbd71dac7a7f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11190,7 +11190,7 @@ deep-equal@^1.0.0, deep-equal@^1.0.1, deep-equal@~1.0.1: resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" integrity sha1-9dJgKStmDghO/0zbyfCK0yR0SLU= -deep-equal@^1.1.1: +deep-equal@^1.1.1, 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== @@ -11853,6 +11853,13 @@ dotenv@^8.0.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.1.0.tgz#d811e178652bfb8a1e593c6dd704ec7e90d85ea2" integrity sha512-GUE3gqcDCaMltj2++g6bRQ5rBJWtkWTmqmD0fo1RnnMuUqHNCt2oTPeDnS9n6fKYvlhn7AeBkb38lymBtWBQdA== +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== + dependencies: + minimatch "^3.0.4" + downgrade-root@^1.0.0: version "1.2.2" resolved "https://registry.yarnpkg.com/downgrade-root/-/downgrade-root-1.2.2.tgz#531319715b0e81ffcc22eb28478ba27643e12c6c" @@ -12369,7 +12376,7 @@ error@^7.0.0, error@^7.0.2: string-template "~0.2.1" xtend "~4.0.0" -es-abstract@^1.10.0, es-abstract@^1.11.0, es-abstract@^1.13.0, es-abstract@^1.14.2, es-abstract@^1.17.0-next.1, es-abstract@^1.4.3, es-abstract@^1.5.0, es-abstract@^1.5.1, es-abstract@^1.7.0, es-abstract@^1.9.0: +es-abstract@^1.10.0, es-abstract@^1.11.0, es-abstract@^1.13.0, es-abstract@^1.14.2, es-abstract@^1.4.3, es-abstract@^1.5.0, es-abstract@^1.5.1, es-abstract@^1.7.0, es-abstract@^1.9.0: version "1.17.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.0.tgz#f42a517d0036a5591dbb2c463591dc8bb50309b1" integrity sha512-yYkE07YF+6SIBmg1MsJ9dlub5L48Ek7X0qz+c/CPCHS9EBXfESorzng4cJQjJW5/pB6vDF41u7F8vUhLVDqIug== @@ -12386,7 +12393,7 @@ es-abstract@^1.10.0, es-abstract@^1.11.0, es-abstract@^1.13.0, es-abstract@^1.14 string.prototype.trimleft "^2.1.1" string.prototype.trimright "^2.1.1" -es-abstract@^1.15.0: +es-abstract@^1.15.0, es-abstract@^1.17.0-next.1: version "1.17.4" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.4.tgz#e3aedf19706b20e7c2594c35fc0d57605a79e184" integrity sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ== @@ -14908,7 +14915,7 @@ glob@^6.0.1, glob@^6.0.4: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.5, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: +glob@^7.0.5, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@~7.1.6: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -16714,7 +16721,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@~2.0.3: +inherits@2, inherits@~2.0.3, inherits@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -17542,7 +17549,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.3, is-regex@^1.0.4, is-regex@^1.0.5: +is-regex@^1.0.3, is-regex@^1.0.4, is-regex@^1.0.5, 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== @@ -21833,7 +21840,7 @@ object-identity-map@^1.0.2: dependencies: object.entries "^1.1.0" -object-inspect@^1.7.0: +object-inspect@^1.7.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== @@ -25830,7 +25837,7 @@ require-from-string@^2.0.1: resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== -require-in-the-middle@^5.0.0: +require-in-the-middle@^5.0.0, require-in-the-middle@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/require-in-the-middle/-/require-in-the-middle-5.0.2.tgz#ce3593007a61583b39ccdcd2c167a2a326c670b2" integrity sha512-l2r6F9i6t5xp4OE9cw/daB/ooQKHZOOW1AYPADhEvk/Tj/THJDS8gePp76Zyuht6Cj57a0KL+eHK5Dyv7wZnKA== @@ -26042,7 +26049,7 @@ resolve@^1.12.0, resolve@^1.4.0: dependencies: path-parse "^1.0.6" -resolve@^1.13.1: +resolve@^1.13.1, resolve@~1.14.2: version "1.14.2" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.14.2.tgz#dbf31d0fa98b1f29aa5169783b9c290cb865fea2" integrity sha512-EjlOBLBO1kxsUxsKjLt7TAECyKW6fOh1VRkykQkKGzcBbjjPIxBqGh0jf7GJ3k/f5mxMqW3htMD3WdTUVtW8HQ== @@ -27895,7 +27902,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== @@ -28465,6 +28472,27 @@ 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" From 35bcb36ee6074f18586571611c9a34097c352f5a Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Mon, 9 Mar 2020 23:55:44 -0700 Subject: [PATCH 02/23] Fixes #59513 by hiding one of the symmetric edges rather than omiting it (#59514) in cytoscape graph. Also selects root nodes with no incoming edges rather than just unconnected nodes. Co-authored-by: Elastic Machine --- .../public/components/app/ServiceMap/Cytoscape.tsx | 12 ++++++------ .../app/ServiceMap/get_cytoscape_elements.ts | 11 +++++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx index 64b82fc8886ca..d636f8b1f4d52 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx @@ -78,11 +78,11 @@ function getLayoutOptions( }; } -function selectRoots(elements: cytoscape.ElementDefinition[]): string[] { - const nodes = cytoscape({ elements }).nodes(); - const unconnectedNodes = nodes.roots().intersection(nodes.leaves()); +function selectRoots(cy: cytoscape.Core): string[] { + const nodes = cy.nodes(); + const roots = nodes.roots(); const rumNodes = nodes.filter(node => isRumAgentName(node.data('agentName'))); - return rumNodes.union(unconnectedNodes).map(node => node.id()); + return rumNodes.union(roots).map(node => node.id()); } export function Cytoscape({ @@ -118,7 +118,7 @@ export function Cytoscape({ } if (event.cy.elements().length > 0) { - const selectedRoots = selectRoots(elements); + const selectedRoots = selectRoots(event.cy); const layout = cy.layout( getLayoutOptions(selectedRoots, height, width) ); @@ -130,7 +130,7 @@ export function Cytoscape({ } } }, - [cy, serviceName, elements, height, width] + [cy, serviceName, height, width] ); // Trigger a custom "data" event when data changes diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/get_cytoscape_elements.ts b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/get_cytoscape_elements.ts index bc619b1ecdfe5..9ba70646598fc 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/get_cytoscape_elements.ts +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceMap/get_cytoscape_elements.ts @@ -136,12 +136,15 @@ export function getCytoscapeElements( // instead of adding connections in two directions, // we add a `bidirectional` flag to use in styling + // and hide the inverse edge when rendering const dedupedConnections = (sortBy( Object.values(connectionsById), // make sure that order is stable 'id' ) as ConnectionWithId[]).reduce< - Array + Array< + ConnectionWithId & { bidirectional?: boolean; isInverseEdge?: boolean } + > >((prev, connection) => { const reversedConnection = prev.find( c => @@ -151,7 +154,10 @@ export function getCytoscapeElements( if (reversedConnection) { reversedConnection.bidirectional = true; - return prev; + return prev.concat({ + ...connection, + isInverseEdge: true + }); } return prev.concat(connection); @@ -160,6 +166,7 @@ export function getCytoscapeElements( const cyEdges = dedupedConnections.map(connection => { return { group: 'edges' as const, + classes: connection.isInverseEdge ? 'invisible' : undefined, data: { id: connection.id, source: connection.source.id, From 28d0cf4485f66374f4bd3ed4d4ead359a69d9d32 Mon Sep 17 00:00:00 2001 From: Liza Katz Date: Tue, 10 Mar 2020 09:34:06 +0000 Subject: [PATCH 03/23] Generate docs from data plugin (#56955) * Add doc building for data plugin * Added data server md file * index file for suggestion component * Clear out internal imports from public API * Remove FunctionalComponent usage * comment out working docs * Added fixes following @octogonz feedback * new docs * Clean up * Clean up 2 * fix jest * rename docs script file * update tasks * tasks * update docs --- docs/development/plugins/data/public/index.md | 12 + ...n-plugins-data-public.addsearchstrategy.md | 11 + ...lugins-data-public.baseformatterspublic.md | 11 + ...ns-data-public.castestokbnfieldtypename.md | 13 + ...plugins-data-public.connecttoquerystate.md | 32 + ...ins-data-public.createsavedqueryservice.md | 11 + ...plugin-plugins-data-public.customfilter.md | 13 + ...blic.datapublicpluginsetup.autocomplete.md | 11 + ...blic.datapublicpluginsetup.fieldformats.md | 11 + ...ugins-data-public.datapublicpluginsetup.md | 21 + ...data-public.datapublicpluginsetup.query.md | 11 + ...ata-public.datapublicpluginsetup.search.md | 11 + ...blic.datapublicpluginstart.autocomplete.md | 11 + ...blic.datapublicpluginstart.fieldformats.md | 11 + ...lic.datapublicpluginstart.indexpatterns.md | 11 + ...ugins-data-public.datapublicpluginstart.md | 23 + ...data-public.datapublicpluginstart.query.md | 11 + ...ata-public.datapublicpluginstart.search.md | 11 + ...ns-data-public.datapublicpluginstart.ui.md | 14 + ...ugins-data-public.defaultsearchstrategy.md | 11 + ...ugin-plugins-data-public.es_field_types.md | 45 + ...-plugins-data-public.es_search_strategy.md | 11 + ...na-plugin-plugins-data-public.esfilters.md | 55 + ...bana-plugin-plugins-data-public.eskuery.md | 15 + ...bana-plugin-plugins-data-public.esquery.md | 22 + ...lic.esqueryconfig.allowleadingwildcards.md | 11 + ...-data-public.esqueryconfig.dateformattz.md | 11 + ...eryconfig.ignorefilteriffieldnotinindex.md | 11 + ...lugin-plugins-data-public.esqueryconfig.md | 21 + ...public.esqueryconfig.querystringoptions.md | 11 + ...in-plugins-data-public.esquerysortvalue.md | 11 + ...ns-data-public.essearchstrategyprovider.md | 11 + ...plugin-plugins-data-public.existsfilter.md | 14 + ...ns-data-public.fetchoptions.abortsignal.md | 11 + ...plugin-plugins-data-public.fetchoptions.md | 19 + ...ta-public.fetchoptions.searchstrategyid.md | 11 + ...lugins-data-public.fieldformatconfig.es.md | 11 + ...lugins-data-public.fieldformatconfig.id.md | 11 + ...n-plugins-data-public.fieldformatconfig.md | 20 + ...ns-data-public.fieldformatconfig.params.md | 11 + ...lugin-plugins-data-public.fieldformatid.md | 13 + ...plugin-plugins-data-public.fieldformats.md | 39 + ...ins-data-public.fieldformatscontenttype.md | 13 + ...ins-data-public.fieldformatsgetconfigfn.md | 11 + ...lugin-plugins-data-public.filter._state.md | 11 + ...ibana-plugin-plugins-data-public.filter.md | 20 + ...-plugin-plugins-data-public.filter.meta.md | 11 + ...plugin-plugins-data-public.filter.query.md | 11 + ...na-plugin-plugins-data-public.filterbar.md | 13 + ...data-public.filtermanager._constructor_.md | 20 + ...ns-data-public.filtermanager.addfilters.md | 23 + ...data-public.filtermanager.getappfilters.md | 15 + ...s-data-public.filtermanager.getfetches_.md | 15 + ...ns-data-public.filtermanager.getfilters.md | 15 + ...a-public.filtermanager.getglobalfilters.md | 15 + ...lic.filtermanager.getpartitionedfilters.md | 15 + ...s-data-public.filtermanager.getupdates_.md | 15 + ...lugin-plugins-data-public.filtermanager.md | 36 + ...ins-data-public.filtermanager.removeall.md | 15 + ...-data-public.filtermanager.removefilter.md | 22 + ...data-public.filtermanager.setappfilters.md | 24 + ...ns-data-public.filtermanager.setfilters.md | 23 + ...ta-public.filtermanager.setfiltersstore.md | 24 + ...a-public.filtermanager.setglobalfilters.md | 24 + ...gin-plugins-data-public.getespreference.md | 23 + ...gin-plugins-data-public.getkbntypenames.md | 15 + ...-plugin-plugins-data-public.getquerylog.md | 25 + ...-plugins-data-public.getsearcherrortype.md | 22 + ...bana-plugin-plugins-data-public.gettime.md | 24 + ...-public.hassearchstategyforindexpattern.md | 11 + ...data-public.idatapluginservices.appname.md | 11 + ...ns-data-public.idatapluginservices.data.md | 11 + ...ns-data-public.idatapluginservices.http.md | 11 + ...plugins-data-public.idatapluginservices.md | 24 + ...ublic.idatapluginservices.notifications.md | 11 + ...public.idatapluginservices.savedobjects.md | 11 + ...data-public.idatapluginservices.storage.md | 11 + ...a-public.idatapluginservices.uisettings.md | 11 + ...in-plugins-data-public.iessearchrequest.md | 18 + ...ins-data-public.iessearchrequest.params.md | 11 + ...n-plugins-data-public.iessearchresponse.md | 18 + ...ta-public.iessearchresponse.rawresponse.md | 11 + ...plugin-plugins-data-public.ifieldformat.md | 11 + ...ugins-data-public.ifieldformatsregistry.md | 11 + ...lugin-plugins-data-public.ifieldsubtype.md | 19 + ...plugins-data-public.ifieldsubtype.multi.md | 13 + ...lugins-data-public.ifieldsubtype.nested.md | 13 + ...ins-data-public.ifieldtype.aggregatable.md | 11 + ...in-plugins-data-public.ifieldtype.count.md | 11 + ...gins-data-public.ifieldtype.displayname.md | 11 + ...-plugins-data-public.ifieldtype.estypes.md | 11 + ...ugins-data-public.ifieldtype.filterable.md | 11 + ...n-plugins-data-public.ifieldtype.format.md | 11 + ...gin-plugins-data-public.ifieldtype.lang.md | 11 + ...a-plugin-plugins-data-public.ifieldtype.md | 33 + ...gin-plugins-data-public.ifieldtype.name.md | 11 + ...ata-public.ifieldtype.readfromdocvalues.md | 11 + ...n-plugins-data-public.ifieldtype.script.md | 11 + ...plugins-data-public.ifieldtype.scripted.md | 11 + ...ugins-data-public.ifieldtype.searchable.md | 11 + ...plugins-data-public.ifieldtype.sortable.md | 11 + ...-plugins-data-public.ifieldtype.subtype.md | 11 + ...gin-plugins-data-public.ifieldtype.type.md | 11 + ...ins-data-public.ifieldtype.visualizable.md | 11 + ...ata-public.iindexpattern.fieldformatmap.md | 14 + ...lugins-data-public.iindexpattern.fields.md | 11 + ...in-plugins-data-public.iindexpattern.id.md | 11 + ...lugin-plugins-data-public.iindexpattern.md | 23 + ...data-public.iindexpattern.timefieldname.md | 11 + ...plugins-data-public.iindexpattern.title.md | 11 + ...-plugins-data-public.iindexpattern.type.md | 11 + ...-data-public.ikibanasearchrequest.debug.md | 13 + ...ins-data-public.ikibanasearchrequest.id.md | 13 + ...lugins-data-public.ikibanasearchrequest.md | 19 + ...ns-data-public.ikibanasearchresponse.id.md | 13 + ...ata-public.ikibanasearchresponse.loaded.md | 13 + ...ugins-data-public.ikibanasearchresponse.md | 20 + ...data-public.ikibanasearchresponse.total.md | 13 + ...-data-public.indexpattern._constructor_.md | 24 + ...s-data-public.indexpattern._fetchfields.md | 15 + ...ta-public.indexpattern.addscriptedfield.md | 25 + ...plugins-data-public.indexpattern.create.md | 22 + ...lugins-data-public.indexpattern.destroy.md | 15 + ...data-public.indexpattern.fieldformatmap.md | 11 + ...plugins-data-public.indexpattern.fields.md | 11 + ...-data-public.indexpattern.fieldsfetcher.md | 11 + ...ins-data-public.indexpattern.flattenhit.md | 11 + ...ns-data-public.indexpattern.formatfield.md | 11 + ...gins-data-public.indexpattern.formathit.md | 11 + ...indexpattern.getaggregationrestrictions.md | 29 + ...a-public.indexpattern.getcomputedfields.md | 29 + ...data-public.indexpattern.getfieldbyname.md | 22 + ...ublic.indexpattern.getnonscriptedfields.md | 15 + ...a-public.indexpattern.getscriptedfields.md | 15 + ...-public.indexpattern.getsourcefiltering.md | 19 + ...s-data-public.indexpattern.gettimefield.md | 15 + ...gin-plugins-data-public.indexpattern.id.md | 11 + ...n-plugins-data-public.indexpattern.init.md | 22 + ...ns-data-public.indexpattern.istimebased.md | 15 + ...public.indexpattern.istimebasedwildcard.md | 15 + ...ta-public.indexpattern.istimenanosbased.md | 15 + ...ins-data-public.indexpattern.iswildcard.md | 15 + ...plugin-plugins-data-public.indexpattern.md | 64 + ...ins-data-public.indexpattern.metafields.md | 11 + ...ata-public.indexpattern.popularizefield.md | 23 + ...ugins-data-public.indexpattern.prepbody.md | 19 + ...-data-public.indexpattern.refreshfields.md | 15 + ...public.indexpattern.removescriptedfield.md | 22 + ...plugins-data-public.indexpattern.routes.md | 17 + ...n-plugins-data-public.indexpattern.save.md | 22 + ...-data-public.indexpattern.timefieldname.md | 11 + ...-plugins-data-public.indexpattern.title.md | 11 + ...plugins-data-public.indexpattern.tojson.md | 15 + ...ugins-data-public.indexpattern.tostring.md | 15 + ...n-plugins-data-public.indexpattern.type.md | 11 + ...ugins-data-public.indexpattern.typemeta.md | 11 + ...data-public.indexpatternaggrestrictions.md | 18 + ...ta-public.indexpatternattributes.fields.md | 11 + ...gins-data-public.indexpatternattributes.md | 28 + ...ic.indexpatternattributes.timefieldname.md | 11 + ...ata-public.indexpatternattributes.title.md | 11 + ...data-public.indexpatternattributes.type.md | 11 + ...-public.indexpatternattributes.typemeta.md | 11 + ...ns-data-public.indexpatternfield.__spec.md | 11 + ...-public.indexpatternfield._constructor_.md | 22 + ...a-public.indexpatternfield.aggregatable.md | 11 + ...ins-data-public.indexpatternfield.count.md | 11 + ...ta-public.indexpatternfield.displayname.md | 11 + ...s-data-public.indexpatternfield.estypes.md | 11 + ...ata-public.indexpatternfield.filterable.md | 11 + ...ns-data-public.indexpatternfield.format.md | 11 + ...gins-data-public.indexpatternfield.lang.md | 11 + ...n-plugins-data-public.indexpatternfield.md | 40 + ...gins-data-public.indexpatternfield.name.md | 11 + ...ns-data-public.indexpatternfield.routes.md | 11 + ...ns-data-public.indexpatternfield.script.md | 11 + ...-data-public.indexpatternfield.scripted.md | 11 + ...ata-public.indexpatternfield.searchable.md | 11 + ...-data-public.indexpatternfield.sortable.md | 11 + ...s-data-public.indexpatternfield.subtype.md | 11 + ...gins-data-public.indexpatternfield.type.md | 11 + ...a-public.indexpatternfield.visualizable.md | 11 + ...lic.indexpatternfieldlist._constructor_.md | 22 + ...s-data-public.indexpatternfieldlist.add.md | 11 + ...-public.indexpatternfieldlist.getbyname.md | 11 + ...-public.indexpatternfieldlist.getbytype.md | 11 + ...ugins-data-public.indexpatternfieldlist.md | 28 + ...ata-public.indexpatternfieldlist.remove.md | 11 + ...ata-public.indexpatternfieldlist.update.md | 11 + ...lugin-plugins-data-public.indexpatterns.md | 24 + ...ugins-data-public.indexpatternscontract.md | 11 + ...public.indexpatternselect._constructor_.md | 20 + ...ic.indexpatternselect.componentdidmount.md | 15 + ...indexpatternselect.componentwillunmount.md | 15 + ...ublic.indexpatternselect.debouncedfetch.md | 11 + ...-public.indexpatternselect.fetchoptions.md | 11 + ...patternselect.fetchselectedindexpattern.md | 11 + ...-plugins-data-public.indexpatternselect.md | 37 + ...data-public.indexpatternselect.onchange.md | 11 + ...s-data-public.indexpatternselect.render.md | 15 + ...ns-data-public.indexpatternselect.state.md | 11 + ...select.unsafe_componentwillreceiveprops.md | 22 + ...s-data-public.indexpatterntypemeta.aggs.md | 11 + ...lugins-data-public.indexpatterntypemeta.md | 18 + ...ugin-plugins-data-public.inputtimerange.md | 14 + ...plugins-data-public.irequesttypesmap.es.md | 11 + ...in-plugins-data-public.irequesttypesmap.md | 19 + ...c.irequesttypesmap.sync_search_strategy.md | 11 + ...lugins-data-public.iresponsetypesmap.es.md | 11 + ...n-plugins-data-public.iresponsetypesmap.md | 19 + ....iresponsetypesmap.sync_search_strategy.md | 11 + ...bana-plugin-plugins-data-public.isearch.md | 11 + ...plugins-data-public.isearchcontext.core.md | 11 + ...public.isearchcontext.getsearchstrategy.md | 11 + ...ugin-plugins-data-public.isearchcontext.md | 19 + ...ugin-plugins-data-public.isearchgeneric.md | 11 + ...ugin-plugins-data-public.isearchoptions.md | 18 + ...ugins-data-public.isearchoptions.signal.md | 11 + ...lugin-plugins-data-public.isearchsource.md | 11 + ...gin-plugins-data-public.isearchstrategy.md | 20 + ...gins-data-public.isearchstrategy.search.md | 11 + ...-plugins-data-public.isyncsearchrequest.md | 18 + ...ublic.isyncsearchrequest.serverstrategy.md | 11 + ...gin-plugins-data-public.kbn_field_types.md | 33 + ...na-plugin-plugins-data-public.kuerynode.md | 18 + ...ugin-plugins-data-public.kuerynode.type.md | 11 + ...ugin-plugins-data-public.matchallfilter.md | 14 + .../kibana-plugin-plugins-data-public.md | 142 ++ ...lugin-plugins-data-public.parseinterval.md | 22 + ...plugin-plugins-data-public.phrasefilter.md | 20 + ...lugin-plugins-data-public.phrasesfilter.md | 13 + ...lugins-data-public.plugin._constructor_.md | 20 + ...ibana-plugin-plugins-data-public.plugin.md | 22 + ...plugin-plugins-data-public.plugin.setup.md | 23 + ...plugin-plugins-data-public.plugin.start.md | 23 + ...-plugin-plugins-data-public.plugin.stop.md | 15 + ...ugin-plugins-data-public.query.language.md | 11 + ...kibana-plugin-plugins-data-public.query.md | 19 + ...-plugin-plugins-data-public.query.query.md | 13 + ...-plugins-data-public.querystate.filters.md | 11 + ...a-plugin-plugins-data-public.querystate.md | 22 + ...-data-public.querystate.refreshinterval.md | 11 + ...gin-plugins-data-public.querystate.time.md | 11 + ...in-plugins-data-public.querystringinput.md | 11 + ...gin-plugins-data-public.querysuggestion.md | 13 + ...public.querysuggestionbasic.cursorindex.md | 11 + ...public.querysuggestionbasic.description.md | 11 + ...ns-data-public.querysuggestionbasic.end.md | 11 + ...lugins-data-public.querysuggestionbasic.md | 25 + ...-data-public.querysuggestionbasic.start.md | 11 + ...s-data-public.querysuggestionbasic.text.md | 11 + ...s-data-public.querysuggestionbasic.type.md | 11 + ...-data-public.querysuggestionfield.field.md | 11 + ...lugins-data-public.querysuggestionfield.md | 21 + ...s-data-public.querysuggestionfield.type.md | 11 + ...lugins-data-public.querysuggestiongetfn.md | 11 + ...lic.querysuggestiongetfnargs.boolfilter.md | 11 + ....querysuggestiongetfnargs.indexpatterns.md | 11 + ...ublic.querysuggestiongetfnargs.language.md | 11 + ...ns-data-public.querysuggestiongetfnargs.md | 26 + ...a-public.querysuggestiongetfnargs.query.md | 11 + ...c.querysuggestiongetfnargs.selectionend.md | 11 + ...querysuggestiongetfnargs.selectionstart.md | 11 + ...-public.querysuggestiongetfnargs.signal.md | 11 + ...lugins-data-public.querysuggestiontypes.md | 22 + ...-plugin-plugins-data-public.rangefilter.md | 21 + ...gin-plugins-data-public.rangefiltermeta.md | 15 + ...ns-data-public.rangefilterparams.format.md | 11 + ...gins-data-public.rangefilterparams.from.md | 11 + ...lugins-data-public.rangefilterparams.gt.md | 11 + ...ugins-data-public.rangefilterparams.gte.md | 11 + ...lugins-data-public.rangefilterparams.lt.md | 11 + ...ugins-data-public.rangefilterparams.lte.md | 11 + ...n-plugins-data-public.rangefilterparams.md | 24 + ...lugins-data-public.rangefilterparams.to.md | 11 + ...gin-plugins-data-public.refreshinterval.md | 19 + ...ugins-data-public.refreshinterval.pause.md | 11 + ...ugins-data-public.refreshinterval.value.md | 11 + ...ugins-data-public.savedquery.attributes.md | 11 + ...lugin-plugins-data-public.savedquery.id.md | 11 + ...a-plugin-plugins-data-public.savedquery.md | 19 + ...public.savedqueryattributes.description.md | 11 + ...ata-public.savedqueryattributes.filters.md | 11 + ...lugins-data-public.savedqueryattributes.md | 22 + ...-data-public.savedqueryattributes.query.md | 11 + ...-public.savedqueryattributes.timefilter.md | 11 + ...-data-public.savedqueryattributes.title.md | 11 + ...blic.savedqueryservice.deletesavedquery.md | 11 + ...blic.savedqueryservice.findsavedqueries.md | 14 + ...ic.savedqueryservice.getallsavedqueries.md | 11 + ...-public.savedqueryservice.getsavedquery.md | 11 + ...ic.savedqueryservice.getsavedquerycount.md | 11 + ...n-plugins-data-public.savedqueryservice.md | 23 + ...data-public.savedqueryservice.savequery.md | 13 + ...lugins-data-public.savedquerytimefilter.md | 13 + ...na-plugin-plugins-data-public.searchbar.md | 13 + ...ugin-plugins-data-public.searchbarprops.md | 11 + ...s-data-public.searcherror._constructor_.md | 20 + ...-plugin-plugins-data-public.searcherror.md | 29 + ...plugins-data-public.searcherror.message.md | 11 + ...in-plugins-data-public.searcherror.name.md | 11 + ...in-plugins-data-public.searcherror.path.md | 11 + ...-plugins-data-public.searcherror.status.md | 11 + ...n-plugins-data-public.searcherror.title.md | 11 + ...in-plugins-data-public.searcherror.type.md | 11 + ...lugin-plugins-data-public.searchrequest.md | 11 + ...ugin-plugins-data-public.searchresponse.md | 11 + ...-data-public.searchsource._constructor_.md | 20 + ...plugins-data-public.searchsource.create.md | 15 + ...ns-data-public.searchsource.createchild.md | 22 + ...ins-data-public.searchsource.createcopy.md | 15 + ...lugins-data-public.searchsource.destroy.md | 17 + ...-plugins-data-public.searchsource.fetch.md | 25 + ...ugins-data-public.searchsource.getfield.md | 25 + ...gins-data-public.searchsource.getfields.md | 49 + ...-plugins-data-public.searchsource.getid.md | 15 + ...ns-data-public.searchsource.getownfield.md | 24 + ...gins-data-public.searchsource.getparent.md | 17 + ...ublic.searchsource.getsearchrequestbody.md | 15 + ...lugins-data-public.searchsource.history.md | 11 + ...plugin-plugins-data-public.searchsource.md | 45 + ...data-public.searchsource.onrequeststart.md | 24 + ...ugins-data-public.searchsource.setfield.md | 23 + ...gins-data-public.searchsource.setfields.md | 22 + ...gins-data-public.searchsource.setparent.md | 25 + ...archsource.setpreferredsearchstrategyid.md | 24 + ...ins-data-public.searchsourcefields.aggs.md | 11 + ...s-data-public.searchsourcefields.fields.md | 11 + ...s-data-public.searchsourcefields.filter.md | 11 + ...ins-data-public.searchsourcefields.from.md | 11 + ...ata-public.searchsourcefields.highlight.md | 11 + ...-public.searchsourcefields.highlightall.md | 11 + ...ns-data-public.searchsourcefields.index.md | 11 + ...-plugins-data-public.searchsourcefields.md | 33 + ...ns-data-public.searchsourcefields.query.md | 11 + ...a-public.searchsourcefields.searchafter.md | 11 + ...ins-data-public.searchsourcefields.size.md | 11 + ...ins-data-public.searchsourcefields.sort.md | 11 + ...s-data-public.searchsourcefields.source.md | 11 + ...blic.searchsourcefields.terminate_after.md | 11 + ...-data-public.searchsourcefields.timeout.md | 11 + ...ins-data-public.searchsourcefields.type.md | 11 + ...-data-public.searchsourcefields.version.md | 11 + ...s-data-public.searchstrategyprovider.id.md | 11 + ...-public.searchstrategyprovider.isviable.md | 11 + ...gins-data-public.searchstrategyprovider.md | 20 + ...ta-public.searchstrategyprovider.search.md | 11 + ...lugin-plugins-data-public.sortdirection.md | 19 + ...gins-data-public.statefulsearchbarprops.md | 16 + ...lugins-data-public.sync_search_strategy.md | 11 + ...ugins-data-public.syncquerystatewithurl.md | 31 + ...-plugins-data-public.timefiltercontract.md | 11 + ...ins-data-public.timefiltersetup.history.md | 11 + ...gin-plugins-data-public.timefiltersetup.md | 20 + ...-data-public.timefiltersetup.timefilter.md | 11 + ...s-data-public.timehistory._constructor_.md | 20 + ...gin-plugins-data-public.timehistory.add.md | 22 + ...gin-plugins-data-public.timehistory.get.md | 15 + ...-plugin-plugins-data-public.timehistory.md | 25 + ...plugins-data-public.timehistorycontract.md | 11 + ...ugin-plugins-data-public.timerange.from.md | 11 + ...na-plugin-plugins-data-public.timerange.md | 20 + ...ugin-plugins-data-public.timerange.mode.md | 11 + ...plugin-plugins-data-public.timerange.to.md | 11 + ...ins-data-public.tsearchstrategyprovider.md | 13 + docs/development/plugins/data/server/index.md | 12 + ...ns-data-server.castestokbnfieldtypename.md | 13 + ...ugin-plugins-data-server.es_field_types.md | 45 + ...na-plugin-plugins-data-server.esfilters.md | 21 + ...bana-plugin-plugins-data-server.eskuery.md | 15 + ...bana-plugin-plugins-data-server.esquery.md | 20 + ...ver.esqueryconfig.allowleadingwildcards.md | 11 + ...-data-server.esqueryconfig.dateformattz.md | 11 + ...eryconfig.ignorefilteriffieldnotinindex.md | 11 + ...lugin-plugins-data-server.esqueryconfig.md | 21 + ...server.esqueryconfig.querystringoptions.md | 11 + ...lugins-data-server.fieldformatconfig.es.md | 11 + ...lugins-data-server.fieldformatconfig.id.md | 11 + ...n-plugins-data-server.fieldformatconfig.md | 20 + ...ns-data-server.fieldformatconfig.params.md | 11 + ...plugin-plugins-data-server.fieldformats.md | 29 + ...ins-data-server.fieldformatsgetconfigfn.md | 11 + ...lugin-plugins-data-server.filter._state.md | 11 + ...ibana-plugin-plugins-data-server.filter.md | 20 + ...-plugin-plugins-data-server.filter.meta.md | 11 + ...plugin-plugins-data-server.filter.query.md | 11 + ...gins-data-server.getdefaultsearchparams.md | 30 + ...bana-plugin-plugins-data-server.icancel.md | 11 + ...ugins-data-server.ifieldformatsregistry.md | 11 + ...lugin-plugins-data-server.ifieldsubtype.md | 19 + ...plugins-data-server.ifieldsubtype.multi.md | 13 + ...lugins-data-server.ifieldsubtype.nested.md | 13 + ...ins-data-server.ifieldtype.aggregatable.md | 11 + ...in-plugins-data-server.ifieldtype.count.md | 11 + ...gins-data-server.ifieldtype.displayname.md | 11 + ...-plugins-data-server.ifieldtype.estypes.md | 11 + ...ugins-data-server.ifieldtype.filterable.md | 11 + ...n-plugins-data-server.ifieldtype.format.md | 11 + ...gin-plugins-data-server.ifieldtype.lang.md | 11 + ...a-plugin-plugins-data-server.ifieldtype.md | 33 + ...gin-plugins-data-server.ifieldtype.name.md | 11 + ...ata-server.ifieldtype.readfromdocvalues.md | 11 + ...n-plugins-data-server.ifieldtype.script.md | 11 + ...plugins-data-server.ifieldtype.scripted.md | 11 + ...ugins-data-server.ifieldtype.searchable.md | 11 + ...plugins-data-server.ifieldtype.sortable.md | 11 + ...-plugins-data-server.ifieldtype.subtype.md | 11 + ...gin-plugins-data-server.ifieldtype.type.md | 11 + ...ins-data-server.ifieldtype.visualizable.md | 11 + ...ata-server.iindexpattern.fieldformatmap.md | 14 + ...lugins-data-server.iindexpattern.fields.md | 11 + ...in-plugins-data-server.iindexpattern.id.md | 11 + ...lugin-plugins-data-server.iindexpattern.md | 23 + ...data-server.iindexpattern.timefieldname.md | 11 + ...plugins-data-server.iindexpattern.title.md | 11 + ...-plugins-data-server.iindexpattern.type.md | 11 + ...ta-server.indexpatternattributes.fields.md | 11 + ...gins-data-server.indexpatternattributes.md | 28 + ...er.indexpatternattributes.timefieldname.md | 11 + ...ata-server.indexpatternattributes.title.md | 11 + ...data-server.indexpatternattributes.type.md | 11 + ...-server.indexpatternattributes.typemeta.md | 11 + ...ndexpatternfielddescriptor.aggregatable.md | 11 + ...ver.indexpatternfielddescriptor.estypes.md | 11 + ...data-server.indexpatternfielddescriptor.md | 24 + ...server.indexpatternfielddescriptor.name.md | 11 + ...atternfielddescriptor.readfromdocvalues.md | 11 + ....indexpatternfielddescriptor.searchable.md | 11 + ...ver.indexpatternfielddescriptor.subtype.md | 11 + ...server.indexpatternfielddescriptor.type.md | 11 + ...lugin-plugins-data-server.indexpatterns.md | 14 + ...rver.indexpatternsfetcher._constructor_.md | 20 + ...patternsfetcher.getfieldsfortimepattern.md | 29 + ...dexpatternsfetcher.getfieldsforwildcard.md | 27 + ...lugins-data-server.indexpatternsfetcher.md | 25 + ...plugins-data-server.irequesttypesmap.es.md | 11 + ...in-plugins-data-server.irequesttypesmap.md | 18 + ...lugins-data-server.iresponsetypesmap.es.md | 11 + ...n-plugins-data-server.iresponsetypesmap.md | 18 + ...bana-plugin-plugins-data-server.isearch.md | 11 + ...gins-data-server.isearchcontext.config_.md | 11 + ...plugins-data-server.isearchcontext.core.md | 11 + ...ugin-plugins-data-server.isearchcontext.md | 19 + ...ugin-plugins-data-server.isearchoptions.md | 18 + ...ugins-data-server.isearchoptions.signal.md | 11 + ...gin-plugins-data-server.kbn_field_types.md | 33 + ...na-plugin-plugins-data-server.kuerynode.md | 18 + ...ugin-plugins-data-server.kuerynode.type.md | 11 + .../kibana-plugin-plugins-data-server.md | 73 + ...lugin-plugins-data-server.parseinterval.md | 22 + ...lugins-data-server.plugin._constructor_.md | 20 + ...ibana-plugin-plugins-data-server.plugin.md | 24 + ...plugin-plugins-data-server.plugin.setup.md | 33 + ...plugin-plugins-data-server.plugin.start.md | 30 + ...-plugin-plugins-data-server.plugin.stop.md | 15 + ...ns-data-server.pluginsetup.fieldformats.md | 11 + ...-plugin-plugins-data-server.pluginsetup.md | 19 + ...-plugins-data-server.pluginsetup.search.md | 11 + ...ns-data-server.pluginstart.fieldformats.md | 11 + ...-plugin-plugins-data-server.pluginstart.md | 18 + ...ugin-plugins-data-server.query.language.md | 11 + ...kibana-plugin-plugins-data-server.query.md | 19 + ...-plugin-plugins-data-server.query.query.md | 13 + ...gin-plugins-data-server.refreshinterval.md | 19 + ...ugins-data-server.refreshinterval.pause.md | 11 + ...ugins-data-server.refreshinterval.value.md | 11 + ...ata-server.shouldreadfieldfromdocvalues.md | 23 + ...ugin-plugins-data-server.timerange.from.md | 11 + ...na-plugin-plugins-data-server.timerange.md | 20 + ...ugin-plugins-data-server.timerange.mode.md | 11 + ...plugin-plugins-data-server.timerange.to.md | 11 + ...ins-data-server.tsearchstrategyprovider.md | 13 + package.json | 2 +- ...nges.js => check_published_api_changes.js} | 2 +- src/core/README.md | 2 +- ....ts => run_check_published_api_changes.ts} | 53 +- .../field_formats/field_formats_registry.ts | 4 +- src/plugins/data/public/public.api.md | 1575 +++++++++++++++++ src/plugins/data/public/types.ts | 1 + src/plugins/data/public/ui/index.ts | 2 +- .../ui/saved_query_form/save_query_form.tsx | 8 +- .../saved_query_management_component.tsx | 8 +- .../ui/search_bar/create_search_bar.tsx | 5 +- .../public/ui/search_bar/search_bar.test.tsx | 2 +- .../data/public/ui/search_bar/search_bar.tsx | 16 +- src/plugins/data/public/ui/typeahead/index.ts | 20 + .../ui/typeahead/suggestion_component.tsx | 6 +- .../ui/typeahead/suggestions_component.tsx | 2 +- .../data/server/plugins_data_server.api.md | 695 ++++++++ src/plugins/data/server/server.api.md | 711 ++++++++ tasks/config/run.js | 4 +- tasks/jenkins.js | 2 +- tasks/test.js | 2 +- 493 files changed, 10516 insertions(+), 53 deletions(-) create mode 100644 docs/development/plugins/data/public/index.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.addsearchstrategy.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.baseformatterspublic.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.castestokbnfieldtypename.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.connecttoquerystate.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.createsavedqueryservice.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.autocomplete.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.fieldformats.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.query.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.search.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.autocomplete.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.fieldformats.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.indexpatterns.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.query.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.search.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.ui.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.defaultsearchstrategy.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.es_field_types.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.es_search_strategy.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.allowleadingwildcards.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.dateformattz.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.ignorefilteriffieldnotinindex.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.querystringoptions.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquerysortvalue.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.essearchstrategyprovider.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fetchoptions.abortsignal.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fetchoptions.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fetchoptions.searchstrategyid.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.es.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.id.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.params.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatid.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformats.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatscontenttype.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter._state.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.meta.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.query.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filterbar.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager._constructor_.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.addfilters.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getappfilters.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getfetches_.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getfilters.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getglobalfilters.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getpartitionedfilters.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getupdates_.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.removeall.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.removefilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setappfilters.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setfilters.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setfiltersstore.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setglobalfilters.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getespreference.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getkbntypenames.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getquerylog.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getsearcherrortype.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.hassearchstategyforindexpattern.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.appname.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.data.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.http.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.notifications.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.savedobjects.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.storage.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.uisettings.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.params.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.rawresponse.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformat.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformatsregistry.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.multi.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.nested.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.aggregatable.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.count.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.displayname.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.estypes.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.filterable.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.format.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.lang.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.name.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.readfromdocvalues.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.script.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.scripted.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.searchable.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.sortable.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.subtype.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.type.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.visualizable.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fieldformatmap.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fields.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.id.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.timefieldname.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.title.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.type.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchrequest.debug.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchrequest.id.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchrequest.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.id.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.loaded.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.total.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern._constructor_.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern._fetchfields.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.create.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.destroy.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.fieldformatmap.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.fields.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.fieldsfetcher.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.flattenhit.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.formatfield.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.formathit.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getcomputedfields.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getfieldbyname.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getnonscriptedfields.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getscriptedfields.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getsourcefiltering.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.gettimefield.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.id.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.init.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.istimebased.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.istimebasedwildcard.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.istimenanosbased.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.iswildcard.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.metafields.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.popularizefield.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.prepbody.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.refreshfields.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.removescriptedfield.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.routes.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.save.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.timefieldname.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.title.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.tojson.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.tostring.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.type.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.typemeta.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.fields.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.timefieldname.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.title.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.type.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.typemeta.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.__spec.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.aggregatable.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.count.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.displayname.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.estypes.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.filterable.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.format.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.lang.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.name.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.routes.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.script.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.scripted.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.searchable.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.sortable.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.type.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist._constructor_.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.add.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.getbyname.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.getbytype.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.remove.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.update.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterns.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternscontract.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect._constructor_.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.componentdidmount.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.componentwillunmount.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.debouncedfetch.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.fetchoptions.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.fetchselectedindexpattern.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.onchange.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.render.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.state.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.unsafe_componentwillreceiveprops.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.aggs.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.inputtimerange.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.irequesttypesmap.es.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.irequesttypesmap.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.irequesttypesmap.sync_search_strategy.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iresponsetypesmap.es.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iresponsetypesmap.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iresponsetypesmap.sync_search_strategy.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearch.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchcontext.core.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchcontext.getsearchstrategy.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchcontext.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchgeneric.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.signal.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchsource.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchstrategy.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchstrategy.search.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isyncsearchrequest.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isyncsearchrequest.serverstrategy.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kbn_field_types.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.type.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.parseinterval.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin._constructor_.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.setup.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.start.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.stop.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.language.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.query.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.filters.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.refreshinterval.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.time.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystringinput.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestion.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.cursorindex.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.description.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.end.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.start.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.text.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.type.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionfield.field.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionfield.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionfield.type.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfn.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.boolfilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.indexpatterns.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.language.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.query.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionend.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionstart.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.signal.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiontypes.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.format.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.from.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gt.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gte.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lt.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lte.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.to.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.pause.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.value.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquery.attributes.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquery.id.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquery.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.description.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.filters.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.query.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.timefilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.title.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.deletesavedquery.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.findsavedqueries.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.getallsavedqueries.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.getsavedquery.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.getsavedquerycount.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.savequery.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquerytimefilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbar.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbarprops.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror._constructor_.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.message.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.name.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.path.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.status.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.title.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.type.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchrequest.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchresponse.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource._constructor_.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.create.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.createchild.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.createcopy.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.destroy.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getfield.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getfields.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getid.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getownfield.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getparent.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getsearchrequestbody.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.history.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.onrequeststart.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setfield.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setfields.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setparent.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setpreferredsearchstrategyid.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.aggs.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.fields.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.filter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.from.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.highlight.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.highlightall.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.index.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.query.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.searchafter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.size.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.sort.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.source.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.terminate_after.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.timeout.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.type.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.version.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.id.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.isviable.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.search.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.sortdirection.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.statefulsearchbarprops.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.sync_search_strategy.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.syncquerystatewithurl.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltercontract.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltersetup.history.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltersetup.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltersetup.timefilter.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory._constructor_.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory.add.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory.get.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistorycontract.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.from.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.mode.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.to.md create mode 100644 docs/development/plugins/data/public/kibana-plugin-plugins-data-public.tsearchstrategyprovider.md create mode 100644 docs/development/plugins/data/server/index.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.castestokbnfieldtypename.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.es_field_types.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.allowleadingwildcards.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.dateformattz.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.ignorefilteriffieldnotinindex.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.querystringoptions.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.es.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.id.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.params.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformats.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter._state.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.meta.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.query.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.getdefaultsearchparams.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.icancel.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldformatsregistry.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.multi.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.nested.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.aggregatable.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.count.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.displayname.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.estypes.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.filterable.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.format.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.lang.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.name.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.readfromdocvalues.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.script.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.scripted.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.searchable.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.sortable.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.subtype.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.type.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.visualizable.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.fieldformatmap.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.fields.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.id.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.timefieldname.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.title.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.type.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.fields.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.timefieldname.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.title.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.type.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.typemeta.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.aggregatable.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.estypes.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.name.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.readfromdocvalues.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.searchable.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.subtype.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.type.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatterns.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher._constructor_.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsfortimepattern.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsforwildcard.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.irequesttypesmap.es.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.irequesttypesmap.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iresponsetypesmap.es.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iresponsetypesmap.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearch.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.config_.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.core.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.signal.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kbn_field_types.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.type.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.parseinterval.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin._constructor_.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.start.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.stop.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.fieldformats.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.search.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginstart.fieldformats.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginstart.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.language.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.query.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.refreshinterval.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.refreshinterval.pause.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.refreshinterval.value.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.shouldreadfieldfromdocvalues.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.from.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.mode.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.to.md create mode 100644 docs/development/plugins/data/server/kibana-plugin-plugins-data-server.tsearchstrategyprovider.md rename scripts/{check_core_api_changes.js => check_published_api_changes.js} (93%) rename src/dev/{run_check_core_api_changes.ts => run_check_published_api_changes.ts} (83%) create mode 100644 src/plugins/data/public/public.api.md create mode 100644 src/plugins/data/public/ui/typeahead/index.ts create mode 100644 src/plugins/data/server/plugins_data_server.api.md create mode 100644 src/plugins/data/server/server.api.md diff --git a/docs/development/plugins/data/public/index.md b/docs/development/plugins/data/public/index.md new file mode 100644 index 0000000000000..424cfd22d3d31 --- /dev/null +++ b/docs/development/plugins/data/public/index.md @@ -0,0 +1,12 @@ + + +[Home](./index.md) + +## API Reference + +## Packages + +| Package | Description | +| --- | --- | +| [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.addsearchstrategy.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.addsearchstrategy.md new file mode 100644 index 0000000000000..119e7fbe62536 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.addsearchstrategy.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [addSearchStrategy](./kibana-plugin-plugins-data-public.addsearchstrategy.md) + +## addSearchStrategy variable + +Signature: + +```typescript +addSearchStrategy: (searchStrategy: SearchStrategyProvider) => void +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.baseformatterspublic.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.baseformatterspublic.md new file mode 100644 index 0000000000000..50e8f2409ac02 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.baseformatterspublic.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [baseFormattersPublic](./kibana-plugin-plugins-data-public.baseformatterspublic.md) + +## baseFormattersPublic variable + +Signature: + +```typescript +baseFormattersPublic: (import("../../common").IFieldFormatType | typeof DateFormat)[] +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.castestokbnfieldtypename.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.castestokbnfieldtypename.md new file mode 100644 index 0000000000000..d7257cfe61011 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.castestokbnfieldtypename.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [castEsToKbnFieldTypeName](./kibana-plugin-plugins-data-public.castestokbnfieldtypename.md) + +## castEsToKbnFieldTypeName variable + +Get the KbnFieldType name for an esType string + +Signature: + +```typescript +castEsToKbnFieldTypeName: (esType: string) => KBN_FIELD_TYPES +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.connecttoquerystate.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.connecttoquerystate.md new file mode 100644 index 0000000000000..005201735ed4b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.connecttoquerystate.md @@ -0,0 +1,32 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [connectToQueryState](./kibana-plugin-plugins-data-public.connecttoquerystate.md) + +## connectToQueryState variable + +Helper to setup two-way syncing of global data and a state container + +Signature: + +```typescript +connectToQueryState: ({ timefilter: { timefilter }, filterManager, state$, }: Pick<{ + filterManager: import("..").FilterManager; + timefilter: import("..").TimefilterSetup; + state$: import("rxjs").Observable<{ + changes: QueryStateChange; + state: QueryState; + }>; + savedQueries: import("..").SavedQueryService; +} | { + filterManager: import("..").FilterManager; + timefilter: import("..").TimefilterSetup; + state$: import("rxjs").Observable<{ + changes: QueryStateChange; + state: QueryState; + }>; +}, "state$" | "timefilter" | "filterManager">, stateContainer: BaseStateContainer, syncConfig: { + time?: boolean | undefined; + refreshInterval?: boolean | undefined; + filters?: boolean | FilterStateStore | undefined; +}) => () => void +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.createsavedqueryservice.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.createsavedqueryservice.md new file mode 100644 index 0000000000000..c23d37dfecf90 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.createsavedqueryservice.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [createSavedQueryService](./kibana-plugin-plugins-data-public.createsavedqueryservice.md) + +## createSavedQueryService variable + +Signature: + +```typescript +createSavedQueryService: (savedObjectsClient: Pick) => SavedQueryService +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md new file mode 100644 index 0000000000000..0a3b4e54cfe55 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.customfilter.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [CustomFilter](./kibana-plugin-plugins-data-public.customfilter.md) + +## CustomFilter type + +Signature: + +```typescript +export declare type CustomFilter = Filter & { + query: any; +}; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.autocomplete.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.autocomplete.md new file mode 100644 index 0000000000000..9ded30c531bed --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.autocomplete.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [DataPublicPluginSetup](./kibana-plugin-plugins-data-public.datapublicpluginsetup.md) > [autocomplete](./kibana-plugin-plugins-data-public.datapublicpluginsetup.autocomplete.md) + +## DataPublicPluginSetup.autocomplete property + +Signature: + +```typescript +autocomplete: AutocompleteSetup; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.fieldformats.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.fieldformats.md new file mode 100644 index 0000000000000..993634023c20c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.fieldformats.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [DataPublicPluginSetup](./kibana-plugin-plugins-data-public.datapublicpluginsetup.md) > [fieldFormats](./kibana-plugin-plugins-data-public.datapublicpluginsetup.fieldformats.md) + +## DataPublicPluginSetup.fieldFormats property + +Signature: + +```typescript +fieldFormats: FieldFormatsSetup; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.md new file mode 100644 index 0000000000000..dba1d79e78682 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [DataPublicPluginSetup](./kibana-plugin-plugins-data-public.datapublicpluginsetup.md) + +## DataPublicPluginSetup interface + +Signature: + +```typescript +export interface DataPublicPluginSetup +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [autocomplete](./kibana-plugin-plugins-data-public.datapublicpluginsetup.autocomplete.md) | AutocompleteSetup | | +| [fieldFormats](./kibana-plugin-plugins-data-public.datapublicpluginsetup.fieldformats.md) | FieldFormatsSetup | | +| [query](./kibana-plugin-plugins-data-public.datapublicpluginsetup.query.md) | QuerySetup | | +| [search](./kibana-plugin-plugins-data-public.datapublicpluginsetup.search.md) | ISearchSetup | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.query.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.query.md new file mode 100644 index 0000000000000..b8882bdf671b6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.query.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [DataPublicPluginSetup](./kibana-plugin-plugins-data-public.datapublicpluginsetup.md) > [query](./kibana-plugin-plugins-data-public.datapublicpluginsetup.query.md) + +## DataPublicPluginSetup.query property + +Signature: + +```typescript +query: QuerySetup; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.search.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.search.md new file mode 100644 index 0000000000000..a957c1acc4194 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginsetup.search.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [DataPublicPluginSetup](./kibana-plugin-plugins-data-public.datapublicpluginsetup.md) > [search](./kibana-plugin-plugins-data-public.datapublicpluginsetup.search.md) + +## DataPublicPluginSetup.search property + +Signature: + +```typescript +search: ISearchSetup; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.autocomplete.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.autocomplete.md new file mode 100644 index 0000000000000..d2e5aee7d90dd --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.autocomplete.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [DataPublicPluginStart](./kibana-plugin-plugins-data-public.datapublicpluginstart.md) > [autocomplete](./kibana-plugin-plugins-data-public.datapublicpluginstart.autocomplete.md) + +## DataPublicPluginStart.autocomplete property + +Signature: + +```typescript +autocomplete: AutocompleteStart; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.fieldformats.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.fieldformats.md new file mode 100644 index 0000000000000..dd4b38f64d10b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.fieldformats.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [DataPublicPluginStart](./kibana-plugin-plugins-data-public.datapublicpluginstart.md) > [fieldFormats](./kibana-plugin-plugins-data-public.datapublicpluginstart.fieldformats.md) + +## DataPublicPluginStart.fieldFormats property + +Signature: + +```typescript +fieldFormats: FieldFormatsStart; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.indexpatterns.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.indexpatterns.md new file mode 100644 index 0000000000000..b3dd6a61760a6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.indexpatterns.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [DataPublicPluginStart](./kibana-plugin-plugins-data-public.datapublicpluginstart.md) > [indexPatterns](./kibana-plugin-plugins-data-public.datapublicpluginstart.indexpatterns.md) + +## DataPublicPluginStart.indexPatterns property + +Signature: + +```typescript +indexPatterns: IndexPatternsContract; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.md new file mode 100644 index 0000000000000..defc633b5d1ce --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [DataPublicPluginStart](./kibana-plugin-plugins-data-public.datapublicpluginstart.md) + +## DataPublicPluginStart interface + +Signature: + +```typescript +export interface DataPublicPluginStart +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [autocomplete](./kibana-plugin-plugins-data-public.datapublicpluginstart.autocomplete.md) | AutocompleteStart | | +| [fieldFormats](./kibana-plugin-plugins-data-public.datapublicpluginstart.fieldformats.md) | FieldFormatsStart | | +| [indexPatterns](./kibana-plugin-plugins-data-public.datapublicpluginstart.indexpatterns.md) | IndexPatternsContract | | +| [query](./kibana-plugin-plugins-data-public.datapublicpluginstart.query.md) | QueryStart | | +| [search](./kibana-plugin-plugins-data-public.datapublicpluginstart.search.md) | ISearchStart | | +| [ui](./kibana-plugin-plugins-data-public.datapublicpluginstart.ui.md) | {
IndexPatternSelect: React.ComponentType<IndexPatternSelectProps>;
SearchBar: React.ComponentType<StatefulSearchBarProps>;
} | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.query.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.query.md new file mode 100644 index 0000000000000..a44e250077ed4 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.query.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [DataPublicPluginStart](./kibana-plugin-plugins-data-public.datapublicpluginstart.md) > [query](./kibana-plugin-plugins-data-public.datapublicpluginstart.query.md) + +## DataPublicPluginStart.query property + +Signature: + +```typescript +query: QueryStart; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.search.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.search.md new file mode 100644 index 0000000000000..eec00e7b13e9d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.search.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [DataPublicPluginStart](./kibana-plugin-plugins-data-public.datapublicpluginstart.md) > [search](./kibana-plugin-plugins-data-public.datapublicpluginstart.search.md) + +## DataPublicPluginStart.search property + +Signature: + +```typescript +search: ISearchStart; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.ui.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.ui.md new file mode 100644 index 0000000000000..9c24216834371 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.datapublicpluginstart.ui.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [DataPublicPluginStart](./kibana-plugin-plugins-data-public.datapublicpluginstart.md) > [ui](./kibana-plugin-plugins-data-public.datapublicpluginstart.ui.md) + +## DataPublicPluginStart.ui property + +Signature: + +```typescript +ui: { + IndexPatternSelect: React.ComponentType; + SearchBar: React.ComponentType; + }; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.defaultsearchstrategy.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.defaultsearchstrategy.md new file mode 100644 index 0000000000000..d6a71cf561bc2 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.defaultsearchstrategy.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [defaultSearchStrategy](./kibana-plugin-plugins-data-public.defaultsearchstrategy.md) + +## defaultSearchStrategy variable + +Signature: + +```typescript +defaultSearchStrategy: SearchStrategyProvider +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.es_field_types.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.es_field_types.md new file mode 100644 index 0000000000000..e7341caf7b3cd --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.es_field_types.md @@ -0,0 +1,45 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ES\_FIELD\_TYPES](./kibana-plugin-plugins-data-public.es_field_types.md) + +## ES\_FIELD\_TYPES enum + +\* + +Signature: + +```typescript +export declare enum ES_FIELD_TYPES +``` + +## Enumeration Members + +| Member | Value | Description | +| --- | --- | --- | +| \_ID | "_id" | | +| \_INDEX | "_index" | | +| \_SOURCE | "_source" | | +| \_TYPE | "_type" | | +| ATTACHMENT | "attachment" | | +| BOOLEAN | "boolean" | | +| BYTE | "byte" | | +| DATE | "date" | | +| DATE\_NANOS | "date_nanos" | | +| DOUBLE | "double" | | +| FLOAT | "float" | | +| GEO\_POINT | "geo_point" | | +| GEO\_SHAPE | "geo_shape" | | +| HALF\_FLOAT | "half_float" | | +| INTEGER | "integer" | | +| IP | "ip" | | +| KEYWORD | "keyword" | | +| LONG | "long" | | +| MURMUR3 | "murmur3" | | +| NESTED | "nested" | | +| OBJECT | "object" | | +| SCALED\_FLOAT | "scaled_float" | | +| SHORT | "short" | | +| STRING | "string" | | +| TEXT | "text" | | +| TOKEN\_COUNT | "token_count" | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.es_search_strategy.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.es_search_strategy.md new file mode 100644 index 0000000000000..9cf3720e330c2 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.es_search_strategy.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ES\_SEARCH\_STRATEGY](./kibana-plugin-plugins-data-public.es_search_strategy.md) + +## ES\_SEARCH\_STRATEGY variable + +Signature: + +```typescript +ES_SEARCH_STRATEGY = "es" +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md new file mode 100644 index 0000000000000..e03072f9a41c3 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esfilters.md @@ -0,0 +1,55 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [esFilters](./kibana-plugin-plugins-data-public.esfilters.md) + +## esFilters variable + +Signature: + +```typescript +esFilters: { + FilterLabel: typeof FilterLabel; + FILTERS: typeof FILTERS; + FilterStateStore: typeof FilterStateStore; + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; + buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").IIndexPattern) => import("../common").PhrasesFilter; + buildExistsFilter: (field: import("../common").IFieldType, indexPattern: import("../common").IIndexPattern) => import("../common").ExistsFilter; + buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").IIndexPattern) => import("../common").PhraseFilter; + buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter; + buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").IIndexPattern, formattedValue?: string | undefined) => import("../common").RangeFilter; + isPhraseFilter: (filter: any) => filter is import("../common").PhraseFilter; + isExistsFilter: (filter: any) => filter is import("../common").ExistsFilter; + isPhrasesFilter: (filter: any) => filter is import("../common").PhrasesFilter; + isRangeFilter: (filter: any) => filter is import("../common").RangeFilter; + isMatchAllFilter: (filter: any) => filter is import("../common").MatchAllFilter; + isMissingFilter: (filter: any) => filter is import("../common").MissingFilter; + isQueryStringFilter: (filter: any) => filter is import("../common").QueryStringFilter; + isFilterPinned: (filter: import("../common").Filter) => boolean | undefined; + toggleFilterNegated: (filter: import("../common").Filter) => { + meta: { + negate: boolean; + alias: string | null; + disabled: boolean; + controlledBy?: string | undefined; + index?: string | undefined; + type?: string | undefined; + key?: string | undefined; + params?: any; + value?: string | ((formatter?: import("../common").FilterValueFormatter | undefined) => string) | undefined; + }; + $state?: import("../common").FilterState | undefined; + query?: any; + }; + disableFilter: (filter: import("../common").Filter) => import("../common").Filter; + getPhraseFilterField: (filter: import("../common").PhraseFilter) => string; + getPhraseFilterValue: (filter: import("../common").PhraseFilter) => string | number | boolean; + getDisplayValueFromFilter: typeof getDisplayValueFromFilter; + compareFilters: (first: import("../common").Filter | import("../common").Filter[], second: import("../common").Filter | import("../common").Filter[], comparatorOptions?: import("./query/filter_manager/lib/compare_filters").FilterCompareOptions) => boolean; + COMPARE_ALL_OPTIONS: import("./query/filter_manager/lib/compare_filters").FilterCompareOptions; + generateFilters: typeof generateFilters; + onlyDisabledFiltersChanged: (newFilters?: import("../common").Filter[] | undefined, oldFilters?: import("../common").Filter[] | undefined) => boolean; + changeTimeFilter: typeof changeTimeFilter; + mapAndFlattenFilters: (filters: import("../common").Filter[]) => import("../common").Filter[]; + extractTimeFilter: typeof extractTimeFilter; +} +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md new file mode 100644 index 0000000000000..5d92e348d6276 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.eskuery.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [esKuery](./kibana-plugin-plugins-data-public.eskuery.md) + +## esKuery variable + +Signature: + +```typescript +esKuery: { + nodeTypes: import("../common/es_query/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial) => import("../common").KueryNode; + toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").IIndexPattern | undefined, config?: Record | undefined, context?: Record | undefined) => import("../../kibana_utils/common").JsonObject; +} +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md new file mode 100644 index 0000000000000..2430e6a93bd2b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquery.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [esQuery](./kibana-plugin-plugins-data-public.esquery.md) + +## esQuery variable + +Signature: + +```typescript +esQuery: { + buildEsQuery: typeof buildEsQuery; + getEsQueryConfig: typeof getEsQueryConfig; + buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").IIndexPattern | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => { + must: never[]; + filter: import("../common").Filter[]; + should: never[]; + must_not: import("../common").Filter[]; + }; + luceneStringToDsl: typeof luceneStringToDsl; + decorateQuery: typeof decorateQuery; +} +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.allowleadingwildcards.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.allowleadingwildcards.md new file mode 100644 index 0000000000000..71eb23ac6299b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.allowleadingwildcards.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) > [allowLeadingWildcards](./kibana-plugin-plugins-data-public.esqueryconfig.allowleadingwildcards.md) + +## EsQueryConfig.allowLeadingWildcards property + +Signature: + +```typescript +allowLeadingWildcards: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.dateformattz.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.dateformattz.md new file mode 100644 index 0000000000000..e9c4c26878a97 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.dateformattz.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) > [dateFormatTZ](./kibana-plugin-plugins-data-public.esqueryconfig.dateformattz.md) + +## EsQueryConfig.dateFormatTZ property + +Signature: + +```typescript +dateFormatTZ?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.ignorefilteriffieldnotinindex.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.ignorefilteriffieldnotinindex.md new file mode 100644 index 0000000000000..9f765c51d0a69 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.ignorefilteriffieldnotinindex.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) > [ignoreFilterIfFieldNotInIndex](./kibana-plugin-plugins-data-public.esqueryconfig.ignorefilteriffieldnotinindex.md) + +## EsQueryConfig.ignoreFilterIfFieldNotInIndex property + +Signature: + +```typescript +ignoreFilterIfFieldNotInIndex: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md new file mode 100644 index 0000000000000..5252f8058b488 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) + +## EsQueryConfig interface + +Signature: + +```typescript +export interface EsQueryConfig +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [allowLeadingWildcards](./kibana-plugin-plugins-data-public.esqueryconfig.allowleadingwildcards.md) | boolean | | +| [dateFormatTZ](./kibana-plugin-plugins-data-public.esqueryconfig.dateformattz.md) | string | | +| [ignoreFilterIfFieldNotInIndex](./kibana-plugin-plugins-data-public.esqueryconfig.ignorefilteriffieldnotinindex.md) | boolean | | +| [queryStringOptions](./kibana-plugin-plugins-data-public.esqueryconfig.querystringoptions.md) | Record<string, any> | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.querystringoptions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.querystringoptions.md new file mode 100644 index 0000000000000..feaa8f1821e30 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esqueryconfig.querystringoptions.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) > [queryStringOptions](./kibana-plugin-plugins-data-public.esqueryconfig.querystringoptions.md) + +## EsQueryConfig.queryStringOptions property + +Signature: + +```typescript +queryStringOptions: Record; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquerysortvalue.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquerysortvalue.md new file mode 100644 index 0000000000000..83762c22f0f82 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.esquerysortvalue.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [EsQuerySortValue](./kibana-plugin-plugins-data-public.esquerysortvalue.md) + +## EsQuerySortValue type + +Signature: + +```typescript +export declare type EsQuerySortValue = Record; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.essearchstrategyprovider.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.essearchstrategyprovider.md new file mode 100644 index 0000000000000..1394c6b868546 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.essearchstrategyprovider.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [esSearchStrategyProvider](./kibana-plugin-plugins-data-public.essearchstrategyprovider.md) + +## esSearchStrategyProvider variable + +Signature: + +```typescript +esSearchStrategyProvider: TSearchStrategyProvider +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md new file mode 100644 index 0000000000000..f1279934db84c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.existsfilter.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ExistsFilter](./kibana-plugin-plugins-data-public.existsfilter.md) + +## ExistsFilter type + +Signature: + +```typescript +export declare type ExistsFilter = Filter & { + meta: ExistsFilterMeta; + exists?: FilterExistsProperty; +}; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fetchoptions.abortsignal.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fetchoptions.abortsignal.md new file mode 100644 index 0000000000000..791f1b63e6539 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fetchoptions.abortsignal.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FetchOptions](./kibana-plugin-plugins-data-public.fetchoptions.md) > [abortSignal](./kibana-plugin-plugins-data-public.fetchoptions.abortsignal.md) + +## FetchOptions.abortSignal property + +Signature: + +```typescript +abortSignal?: AbortSignal; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fetchoptions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fetchoptions.md new file mode 100644 index 0000000000000..f07fdd4280533 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fetchoptions.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FetchOptions](./kibana-plugin-plugins-data-public.fetchoptions.md) + +## FetchOptions interface + +Signature: + +```typescript +export interface FetchOptions +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [abortSignal](./kibana-plugin-plugins-data-public.fetchoptions.abortsignal.md) | AbortSignal | | +| [searchStrategyId](./kibana-plugin-plugins-data-public.fetchoptions.searchstrategyid.md) | string | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fetchoptions.searchstrategyid.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fetchoptions.searchstrategyid.md new file mode 100644 index 0000000000000..8824529eb4eca --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fetchoptions.searchstrategyid.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FetchOptions](./kibana-plugin-plugins-data-public.fetchoptions.md) > [searchStrategyId](./kibana-plugin-plugins-data-public.fetchoptions.searchstrategyid.md) + +## FetchOptions.searchStrategyId property + +Signature: + +```typescript +searchStrategyId?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.es.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.es.md new file mode 100644 index 0000000000000..82441ee41d80d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.es.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) > [es](./kibana-plugin-plugins-data-public.fieldformatconfig.es.md) + +## FieldFormatConfig.es property + +Signature: + +```typescript +es?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.id.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.id.md new file mode 100644 index 0000000000000..b179c314a56d3 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.id.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) > [id](./kibana-plugin-plugins-data-public.fieldformatconfig.id.md) + +## FieldFormatConfig.id property + +Signature: + +```typescript +id: FieldFormatId; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.md new file mode 100644 index 0000000000000..f856a3132eccb --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) + +## FieldFormatConfig interface + +Signature: + +```typescript +export interface FieldFormatConfig +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [es](./kibana-plugin-plugins-data-public.fieldformatconfig.es.md) | boolean | | +| [id](./kibana-plugin-plugins-data-public.fieldformatconfig.id.md) | FieldFormatId | | +| [params](./kibana-plugin-plugins-data-public.fieldformatconfig.params.md) | Record<string, any> | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.params.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.params.md new file mode 100644 index 0000000000000..aad977643ad2f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatconfig.params.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) > [params](./kibana-plugin-plugins-data-public.fieldformatconfig.params.md) + +## FieldFormatConfig.params property + +Signature: + +```typescript +params: Record; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatid.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatid.md new file mode 100644 index 0000000000000..9f94d50a2001f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatid.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatId](./kibana-plugin-plugins-data-public.fieldformatid.md) + +## FieldFormatId type + + id type is needed for creating custom converters. + +Signature: + +```typescript +export declare type FieldFormatId = FIELD_FORMAT_IDS | string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformats.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformats.md new file mode 100644 index 0000000000000..7fd4d03e1b074 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformats.md @@ -0,0 +1,39 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [fieldFormats](./kibana-plugin-plugins-data-public.fieldformats.md) + +## fieldFormats variable + +Signature: + +```typescript +fieldFormats: { + FieldFormat: typeof FieldFormat; + FieldFormatsRegistry: typeof FieldFormatsRegistry; + serialize: (agg: import("../../../legacy/core_plugins/data/public/search").AggConfig) => import("../../expressions/common").SerializedFieldFormat; + DEFAULT_CONVERTER_COLOR: { + range: string; + regex: string; + text: string; + background: string; + }; + HTML_CONTEXT_TYPE: import("../common").FieldFormatsContentType; + TEXT_CONTEXT_TYPE: import("../common").FieldFormatsContentType; + FIELD_FORMAT_IDS: typeof FIELD_FORMAT_IDS; + BoolFormat: typeof BoolFormat; + BytesFormat: typeof BytesFormat; + ColorFormat: typeof ColorFormat; + DateFormat: typeof DateFormat; + DateNanosFormat: typeof DateNanosFormat; + DurationFormat: typeof DurationFormat; + IpFormat: typeof IpFormat; + NumberFormat: typeof NumberFormat; + PercentFormat: typeof PercentFormat; + RelativeDateFormat: typeof RelativeDateFormat; + SourceFormat: typeof SourceFormat; + StaticLookupFormat: typeof StaticLookupFormat; + UrlFormat: typeof UrlFormat; + StringFormat: typeof StringFormat; + TruncateFormat: typeof TruncateFormat; +} +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatscontenttype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatscontenttype.md new file mode 100644 index 0000000000000..8e89a0262b438 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatscontenttype.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatsContentType](./kibana-plugin-plugins-data-public.fieldformatscontenttype.md) + +## FieldFormatsContentType type + +\* + +Signature: + +```typescript +export declare type FieldFormatsContentType = 'html' | 'text'; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md new file mode 100644 index 0000000000000..4233eea42cded --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md) + +## FieldFormatsGetConfigFn type + +Signature: + +```typescript +export declare type FieldFormatsGetConfigFn = (key: string, defaultOverride?: T) => T; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter._state.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter._state.md new file mode 100644 index 0000000000000..bfb5dff71e70d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter._state.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Filter](./kibana-plugin-plugins-data-public.filter.md) > [$state](./kibana-plugin-plugins-data-public.filter._state.md) + +## Filter.$state property + +Signature: + +```typescript +$state?: FilterState; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md new file mode 100644 index 0000000000000..f993721ee96ad --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Filter](./kibana-plugin-plugins-data-public.filter.md) + +## Filter interface + +Signature: + +```typescript +export interface Filter +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [$state](./kibana-plugin-plugins-data-public.filter._state.md) | FilterState | | +| [meta](./kibana-plugin-plugins-data-public.filter.meta.md) | FilterMeta | | +| [query](./kibana-plugin-plugins-data-public.filter.query.md) | any | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.meta.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.meta.md new file mode 100644 index 0000000000000..3385a3773a2aa --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.meta.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Filter](./kibana-plugin-plugins-data-public.filter.md) > [meta](./kibana-plugin-plugins-data-public.filter.meta.md) + +## Filter.meta property + +Signature: + +```typescript +meta: FilterMeta; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.query.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.query.md new file mode 100644 index 0000000000000..083b544493e80 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filter.query.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Filter](./kibana-plugin-plugins-data-public.filter.md) > [query](./kibana-plugin-plugins-data-public.filter.query.md) + +## Filter.query property + +Signature: + +```typescript +query?: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filterbar.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filterbar.md new file mode 100644 index 0000000000000..016adffd0d7f4 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filterbar.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterBar](./kibana-plugin-plugins-data-public.filterbar.md) + +## FilterBar variable + +Signature: + +```typescript +FilterBar: React.ComponentClass, any> & { + WrappedComponent: React.ComponentType; +} +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager._constructor_.md new file mode 100644 index 0000000000000..6f9c3058928d1 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager._constructor_.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [(constructor)](./kibana-plugin-plugins-data-public.filtermanager._constructor_.md) + +## FilterManager.(constructor) + +Constructs a new instance of the `FilterManager` class + +Signature: + +```typescript +constructor(uiSettings: IUiSettingsClient); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| uiSettings | IUiSettingsClient | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.addfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.addfilters.md new file mode 100644 index 0000000000000..98b21800ee655 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.addfilters.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [addFilters](./kibana-plugin-plugins-data-public.filtermanager.addfilters.md) + +## FilterManager.addFilters() method + +Signature: + +```typescript +addFilters(filters: Filter[] | Filter, pinFilterStatus?: boolean): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| filters | Filter[] | Filter | | +| pinFilterStatus | boolean | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getappfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getappfilters.md new file mode 100644 index 0000000000000..7bb1f5971b740 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getappfilters.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [getAppFilters](./kibana-plugin-plugins-data-public.filtermanager.getappfilters.md) + +## FilterManager.getAppFilters() method + +Signature: + +```typescript +getAppFilters(): Filter[]; +``` +Returns: + +`Filter[]` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getfetches_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getfetches_.md new file mode 100644 index 0000000000000..fa47d1552de39 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getfetches_.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [getFetches$](./kibana-plugin-plugins-data-public.filtermanager.getfetches_.md) + +## FilterManager.getFetches$() method + +Signature: + +```typescript +getFetches$(): import("rxjs").Observable; +``` +Returns: + +`import("rxjs").Observable` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getfilters.md new file mode 100644 index 0000000000000..234354e7f674a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getfilters.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [getFilters](./kibana-plugin-plugins-data-public.filtermanager.getfilters.md) + +## FilterManager.getFilters() method + +Signature: + +```typescript +getFilters(): Filter[]; +``` +Returns: + +`Filter[]` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getglobalfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getglobalfilters.md new file mode 100644 index 0000000000000..933a0522ea2fd --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getglobalfilters.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [getGlobalFilters](./kibana-plugin-plugins-data-public.filtermanager.getglobalfilters.md) + +## FilterManager.getGlobalFilters() method + +Signature: + +```typescript +getGlobalFilters(): Filter[]; +``` +Returns: + +`Filter[]` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getpartitionedfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getpartitionedfilters.md new file mode 100644 index 0000000000000..ca8e9b8b4ff42 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getpartitionedfilters.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [getPartitionedFilters](./kibana-plugin-plugins-data-public.filtermanager.getpartitionedfilters.md) + +## FilterManager.getPartitionedFilters() method + +Signature: + +```typescript +getPartitionedFilters(): PartitionedFilters; +``` +Returns: + +`PartitionedFilters` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getupdates_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getupdates_.md new file mode 100644 index 0000000000000..ca121c4a51877 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.getupdates_.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [getUpdates$](./kibana-plugin-plugins-data-public.filtermanager.getupdates_.md) + +## FilterManager.getUpdates$() method + +Signature: + +```typescript +getUpdates$(): import("rxjs").Observable; +``` +Returns: + +`import("rxjs").Observable` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.md new file mode 100644 index 0000000000000..3e85859a3c831 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.md @@ -0,0 +1,36 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) + +## FilterManager class + +Signature: + +```typescript +export declare class FilterManager +``` + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)(uiSettings)](./kibana-plugin-plugins-data-public.filtermanager._constructor_.md) | | Constructs a new instance of the FilterManager class | + +## Methods + +| Method | Modifiers | Description | +| --- | --- | --- | +| [addFilters(filters, pinFilterStatus)](./kibana-plugin-plugins-data-public.filtermanager.addfilters.md) | | | +| [getAppFilters()](./kibana-plugin-plugins-data-public.filtermanager.getappfilters.md) | | | +| [getFetches$()](./kibana-plugin-plugins-data-public.filtermanager.getfetches_.md) | | | +| [getFilters()](./kibana-plugin-plugins-data-public.filtermanager.getfilters.md) | | | +| [getGlobalFilters()](./kibana-plugin-plugins-data-public.filtermanager.getglobalfilters.md) | | | +| [getPartitionedFilters()](./kibana-plugin-plugins-data-public.filtermanager.getpartitionedfilters.md) | | | +| [getUpdates$()](./kibana-plugin-plugins-data-public.filtermanager.getupdates_.md) | | | +| [removeAll()](./kibana-plugin-plugins-data-public.filtermanager.removeall.md) | | | +| [removeFilter(filter)](./kibana-plugin-plugins-data-public.filtermanager.removefilter.md) | | | +| [setAppFilters(newAppFilters)](./kibana-plugin-plugins-data-public.filtermanager.setappfilters.md) | | Sets new app filters and leaves global filters untouched, Removes app filters for which there is a duplicate within new global filters | +| [setFilters(newFilters, pinFilterStatus)](./kibana-plugin-plugins-data-public.filtermanager.setfilters.md) | | | +| [setFiltersStore(filters, store, shouldOverrideStore)](./kibana-plugin-plugins-data-public.filtermanager.setfiltersstore.md) | static | | +| [setGlobalFilters(newGlobalFilters)](./kibana-plugin-plugins-data-public.filtermanager.setglobalfilters.md) | | Sets new global filters and leaves app filters untouched, Removes app filters for which there is a duplicate within new global filters | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.removeall.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.removeall.md new file mode 100644 index 0000000000000..745e62f36503d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.removeall.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [removeAll](./kibana-plugin-plugins-data-public.filtermanager.removeall.md) + +## FilterManager.removeAll() method + +Signature: + +```typescript +removeAll(): void; +``` +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.removefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.removefilter.md new file mode 100644 index 0000000000000..a048cc2e21c8f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.removefilter.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [removeFilter](./kibana-plugin-plugins-data-public.filtermanager.removefilter.md) + +## FilterManager.removeFilter() method + +Signature: + +```typescript +removeFilter(filter: Filter): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| filter | Filter | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setappfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setappfilters.md new file mode 100644 index 0000000000000..36743fc0d3cad --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setappfilters.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [setAppFilters](./kibana-plugin-plugins-data-public.filtermanager.setappfilters.md) + +## FilterManager.setAppFilters() method + +Sets new app filters and leaves global filters untouched, Removes app filters for which there is a duplicate within new global filters + +Signature: + +```typescript +setAppFilters(newAppFilters: Filter[]): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| newAppFilters | Filter[] | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setfilters.md new file mode 100644 index 0000000000000..0e37e55cee324 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setfilters.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [setFilters](./kibana-plugin-plugins-data-public.filtermanager.setfilters.md) + +## FilterManager.setFilters() method + +Signature: + +```typescript +setFilters(newFilters: Filter[], pinFilterStatus?: boolean): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| newFilters | Filter[] | | +| pinFilterStatus | boolean | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setfiltersstore.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setfiltersstore.md new file mode 100644 index 0000000000000..1f0982b20353a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setfiltersstore.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [setFiltersStore](./kibana-plugin-plugins-data-public.filtermanager.setfiltersstore.md) + +## FilterManager.setFiltersStore() method + +Signature: + +```typescript +static setFiltersStore(filters: Filter[], store: FilterStateStore, shouldOverrideStore?: boolean): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| filters | Filter[] | | +| store | FilterStateStore | | +| shouldOverrideStore | boolean | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setglobalfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setglobalfilters.md new file mode 100644 index 0000000000000..cd234d2350696 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.filtermanager.setglobalfilters.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) > [setGlobalFilters](./kibana-plugin-plugins-data-public.filtermanager.setglobalfilters.md) + +## FilterManager.setGlobalFilters() method + +Sets new global filters and leaves app filters untouched, Removes app filters for which there is a duplicate within new global filters + +Signature: + +```typescript +setGlobalFilters(newGlobalFilters: Filter[]): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| newGlobalFilters | Filter[] | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getespreference.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getespreference.md new file mode 100644 index 0000000000000..f872c56c168ce --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getespreference.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [getEsPreference](./kibana-plugin-plugins-data-public.getespreference.md) + +## getEsPreference() function + +Signature: + +```typescript +export declare function getEsPreference(uiSettings: IUiSettingsClient, sessionId?: string): any; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| uiSettings | IUiSettingsClient | | +| sessionId | string | | + +Returns: + +`any` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getkbntypenames.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getkbntypenames.md new file mode 100644 index 0000000000000..57ea5bab6e8c3 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getkbntypenames.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [getKbnTypeNames](./kibana-plugin-plugins-data-public.getkbntypenames.md) + +## getKbnTypeNames variable + +Get the esTypes known by all kbnFieldTypes + + {Array} + +Signature: + +```typescript +getKbnTypeNames: () => string[] +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getquerylog.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getquerylog.md new file mode 100644 index 0000000000000..e933245e81623 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getquerylog.md @@ -0,0 +1,25 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [getQueryLog](./kibana-plugin-plugins-data-public.getquerylog.md) + +## getQueryLog() function + +Signature: + +```typescript +export declare function getQueryLog(uiSettings: IUiSettingsClient, storage: IStorageWrapper, appName: string, language: string): PersistedLog; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| uiSettings | IUiSettingsClient | | +| storage | IStorageWrapper | | +| appName | string | | +| language | string | | + +Returns: + +`PersistedLog` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getsearcherrortype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getsearcherrortype.md new file mode 100644 index 0000000000000..b46728c093792 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.getsearcherrortype.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [getSearchErrorType](./kibana-plugin-plugins-data-public.getsearcherrortype.md) + +## getSearchErrorType() function + +Signature: + +```typescript +export declare function getSearchErrorType({ message }: Pick): "UNSUPPORTED_QUERY" | undefined; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| { message } | Pick<SearchError, 'message'> | | + +Returns: + +`"UNSUPPORTED_QUERY" | undefined` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md new file mode 100644 index 0000000000000..04a0d871cab2d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.gettime.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [getTime](./kibana-plugin-plugins-data-public.gettime.md) + +## getTime() function + +Signature: + +```typescript +export declare function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, forceNow?: Date): import("../..").RangeFilter | undefined; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| indexPattern | IIndexPattern | undefined | | +| timeRange | TimeRange | | +| forceNow | Date | | + +Returns: + +`import("../..").RangeFilter | undefined` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.hassearchstategyforindexpattern.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.hassearchstategyforindexpattern.md new file mode 100644 index 0000000000000..94608e7a86820 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.hassearchstategyforindexpattern.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [hasSearchStategyForIndexPattern](./kibana-plugin-plugins-data-public.hassearchstategyforindexpattern.md) + +## hasSearchStategyForIndexPattern variable + +Signature: + +```typescript +hasSearchStategyForIndexPattern: (indexPattern: IndexPattern) => boolean +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.appname.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.appname.md new file mode 100644 index 0000000000000..b58ee46f638db --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.appname.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) > [appName](./kibana-plugin-plugins-data-public.idatapluginservices.appname.md) + +## IDataPluginServices.appName property + +Signature: + +```typescript +appName: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.data.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.data.md new file mode 100644 index 0000000000000..8a94974a7dd6b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.data.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) > [data](./kibana-plugin-plugins-data-public.idatapluginservices.data.md) + +## IDataPluginServices.data property + +Signature: + +```typescript +data: DataPublicPluginStart; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.http.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.http.md new file mode 100644 index 0000000000000..48a04c1204d14 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.http.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) > [http](./kibana-plugin-plugins-data-public.idatapluginservices.http.md) + +## IDataPluginServices.http property + +Signature: + +```typescript +http: CoreStart['http']; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.md new file mode 100644 index 0000000000000..5f940bf70a12b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) + +## IDataPluginServices interface + +Signature: + +```typescript +export interface IDataPluginServices extends Partial +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [appName](./kibana-plugin-plugins-data-public.idatapluginservices.appname.md) | string | | +| [data](./kibana-plugin-plugins-data-public.idatapluginservices.data.md) | DataPublicPluginStart | | +| [http](./kibana-plugin-plugins-data-public.idatapluginservices.http.md) | CoreStart['http'] | | +| [notifications](./kibana-plugin-plugins-data-public.idatapluginservices.notifications.md) | CoreStart['notifications'] | | +| [savedObjects](./kibana-plugin-plugins-data-public.idatapluginservices.savedobjects.md) | CoreStart['savedObjects'] | | +| [storage](./kibana-plugin-plugins-data-public.idatapluginservices.storage.md) | IStorageWrapper | | +| [uiSettings](./kibana-plugin-plugins-data-public.idatapluginservices.uisettings.md) | CoreStart['uiSettings'] | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.notifications.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.notifications.md new file mode 100644 index 0000000000000..79b9e8a26e199 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.notifications.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) > [notifications](./kibana-plugin-plugins-data-public.idatapluginservices.notifications.md) + +## IDataPluginServices.notifications property + +Signature: + +```typescript +notifications: CoreStart['notifications']; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.savedobjects.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.savedobjects.md new file mode 100644 index 0000000000000..2128d12a56b79 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.savedobjects.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) > [savedObjects](./kibana-plugin-plugins-data-public.idatapluginservices.savedobjects.md) + +## IDataPluginServices.savedObjects property + +Signature: + +```typescript +savedObjects: CoreStart['savedObjects']; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.storage.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.storage.md new file mode 100644 index 0000000000000..923c60e7245d3 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.storage.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) > [storage](./kibana-plugin-plugins-data-public.idatapluginservices.storage.md) + +## IDataPluginServices.storage property + +Signature: + +```typescript +storage: IStorageWrapper; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.uisettings.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.uisettings.md new file mode 100644 index 0000000000000..ccdd2ec23dc84 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.idatapluginservices.uisettings.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) > [uiSettings](./kibana-plugin-plugins-data-public.idatapluginservices.uisettings.md) + +## IDataPluginServices.uiSettings property + +Signature: + +```typescript +uiSettings: CoreStart['uiSettings']; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.md new file mode 100644 index 0000000000000..7a40725a67e5f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IEsSearchRequest](./kibana-plugin-plugins-data-public.iessearchrequest.md) + +## IEsSearchRequest interface + +Signature: + +```typescript +export interface IEsSearchRequest extends IKibanaSearchRequest +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [params](./kibana-plugin-plugins-data-public.iessearchrequest.params.md) | SearchParams | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.params.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.params.md new file mode 100644 index 0000000000000..2ca8c83d3f1ef --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchrequest.params.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IEsSearchRequest](./kibana-plugin-plugins-data-public.iessearchrequest.md) > [params](./kibana-plugin-plugins-data-public.iessearchrequest.params.md) + +## IEsSearchRequest.params property + +Signature: + +```typescript +params: SearchParams; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.md new file mode 100644 index 0000000000000..a5027ef292ef8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IEsSearchResponse](./kibana-plugin-plugins-data-public.iessearchresponse.md) + +## IEsSearchResponse interface + +Signature: + +```typescript +export interface IEsSearchResponse extends IKibanaSearchResponse +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [rawResponse](./kibana-plugin-plugins-data-public.iessearchresponse.rawresponse.md) | SearchResponse<Hits> | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.rawresponse.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.rawresponse.md new file mode 100644 index 0000000000000..8f6563a1cea84 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iessearchresponse.rawresponse.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IEsSearchResponse](./kibana-plugin-plugins-data-public.iessearchresponse.md) > [rawResponse](./kibana-plugin-plugins-data-public.iessearchresponse.rawresponse.md) + +## IEsSearchResponse.rawResponse property + +Signature: + +```typescript +rawResponse: SearchResponse; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformat.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformat.md new file mode 100644 index 0000000000000..0937706d6b0e9 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformat.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldFormat](./kibana-plugin-plugins-data-public.ifieldformat.md) + +## IFieldFormat type + +Signature: + +```typescript +export declare type IFieldFormat = PublicMethodsOf; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformatsregistry.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformatsregistry.md new file mode 100644 index 0000000000000..0f83e2bb2d423 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldformatsregistry.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldFormatsRegistry](./kibana-plugin-plugins-data-public.ifieldformatsregistry.md) + +## IFieldFormatsRegistry type + +Signature: + +```typescript +declare type IFieldFormatsRegistry = PublicMethodsOf; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md new file mode 100644 index 0000000000000..7e6ea86d7f3e8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) + +## IFieldSubType interface + +Signature: + +```typescript +export interface IFieldSubType +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [multi](./kibana-plugin-plugins-data-public.ifieldsubtype.multi.md) | {
parent: string;
} | | +| [nested](./kibana-plugin-plugins-data-public.ifieldsubtype.nested.md) | {
path: string;
} | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.multi.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.multi.md new file mode 100644 index 0000000000000..6cfc6f037d013 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.multi.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) > [multi](./kibana-plugin-plugins-data-public.ifieldsubtype.multi.md) + +## IFieldSubType.multi property + +Signature: + +```typescript +multi?: { + parent: string; + }; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.nested.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.nested.md new file mode 100644 index 0000000000000..f9308b90a1b96 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldsubtype.nested.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) > [nested](./kibana-plugin-plugins-data-public.ifieldsubtype.nested.md) + +## IFieldSubType.nested property + +Signature: + +```typescript +nested?: { + path: string; + }; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.aggregatable.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.aggregatable.md new file mode 100644 index 0000000000000..ac657500dc30e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.aggregatable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [aggregatable](./kibana-plugin-plugins-data-public.ifieldtype.aggregatable.md) + +## IFieldType.aggregatable property + +Signature: + +```typescript +aggregatable?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.count.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.count.md new file mode 100644 index 0000000000000..58e66820d90e8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.count.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [count](./kibana-plugin-plugins-data-public.ifieldtype.count.md) + +## IFieldType.count property + +Signature: + +```typescript +count?: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.displayname.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.displayname.md new file mode 100644 index 0000000000000..3a367ff86bd4d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.displayname.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [displayName](./kibana-plugin-plugins-data-public.ifieldtype.displayname.md) + +## IFieldType.displayName property + +Signature: + +```typescript +displayName?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.estypes.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.estypes.md new file mode 100644 index 0000000000000..9500ef64687d3 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.estypes.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [esTypes](./kibana-plugin-plugins-data-public.ifieldtype.estypes.md) + +## IFieldType.esTypes property + +Signature: + +```typescript +esTypes?: string[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.filterable.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.filterable.md new file mode 100644 index 0000000000000..b02424a2f7bf7 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.filterable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [filterable](./kibana-plugin-plugins-data-public.ifieldtype.filterable.md) + +## IFieldType.filterable property + +Signature: + +```typescript +filterable?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.format.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.format.md new file mode 100644 index 0000000000000..d2de74398e416 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.format.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [format](./kibana-plugin-plugins-data-public.ifieldtype.format.md) + +## IFieldType.format property + +Signature: + +```typescript +format?: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.lang.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.lang.md new file mode 100644 index 0000000000000..a994fc458cfb6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.lang.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [lang](./kibana-plugin-plugins-data-public.ifieldtype.lang.md) + +## IFieldType.lang property + +Signature: + +```typescript +lang?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md new file mode 100644 index 0000000000000..be6af335f20cd --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.md @@ -0,0 +1,33 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) + +## IFieldType interface + +Signature: + +```typescript +export interface IFieldType +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [aggregatable](./kibana-plugin-plugins-data-public.ifieldtype.aggregatable.md) | boolean | | +| [count](./kibana-plugin-plugins-data-public.ifieldtype.count.md) | number | | +| [displayName](./kibana-plugin-plugins-data-public.ifieldtype.displayname.md) | string | | +| [esTypes](./kibana-plugin-plugins-data-public.ifieldtype.estypes.md) | string[] | | +| [filterable](./kibana-plugin-plugins-data-public.ifieldtype.filterable.md) | boolean | | +| [format](./kibana-plugin-plugins-data-public.ifieldtype.format.md) | any | | +| [lang](./kibana-plugin-plugins-data-public.ifieldtype.lang.md) | string | | +| [name](./kibana-plugin-plugins-data-public.ifieldtype.name.md) | string | | +| [readFromDocValues](./kibana-plugin-plugins-data-public.ifieldtype.readfromdocvalues.md) | boolean | | +| [script](./kibana-plugin-plugins-data-public.ifieldtype.script.md) | string | | +| [scripted](./kibana-plugin-plugins-data-public.ifieldtype.scripted.md) | boolean | | +| [searchable](./kibana-plugin-plugins-data-public.ifieldtype.searchable.md) | boolean | | +| [sortable](./kibana-plugin-plugins-data-public.ifieldtype.sortable.md) | boolean | | +| [subType](./kibana-plugin-plugins-data-public.ifieldtype.subtype.md) | IFieldSubType | | +| [type](./kibana-plugin-plugins-data-public.ifieldtype.type.md) | string | | +| [visualizable](./kibana-plugin-plugins-data-public.ifieldtype.visualizable.md) | boolean | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.name.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.name.md new file mode 100644 index 0000000000000..1c01484372fd3 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.name.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [name](./kibana-plugin-plugins-data-public.ifieldtype.name.md) + +## IFieldType.name property + +Signature: + +```typescript +name: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.readfromdocvalues.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.readfromdocvalues.md new file mode 100644 index 0000000000000..9f16b29edc9fe --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.readfromdocvalues.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [readFromDocValues](./kibana-plugin-plugins-data-public.ifieldtype.readfromdocvalues.md) + +## IFieldType.readFromDocValues property + +Signature: + +```typescript +readFromDocValues?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.script.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.script.md new file mode 100644 index 0000000000000..252c2c3822046 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.script.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [script](./kibana-plugin-plugins-data-public.ifieldtype.script.md) + +## IFieldType.script property + +Signature: + +```typescript +script?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.scripted.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.scripted.md new file mode 100644 index 0000000000000..33bbd0c2c20cb --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.scripted.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [scripted](./kibana-plugin-plugins-data-public.ifieldtype.scripted.md) + +## IFieldType.scripted property + +Signature: + +```typescript +scripted?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.searchable.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.searchable.md new file mode 100644 index 0000000000000..f977628f76698 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.searchable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [searchable](./kibana-plugin-plugins-data-public.ifieldtype.searchable.md) + +## IFieldType.searchable property + +Signature: + +```typescript +searchable?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.sortable.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.sortable.md new file mode 100644 index 0000000000000..0fd3943fb3c6e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.sortable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [sortable](./kibana-plugin-plugins-data-public.ifieldtype.sortable.md) + +## IFieldType.sortable property + +Signature: + +```typescript +sortable?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.subtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.subtype.md new file mode 100644 index 0000000000000..d0c26186da085 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.subtype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [subType](./kibana-plugin-plugins-data-public.ifieldtype.subtype.md) + +## IFieldType.subType property + +Signature: + +```typescript +subType?: IFieldSubType; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.type.md new file mode 100644 index 0000000000000..26228cbe4bfdb --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [type](./kibana-plugin-plugins-data-public.ifieldtype.type.md) + +## IFieldType.type property + +Signature: + +```typescript +type: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.visualizable.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.visualizable.md new file mode 100644 index 0000000000000..19a50bee9638d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ifieldtype.visualizable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) > [visualizable](./kibana-plugin-plugins-data-public.ifieldtype.visualizable.md) + +## IFieldType.visualizable property + +Signature: + +```typescript +visualizable?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fieldformatmap.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fieldformatmap.md new file mode 100644 index 0000000000000..2c131c6da9937 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fieldformatmap.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IIndexPattern](./kibana-plugin-plugins-data-public.iindexpattern.md) > [fieldFormatMap](./kibana-plugin-plugins-data-public.iindexpattern.fieldformatmap.md) + +## IIndexPattern.fieldFormatMap property + +Signature: + +```typescript +fieldFormatMap?: Record; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fields.md new file mode 100644 index 0000000000000..792bee44f96a8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.fields.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IIndexPattern](./kibana-plugin-plugins-data-public.iindexpattern.md) > [fields](./kibana-plugin-plugins-data-public.iindexpattern.fields.md) + +## IIndexPattern.fields property + +Signature: + +```typescript +fields: IFieldType[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.id.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.id.md new file mode 100644 index 0000000000000..917a80975df6c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.id.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IIndexPattern](./kibana-plugin-plugins-data-public.iindexpattern.md) > [id](./kibana-plugin-plugins-data-public.iindexpattern.id.md) + +## IIndexPattern.id property + +Signature: + +```typescript +id?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md new file mode 100644 index 0000000000000..1bbd6cf67f0ce --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IIndexPattern](./kibana-plugin-plugins-data-public.iindexpattern.md) + +## IIndexPattern interface + +Signature: + +```typescript +export interface IIndexPattern +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [fieldFormatMap](./kibana-plugin-plugins-data-public.iindexpattern.fieldformatmap.md) | Record<string, {
id: string;
params: unknown;
}> | | +| [fields](./kibana-plugin-plugins-data-public.iindexpattern.fields.md) | IFieldType[] | | +| [id](./kibana-plugin-plugins-data-public.iindexpattern.id.md) | string | | +| [timeFieldName](./kibana-plugin-plugins-data-public.iindexpattern.timefieldname.md) | string | | +| [title](./kibana-plugin-plugins-data-public.iindexpattern.title.md) | string | | +| [type](./kibana-plugin-plugins-data-public.iindexpattern.type.md) | string | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.timefieldname.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.timefieldname.md new file mode 100644 index 0000000000000..791e9e53ee3da --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.timefieldname.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IIndexPattern](./kibana-plugin-plugins-data-public.iindexpattern.md) > [timeFieldName](./kibana-plugin-plugins-data-public.iindexpattern.timefieldname.md) + +## IIndexPattern.timeFieldName property + +Signature: + +```typescript +timeFieldName?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.title.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.title.md new file mode 100644 index 0000000000000..c3a8644307b64 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.title.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IIndexPattern](./kibana-plugin-plugins-data-public.iindexpattern.md) > [title](./kibana-plugin-plugins-data-public.iindexpattern.title.md) + +## IIndexPattern.title property + +Signature: + +```typescript +title: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.type.md new file mode 100644 index 0000000000000..ea75c20b403c0 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iindexpattern.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IIndexPattern](./kibana-plugin-plugins-data-public.iindexpattern.md) > [type](./kibana-plugin-plugins-data-public.iindexpattern.type.md) + +## IIndexPattern.type property + +Signature: + +```typescript +type?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchrequest.debug.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchrequest.debug.md new file mode 100644 index 0000000000000..cfb21a78557fd --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchrequest.debug.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IKibanaSearchRequest](./kibana-plugin-plugins-data-public.ikibanasearchrequest.md) > [debug](./kibana-plugin-plugins-data-public.ikibanasearchrequest.debug.md) + +## IKibanaSearchRequest.debug property + +Optionally tell search strategies to output debug information. + +Signature: + +```typescript +debug?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchrequest.id.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchrequest.id.md new file mode 100644 index 0000000000000..61976abca3d6a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchrequest.id.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IKibanaSearchRequest](./kibana-plugin-plugins-data-public.ikibanasearchrequest.md) > [id](./kibana-plugin-plugins-data-public.ikibanasearchrequest.id.md) + +## IKibanaSearchRequest.id property + +An id can be used to uniquely identify this request. + +Signature: + +```typescript +id?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchrequest.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchrequest.md new file mode 100644 index 0000000000000..57e0fbe2c19a9 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchrequest.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IKibanaSearchRequest](./kibana-plugin-plugins-data-public.ikibanasearchrequest.md) + +## IKibanaSearchRequest interface + +Signature: + +```typescript +export interface IKibanaSearchRequest +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [debug](./kibana-plugin-plugins-data-public.ikibanasearchrequest.debug.md) | boolean | Optionally tell search strategies to output debug information. | +| [id](./kibana-plugin-plugins-data-public.ikibanasearchrequest.id.md) | string | An id can be used to uniquely identify this request. | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.id.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.id.md new file mode 100644 index 0000000000000..33dbf0d97b705 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.id.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IKibanaSearchResponse](./kibana-plugin-plugins-data-public.ikibanasearchresponse.md) > [id](./kibana-plugin-plugins-data-public.ikibanasearchresponse.id.md) + +## IKibanaSearchResponse.id property + +Some responses may contain a unique id to identify the request this response came from. + +Signature: + +```typescript +id?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.loaded.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.loaded.md new file mode 100644 index 0000000000000..efa86795ffca5 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.loaded.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IKibanaSearchResponse](./kibana-plugin-plugins-data-public.ikibanasearchresponse.md) > [loaded](./kibana-plugin-plugins-data-public.ikibanasearchresponse.loaded.md) + +## IKibanaSearchResponse.loaded property + +If relevant to the search strategy, return a loaded number that represents how progress is indicated. + +Signature: + +```typescript +loaded?: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.md new file mode 100644 index 0000000000000..f7dfd1ddd2f49 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IKibanaSearchResponse](./kibana-plugin-plugins-data-public.ikibanasearchresponse.md) + +## IKibanaSearchResponse interface + +Signature: + +```typescript +export interface IKibanaSearchResponse +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [id](./kibana-plugin-plugins-data-public.ikibanasearchresponse.id.md) | string | Some responses may contain a unique id to identify the request this response came from. | +| [loaded](./kibana-plugin-plugins-data-public.ikibanasearchresponse.loaded.md) | number | If relevant to the search strategy, return a loaded number that represents how progress is indicated. | +| [total](./kibana-plugin-plugins-data-public.ikibanasearchresponse.total.md) | number | If relevant to the search strategy, return a total number that represents how progress is indicated. | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.total.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.total.md new file mode 100644 index 0000000000000..cfa3567da86fc --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.ikibanasearchresponse.total.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IKibanaSearchResponse](./kibana-plugin-plugins-data-public.ikibanasearchresponse.md) > [total](./kibana-plugin-plugins-data-public.ikibanasearchresponse.total.md) + +## IKibanaSearchResponse.total property + +If relevant to the search strategy, return a total number that represents how progress is indicated. + +Signature: + +```typescript +total?: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern._constructor_.md new file mode 100644 index 0000000000000..4159247bb7c32 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern._constructor_.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [(constructor)](./kibana-plugin-plugins-data-public.indexpattern._constructor_.md) + +## IndexPattern.(constructor) + +Constructs a new instance of the `IndexPattern` class + +Signature: + +```typescript +constructor(id: string | undefined, getConfig: any, savedObjectsClient: SavedObjectsClientContract, apiClient: IIndexPatternsApiClient, patternCache: any); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| id | string | undefined | | +| getConfig | any | | +| savedObjectsClient | SavedObjectsClientContract | | +| apiClient | IIndexPatternsApiClient | | +| patternCache | any | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern._fetchfields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern._fetchfields.md new file mode 100644 index 0000000000000..8fff8baa71139 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern._fetchfields.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [\_fetchFields](./kibana-plugin-plugins-data-public.indexpattern._fetchfields.md) + +## IndexPattern.\_fetchFields() method + +Signature: + +```typescript +_fetchFields(): Promise; +``` +Returns: + +`Promise` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md new file mode 100644 index 0000000000000..4bbbd83c65e10 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md @@ -0,0 +1,25 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [addScriptedField](./kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md) + +## IndexPattern.addScriptedField() method + +Signature: + +```typescript +addScriptedField(name: string, script: string, fieldType: string | undefined, lang: string): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| name | string | | +| script | string | | +| fieldType | string | undefined | | +| lang | string | | + +Returns: + +`Promise` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.create.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.create.md new file mode 100644 index 0000000000000..5c122b835f59d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.create.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [create](./kibana-plugin-plugins-data-public.indexpattern.create.md) + +## IndexPattern.create() method + +Signature: + +```typescript +create(allowOverride?: boolean): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| allowOverride | boolean | | + +Returns: + +`Promise` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.destroy.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.destroy.md new file mode 100644 index 0000000000000..3a8e1b9dae5a6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.destroy.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [destroy](./kibana-plugin-plugins-data-public.indexpattern.destroy.md) + +## IndexPattern.destroy() method + +Signature: + +```typescript +destroy(): Promise<{}> | undefined; +``` +Returns: + +`Promise<{}> | undefined` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.fieldformatmap.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.fieldformatmap.md new file mode 100644 index 0000000000000..b89b244d9826c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.fieldformatmap.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [fieldFormatMap](./kibana-plugin-plugins-data-public.indexpattern.fieldformatmap.md) + +## IndexPattern.fieldFormatMap property + +Signature: + +```typescript +fieldFormatMap: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.fields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.fields.md new file mode 100644 index 0000000000000..fcd682340eb53 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.fields.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [fields](./kibana-plugin-plugins-data-public.indexpattern.fields.md) + +## IndexPattern.fields property + +Signature: + +```typescript +fields: IFieldList; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.fieldsfetcher.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.fieldsfetcher.md new file mode 100644 index 0000000000000..4d44b386a1db1 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.fieldsfetcher.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [fieldsFetcher](./kibana-plugin-plugins-data-public.indexpattern.fieldsfetcher.md) + +## IndexPattern.fieldsFetcher property + +Signature: + +```typescript +fieldsFetcher: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.flattenhit.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.flattenhit.md new file mode 100644 index 0000000000000..db28d95197bb3 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.flattenhit.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [flattenHit](./kibana-plugin-plugins-data-public.indexpattern.flattenhit.md) + +## IndexPattern.flattenHit property + +Signature: + +```typescript +flattenHit: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.formatfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.formatfield.md new file mode 100644 index 0000000000000..5a475d6161ac3 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.formatfield.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [formatField](./kibana-plugin-plugins-data-public.indexpattern.formatfield.md) + +## IndexPattern.formatField property + +Signature: + +```typescript +formatField: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.formathit.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.formathit.md new file mode 100644 index 0000000000000..ac515d374a93f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.formathit.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [formatHit](./kibana-plugin-plugins-data-public.indexpattern.formathit.md) + +## IndexPattern.formatHit property + +Signature: + +```typescript +formatHit: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md new file mode 100644 index 0000000000000..e42980bb53af4 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md @@ -0,0 +1,29 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [getAggregationRestrictions](./kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md) + +## IndexPattern.getAggregationRestrictions() method + +Signature: + +```typescript +getAggregationRestrictions(): Record> | undefined; +``` +Returns: + +`Record> | undefined` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getcomputedfields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getcomputedfields.md new file mode 100644 index 0000000000000..84aeb9ffeb21a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getcomputedfields.md @@ -0,0 +1,29 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [getComputedFields](./kibana-plugin-plugins-data-public.indexpattern.getcomputedfields.md) + +## IndexPattern.getComputedFields() method + +Signature: + +```typescript +getComputedFields(): { + storedFields: string[]; + scriptFields: any; + docvalueFields: { + field: any; + format: string; + }[]; + }; +``` +Returns: + +`{ + storedFields: string[]; + scriptFields: any; + docvalueFields: { + field: any; + format: string; + }[]; + }` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getfieldbyname.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getfieldbyname.md new file mode 100644 index 0000000000000..e6a23c5c70aab --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getfieldbyname.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [getFieldByName](./kibana-plugin-plugins-data-public.indexpattern.getfieldbyname.md) + +## IndexPattern.getFieldByName() method + +Signature: + +```typescript +getFieldByName(name: string): Field | void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| name | string | | + +Returns: + +`Field | void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getnonscriptedfields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getnonscriptedfields.md new file mode 100644 index 0000000000000..4e49304484815 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getnonscriptedfields.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [getNonScriptedFields](./kibana-plugin-plugins-data-public.indexpattern.getnonscriptedfields.md) + +## IndexPattern.getNonScriptedFields() method + +Signature: + +```typescript +getNonScriptedFields(): Field[]; +``` +Returns: + +`Field[]` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getscriptedfields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getscriptedfields.md new file mode 100644 index 0000000000000..9ab4f9a9aaed5 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getscriptedfields.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [getScriptedFields](./kibana-plugin-plugins-data-public.indexpattern.getscriptedfields.md) + +## IndexPattern.getScriptedFields() method + +Signature: + +```typescript +getScriptedFields(): Field[]; +``` +Returns: + +`Field[]` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getsourcefiltering.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getsourcefiltering.md new file mode 100644 index 0000000000000..121d32c7c40c8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.getsourcefiltering.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [getSourceFiltering](./kibana-plugin-plugins-data-public.indexpattern.getsourcefiltering.md) + +## IndexPattern.getSourceFiltering() method + +Signature: + +```typescript +getSourceFiltering(): { + excludes: any[]; + }; +``` +Returns: + +`{ + excludes: any[]; + }` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.gettimefield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.gettimefield.md new file mode 100644 index 0000000000000..8e68e8c35aff7 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.gettimefield.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [getTimeField](./kibana-plugin-plugins-data-public.indexpattern.gettimefield.md) + +## IndexPattern.getTimeField() method + +Signature: + +```typescript +getTimeField(): Field | undefined; +``` +Returns: + +`Field | undefined` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.id.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.id.md new file mode 100644 index 0000000000000..85e680170d6ea --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.id.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [id](./kibana-plugin-plugins-data-public.indexpattern.id.md) + +## IndexPattern.id property + +Signature: + +```typescript +id?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.init.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.init.md new file mode 100644 index 0000000000000..ce401bec87dbb --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.init.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [init](./kibana-plugin-plugins-data-public.indexpattern.init.md) + +## IndexPattern.init() method + +Signature: + +```typescript +init(forceFieldRefresh?: boolean): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| forceFieldRefresh | boolean | | + +Returns: + +`Promise` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.istimebased.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.istimebased.md new file mode 100644 index 0000000000000..aca243496d083 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.istimebased.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [isTimeBased](./kibana-plugin-plugins-data-public.indexpattern.istimebased.md) + +## IndexPattern.isTimeBased() method + +Signature: + +```typescript +isTimeBased(): boolean; +``` +Returns: + +`boolean` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.istimebasedwildcard.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.istimebasedwildcard.md new file mode 100644 index 0000000000000..27f99f418a078 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.istimebasedwildcard.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [isTimeBasedWildcard](./kibana-plugin-plugins-data-public.indexpattern.istimebasedwildcard.md) + +## IndexPattern.isTimeBasedWildcard() method + +Signature: + +```typescript +isTimeBasedWildcard(): boolean; +``` +Returns: + +`boolean` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.istimenanosbased.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.istimenanosbased.md new file mode 100644 index 0000000000000..3a3767ae64149 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.istimenanosbased.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [isTimeNanosBased](./kibana-plugin-plugins-data-public.indexpattern.istimenanosbased.md) + +## IndexPattern.isTimeNanosBased() method + +Signature: + +```typescript +isTimeNanosBased(): boolean; +``` +Returns: + +`boolean` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.iswildcard.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.iswildcard.md new file mode 100644 index 0000000000000..e5ea55ef1dd48 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.iswildcard.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [isWildcard](./kibana-plugin-plugins-data-public.indexpattern.iswildcard.md) + +## IndexPattern.isWildcard() method + +Signature: + +```typescript +isWildcard(): boolean; +``` +Returns: + +`boolean` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md new file mode 100644 index 0000000000000..35075e19dcaf6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md @@ -0,0 +1,64 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) + +## IndexPattern class + +Signature: + +```typescript +export declare class IndexPattern implements IIndexPattern +``` + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)(id, getConfig, savedObjectsClient, apiClient, patternCache)](./kibana-plugin-plugins-data-public.indexpattern._constructor_.md) | | Constructs a new instance of the IndexPattern class | + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [fieldFormatMap](./kibana-plugin-plugins-data-public.indexpattern.fieldformatmap.md) | | any | | +| [fields](./kibana-plugin-plugins-data-public.indexpattern.fields.md) | | IFieldList | | +| [fieldsFetcher](./kibana-plugin-plugins-data-public.indexpattern.fieldsfetcher.md) | | any | | +| [flattenHit](./kibana-plugin-plugins-data-public.indexpattern.flattenhit.md) | | any | | +| [formatField](./kibana-plugin-plugins-data-public.indexpattern.formatfield.md) | | any | | +| [formatHit](./kibana-plugin-plugins-data-public.indexpattern.formathit.md) | | any | | +| [id](./kibana-plugin-plugins-data-public.indexpattern.id.md) | | string | | +| [metaFields](./kibana-plugin-plugins-data-public.indexpattern.metafields.md) | | string[] | | +| [routes](./kibana-plugin-plugins-data-public.indexpattern.routes.md) | | {
edit: string;
addField: string;
indexedFields: string;
scriptedFields: string;
sourceFilters: string;
} | | +| [timeFieldName](./kibana-plugin-plugins-data-public.indexpattern.timefieldname.md) | | string | undefined | | +| [title](./kibana-plugin-plugins-data-public.indexpattern.title.md) | | string | | +| [type](./kibana-plugin-plugins-data-public.indexpattern.type.md) | | string | | +| [typeMeta](./kibana-plugin-plugins-data-public.indexpattern.typemeta.md) | | TypeMeta | | + +## Methods + +| Method | Modifiers | Description | +| --- | --- | --- | +| [\_fetchFields()](./kibana-plugin-plugins-data-public.indexpattern._fetchfields.md) | | | +| [addScriptedField(name, script, fieldType, lang)](./kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md) | | | +| [create(allowOverride)](./kibana-plugin-plugins-data-public.indexpattern.create.md) | | | +| [destroy()](./kibana-plugin-plugins-data-public.indexpattern.destroy.md) | | | +| [getAggregationRestrictions()](./kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md) | | | +| [getComputedFields()](./kibana-plugin-plugins-data-public.indexpattern.getcomputedfields.md) | | | +| [getFieldByName(name)](./kibana-plugin-plugins-data-public.indexpattern.getfieldbyname.md) | | | +| [getNonScriptedFields()](./kibana-plugin-plugins-data-public.indexpattern.getnonscriptedfields.md) | | | +| [getScriptedFields()](./kibana-plugin-plugins-data-public.indexpattern.getscriptedfields.md) | | | +| [getSourceFiltering()](./kibana-plugin-plugins-data-public.indexpattern.getsourcefiltering.md) | | | +| [getTimeField()](./kibana-plugin-plugins-data-public.indexpattern.gettimefield.md) | | | +| [init(forceFieldRefresh)](./kibana-plugin-plugins-data-public.indexpattern.init.md) | | | +| [isTimeBased()](./kibana-plugin-plugins-data-public.indexpattern.istimebased.md) | | | +| [isTimeBasedWildcard()](./kibana-plugin-plugins-data-public.indexpattern.istimebasedwildcard.md) | | | +| [isTimeNanosBased()](./kibana-plugin-plugins-data-public.indexpattern.istimenanosbased.md) | | | +| [isWildcard()](./kibana-plugin-plugins-data-public.indexpattern.iswildcard.md) | | | +| [popularizeField(fieldName, unit)](./kibana-plugin-plugins-data-public.indexpattern.popularizefield.md) | | | +| [prepBody()](./kibana-plugin-plugins-data-public.indexpattern.prepbody.md) | | | +| [refreshFields()](./kibana-plugin-plugins-data-public.indexpattern.refreshfields.md) | | | +| [removeScriptedField(field)](./kibana-plugin-plugins-data-public.indexpattern.removescriptedfield.md) | | | +| [save(saveAttempts)](./kibana-plugin-plugins-data-public.indexpattern.save.md) | | | +| [toJSON()](./kibana-plugin-plugins-data-public.indexpattern.tojson.md) | | | +| [toString()](./kibana-plugin-plugins-data-public.indexpattern.tostring.md) | | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.metafields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.metafields.md new file mode 100644 index 0000000000000..9f56bad35383c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.metafields.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [metaFields](./kibana-plugin-plugins-data-public.indexpattern.metafields.md) + +## IndexPattern.metaFields property + +Signature: + +```typescript +metaFields: string[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.popularizefield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.popularizefield.md new file mode 100644 index 0000000000000..eba5382158520 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.popularizefield.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [popularizeField](./kibana-plugin-plugins-data-public.indexpattern.popularizefield.md) + +## IndexPattern.popularizeField() method + +Signature: + +```typescript +popularizeField(fieldName: string, unit?: number): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| fieldName | string | | +| unit | number | | + +Returns: + +`Promise` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.prepbody.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.prepbody.md new file mode 100644 index 0000000000000..5c9f017b571da --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.prepbody.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [prepBody](./kibana-plugin-plugins-data-public.indexpattern.prepbody.md) + +## IndexPattern.prepBody() method + +Signature: + +```typescript +prepBody(): { + [key: string]: any; + }; +``` +Returns: + +`{ + [key: string]: any; + }` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.refreshfields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.refreshfields.md new file mode 100644 index 0000000000000..271d0c45a4244 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.refreshfields.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [refreshFields](./kibana-plugin-plugins-data-public.indexpattern.refreshfields.md) + +## IndexPattern.refreshFields() method + +Signature: + +```typescript +refreshFields(): Promise; +``` +Returns: + +`Promise` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.removescriptedfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.removescriptedfield.md new file mode 100644 index 0000000000000..2a6811f501152 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.removescriptedfield.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [removeScriptedField](./kibana-plugin-plugins-data-public.indexpattern.removescriptedfield.md) + +## IndexPattern.removeScriptedField() method + +Signature: + +```typescript +removeScriptedField(field: IFieldType): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| field | IFieldType | | + +Returns: + +`Promise` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.routes.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.routes.md new file mode 100644 index 0000000000000..81e7abd4f9609 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.routes.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [routes](./kibana-plugin-plugins-data-public.indexpattern.routes.md) + +## IndexPattern.routes property + +Signature: + +```typescript +get routes(): { + edit: string; + addField: string; + indexedFields: string; + scriptedFields: string; + sourceFilters: string; + }; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.save.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.save.md new file mode 100644 index 0000000000000..d0b471cc2bc21 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.save.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [save](./kibana-plugin-plugins-data-public.indexpattern.save.md) + +## IndexPattern.save() method + +Signature: + +```typescript +save(saveAttempts?: number): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| saveAttempts | number | | + +Returns: + +`Promise` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.timefieldname.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.timefieldname.md new file mode 100644 index 0000000000000..dc1cab592baac --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.timefieldname.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [timeFieldName](./kibana-plugin-plugins-data-public.indexpattern.timefieldname.md) + +## IndexPattern.timeFieldName property + +Signature: + +```typescript +timeFieldName: string | undefined; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.title.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.title.md new file mode 100644 index 0000000000000..aca6028bee96a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.title.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [title](./kibana-plugin-plugins-data-public.indexpattern.title.md) + +## IndexPattern.title property + +Signature: + +```typescript +title: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.tojson.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.tojson.md new file mode 100644 index 0000000000000..0ae04bb424d44 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.tojson.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [toJSON](./kibana-plugin-plugins-data-public.indexpattern.tojson.md) + +## IndexPattern.toJSON() method + +Signature: + +```typescript +toJSON(): string | undefined; +``` +Returns: + +`string | undefined` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.tostring.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.tostring.md new file mode 100644 index 0000000000000..a10b549a7b9eb --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.tostring.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [toString](./kibana-plugin-plugins-data-public.indexpattern.tostring.md) + +## IndexPattern.toString() method + +Signature: + +```typescript +toString(): string; +``` +Returns: + +`string` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.type.md new file mode 100644 index 0000000000000..58047d9e27ac6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [type](./kibana-plugin-plugins-data-public.indexpattern.type.md) + +## IndexPattern.type property + +Signature: + +```typescript +type?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.typemeta.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.typemeta.md new file mode 100644 index 0000000000000..ea8533a8d837c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.typemeta.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [typeMeta](./kibana-plugin-plugins-data-public.indexpattern.typemeta.md) + +## IndexPattern.typeMeta property + +Signature: + +```typescript +typeMeta?: TypeMeta; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md new file mode 100644 index 0000000000000..324bd1e410c6c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternAggRestrictions](./kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md) + +## IndexPatternAggRestrictions type + +Signature: + +```typescript +export declare type AggregationRestrictions = Record; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.fields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.fields.md new file mode 100644 index 0000000000000..a72184bf0111d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.fields.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-public.indexpatternattributes.md) > [fields](./kibana-plugin-plugins-data-public.indexpatternattributes.fields.md) + +## IndexPatternAttributes.fields property + +Signature: + +```typescript +fields: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.md new file mode 100644 index 0000000000000..39ae328c14501 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.md @@ -0,0 +1,28 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-public.indexpatternattributes.md) + +## IndexPatternAttributes interface + +> Warning: This API is now obsolete. +> +> + +Use data plugin interface instead + +Signature: + +```typescript +export interface IndexPatternAttributes +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [fields](./kibana-plugin-plugins-data-public.indexpatternattributes.fields.md) | string | | +| [timeFieldName](./kibana-plugin-plugins-data-public.indexpatternattributes.timefieldname.md) | string | | +| [title](./kibana-plugin-plugins-data-public.indexpatternattributes.title.md) | string | | +| [type](./kibana-plugin-plugins-data-public.indexpatternattributes.type.md) | string | | +| [typeMeta](./kibana-plugin-plugins-data-public.indexpatternattributes.typemeta.md) | string | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.timefieldname.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.timefieldname.md new file mode 100644 index 0000000000000..22c241c58f202 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.timefieldname.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-public.indexpatternattributes.md) > [timeFieldName](./kibana-plugin-plugins-data-public.indexpatternattributes.timefieldname.md) + +## IndexPatternAttributes.timeFieldName property + +Signature: + +```typescript +timeFieldName?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.title.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.title.md new file mode 100644 index 0000000000000..bfdb775c19e9b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.title.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-public.indexpatternattributes.md) > [title](./kibana-plugin-plugins-data-public.indexpatternattributes.title.md) + +## IndexPatternAttributes.title property + +Signature: + +```typescript +title: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.type.md new file mode 100644 index 0000000000000..d980d3af41912 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-public.indexpatternattributes.md) > [type](./kibana-plugin-plugins-data-public.indexpatternattributes.type.md) + +## IndexPatternAttributes.type property + +Signature: + +```typescript +type: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.typemeta.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.typemeta.md new file mode 100644 index 0000000000000..130e4928640f5 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternattributes.typemeta.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-public.indexpatternattributes.md) > [typeMeta](./kibana-plugin-plugins-data-public.indexpatternattributes.typemeta.md) + +## IndexPatternAttributes.typeMeta property + +Signature: + +```typescript +typeMeta: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.__spec.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.__spec.md new file mode 100644 index 0000000000000..f52a3324af36f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.__spec.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [$$spec](./kibana-plugin-plugins-data-public.indexpatternfield.__spec.md) + +## IndexPatternField.$$spec property + +Signature: + +```typescript +$$spec: FieldSpec; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md new file mode 100644 index 0000000000000..cf7470c035a53 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [(constructor)](./kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md) + +## IndexPatternField.(constructor) + +Constructs a new instance of the `Field` class + +Signature: + +```typescript +constructor(indexPattern: IndexPattern, spec: FieldSpec | Field, shortDotsEnable?: boolean); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| indexPattern | IndexPattern | | +| spec | FieldSpec | Field | | +| shortDotsEnable | boolean | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.aggregatable.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.aggregatable.md new file mode 100644 index 0000000000000..267c8f786b5dd --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.aggregatable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [aggregatable](./kibana-plugin-plugins-data-public.indexpatternfield.aggregatable.md) + +## IndexPatternField.aggregatable property + +Signature: + +```typescript +aggregatable?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.count.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.count.md new file mode 100644 index 0000000000000..8e848276f21c4 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.count.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [count](./kibana-plugin-plugins-data-public.indexpatternfield.count.md) + +## IndexPatternField.count property + +Signature: + +```typescript +count?: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.displayname.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.displayname.md new file mode 100644 index 0000000000000..ed9630f92fc97 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.displayname.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [displayName](./kibana-plugin-plugins-data-public.indexpatternfield.displayname.md) + +## IndexPatternField.displayName property + +Signature: + +```typescript +displayName?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.estypes.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.estypes.md new file mode 100644 index 0000000000000..dec74df099d43 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.estypes.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [esTypes](./kibana-plugin-plugins-data-public.indexpatternfield.estypes.md) + +## IndexPatternField.esTypes property + +Signature: + +```typescript +esTypes?: string[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.filterable.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.filterable.md new file mode 100644 index 0000000000000..4290c4a2f86b3 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.filterable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [filterable](./kibana-plugin-plugins-data-public.indexpatternfield.filterable.md) + +## IndexPatternField.filterable property + +Signature: + +```typescript +filterable?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.format.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.format.md new file mode 100644 index 0000000000000..d5df8ed628cb0 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.format.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [format](./kibana-plugin-plugins-data-public.indexpatternfield.format.md) + +## IndexPatternField.format property + +Signature: + +```typescript +format: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.lang.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.lang.md new file mode 100644 index 0000000000000..f731be8f613cf --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.lang.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [lang](./kibana-plugin-plugins-data-public.indexpatternfield.lang.md) + +## IndexPatternField.lang property + +Signature: + +```typescript +lang?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md new file mode 100644 index 0000000000000..430590c7a2505 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md @@ -0,0 +1,40 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) + +## IndexPatternField class + +Signature: + +```typescript +export declare class Field implements IFieldType +``` + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)(indexPattern, spec, shortDotsEnable)](./kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md) | | Constructs a new instance of the Field class | + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [$$spec](./kibana-plugin-plugins-data-public.indexpatternfield.__spec.md) | | FieldSpec | | +| [aggregatable](./kibana-plugin-plugins-data-public.indexpatternfield.aggregatable.md) | | boolean | | +| [count](./kibana-plugin-plugins-data-public.indexpatternfield.count.md) | | number | | +| [displayName](./kibana-plugin-plugins-data-public.indexpatternfield.displayname.md) | | string | | +| [esTypes](./kibana-plugin-plugins-data-public.indexpatternfield.estypes.md) | | string[] | | +| [filterable](./kibana-plugin-plugins-data-public.indexpatternfield.filterable.md) | | boolean | | +| [format](./kibana-plugin-plugins-data-public.indexpatternfield.format.md) | | any | | +| [lang](./kibana-plugin-plugins-data-public.indexpatternfield.lang.md) | | string | | +| [name](./kibana-plugin-plugins-data-public.indexpatternfield.name.md) | | string | | +| [routes](./kibana-plugin-plugins-data-public.indexpatternfield.routes.md) | | Record<string, string> | | +| [script](./kibana-plugin-plugins-data-public.indexpatternfield.script.md) | | string | | +| [scripted](./kibana-plugin-plugins-data-public.indexpatternfield.scripted.md) | | boolean | | +| [searchable](./kibana-plugin-plugins-data-public.indexpatternfield.searchable.md) | | boolean | | +| [sortable](./kibana-plugin-plugins-data-public.indexpatternfield.sortable.md) | | boolean | | +| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | IFieldSubType | | +| [type](./kibana-plugin-plugins-data-public.indexpatternfield.type.md) | | string | | +| [visualizable](./kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md) | | boolean | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.name.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.name.md new file mode 100644 index 0000000000000..cb24621e73209 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.name.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [name](./kibana-plugin-plugins-data-public.indexpatternfield.name.md) + +## IndexPatternField.name property + +Signature: + +```typescript +name: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.routes.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.routes.md new file mode 100644 index 0000000000000..664a7b7b7ca0e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.routes.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [routes](./kibana-plugin-plugins-data-public.indexpatternfield.routes.md) + +## IndexPatternField.routes property + +Signature: + +```typescript +routes: Record; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.script.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.script.md new file mode 100644 index 0000000000000..132ba25a47637 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.script.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [script](./kibana-plugin-plugins-data-public.indexpatternfield.script.md) + +## IndexPatternField.script property + +Signature: + +```typescript +script?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.scripted.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.scripted.md new file mode 100644 index 0000000000000..1dd6bc865a75d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.scripted.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [scripted](./kibana-plugin-plugins-data-public.indexpatternfield.scripted.md) + +## IndexPatternField.scripted property + +Signature: + +```typescript +scripted?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.searchable.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.searchable.md new file mode 100644 index 0000000000000..42f984d851435 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.searchable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [searchable](./kibana-plugin-plugins-data-public.indexpatternfield.searchable.md) + +## IndexPatternField.searchable property + +Signature: + +```typescript +searchable?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.sortable.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.sortable.md new file mode 100644 index 0000000000000..72d225185140b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.sortable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [sortable](./kibana-plugin-plugins-data-public.indexpatternfield.sortable.md) + +## IndexPatternField.sortable property + +Signature: + +```typescript +sortable?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md new file mode 100644 index 0000000000000..2d807f8a5739c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.subtype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) + +## IndexPatternField.subType property + +Signature: + +```typescript +subType?: IFieldSubType; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.type.md new file mode 100644 index 0000000000000..c8483c9b83c9a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [type](./kibana-plugin-plugins-data-public.indexpatternfield.type.md) + +## IndexPatternField.type property + +Signature: + +```typescript +type: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md new file mode 100644 index 0000000000000..dd661ae779c11 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [visualizable](./kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md) + +## IndexPatternField.visualizable property + +Signature: + +```typescript +visualizable?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist._constructor_.md new file mode 100644 index 0000000000000..2207107db8b2b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist._constructor_.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternFieldList](./kibana-plugin-plugins-data-public.indexpatternfieldlist.md) > [(constructor)](./kibana-plugin-plugins-data-public.indexpatternfieldlist._constructor_.md) + +## IndexPatternFieldList.(constructor) + +Constructs a new instance of the `FieldList` class + +Signature: + +```typescript +constructor(indexPattern: IndexPattern, specs?: FieldSpec[], shortDotsEnable?: boolean); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| indexPattern | IndexPattern | | +| specs | FieldSpec[] | | +| shortDotsEnable | boolean | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.add.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.add.md new file mode 100644 index 0000000000000..dce2f38bbcf10 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.add.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternFieldList](./kibana-plugin-plugins-data-public.indexpatternfieldlist.md) > [add](./kibana-plugin-plugins-data-public.indexpatternfieldlist.add.md) + +## IndexPatternFieldList.add property + +Signature: + +```typescript +add: (field: Record) => void; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.getbyname.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.getbyname.md new file mode 100644 index 0000000000000..bf6bc51b60301 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.getbyname.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternFieldList](./kibana-plugin-plugins-data-public.indexpatternfieldlist.md) > [getByName](./kibana-plugin-plugins-data-public.indexpatternfieldlist.getbyname.md) + +## IndexPatternFieldList.getByName property + +Signature: + +```typescript +getByName: (name: string) => Field | undefined; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.getbytype.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.getbytype.md new file mode 100644 index 0000000000000..86c5ae32940d4 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.getbytype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternFieldList](./kibana-plugin-plugins-data-public.indexpatternfieldlist.md) > [getByType](./kibana-plugin-plugins-data-public.indexpatternfieldlist.getbytype.md) + +## IndexPatternFieldList.getByType property + +Signature: + +```typescript +getByType: (type: string) => any[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.md new file mode 100644 index 0000000000000..4b7184b7dc151 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.md @@ -0,0 +1,28 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternFieldList](./kibana-plugin-plugins-data-public.indexpatternfieldlist.md) + +## IndexPatternFieldList class + +Signature: + +```typescript +export declare class FieldList extends Array implements IFieldList +``` + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)(indexPattern, specs, shortDotsEnable)](./kibana-plugin-plugins-data-public.indexpatternfieldlist._constructor_.md) | | Constructs a new instance of the FieldList class | + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [add](./kibana-plugin-plugins-data-public.indexpatternfieldlist.add.md) | | (field: Record<string, any>) => void | | +| [getByName](./kibana-plugin-plugins-data-public.indexpatternfieldlist.getbyname.md) | | (name: string) => Field | undefined | | +| [getByType](./kibana-plugin-plugins-data-public.indexpatternfieldlist.getbytype.md) | | (type: string) => any[] | | +| [remove](./kibana-plugin-plugins-data-public.indexpatternfieldlist.remove.md) | | (field: IFieldType) => void | | +| [update](./kibana-plugin-plugins-data-public.indexpatternfieldlist.update.md) | | (field: Field) => void | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.remove.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.remove.md new file mode 100644 index 0000000000000..1f2e0883d272e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.remove.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternFieldList](./kibana-plugin-plugins-data-public.indexpatternfieldlist.md) > [remove](./kibana-plugin-plugins-data-public.indexpatternfieldlist.remove.md) + +## IndexPatternFieldList.remove property + +Signature: + +```typescript +remove: (field: IFieldType) => void; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.update.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.update.md new file mode 100644 index 0000000000000..ca03ec4b72893 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.update.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternFieldList](./kibana-plugin-plugins-data-public.indexpatternfieldlist.md) > [update](./kibana-plugin-plugins-data-public.indexpatternfieldlist.update.md) + +## IndexPatternFieldList.update property + +Signature: + +```typescript +update: (field: Field) => void; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterns.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterns.md new file mode 100644 index 0000000000000..fa97666a61b93 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterns.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [indexPatterns](./kibana-plugin-plugins-data-public.indexpatterns.md) + +## indexPatterns variable + +Signature: + +```typescript +indexPatterns: { + ILLEGAL_CHARACTERS_KEY: string; + CONTAINS_SPACES_KEY: string; + ILLEGAL_CHARACTERS_VISIBLE: string[]; + ILLEGAL_CHARACTERS: string[]; + isDefault: (indexPattern: import("../common").IIndexPattern) => boolean; + isFilterable: typeof isFilterable; + isNestedField: typeof isNestedField; + validate: typeof validateIndexPattern; + getFromSavedObject: typeof getFromSavedObject; + flattenHitWrapper: typeof flattenHitWrapper; + getRoutes: typeof getRoutes; + formatHitProvider: typeof formatHitProvider; +} +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternscontract.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternscontract.md new file mode 100644 index 0000000000000..f83ed272c089c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternscontract.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternsContract](./kibana-plugin-plugins-data-public.indexpatternscontract.md) + +## IndexPatternsContract type + +Signature: + +```typescript +export declare type IndexPatternsContract = PublicMethodsOf; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect._constructor_.md new file mode 100644 index 0000000000000..4c08e8c862613 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect._constructor_.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) > [(constructor)](./kibana-plugin-plugins-data-public.indexpatternselect._constructor_.md) + +## IndexPatternSelect.(constructor) + +Constructs a new instance of the `IndexPatternSelect` class + +Signature: + +```typescript +constructor(props: IndexPatternSelectProps); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| props | IndexPatternSelectProps | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.componentdidmount.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.componentdidmount.md new file mode 100644 index 0000000000000..cf70c2add8742 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.componentdidmount.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) > [componentDidMount](./kibana-plugin-plugins-data-public.indexpatternselect.componentdidmount.md) + +## IndexPatternSelect.componentDidMount() method + +Signature: + +```typescript +componentDidMount(): void; +``` +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.componentwillunmount.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.componentwillunmount.md new file mode 100644 index 0000000000000..5f11208ecc317 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.componentwillunmount.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) > [componentWillUnmount](./kibana-plugin-plugins-data-public.indexpatternselect.componentwillunmount.md) + +## IndexPatternSelect.componentWillUnmount() method + +Signature: + +```typescript +componentWillUnmount(): void; +``` +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.debouncedfetch.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.debouncedfetch.md new file mode 100644 index 0000000000000..5238e2f1913e4 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.debouncedfetch.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) > [debouncedFetch](./kibana-plugin-plugins-data-public.indexpatternselect.debouncedfetch.md) + +## IndexPatternSelect.debouncedFetch property + +Signature: + +```typescript +debouncedFetch: ((searchValue: string) => Promise) & _.Cancelable; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.fetchoptions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.fetchoptions.md new file mode 100644 index 0000000000000..f5e388a86f4ae --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.fetchoptions.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) > [fetchOptions](./kibana-plugin-plugins-data-public.indexpatternselect.fetchoptions.md) + +## IndexPatternSelect.fetchOptions property + +Signature: + +```typescript +fetchOptions: (searchValue?: string) => void; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.fetchselectedindexpattern.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.fetchselectedindexpattern.md new file mode 100644 index 0000000000000..d5981c19b99af --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.fetchselectedindexpattern.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) > [fetchSelectedIndexPattern](./kibana-plugin-plugins-data-public.indexpatternselect.fetchselectedindexpattern.md) + +## IndexPatternSelect.fetchSelectedIndexPattern property + +Signature: + +```typescript +fetchSelectedIndexPattern: (indexPatternId: string) => Promise; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.md new file mode 100644 index 0000000000000..4f4feeb4caa8d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.md @@ -0,0 +1,37 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) + +## IndexPatternSelect class + +Signature: + +```typescript +export declare class IndexPatternSelect extends Component +``` + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)(props)](./kibana-plugin-plugins-data-public.indexpatternselect._constructor_.md) | | Constructs a new instance of the IndexPatternSelect class | + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [debouncedFetch](./kibana-plugin-plugins-data-public.indexpatternselect.debouncedfetch.md) | | ((searchValue: string) => Promise<void>) & _.Cancelable | | +| [fetchOptions](./kibana-plugin-plugins-data-public.indexpatternselect.fetchoptions.md) | | (searchValue?: string) => void | | +| [fetchSelectedIndexPattern](./kibana-plugin-plugins-data-public.indexpatternselect.fetchselectedindexpattern.md) | | (indexPatternId: string) => Promise<void> | | +| [onChange](./kibana-plugin-plugins-data-public.indexpatternselect.onchange.md) | | (selectedOptions: any) => void | | +| [state](./kibana-plugin-plugins-data-public.indexpatternselect.state.md) | | IndexPatternSelectState | | + +## Methods + +| Method | Modifiers | Description | +| --- | --- | --- | +| [componentDidMount()](./kibana-plugin-plugins-data-public.indexpatternselect.componentdidmount.md) | | | +| [componentWillUnmount()](./kibana-plugin-plugins-data-public.indexpatternselect.componentwillunmount.md) | | | +| [render()](./kibana-plugin-plugins-data-public.indexpatternselect.render.md) | | | +| [UNSAFE\_componentWillReceiveProps(nextProps)](./kibana-plugin-plugins-data-public.indexpatternselect.unsafe_componentwillreceiveprops.md) | | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.onchange.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.onchange.md new file mode 100644 index 0000000000000..c0c2a2e6802e9 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.onchange.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) > [onChange](./kibana-plugin-plugins-data-public.indexpatternselect.onchange.md) + +## IndexPatternSelect.onChange property + +Signature: + +```typescript +onChange: (selectedOptions: any) => void; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.render.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.render.md new file mode 100644 index 0000000000000..1cb495e7f8795 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.render.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) > [render](./kibana-plugin-plugins-data-public.indexpatternselect.render.md) + +## IndexPatternSelect.render() method + +Signature: + +```typescript +render(): JSX.Element; +``` +Returns: + +`JSX.Element` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.state.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.state.md new file mode 100644 index 0000000000000..58fbcfe090235 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.state.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) > [state](./kibana-plugin-plugins-data-public.indexpatternselect.state.md) + +## IndexPatternSelect.state property + +Signature: + +```typescript +state: IndexPatternSelectState; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.unsafe_componentwillreceiveprops.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.unsafe_componentwillreceiveprops.md new file mode 100644 index 0000000000000..de9d6a69e216e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselect.unsafe_componentwillreceiveprops.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) > [UNSAFE\_componentWillReceiveProps](./kibana-plugin-plugins-data-public.indexpatternselect.unsafe_componentwillreceiveprops.md) + +## IndexPatternSelect.UNSAFE\_componentWillReceiveProps() method + +Signature: + +```typescript +UNSAFE_componentWillReceiveProps(nextProps: IndexPatternSelectProps): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| nextProps | IndexPatternSelectProps | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.aggs.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.aggs.md new file mode 100644 index 0000000000000..46cb435fb19bc --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.aggs.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternTypeMeta](./kibana-plugin-plugins-data-public.indexpatterntypemeta.md) > [aggs](./kibana-plugin-plugins-data-public.indexpatterntypemeta.aggs.md) + +## IndexPatternTypeMeta.aggs property + +Signature: + +```typescript +aggs?: Record; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.md new file mode 100644 index 0000000000000..e6690b244c9ea --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatterntypemeta.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternTypeMeta](./kibana-plugin-plugins-data-public.indexpatterntypemeta.md) + +## IndexPatternTypeMeta interface + +Signature: + +```typescript +export interface TypeMeta +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [aggs](./kibana-plugin-plugins-data-public.indexpatterntypemeta.aggs.md) | Record<string, AggregationRestrictions> | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.inputtimerange.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.inputtimerange.md new file mode 100644 index 0000000000000..649355a5fffb5 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.inputtimerange.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [InputTimeRange](./kibana-plugin-plugins-data-public.inputtimerange.md) + +## InputTimeRange type + +Signature: + +```typescript +export declare type InputTimeRange = TimeRange | { + from: Moment; + to: Moment; +}; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.irequesttypesmap.es.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.irequesttypesmap.es.md new file mode 100644 index 0000000000000..0b31968f06425 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.irequesttypesmap.es.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IRequestTypesMap](./kibana-plugin-plugins-data-public.irequesttypesmap.md) > [es](./kibana-plugin-plugins-data-public.irequesttypesmap.es.md) + +## IRequestTypesMap.es property + +Signature: + +```typescript +[ES_SEARCH_STRATEGY]: IEsSearchRequest; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.irequesttypesmap.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.irequesttypesmap.md new file mode 100644 index 0000000000000..4ca5e9eab665a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.irequesttypesmap.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IRequestTypesMap](./kibana-plugin-plugins-data-public.irequesttypesmap.md) + +## IRequestTypesMap interface + +Signature: + +```typescript +export interface IRequestTypesMap +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [es](./kibana-plugin-plugins-data-public.irequesttypesmap.es.md) | IEsSearchRequest | | +| [SYNC\_SEARCH\_STRATEGY](./kibana-plugin-plugins-data-public.irequesttypesmap.sync_search_strategy.md) | ISyncSearchRequest | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.irequesttypesmap.sync_search_strategy.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.irequesttypesmap.sync_search_strategy.md new file mode 100644 index 0000000000000..28b87111a75ad --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.irequesttypesmap.sync_search_strategy.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IRequestTypesMap](./kibana-plugin-plugins-data-public.irequesttypesmap.md) > [SYNC\_SEARCH\_STRATEGY](./kibana-plugin-plugins-data-public.irequesttypesmap.sync_search_strategy.md) + +## IRequestTypesMap.SYNC\_SEARCH\_STRATEGY property + +Signature: + +```typescript +[SYNC_SEARCH_STRATEGY]: ISyncSearchRequest; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iresponsetypesmap.es.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iresponsetypesmap.es.md new file mode 100644 index 0000000000000..8056d0b16a66e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iresponsetypesmap.es.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IResponseTypesMap](./kibana-plugin-plugins-data-public.iresponsetypesmap.md) > [es](./kibana-plugin-plugins-data-public.iresponsetypesmap.es.md) + +## IResponseTypesMap.es property + +Signature: + +```typescript +[ES_SEARCH_STRATEGY]: IEsSearchResponse; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iresponsetypesmap.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iresponsetypesmap.md new file mode 100644 index 0000000000000..b6ec3aa38c96a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iresponsetypesmap.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IResponseTypesMap](./kibana-plugin-plugins-data-public.iresponsetypesmap.md) + +## IResponseTypesMap interface + +Signature: + +```typescript +export interface IResponseTypesMap +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [es](./kibana-plugin-plugins-data-public.iresponsetypesmap.es.md) | IEsSearchResponse | | +| [SYNC\_SEARCH\_STRATEGY](./kibana-plugin-plugins-data-public.iresponsetypesmap.sync_search_strategy.md) | IKibanaSearchResponse | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iresponsetypesmap.sync_search_strategy.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iresponsetypesmap.sync_search_strategy.md new file mode 100644 index 0000000000000..c9fad4ced534c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.iresponsetypesmap.sync_search_strategy.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IResponseTypesMap](./kibana-plugin-plugins-data-public.iresponsetypesmap.md) > [SYNC\_SEARCH\_STRATEGY](./kibana-plugin-plugins-data-public.iresponsetypesmap.sync_search_strategy.md) + +## IResponseTypesMap.SYNC\_SEARCH\_STRATEGY property + +Signature: + +```typescript +[SYNC_SEARCH_STRATEGY]: IKibanaSearchResponse; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearch.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearch.md new file mode 100644 index 0000000000000..1a58b41052caf --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearch.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearch](./kibana-plugin-plugins-data-public.isearch.md) + +## ISearch type + +Signature: + +```typescript +export declare type ISearch = (request: IRequestTypesMap[T], options?: ISearchOptions) => Observable; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchcontext.core.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchcontext.core.md new file mode 100644 index 0000000000000..7a7ea43bd3d40 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchcontext.core.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearchContext](./kibana-plugin-plugins-data-public.isearchcontext.md) > [core](./kibana-plugin-plugins-data-public.isearchcontext.core.md) + +## ISearchContext.core property + +Signature: + +```typescript +core: CoreStart; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchcontext.getsearchstrategy.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchcontext.getsearchstrategy.md new file mode 100644 index 0000000000000..93ac88d200bb8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchcontext.getsearchstrategy.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearchContext](./kibana-plugin-plugins-data-public.isearchcontext.md) > [getSearchStrategy](./kibana-plugin-plugins-data-public.isearchcontext.getsearchstrategy.md) + +## ISearchContext.getSearchStrategy property + +Signature: + +```typescript +getSearchStrategy: (name: T) => TSearchStrategyProvider; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchcontext.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchcontext.md new file mode 100644 index 0000000000000..9b89f71434119 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchcontext.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearchContext](./kibana-plugin-plugins-data-public.isearchcontext.md) + +## ISearchContext interface + +Signature: + +```typescript +export interface ISearchContext +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [core](./kibana-plugin-plugins-data-public.isearchcontext.core.md) | CoreStart | | +| [getSearchStrategy](./kibana-plugin-plugins-data-public.isearchcontext.getsearchstrategy.md) | <T extends TStrategyTypes>(name: T) => TSearchStrategyProvider<T> | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchgeneric.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchgeneric.md new file mode 100644 index 0000000000000..e118dac31c296 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchgeneric.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearchGeneric](./kibana-plugin-plugins-data-public.isearchgeneric.md) + +## ISearchGeneric type + +Signature: + +```typescript +export declare type ISearchGeneric = (request: IRequestTypesMap[T], options?: ISearchOptions, strategy?: T) => Observable; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.md new file mode 100644 index 0000000000000..05b7252606289 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearchOptions](./kibana-plugin-plugins-data-public.isearchoptions.md) + +## ISearchOptions interface + +Signature: + +```typescript +export interface ISearchOptions +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [signal](./kibana-plugin-plugins-data-public.isearchoptions.signal.md) | AbortSignal | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.signal.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.signal.md new file mode 100644 index 0000000000000..10bd186d55baa --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchoptions.signal.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearchOptions](./kibana-plugin-plugins-data-public.isearchoptions.md) > [signal](./kibana-plugin-plugins-data-public.isearchoptions.signal.md) + +## ISearchOptions.signal property + +Signature: + +```typescript +signal?: AbortSignal; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchsource.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchsource.md new file mode 100644 index 0000000000000..a8154dff72a6a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchsource.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearchSource](./kibana-plugin-plugins-data-public.isearchsource.md) + +## ISearchSource type + +Signature: + +```typescript +export declare type ISearchSource = Pick; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchstrategy.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchstrategy.md new file mode 100644 index 0000000000000..9e74bc0e60a73 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchstrategy.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearchStrategy](./kibana-plugin-plugins-data-public.isearchstrategy.md) + +## ISearchStrategy interface + +Search strategy interface contains a search method that takes in a request and returns a promise that resolves to a response. + +Signature: + +```typescript +export interface ISearchStrategy +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [search](./kibana-plugin-plugins-data-public.isearchstrategy.search.md) | ISearch<T> | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchstrategy.search.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchstrategy.search.md new file mode 100644 index 0000000000000..e2e4264b7c6e0 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isearchstrategy.search.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISearchStrategy](./kibana-plugin-plugins-data-public.isearchstrategy.md) > [search](./kibana-plugin-plugins-data-public.isearchstrategy.search.md) + +## ISearchStrategy.search property + +Signature: + +```typescript +search: ISearch; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isyncsearchrequest.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isyncsearchrequest.md new file mode 100644 index 0000000000000..29befdbf295dc --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isyncsearchrequest.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISyncSearchRequest](./kibana-plugin-plugins-data-public.isyncsearchrequest.md) + +## ISyncSearchRequest interface + +Signature: + +```typescript +export interface ISyncSearchRequest extends IKibanaSearchRequest +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [serverStrategy](./kibana-plugin-plugins-data-public.isyncsearchrequest.serverstrategy.md) | string | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isyncsearchrequest.serverstrategy.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isyncsearchrequest.serverstrategy.md new file mode 100644 index 0000000000000..f30f274a3b9b6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isyncsearchrequest.serverstrategy.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [ISyncSearchRequest](./kibana-plugin-plugins-data-public.isyncsearchrequest.md) > [serverStrategy](./kibana-plugin-plugins-data-public.isyncsearchrequest.serverstrategy.md) + +## ISyncSearchRequest.serverStrategy property + +Signature: + +```typescript +serverStrategy: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kbn_field_types.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kbn_field_types.md new file mode 100644 index 0000000000000..e5ae8ffbd2877 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kbn_field_types.md @@ -0,0 +1,33 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [KBN\_FIELD\_TYPES](./kibana-plugin-plugins-data-public.kbn_field_types.md) + +## KBN\_FIELD\_TYPES enum + +\* + +Signature: + +```typescript +export declare enum KBN_FIELD_TYPES +``` + +## Enumeration Members + +| Member | Value | Description | +| --- | --- | --- | +| \_SOURCE | "_source" | | +| ATTACHMENT | "attachment" | | +| BOOLEAN | "boolean" | | +| CONFLICT | "conflict" | | +| DATE | "date" | | +| GEO\_POINT | "geo_point" | | +| GEO\_SHAPE | "geo_shape" | | +| IP | "ip" | | +| MURMUR3 | "murmur3" | | +| NESTED | "nested" | | +| NUMBER | "number" | | +| OBJECT | "object" | | +| STRING | "string" | | +| UNKNOWN | "unknown" | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md new file mode 100644 index 0000000000000..276f25da8cb9f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [KueryNode](./kibana-plugin-plugins-data-public.kuerynode.md) + +## KueryNode interface + +Signature: + +```typescript +export interface KueryNode +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [type](./kibana-plugin-plugins-data-public.kuerynode.type.md) | keyof NodeTypes | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.type.md new file mode 100644 index 0000000000000..2ff96b6421c2e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.kuerynode.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [KueryNode](./kibana-plugin-plugins-data-public.kuerynode.md) > [type](./kibana-plugin-plugins-data-public.kuerynode.type.md) + +## KueryNode.type property + +Signature: + +```typescript +type: keyof NodeTypes; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md new file mode 100644 index 0000000000000..740b83bb5c563 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.matchallfilter.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [MatchAllFilter](./kibana-plugin-plugins-data-public.matchallfilter.md) + +## MatchAllFilter type + +Signature: + +```typescript +export declare type MatchAllFilter = Filter & { + meta: MatchAllFilterMeta; + match_all: any; +}; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md new file mode 100644 index 0000000000000..4b85461e64097 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md @@ -0,0 +1,142 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) + +## kibana-plugin-plugins-data-public package + +## Classes + +| Class | Description | +| --- | --- | +| [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) | | +| [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) | | +| [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) | | +| [IndexPatternFieldList](./kibana-plugin-plugins-data-public.indexpatternfieldlist.md) | | +| [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) | | +| [Plugin](./kibana-plugin-plugins-data-public.plugin.md) | | +| [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) | | +| [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) | | +| [TimeHistory](./kibana-plugin-plugins-data-public.timehistory.md) | | + +## Enumerations + +| Enumeration | Description | +| --- | --- | +| [ES\_FIELD\_TYPES](./kibana-plugin-plugins-data-public.es_field_types.md) | \* | +| [KBN\_FIELD\_TYPES](./kibana-plugin-plugins-data-public.kbn_field_types.md) | \* | +| [QuerySuggestionTypes](./kibana-plugin-plugins-data-public.querysuggestiontypes.md) | | +| [SortDirection](./kibana-plugin-plugins-data-public.sortdirection.md) | | + +## Functions + +| Function | Description | +| --- | --- | +| [getDefaultQuery(language)](./kibana-plugin-plugins-data-public.getdefaultquery.md) | | +| [getEsPreference(uiSettings, sessionId)](./kibana-plugin-plugins-data-public.getespreference.md) | | +| [getQueryLog(uiSettings, storage, appName, language)](./kibana-plugin-plugins-data-public.getquerylog.md) | | +| [getSearchErrorType({ message })](./kibana-plugin-plugins-data-public.getsearcherrortype.md) | | +| [getTime(indexPattern, timeRange, forceNow)](./kibana-plugin-plugins-data-public.gettime.md) | | +| [parseInterval(interval)](./kibana-plugin-plugins-data-public.parseinterval.md) | | +| [plugin(initializerContext)](./kibana-plugin-plugins-data-public.plugin.md) | | + +## Interfaces + +| Interface | Description | +| --- | --- | +| [DataPublicPluginSetup](./kibana-plugin-plugins-data-public.datapublicpluginsetup.md) | | +| [DataPublicPluginStart](./kibana-plugin-plugins-data-public.datapublicpluginstart.md) | | +| [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) | | +| [FetchOptions](./kibana-plugin-plugins-data-public.fetchoptions.md) | | +| [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) | | +| [Filter](./kibana-plugin-plugins-data-public.filter.md) | | +| [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) | | +| [IEsSearchRequest](./kibana-plugin-plugins-data-public.iessearchrequest.md) | | +| [IEsSearchResponse](./kibana-plugin-plugins-data-public.iessearchresponse.md) | | +| [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) | | +| [IFieldType](./kibana-plugin-plugins-data-public.ifieldtype.md) | | +| [IIndexPattern](./kibana-plugin-plugins-data-public.iindexpattern.md) | | +| [IKibanaSearchRequest](./kibana-plugin-plugins-data-public.ikibanasearchrequest.md) | | +| [IKibanaSearchResponse](./kibana-plugin-plugins-data-public.ikibanasearchresponse.md) | | +| [IndexPatternAttributes](./kibana-plugin-plugins-data-public.indexpatternattributes.md) | Use data plugin interface instead | +| [IndexPatternTypeMeta](./kibana-plugin-plugins-data-public.indexpatterntypemeta.md) | | +| [IRequestTypesMap](./kibana-plugin-plugins-data-public.irequesttypesmap.md) | | +| [IResponseTypesMap](./kibana-plugin-plugins-data-public.iresponsetypesmap.md) | | +| [ISearchContext](./kibana-plugin-plugins-data-public.isearchcontext.md) | | +| [ISearchOptions](./kibana-plugin-plugins-data-public.isearchoptions.md) | | +| [ISearchStrategy](./kibana-plugin-plugins-data-public.isearchstrategy.md) | Search strategy interface contains a search method that takes in a request and returns a promise that resolves to a response. | +| [ISyncSearchRequest](./kibana-plugin-plugins-data-public.isyncsearchrequest.md) | | +| [KueryNode](./kibana-plugin-plugins-data-public.kuerynode.md) | | +| [Query](./kibana-plugin-plugins-data-public.query.md) | | +| [QueryState](./kibana-plugin-plugins-data-public.querystate.md) | All query state service state | +| [QuerySuggestionBasic](./kibana-plugin-plugins-data-public.querysuggestionbasic.md) | \* | +| [QuerySuggestionField](./kibana-plugin-plugins-data-public.querysuggestionfield.md) | \* | +| [QuerySuggestionGetFnArgs](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md) | \* | +| [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) | | +| [RefreshInterval](./kibana-plugin-plugins-data-public.refreshinterval.md) | | +| [SavedQuery](./kibana-plugin-plugins-data-public.savedquery.md) | | +| [SavedQueryAttributes](./kibana-plugin-plugins-data-public.savedqueryattributes.md) | | +| [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) | | +| [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) | | +| [SearchStrategyProvider](./kibana-plugin-plugins-data-public.searchstrategyprovider.md) | | +| [TimefilterSetup](./kibana-plugin-plugins-data-public.timefiltersetup.md) | | +| [TimeRange](./kibana-plugin-plugins-data-public.timerange.md) | | + +## Variables + +| Variable | Description | +| --- | --- | +| [addSearchStrategy](./kibana-plugin-plugins-data-public.addsearchstrategy.md) | | +| [baseFormattersPublic](./kibana-plugin-plugins-data-public.baseformatterspublic.md) | | +| [castEsToKbnFieldTypeName](./kibana-plugin-plugins-data-public.castestokbnfieldtypename.md) | Get the KbnFieldType name for an esType string | +| [connectToQueryState](./kibana-plugin-plugins-data-public.connecttoquerystate.md) | Helper to setup two-way syncing of global data and a state container | +| [createSavedQueryService](./kibana-plugin-plugins-data-public.createsavedqueryservice.md) | | +| [defaultSearchStrategy](./kibana-plugin-plugins-data-public.defaultsearchstrategy.md) | | +| [ES\_SEARCH\_STRATEGY](./kibana-plugin-plugins-data-public.es_search_strategy.md) | | +| [esFilters](./kibana-plugin-plugins-data-public.esfilters.md) | | +| [esKuery](./kibana-plugin-plugins-data-public.eskuery.md) | | +| [esQuery](./kibana-plugin-plugins-data-public.esquery.md) | | +| [esSearchStrategyProvider](./kibana-plugin-plugins-data-public.essearchstrategyprovider.md) | | +| [fieldFormats](./kibana-plugin-plugins-data-public.fieldformats.md) | | +| [FilterBar](./kibana-plugin-plugins-data-public.filterbar.md) | | +| [getKbnTypeNames](./kibana-plugin-plugins-data-public.getkbntypenames.md) | Get the esTypes known by all kbnFieldTypes {Array} | +| [hasSearchStategyForIndexPattern](./kibana-plugin-plugins-data-public.hassearchstategyforindexpattern.md) | | +| [indexPatterns](./kibana-plugin-plugins-data-public.indexpatterns.md) | | +| [QueryStringInput](./kibana-plugin-plugins-data-public.querystringinput.md) | | +| [SearchBar](./kibana-plugin-plugins-data-public.searchbar.md) | | +| [SYNC\_SEARCH\_STRATEGY](./kibana-plugin-plugins-data-public.sync_search_strategy.md) | | +| [syncQueryStateWithUrl](./kibana-plugin-plugins-data-public.syncquerystatewithurl.md) | Helper to setup syncing of global data with the URL | + +## Type Aliases + +| Type Alias | Description | +| --- | --- | +| [CustomFilter](./kibana-plugin-plugins-data-public.customfilter.md) | | +| [EsQuerySortValue](./kibana-plugin-plugins-data-public.esquerysortvalue.md) | | +| [ExistsFilter](./kibana-plugin-plugins-data-public.existsfilter.md) | | +| [FieldFormatId](./kibana-plugin-plugins-data-public.fieldformatid.md) | id type is needed for creating custom converters. | +| [FieldFormatsContentType](./kibana-plugin-plugins-data-public.fieldformatscontenttype.md) | \* | +| [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md) | | +| [IFieldFormat](./kibana-plugin-plugins-data-public.ifieldformat.md) | | +| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-public.ifieldformatsregistry.md) | | +| [IndexPatternAggRestrictions](./kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md) | | +| [IndexPatternsContract](./kibana-plugin-plugins-data-public.indexpatternscontract.md) | | +| [InputTimeRange](./kibana-plugin-plugins-data-public.inputtimerange.md) | | +| [ISearch](./kibana-plugin-plugins-data-public.isearch.md) | | +| [ISearchGeneric](./kibana-plugin-plugins-data-public.isearchgeneric.md) | | +| [ISearchSource](./kibana-plugin-plugins-data-public.isearchsource.md) | | +| [MatchAllFilter](./kibana-plugin-plugins-data-public.matchallfilter.md) | | +| [PhraseFilter](./kibana-plugin-plugins-data-public.phrasefilter.md) | | +| [PhrasesFilter](./kibana-plugin-plugins-data-public.phrasesfilter.md) | | +| [QuerySuggestion](./kibana-plugin-plugins-data-public.querysuggestion.md) | \* | +| [QuerySuggestionGetFn](./kibana-plugin-plugins-data-public.querysuggestiongetfn.md) | | +| [RangeFilter](./kibana-plugin-plugins-data-public.rangefilter.md) | | +| [RangeFilterMeta](./kibana-plugin-plugins-data-public.rangefiltermeta.md) | | +| [SavedQueryTimeFilter](./kibana-plugin-plugins-data-public.savedquerytimefilter.md) | | +| [SearchBarProps](./kibana-plugin-plugins-data-public.searchbarprops.md) | | +| [SearchRequest](./kibana-plugin-plugins-data-public.searchrequest.md) | | +| [SearchResponse](./kibana-plugin-plugins-data-public.searchresponse.md) | | +| [StatefulSearchBarProps](./kibana-plugin-plugins-data-public.statefulsearchbarprops.md) | | +| [TimefilterContract](./kibana-plugin-plugins-data-public.timefiltercontract.md) | | +| [TimeHistoryContract](./kibana-plugin-plugins-data-public.timehistorycontract.md) | | +| [TSearchStrategyProvider](./kibana-plugin-plugins-data-public.tsearchstrategyprovider.md) | Search strategy provider creates an instance of a search strategy with the request handler context bound to it. This way every search strategy can use whatever information they require from the request context. | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.parseinterval.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.parseinterval.md new file mode 100644 index 0000000000000..1f5371fbf088a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.parseinterval.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [parseInterval](./kibana-plugin-plugins-data-public.parseinterval.md) + +## parseInterval() function + +Signature: + +```typescript +export declare function parseInterval(interval: string): moment.Duration | null; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| interval | string | | + +Returns: + +`moment.Duration | null` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md new file mode 100644 index 0000000000000..090b78a7078cc --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasefilter.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [PhraseFilter](./kibana-plugin-plugins-data-public.phrasefilter.md) + +## PhraseFilter type + +Signature: + +```typescript +export declare type PhraseFilter = Filter & { + meta: PhraseFilterMeta; + script?: { + script: { + source?: any; + lang?: string; + params: any; + }; + }; +}; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md new file mode 100644 index 0000000000000..ab205cb62fd14 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.phrasesfilter.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [PhrasesFilter](./kibana-plugin-plugins-data-public.phrasesfilter.md) + +## PhrasesFilter type + +Signature: + +```typescript +export declare type PhrasesFilter = Filter & { + meta: PhrasesFilterMeta; +}; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin._constructor_.md new file mode 100644 index 0000000000000..5ec2d491295bf --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin._constructor_.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Plugin](./kibana-plugin-plugins-data-public.plugin.md) > [(constructor)](./kibana-plugin-plugins-data-public.plugin._constructor_.md) + +## Plugin.(constructor) + +Constructs a new instance of the `DataPublicPlugin` class + +Signature: + +```typescript +constructor(initializerContext: PluginInitializerContext); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| initializerContext | PluginInitializerContext | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.md new file mode 100644 index 0000000000000..6cbc1f441c048 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [plugin](./kibana-plugin-plugins-data-public.plugin.md) + +## plugin() function + +Signature: + +```typescript +export declare function plugin(initializerContext: PluginInitializerContext): DataPublicPlugin; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| initializerContext | PluginInitializerContext | | + +Returns: + +`DataPublicPlugin` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.setup.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.setup.md new file mode 100644 index 0000000000000..98a954456d482 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.setup.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Plugin](./kibana-plugin-plugins-data-public.plugin.md) > [setup](./kibana-plugin-plugins-data-public.plugin.setup.md) + +## Plugin.setup() method + +Signature: + +```typescript +setup(core: CoreSetup, { uiActions }: DataSetupDependencies): DataPublicPluginSetup; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| core | CoreSetup | | +| { uiActions } | DataSetupDependencies | | + +Returns: + +`DataPublicPluginSetup` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.start.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.start.md new file mode 100644 index 0000000000000..56934e8a29edd --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.start.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Plugin](./kibana-plugin-plugins-data-public.plugin.md) > [start](./kibana-plugin-plugins-data-public.plugin.start.md) + +## Plugin.start() method + +Signature: + +```typescript +start(core: CoreStart, { uiActions }: DataStartDependencies): DataPublicPluginStart; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| core | CoreStart | | +| { uiActions } | DataStartDependencies | | + +Returns: + +`DataPublicPluginStart` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.stop.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.stop.md new file mode 100644 index 0000000000000..8b8b63db4e03a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.plugin.stop.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Plugin](./kibana-plugin-plugins-data-public.plugin.md) > [stop](./kibana-plugin-plugins-data-public.plugin.stop.md) + +## Plugin.stop() method + +Signature: + +```typescript +stop(): void; +``` +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.language.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.language.md new file mode 100644 index 0000000000000..127ee9210799e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.language.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Query](./kibana-plugin-plugins-data-public.query.md) > [language](./kibana-plugin-plugins-data-public.query.language.md) + +## Query.language property + +Signature: + +```typescript +language: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.md new file mode 100644 index 0000000000000..a1dffe5ff5fa4 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Query](./kibana-plugin-plugins-data-public.query.md) + +## Query interface + +Signature: + +```typescript +export interface Query +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [language](./kibana-plugin-plugins-data-public.query.language.md) | string | | +| [query](./kibana-plugin-plugins-data-public.query.query.md) | string | {
[key: string]: any;
} | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.query.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.query.md new file mode 100644 index 0000000000000..9fcd0310af0fe --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.query.query.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Query](./kibana-plugin-plugins-data-public.query.md) > [query](./kibana-plugin-plugins-data-public.query.query.md) + +## Query.query property + +Signature: + +```typescript +query: string | { + [key: string]: any; + }; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.filters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.filters.md new file mode 100644 index 0000000000000..7155ea92d82ec --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.filters.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QueryState](./kibana-plugin-plugins-data-public.querystate.md) > [filters](./kibana-plugin-plugins-data-public.querystate.filters.md) + +## QueryState.filters property + +Signature: + +```typescript +filters?: Filter[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.md new file mode 100644 index 0000000000000..cc489a0cb0367 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QueryState](./kibana-plugin-plugins-data-public.querystate.md) + +## QueryState interface + +All query state service state + +Signature: + +```typescript +export interface QueryState +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [filters](./kibana-plugin-plugins-data-public.querystate.filters.md) | Filter[] | | +| [refreshInterval](./kibana-plugin-plugins-data-public.querystate.refreshinterval.md) | RefreshInterval | | +| [time](./kibana-plugin-plugins-data-public.querystate.time.md) | TimeRange | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.refreshinterval.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.refreshinterval.md new file mode 100644 index 0000000000000..04745f94a05af --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.refreshinterval.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QueryState](./kibana-plugin-plugins-data-public.querystate.md) > [refreshInterval](./kibana-plugin-plugins-data-public.querystate.refreshinterval.md) + +## QueryState.refreshInterval property + +Signature: + +```typescript +refreshInterval?: RefreshInterval; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.time.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.time.md new file mode 100644 index 0000000000000..8d08c8250387a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystate.time.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QueryState](./kibana-plugin-plugins-data-public.querystate.md) > [time](./kibana-plugin-plugins-data-public.querystate.time.md) + +## QueryState.time property + +Signature: + +```typescript +time?: TimeRange; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystringinput.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystringinput.md new file mode 100644 index 0000000000000..d0d4cc491e142 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystringinput.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QueryStringInput](./kibana-plugin-plugins-data-public.querystringinput.md) + +## QueryStringInput variable + +Signature: + +```typescript +QueryStringInput: React.FC> +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestion.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestion.md new file mode 100644 index 0000000000000..5586b3843d777 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestion.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestion](./kibana-plugin-plugins-data-public.querysuggestion.md) + +## QuerySuggestion type + +\* + +Signature: + +```typescript +export declare type QuerySuggestion = QuerySuggestionBasic | QuerySuggestionField; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.cursorindex.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.cursorindex.md new file mode 100644 index 0000000000000..bc0a080739746 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.cursorindex.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionBasic](./kibana-plugin-plugins-data-public.querysuggestionbasic.md) > [cursorIndex](./kibana-plugin-plugins-data-public.querysuggestionbasic.cursorindex.md) + +## QuerySuggestionBasic.cursorIndex property + +Signature: + +```typescript +cursorIndex?: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.description.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.description.md new file mode 100644 index 0000000000000..2e322c8225a27 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.description.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionBasic](./kibana-plugin-plugins-data-public.querysuggestionbasic.md) > [description](./kibana-plugin-plugins-data-public.querysuggestionbasic.description.md) + +## QuerySuggestionBasic.description property + +Signature: + +```typescript +description?: string | JSX.Element; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.end.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.end.md new file mode 100644 index 0000000000000..a76e301ca257d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.end.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionBasic](./kibana-plugin-plugins-data-public.querysuggestionbasic.md) > [end](./kibana-plugin-plugins-data-public.querysuggestionbasic.end.md) + +## QuerySuggestionBasic.end property + +Signature: + +```typescript +end: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.md new file mode 100644 index 0000000000000..ab8fc45cd49dd --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.md @@ -0,0 +1,25 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionBasic](./kibana-plugin-plugins-data-public.querysuggestionbasic.md) + +## QuerySuggestionBasic interface + +\* + +Signature: + +```typescript +export interface QuerySuggestionBasic +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [cursorIndex](./kibana-plugin-plugins-data-public.querysuggestionbasic.cursorindex.md) | number | | +| [description](./kibana-plugin-plugins-data-public.querysuggestionbasic.description.md) | string | JSX.Element | | +| [end](./kibana-plugin-plugins-data-public.querysuggestionbasic.end.md) | number | | +| [start](./kibana-plugin-plugins-data-public.querysuggestionbasic.start.md) | number | | +| [text](./kibana-plugin-plugins-data-public.querysuggestionbasic.text.md) | string | | +| [type](./kibana-plugin-plugins-data-public.querysuggestionbasic.type.md) | QuerySuggestionTypes | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.start.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.start.md new file mode 100644 index 0000000000000..2b24fc9b2f078 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.start.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionBasic](./kibana-plugin-plugins-data-public.querysuggestionbasic.md) > [start](./kibana-plugin-plugins-data-public.querysuggestionbasic.start.md) + +## QuerySuggestionBasic.start property + +Signature: + +```typescript +start: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.text.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.text.md new file mode 100644 index 0000000000000..4054b5e1623d0 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.text.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionBasic](./kibana-plugin-plugins-data-public.querysuggestionbasic.md) > [text](./kibana-plugin-plugins-data-public.querysuggestionbasic.text.md) + +## QuerySuggestionBasic.text property + +Signature: + +```typescript +text: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.type.md new file mode 100644 index 0000000000000..1bce656d94b57 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionbasic.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionBasic](./kibana-plugin-plugins-data-public.querysuggestionbasic.md) > [type](./kibana-plugin-plugins-data-public.querysuggestionbasic.type.md) + +## QuerySuggestionBasic.type property + +Signature: + +```typescript +type: QuerySuggestionTypes; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionfield.field.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionfield.field.md new file mode 100644 index 0000000000000..ce4e3a9afeb4e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionfield.field.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionField](./kibana-plugin-plugins-data-public.querysuggestionfield.md) > [field](./kibana-plugin-plugins-data-public.querysuggestionfield.field.md) + +## QuerySuggestionField.field property + +Signature: + +```typescript +field: IFieldType; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionfield.md new file mode 100644 index 0000000000000..88eb29d4ed66f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionfield.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionField](./kibana-plugin-plugins-data-public.querysuggestionfield.md) + +## QuerySuggestionField interface + +\* + +Signature: + +```typescript +export interface QuerySuggestionField extends QuerySuggestionBasic +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [field](./kibana-plugin-plugins-data-public.querysuggestionfield.field.md) | IFieldType | | +| [type](./kibana-plugin-plugins-data-public.querysuggestionfield.type.md) | QuerySuggestionTypes.Field | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionfield.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionfield.type.md new file mode 100644 index 0000000000000..185ee7dc47f22 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestionfield.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionField](./kibana-plugin-plugins-data-public.querysuggestionfield.md) > [type](./kibana-plugin-plugins-data-public.querysuggestionfield.type.md) + +## QuerySuggestionField.type property + +Signature: + +```typescript +type: QuerySuggestionTypes.Field; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfn.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfn.md new file mode 100644 index 0000000000000..30a4630d6a983 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfn.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionGetFn](./kibana-plugin-plugins-data-public.querysuggestiongetfn.md) + +## QuerySuggestionGetFn type + +Signature: + +```typescript +export declare type QuerySuggestionGetFn = (args: QuerySuggestionGetFnArgs) => Promise | undefined; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.boolfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.boolfilter.md new file mode 100644 index 0000000000000..e5fecb8a2db16 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.boolfilter.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionGetFnArgs](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md) > [boolFilter](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.boolfilter.md) + +## QuerySuggestionGetFnArgs.boolFilter property + +Signature: + +```typescript +boolFilter?: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.indexpatterns.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.indexpatterns.md new file mode 100644 index 0000000000000..2ad3b2ea63308 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.indexpatterns.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionGetFnArgs](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md) > [indexPatterns](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.indexpatterns.md) + +## QuerySuggestionGetFnArgs.indexPatterns property + +Signature: + +```typescript +indexPatterns: IIndexPattern[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.language.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.language.md new file mode 100644 index 0000000000000..adebd05d21a1f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.language.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionGetFnArgs](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md) > [language](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.language.md) + +## QuerySuggestionGetFnArgs.language property + +Signature: + +```typescript +language: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md new file mode 100644 index 0000000000000..96e43ca836891 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionGetFnArgs](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md) + +## QuerySuggestionGetFnArgs interface + +\* + +Signature: + +```typescript +export interface QuerySuggestionGetFnArgs +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [boolFilter](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.boolfilter.md) | any | | +| [indexPatterns](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.indexpatterns.md) | IIndexPattern[] | | +| [language](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.language.md) | string | | +| [query](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.query.md) | string | | +| [selectionEnd](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionend.md) | number | | +| [selectionStart](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionstart.md) | number | | +| [signal](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.signal.md) | AbortSignal | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.query.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.query.md new file mode 100644 index 0000000000000..4cbe5a255841c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.query.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionGetFnArgs](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md) > [query](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.query.md) + +## QuerySuggestionGetFnArgs.query property + +Signature: + +```typescript +query: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionend.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionend.md new file mode 100644 index 0000000000000..458a28cb6b1fa --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionend.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionGetFnArgs](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md) > [selectionEnd](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionend.md) + +## QuerySuggestionGetFnArgs.selectionEnd property + +Signature: + +```typescript +selectionEnd: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionstart.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionstart.md new file mode 100644 index 0000000000000..c253140468746 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionstart.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionGetFnArgs](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md) > [selectionStart](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.selectionstart.md) + +## QuerySuggestionGetFnArgs.selectionStart property + +Signature: + +```typescript +selectionStart: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.signal.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.signal.md new file mode 100644 index 0000000000000..9a24fd2b47a14 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiongetfnargs.signal.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionGetFnArgs](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.md) > [signal](./kibana-plugin-plugins-data-public.querysuggestiongetfnargs.signal.md) + +## QuerySuggestionGetFnArgs.signal property + +Signature: + +```typescript +signal?: AbortSignal; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiontypes.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiontypes.md new file mode 100644 index 0000000000000..fd5010167eaa1 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querysuggestiontypes.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [QuerySuggestionTypes](./kibana-plugin-plugins-data-public.querysuggestiontypes.md) + +## QuerySuggestionTypes enum + +Signature: + +```typescript +export declare enum QuerySuggestionTypes +``` + +## Enumeration Members + +| Member | Value | Description | +| --- | --- | --- | +| Conjunction | "conjunction" | | +| Field | "field" | | +| Operator | "operator" | | +| RecentSearch | "recentSearch" | | +| Value | "value" | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md new file mode 100644 index 0000000000000..fbe04f5e0a2a9 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilter.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilter](./kibana-plugin-plugins-data-public.rangefilter.md) + +## RangeFilter type + +Signature: + +```typescript +export declare type RangeFilter = Filter & EsRangeFilter & { + meta: RangeFilterMeta; + script?: { + script: { + params: any; + lang: string; + source: any; + }; + }; + match_all?: any; +}; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md new file mode 100644 index 0000000000000..609e98cb6faa8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefiltermeta.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterMeta](./kibana-plugin-plugins-data-public.rangefiltermeta.md) + +## RangeFilterMeta type + +Signature: + +```typescript +export declare type RangeFilterMeta = FilterMeta & { + params: RangeFilterParams; + field?: any; + formattedValue?: string; +}; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.format.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.format.md new file mode 100644 index 0000000000000..15926481923ab --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.format.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [format](./kibana-plugin-plugins-data-public.rangefilterparams.format.md) + +## RangeFilterParams.format property + +Signature: + +```typescript +format?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.from.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.from.md new file mode 100644 index 0000000000000..99b8d75e9c316 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.from.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [from](./kibana-plugin-plugins-data-public.rangefilterparams.from.md) + +## RangeFilterParams.from property + +Signature: + +```typescript +from?: number | string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gt.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gt.md new file mode 100644 index 0000000000000..32bfc6eeb68cb --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gt.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [gt](./kibana-plugin-plugins-data-public.rangefilterparams.gt.md) + +## RangeFilterParams.gt property + +Signature: + +```typescript +gt?: number | string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gte.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gte.md new file mode 100644 index 0000000000000..81345e4a81610 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.gte.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [gte](./kibana-plugin-plugins-data-public.rangefilterparams.gte.md) + +## RangeFilterParams.gte property + +Signature: + +```typescript +gte?: number | string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lt.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lt.md new file mode 100644 index 0000000000000..6250fecfe59d6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lt.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [lt](./kibana-plugin-plugins-data-public.rangefilterparams.lt.md) + +## RangeFilterParams.lt property + +Signature: + +```typescript +lt?: number | string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lte.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lte.md new file mode 100644 index 0000000000000..c4f3cbf00b304 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.lte.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [lte](./kibana-plugin-plugins-data-public.rangefilterparams.lte.md) + +## RangeFilterParams.lte property + +Signature: + +```typescript +lte?: number | string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md new file mode 100644 index 0000000000000..977559f5e6cb2 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) + +## RangeFilterParams interface + +Signature: + +```typescript +export interface RangeFilterParams +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [format](./kibana-plugin-plugins-data-public.rangefilterparams.format.md) | string | | +| [from](./kibana-plugin-plugins-data-public.rangefilterparams.from.md) | number | string | | +| [gt](./kibana-plugin-plugins-data-public.rangefilterparams.gt.md) | number | string | | +| [gte](./kibana-plugin-plugins-data-public.rangefilterparams.gte.md) | number | string | | +| [lt](./kibana-plugin-plugins-data-public.rangefilterparams.lt.md) | number | string | | +| [lte](./kibana-plugin-plugins-data-public.rangefilterparams.lte.md) | number | string | | +| [to](./kibana-plugin-plugins-data-public.rangefilterparams.to.md) | number | string | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.to.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.to.md new file mode 100644 index 0000000000000..c9d0069fb75f5 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.rangefilterparams.to.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RangeFilterParams](./kibana-plugin-plugins-data-public.rangefilterparams.md) > [to](./kibana-plugin-plugins-data-public.rangefilterparams.to.md) + +## RangeFilterParams.to property + +Signature: + +```typescript +to?: number | string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.md new file mode 100644 index 0000000000000..6a6350d8ba4f6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RefreshInterval](./kibana-plugin-plugins-data-public.refreshinterval.md) + +## RefreshInterval interface + +Signature: + +```typescript +export interface RefreshInterval +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [pause](./kibana-plugin-plugins-data-public.refreshinterval.pause.md) | boolean | | +| [value](./kibana-plugin-plugins-data-public.refreshinterval.value.md) | number | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.pause.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.pause.md new file mode 100644 index 0000000000000..fb854fcbbc277 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.pause.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RefreshInterval](./kibana-plugin-plugins-data-public.refreshinterval.md) > [pause](./kibana-plugin-plugins-data-public.refreshinterval.pause.md) + +## RefreshInterval.pause property + +Signature: + +```typescript +pause: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.value.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.value.md new file mode 100644 index 0000000000000..021a01391b71e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.value.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [RefreshInterval](./kibana-plugin-plugins-data-public.refreshinterval.md) > [value](./kibana-plugin-plugins-data-public.refreshinterval.value.md) + +## RefreshInterval.value property + +Signature: + +```typescript +value: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquery.attributes.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquery.attributes.md new file mode 100644 index 0000000000000..6c5277162fd51 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquery.attributes.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQuery](./kibana-plugin-plugins-data-public.savedquery.md) > [attributes](./kibana-plugin-plugins-data-public.savedquery.attributes.md) + +## SavedQuery.attributes property + +Signature: + +```typescript +attributes: SavedQueryAttributes; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquery.id.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquery.id.md new file mode 100644 index 0000000000000..386a1d048e937 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquery.id.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQuery](./kibana-plugin-plugins-data-public.savedquery.md) > [id](./kibana-plugin-plugins-data-public.savedquery.id.md) + +## SavedQuery.id property + +Signature: + +```typescript +id: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquery.md new file mode 100644 index 0000000000000..14c143edf13c1 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquery.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQuery](./kibana-plugin-plugins-data-public.savedquery.md) + +## SavedQuery interface + +Signature: + +```typescript +export interface SavedQuery +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [attributes](./kibana-plugin-plugins-data-public.savedquery.attributes.md) | SavedQueryAttributes | | +| [id](./kibana-plugin-plugins-data-public.savedquery.id.md) | string | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.description.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.description.md new file mode 100644 index 0000000000000..859935480357c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.description.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryAttributes](./kibana-plugin-plugins-data-public.savedqueryattributes.md) > [description](./kibana-plugin-plugins-data-public.savedqueryattributes.description.md) + +## SavedQueryAttributes.description property + +Signature: + +```typescript +description: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.filters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.filters.md new file mode 100644 index 0000000000000..c2c1ac681802b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.filters.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryAttributes](./kibana-plugin-plugins-data-public.savedqueryattributes.md) > [filters](./kibana-plugin-plugins-data-public.savedqueryattributes.filters.md) + +## SavedQueryAttributes.filters property + +Signature: + +```typescript +filters?: Filter[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.md new file mode 100644 index 0000000000000..612be6a1dabc6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryAttributes](./kibana-plugin-plugins-data-public.savedqueryattributes.md) + +## SavedQueryAttributes interface + +Signature: + +```typescript +export interface SavedQueryAttributes +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [description](./kibana-plugin-plugins-data-public.savedqueryattributes.description.md) | string | | +| [filters](./kibana-plugin-plugins-data-public.savedqueryattributes.filters.md) | Filter[] | | +| [query](./kibana-plugin-plugins-data-public.savedqueryattributes.query.md) | Query | | +| [timefilter](./kibana-plugin-plugins-data-public.savedqueryattributes.timefilter.md) | SavedQueryTimeFilter | | +| [title](./kibana-plugin-plugins-data-public.savedqueryattributes.title.md) | string | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.query.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.query.md new file mode 100644 index 0000000000000..96673fc3a8fde --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.query.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryAttributes](./kibana-plugin-plugins-data-public.savedqueryattributes.md) > [query](./kibana-plugin-plugins-data-public.savedqueryattributes.query.md) + +## SavedQueryAttributes.query property + +Signature: + +```typescript +query: Query; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.timefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.timefilter.md new file mode 100644 index 0000000000000..b4edb059a3dfd --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.timefilter.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryAttributes](./kibana-plugin-plugins-data-public.savedqueryattributes.md) > [timefilter](./kibana-plugin-plugins-data-public.savedqueryattributes.timefilter.md) + +## SavedQueryAttributes.timefilter property + +Signature: + +```typescript +timefilter?: SavedQueryTimeFilter; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.title.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.title.md new file mode 100644 index 0000000000000..99ae1b83e8834 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryattributes.title.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryAttributes](./kibana-plugin-plugins-data-public.savedqueryattributes.md) > [title](./kibana-plugin-plugins-data-public.savedqueryattributes.title.md) + +## SavedQueryAttributes.title property + +Signature: + +```typescript +title: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.deletesavedquery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.deletesavedquery.md new file mode 100644 index 0000000000000..5dd12a011ceca --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.deletesavedquery.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) > [deleteSavedQuery](./kibana-plugin-plugins-data-public.savedqueryservice.deletesavedquery.md) + +## SavedQueryService.deleteSavedQuery property + +Signature: + +```typescript +deleteSavedQuery: (id: string) => Promise<{}>; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.findsavedqueries.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.findsavedqueries.md new file mode 100644 index 0000000000000..ef3f6ea1645f0 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.findsavedqueries.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) > [findSavedQueries](./kibana-plugin-plugins-data-public.savedqueryservice.findsavedqueries.md) + +## SavedQueryService.findSavedQueries property + +Signature: + +```typescript +findSavedQueries: (searchText?: string, perPage?: number, activePage?: number) => Promise<{ + total: number; + queries: SavedQuery[]; + }>; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.getallsavedqueries.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.getallsavedqueries.md new file mode 100644 index 0000000000000..ef5048f3b22b8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.getallsavedqueries.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) > [getAllSavedQueries](./kibana-plugin-plugins-data-public.savedqueryservice.getallsavedqueries.md) + +## SavedQueryService.getAllSavedQueries property + +Signature: + +```typescript +getAllSavedQueries: () => Promise; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.getsavedquery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.getsavedquery.md new file mode 100644 index 0000000000000..19c8fcc2a3f40 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.getsavedquery.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) > [getSavedQuery](./kibana-plugin-plugins-data-public.savedqueryservice.getsavedquery.md) + +## SavedQueryService.getSavedQuery property + +Signature: + +```typescript +getSavedQuery: (id: string) => Promise; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.getsavedquerycount.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.getsavedquerycount.md new file mode 100644 index 0000000000000..225c74abe289f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.getsavedquerycount.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) > [getSavedQueryCount](./kibana-plugin-plugins-data-public.savedqueryservice.getsavedquerycount.md) + +## SavedQueryService.getSavedQueryCount property + +Signature: + +```typescript +getSavedQueryCount: () => Promise; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.md new file mode 100644 index 0000000000000..de48d867a9580 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) + +## SavedQueryService interface + +Signature: + +```typescript +export interface SavedQueryService +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [deleteSavedQuery](./kibana-plugin-plugins-data-public.savedqueryservice.deletesavedquery.md) | (id: string) => Promise<{}> | | +| [findSavedQueries](./kibana-plugin-plugins-data-public.savedqueryservice.findsavedqueries.md) | (searchText?: string, perPage?: number, activePage?: number) => Promise<{
total: number;
queries: SavedQuery[];
}> | | +| [getAllSavedQueries](./kibana-plugin-plugins-data-public.savedqueryservice.getallsavedqueries.md) | () => Promise<SavedQuery[]> | | +| [getSavedQuery](./kibana-plugin-plugins-data-public.savedqueryservice.getsavedquery.md) | (id: string) => Promise<SavedQuery> | | +| [getSavedQueryCount](./kibana-plugin-plugins-data-public.savedqueryservice.getsavedquerycount.md) | () => Promise<number> | | +| [saveQuery](./kibana-plugin-plugins-data-public.savedqueryservice.savequery.md) | (attributes: SavedQueryAttributes, config?: {
overwrite: boolean;
}) => Promise<SavedQuery> | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.savequery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.savequery.md new file mode 100644 index 0000000000000..64bced8ace292 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedqueryservice.savequery.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) > [saveQuery](./kibana-plugin-plugins-data-public.savedqueryservice.savequery.md) + +## SavedQueryService.saveQuery property + +Signature: + +```typescript +saveQuery: (attributes: SavedQueryAttributes, config?: { + overwrite: boolean; + }) => Promise; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquerytimefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquerytimefilter.md new file mode 100644 index 0000000000000..542ed16ec1ef6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.savedquerytimefilter.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SavedQueryTimeFilter](./kibana-plugin-plugins-data-public.savedquerytimefilter.md) + +## SavedQueryTimeFilter type + +Signature: + +```typescript +export declare type SavedQueryTimeFilter = TimeRange & { + refreshInterval: RefreshInterval; +}; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbar.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbar.md new file mode 100644 index 0000000000000..89c5ca800a4d4 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbar.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchBar](./kibana-plugin-plugins-data-public.searchbar.md) + +## SearchBar variable + +Signature: + +```typescript +SearchBar: React.ComponentClass, "query" | "isLoading" | "indexPatterns" | "filters" | "refreshInterval" | "screenTitle" | "dataTestSubj" | "customSubmitButton" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "onRefresh" | "timeHistory" | "onFiltersUpdated" | "onRefreshChange">, any> & { + WrappedComponent: React.ComponentType & ReactIntl.InjectedIntlProps>; +} +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbarprops.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbarprops.md new file mode 100644 index 0000000000000..7ab0c19fd37ba --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbarprops.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchBarProps](./kibana-plugin-plugins-data-public.searchbarprops.md) + +## SearchBarProps type + +Signature: + +```typescript +export declare type SearchBarProps = SearchBarOwnProps & SearchBarInjectedDeps; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror._constructor_.md new file mode 100644 index 0000000000000..4d7691d24a79d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror._constructor_.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) > [(constructor)](./kibana-plugin-plugins-data-public.searcherror._constructor_.md) + +## SearchError.(constructor) + +Constructs a new instance of the `SearchError` class + +Signature: + +```typescript +constructor({ status, title, message, path, type }: SearchErrorOptions); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| { status, title, message, path, type } | SearchErrorOptions | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.md new file mode 100644 index 0000000000000..06e60cadf4a85 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.md @@ -0,0 +1,29 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) + +## SearchError class + +Signature: + +```typescript +export declare class SearchError extends Error +``` + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)({ status, title, message, path, type })](./kibana-plugin-plugins-data-public.searcherror._constructor_.md) | | Constructs a new instance of the SearchError class | + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [message](./kibana-plugin-plugins-data-public.searcherror.message.md) | | string | | +| [name](./kibana-plugin-plugins-data-public.searcherror.name.md) | | string | | +| [path](./kibana-plugin-plugins-data-public.searcherror.path.md) | | string | | +| [status](./kibana-plugin-plugins-data-public.searcherror.status.md) | | string | | +| [title](./kibana-plugin-plugins-data-public.searcherror.title.md) | | string | | +| [type](./kibana-plugin-plugins-data-public.searcherror.type.md) | | string | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.message.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.message.md new file mode 100644 index 0000000000000..5e2de2fbf7f42 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.message.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) > [message](./kibana-plugin-plugins-data-public.searcherror.message.md) + +## SearchError.message property + +Signature: + +```typescript +message: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.name.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.name.md new file mode 100644 index 0000000000000..8ad7bb5fcfd81 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.name.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) > [name](./kibana-plugin-plugins-data-public.searcherror.name.md) + +## SearchError.name property + +Signature: + +```typescript +name: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.path.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.path.md new file mode 100644 index 0000000000000..833c16e73ea8e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.path.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) > [path](./kibana-plugin-plugins-data-public.searcherror.path.md) + +## SearchError.path property + +Signature: + +```typescript +path: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.status.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.status.md new file mode 100644 index 0000000000000..ae1a947da0abb --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.status.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) > [status](./kibana-plugin-plugins-data-public.searcherror.status.md) + +## SearchError.status property + +Signature: + +```typescript +status: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.title.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.title.md new file mode 100644 index 0000000000000..aa73ab3b5790c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.title.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) > [title](./kibana-plugin-plugins-data-public.searcherror.title.md) + +## SearchError.title property + +Signature: + +```typescript +title: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.type.md new file mode 100644 index 0000000000000..dde447a9059c5 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searcherror.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) > [type](./kibana-plugin-plugins-data-public.searcherror.type.md) + +## SearchError.type property + +Signature: + +```typescript +type: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchrequest.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchrequest.md new file mode 100644 index 0000000000000..dbb465839e52c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchrequest.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchRequest](./kibana-plugin-plugins-data-public.searchrequest.md) + +## SearchRequest type + +Signature: + +```typescript +export declare type SearchRequest = any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchresponse.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchresponse.md new file mode 100644 index 0000000000000..6da31c8bced7e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchresponse.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchResponse](./kibana-plugin-plugins-data-public.searchresponse.md) + +## SearchResponse type + +Signature: + +```typescript +export declare type SearchResponse = any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource._constructor_.md new file mode 100644 index 0000000000000..e0c9e77b313a5 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource._constructor_.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [(constructor)](./kibana-plugin-plugins-data-public.searchsource._constructor_.md) + +## SearchSource.(constructor) + +Constructs a new instance of the `SearchSource` class + +Signature: + +```typescript +constructor(fields?: SearchSourceFields); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| fields | SearchSourceFields | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.create.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.create.md new file mode 100644 index 0000000000000..b0a0201680ca8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.create.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [create](./kibana-plugin-plugins-data-public.searchsource.create.md) + +## SearchSource.create() method + +Signature: + +```typescript +create(): SearchSource; +``` +Returns: + +`SearchSource` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.createchild.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.createchild.md new file mode 100644 index 0000000000000..3f17dc21cf514 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.createchild.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [createChild](./kibana-plugin-plugins-data-public.searchsource.createchild.md) + +## SearchSource.createChild() method + +Signature: + +```typescript +createChild(options?: {}): SearchSource; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| options | {} | | + +Returns: + +`SearchSource` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.createcopy.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.createcopy.md new file mode 100644 index 0000000000000..f503a3dfc3299 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.createcopy.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [createCopy](./kibana-plugin-plugins-data-public.searchsource.createcopy.md) + +## SearchSource.createCopy() method + +Signature: + +```typescript +createCopy(): SearchSource; +``` +Returns: + +`SearchSource` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.destroy.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.destroy.md new file mode 100644 index 0000000000000..8a7cc5ee75d11 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.destroy.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [destroy](./kibana-plugin-plugins-data-public.searchsource.destroy.md) + +## SearchSource.destroy() method + +Completely destroy the SearchSource. {undefined} + +Signature: + +```typescript +destroy(): void; +``` +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch.md new file mode 100644 index 0000000000000..208ce565fac13 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch.md @@ -0,0 +1,25 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [fetch](./kibana-plugin-plugins-data-public.searchsource.fetch.md) + +## SearchSource.fetch() method + +Fetch this source and reject the returned Promise on error + + +Signature: + +```typescript +fetch(options?: FetchOptions): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| options | FetchOptions | | + +Returns: + +`Promise` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getfield.md new file mode 100644 index 0000000000000..98ba815696cf6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getfield.md @@ -0,0 +1,25 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [getField](./kibana-plugin-plugins-data-public.searchsource.getfield.md) + +## SearchSource.getField() method + +Get fields from the fields + +Signature: + +```typescript +getField(field: K, recurse?: boolean): SearchSourceFields[K]; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| field | K | | +| recurse | boolean | | + +Returns: + +`SearchSourceFields[K]` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getfields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getfields.md new file mode 100644 index 0000000000000..4f4e575241e10 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getfields.md @@ -0,0 +1,49 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [getFields](./kibana-plugin-plugins-data-public.searchsource.getfields.md) + +## SearchSource.getFields() method + +Signature: + +```typescript +getFields(): { + type?: string | undefined; + query?: import("../..").Query | undefined; + filter?: Filter | Filter[] | (() => Filter | Filter[] | undefined) | undefined; + sort?: Record | Record[] | undefined; + highlight?: any; + highlightAll?: boolean | undefined; + aggs?: any; + from?: number | undefined; + size?: number | undefined; + source?: string | boolean | string[] | undefined; + version?: boolean | undefined; + fields?: string | boolean | string[] | undefined; + index?: import("../..").IndexPattern | undefined; + searchAfter?: import("./types").EsQuerySearchAfter | undefined; + timeout?: string | undefined; + terminate_after?: number | undefined; + }; +``` +Returns: + +`{ + type?: string | undefined; + query?: import("../..").Query | undefined; + filter?: Filter | Filter[] | (() => Filter | Filter[] | undefined) | undefined; + sort?: Record | Record[] | undefined; + highlight?: any; + highlightAll?: boolean | undefined; + aggs?: any; + from?: number | undefined; + size?: number | undefined; + source?: string | boolean | string[] | undefined; + version?: boolean | undefined; + fields?: string | boolean | string[] | undefined; + index?: import("../..").IndexPattern | undefined; + searchAfter?: import("./types").EsQuerySearchAfter | undefined; + timeout?: string | undefined; + terminate_after?: number | undefined; + }` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getid.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getid.md new file mode 100644 index 0000000000000..55aaa26ca62f3 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getid.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [getId](./kibana-plugin-plugins-data-public.searchsource.getid.md) + +## SearchSource.getId() method + +Signature: + +```typescript +getId(): string; +``` +Returns: + +`string` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getownfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getownfield.md new file mode 100644 index 0000000000000..d5a133772264e --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getownfield.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [getOwnField](./kibana-plugin-plugins-data-public.searchsource.getownfield.md) + +## SearchSource.getOwnField() method + +Get the field from our own fields, don't traverse up the chain + +Signature: + +```typescript +getOwnField(field: K): SearchSourceFields[K]; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| field | K | | + +Returns: + +`SearchSourceFields[K]` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getparent.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getparent.md new file mode 100644 index 0000000000000..14578f7949ba6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getparent.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [getParent](./kibana-plugin-plugins-data-public.searchsource.getparent.md) + +## SearchSource.getParent() method + +Get the parent of this SearchSource {undefined\|searchSource} + +Signature: + +```typescript +getParent(): SearchSource | undefined; +``` +Returns: + +`SearchSource | undefined` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getsearchrequestbody.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getsearchrequestbody.md new file mode 100644 index 0000000000000..f3451c9391074 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.getsearchrequestbody.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [getSearchRequestBody](./kibana-plugin-plugins-data-public.searchsource.getsearchrequestbody.md) + +## SearchSource.getSearchRequestBody() method + +Signature: + +```typescript +getSearchRequestBody(): Promise; +``` +Returns: + +`Promise` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.history.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.history.md new file mode 100644 index 0000000000000..e77c9dac7239f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.history.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [history](./kibana-plugin-plugins-data-public.searchsource.history.md) + +## SearchSource.history property + +Signature: + +```typescript +history: SearchRequest[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.md new file mode 100644 index 0000000000000..8e1dbb6e2671d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.md @@ -0,0 +1,45 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) + +## SearchSource class + +Signature: + +```typescript +export declare class SearchSource +``` + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)(fields)](./kibana-plugin-plugins-data-public.searchsource._constructor_.md) | | Constructs a new instance of the SearchSource class | + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [history](./kibana-plugin-plugins-data-public.searchsource.history.md) | | SearchRequest[] | | + +## Methods + +| Method | Modifiers | Description | +| --- | --- | --- | +| [create()](./kibana-plugin-plugins-data-public.searchsource.create.md) | | | +| [createChild(options)](./kibana-plugin-plugins-data-public.searchsource.createchild.md) | | | +| [createCopy()](./kibana-plugin-plugins-data-public.searchsource.createcopy.md) | | | +| [destroy()](./kibana-plugin-plugins-data-public.searchsource.destroy.md) | | Completely destroy the SearchSource. {undefined} | +| [fetch(options)](./kibana-plugin-plugins-data-public.searchsource.fetch.md) | | Fetch this source and reject the returned Promise on error | +| [getField(field, recurse)](./kibana-plugin-plugins-data-public.searchsource.getfield.md) | | Get fields from the fields | +| [getFields()](./kibana-plugin-plugins-data-public.searchsource.getfields.md) | | | +| [getId()](./kibana-plugin-plugins-data-public.searchsource.getid.md) | | | +| [getOwnField(field)](./kibana-plugin-plugins-data-public.searchsource.getownfield.md) | | Get the field from our own fields, don't traverse up the chain | +| [getParent()](./kibana-plugin-plugins-data-public.searchsource.getparent.md) | | Get the parent of this SearchSource {undefined\|searchSource} | +| [getSearchRequestBody()](./kibana-plugin-plugins-data-public.searchsource.getsearchrequestbody.md) | | | +| [onRequestStart(handler)](./kibana-plugin-plugins-data-public.searchsource.onrequeststart.md) | | Add a handler that will be notified whenever requests start | +| [setField(field, value)](./kibana-plugin-plugins-data-public.searchsource.setfield.md) | | | +| [setFields(newFields)](./kibana-plugin-plugins-data-public.searchsource.setfields.md) | | | +| [setParent(parent, options)](./kibana-plugin-plugins-data-public.searchsource.setparent.md) | | Set a searchSource that this source should inherit from | +| [setPreferredSearchStrategyId(searchStrategyId)](./kibana-plugin-plugins-data-public.searchsource.setpreferredsearchstrategyid.md) | | \*\*\* PUBLIC API \*\*\* | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.onrequeststart.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.onrequeststart.md new file mode 100644 index 0000000000000..092d057c69196 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.onrequeststart.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [onRequestStart](./kibana-plugin-plugins-data-public.searchsource.onrequeststart.md) + +## SearchSource.onRequestStart() method + +Add a handler that will be notified whenever requests start + +Signature: + +```typescript +onRequestStart(handler: (searchSource: ISearchSource, options?: FetchOptions) => Promise): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| handler | (searchSource: ISearchSource, options?: FetchOptions) => Promise<unknown> | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setfield.md new file mode 100644 index 0000000000000..83b7c30281752 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setfield.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [setField](./kibana-plugin-plugins-data-public.searchsource.setfield.md) + +## SearchSource.setField() method + +Signature: + +```typescript +setField(field: K, value: SearchSourceFields[K]): this; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| field | K | | +| value | SearchSourceFields[K] | | + +Returns: + +`this` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setfields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setfields.md new file mode 100644 index 0000000000000..fa9b265aa43b7 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setfields.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [setFields](./kibana-plugin-plugins-data-public.searchsource.setfields.md) + +## SearchSource.setFields() method + +Signature: + +```typescript +setFields(newFields: SearchSourceFields): this; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| newFields | SearchSourceFields | | + +Returns: + +`this` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setparent.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setparent.md new file mode 100644 index 0000000000000..19bf10bec210f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setparent.md @@ -0,0 +1,25 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [setParent](./kibana-plugin-plugins-data-public.searchsource.setparent.md) + +## SearchSource.setParent() method + +Set a searchSource that this source should inherit from + +Signature: + +```typescript +setParent(parent?: ISearchSource, options?: SearchSourceOptions): this; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| parent | ISearchSource | | +| options | SearchSourceOptions | | + +Returns: + +`this` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setpreferredsearchstrategyid.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setpreferredsearchstrategyid.md new file mode 100644 index 0000000000000..8d8dbce9e60f6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.setpreferredsearchstrategyid.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [setPreferredSearchStrategyId](./kibana-plugin-plugins-data-public.searchsource.setpreferredsearchstrategyid.md) + +## SearchSource.setPreferredSearchStrategyId() method + +\*\*\* PUBLIC API \*\*\* + +Signature: + +```typescript +setPreferredSearchStrategyId(searchStrategyId: string): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| searchStrategyId | string | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.aggs.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.aggs.md new file mode 100644 index 0000000000000..743646708b4c6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.aggs.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [aggs](./kibana-plugin-plugins-data-public.searchsourcefields.aggs.md) + +## SearchSourceFields.aggs property + +Signature: + +```typescript +aggs?: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.fields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.fields.md new file mode 100644 index 0000000000000..21d09910bd2b9 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.fields.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [fields](./kibana-plugin-plugins-data-public.searchsourcefields.fields.md) + +## SearchSourceFields.fields property + +Signature: + +```typescript +fields?: NameList; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.filter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.filter.md new file mode 100644 index 0000000000000..a14d33420a22d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.filter.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [filter](./kibana-plugin-plugins-data-public.searchsourcefields.filter.md) + +## SearchSourceFields.filter property + +Signature: + +```typescript +filter?: Filter[] | Filter | (() => Filter[] | Filter | undefined); +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.from.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.from.md new file mode 100644 index 0000000000000..0b8bbfc3ef378 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.from.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [from](./kibana-plugin-plugins-data-public.searchsourcefields.from.md) + +## SearchSourceFields.from property + +Signature: + +```typescript +from?: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.highlight.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.highlight.md new file mode 100644 index 0000000000000..0541fb7cf9212 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.highlight.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [highlight](./kibana-plugin-plugins-data-public.searchsourcefields.highlight.md) + +## SearchSourceFields.highlight property + +Signature: + +```typescript +highlight?: any; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.highlightall.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.highlightall.md new file mode 100644 index 0000000000000..82f18e73856a6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.highlightall.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [highlightAll](./kibana-plugin-plugins-data-public.searchsourcefields.highlightall.md) + +## SearchSourceFields.highlightAll property + +Signature: + +```typescript +highlightAll?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.index.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.index.md new file mode 100644 index 0000000000000..fa1d1a552a560 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.index.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [index](./kibana-plugin-plugins-data-public.searchsourcefields.index.md) + +## SearchSourceFields.index property + +Signature: + +```typescript +index?: IndexPattern; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md new file mode 100644 index 0000000000000..7a64af0f8b2b8 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.md @@ -0,0 +1,33 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) + +## SearchSourceFields interface + +Signature: + +```typescript +export interface SearchSourceFields +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [aggs](./kibana-plugin-plugins-data-public.searchsourcefields.aggs.md) | any | | +| [fields](./kibana-plugin-plugins-data-public.searchsourcefields.fields.md) | NameList | | +| [filter](./kibana-plugin-plugins-data-public.searchsourcefields.filter.md) | Filter[] | Filter | (() => Filter[] | Filter | undefined) | | +| [from](./kibana-plugin-plugins-data-public.searchsourcefields.from.md) | number | | +| [highlight](./kibana-plugin-plugins-data-public.searchsourcefields.highlight.md) | any | | +| [highlightAll](./kibana-plugin-plugins-data-public.searchsourcefields.highlightall.md) | boolean | | +| [index](./kibana-plugin-plugins-data-public.searchsourcefields.index.md) | IndexPattern | | +| [query](./kibana-plugin-plugins-data-public.searchsourcefields.query.md) | Query | | +| [searchAfter](./kibana-plugin-plugins-data-public.searchsourcefields.searchafter.md) | EsQuerySearchAfter | | +| [size](./kibana-plugin-plugins-data-public.searchsourcefields.size.md) | number | | +| [sort](./kibana-plugin-plugins-data-public.searchsourcefields.sort.md) | EsQuerySortValue | EsQuerySortValue[] | | +| [source](./kibana-plugin-plugins-data-public.searchsourcefields.source.md) | NameList | | +| [terminate\_after](./kibana-plugin-plugins-data-public.searchsourcefields.terminate_after.md) | number | | +| [timeout](./kibana-plugin-plugins-data-public.searchsourcefields.timeout.md) | string | | +| [type](./kibana-plugin-plugins-data-public.searchsourcefields.type.md) | string | | +| [version](./kibana-plugin-plugins-data-public.searchsourcefields.version.md) | boolean | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.query.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.query.md new file mode 100644 index 0000000000000..687dafce798d1 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.query.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [query](./kibana-plugin-plugins-data-public.searchsourcefields.query.md) + +## SearchSourceFields.query property + +Signature: + +```typescript +query?: Query; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.searchafter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.searchafter.md new file mode 100644 index 0000000000000..fca9efcae8406 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.searchafter.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [searchAfter](./kibana-plugin-plugins-data-public.searchsourcefields.searchafter.md) + +## SearchSourceFields.searchAfter property + +Signature: + +```typescript +searchAfter?: EsQuerySearchAfter; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.size.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.size.md new file mode 100644 index 0000000000000..38a5f1856644b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.size.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [size](./kibana-plugin-plugins-data-public.searchsourcefields.size.md) + +## SearchSourceFields.size property + +Signature: + +```typescript +size?: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.sort.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.sort.md new file mode 100644 index 0000000000000..c10f556cef6d6 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.sort.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [sort](./kibana-plugin-plugins-data-public.searchsourcefields.sort.md) + +## SearchSourceFields.sort property + +Signature: + +```typescript +sort?: EsQuerySortValue | EsQuerySortValue[]; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.source.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.source.md new file mode 100644 index 0000000000000..0066e96d0dfc1 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.source.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [source](./kibana-plugin-plugins-data-public.searchsourcefields.source.md) + +## SearchSourceFields.source property + +Signature: + +```typescript +source?: NameList; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.terminate_after.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.terminate_after.md new file mode 100644 index 0000000000000..e863c8ef77ef7 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.terminate_after.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [terminate\_after](./kibana-plugin-plugins-data-public.searchsourcefields.terminate_after.md) + +## SearchSourceFields.terminate\_after property + +Signature: + +```typescript +terminate_after?: number; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.timeout.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.timeout.md new file mode 100644 index 0000000000000..04fcaf455323a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.timeout.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [timeout](./kibana-plugin-plugins-data-public.searchsourcefields.timeout.md) + +## SearchSourceFields.timeout property + +Signature: + +```typescript +timeout?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.type.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.type.md new file mode 100644 index 0000000000000..97e5f469fb62f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [type](./kibana-plugin-plugins-data-public.searchsourcefields.type.md) + +## SearchSourceFields.type property + +Signature: + +```typescript +type?: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.version.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.version.md new file mode 100644 index 0000000000000..c940be14f3cde --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchsourcefields.version.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) > [version](./kibana-plugin-plugins-data-public.searchsourcefields.version.md) + +## SearchSourceFields.version property + +Signature: + +```typescript +version?: boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.id.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.id.md new file mode 100644 index 0000000000000..d60ffba6a05ca --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.id.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchStrategyProvider](./kibana-plugin-plugins-data-public.searchstrategyprovider.md) > [id](./kibana-plugin-plugins-data-public.searchstrategyprovider.id.md) + +## SearchStrategyProvider.id property + +Signature: + +```typescript +id: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.isviable.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.isviable.md new file mode 100644 index 0000000000000..aa8ed49051ee9 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.isviable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchStrategyProvider](./kibana-plugin-plugins-data-public.searchstrategyprovider.md) > [isViable](./kibana-plugin-plugins-data-public.searchstrategyprovider.isviable.md) + +## SearchStrategyProvider.isViable property + +Signature: + +```typescript +isViable: (indexPattern: IndexPattern) => boolean; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.md new file mode 100644 index 0000000000000..b271a921906a7 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchStrategyProvider](./kibana-plugin-plugins-data-public.searchstrategyprovider.md) + +## SearchStrategyProvider interface + +Signature: + +```typescript +export interface SearchStrategyProvider +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [id](./kibana-plugin-plugins-data-public.searchstrategyprovider.id.md) | string | | +| [isViable](./kibana-plugin-plugins-data-public.searchstrategyprovider.isviable.md) | (indexPattern: IndexPattern) => boolean | | +| [search](./kibana-plugin-plugins-data-public.searchstrategyprovider.search.md) | (params: SearchStrategySearchParams) => SearchStrategyResponse | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.search.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.search.md new file mode 100644 index 0000000000000..6e2561c3b0ad0 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchstrategyprovider.search.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchStrategyProvider](./kibana-plugin-plugins-data-public.searchstrategyprovider.md) > [search](./kibana-plugin-plugins-data-public.searchstrategyprovider.search.md) + +## SearchStrategyProvider.search property + +Signature: + +```typescript +search: (params: SearchStrategySearchParams) => SearchStrategyResponse; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.sortdirection.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.sortdirection.md new file mode 100644 index 0000000000000..bea20c323b850 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.sortdirection.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SortDirection](./kibana-plugin-plugins-data-public.sortdirection.md) + +## SortDirection enum + +Signature: + +```typescript +export declare enum SortDirection +``` + +## Enumeration Members + +| Member | Value | Description | +| --- | --- | --- | +| asc | "asc" | | +| desc | "desc" | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.statefulsearchbarprops.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.statefulsearchbarprops.md new file mode 100644 index 0000000000000..7e10306857b8a --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.statefulsearchbarprops.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [StatefulSearchBarProps](./kibana-plugin-plugins-data-public.statefulsearchbarprops.md) + +## StatefulSearchBarProps type + +Signature: + +```typescript +export declare type StatefulSearchBarProps = SearchBarOwnProps & { + appName: string; + useDefaultBehaviors?: boolean; + savedQueryId?: string; + onSavedQueryIdChange?: (savedQueryId?: string) => void; +}; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.sync_search_strategy.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.sync_search_strategy.md new file mode 100644 index 0000000000000..3681fe6d6274c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.sync_search_strategy.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SYNC\_SEARCH\_STRATEGY](./kibana-plugin-plugins-data-public.sync_search_strategy.md) + +## SYNC\_SEARCH\_STRATEGY variable + +Signature: + +```typescript +SYNC_SEARCH_STRATEGY = "SYNC_SEARCH_STRATEGY" +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.syncquerystatewithurl.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.syncquerystatewithurl.md new file mode 100644 index 0000000000000..aa1a54bcb6257 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.syncquerystatewithurl.md @@ -0,0 +1,31 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [syncQueryStateWithUrl](./kibana-plugin-plugins-data-public.syncquerystatewithurl.md) + +## syncQueryStateWithUrl variable + +Helper to setup syncing of global data with the URL + +Signature: + +```typescript +syncQueryStateWithUrl: (query: Pick<{ + filterManager: import("..").FilterManager; + timefilter: import("..").TimefilterSetup; + state$: import("rxjs").Observable<{ + changes: import("./types").QueryStateChange; + state: QueryState; + }>; + savedQueries: import("..").SavedQueryService; +} | { + filterManager: import("..").FilterManager; + timefilter: import("..").TimefilterSetup; + state$: import("rxjs").Observable<{ + changes: import("./types").QueryStateChange; + state: QueryState; + }>; +}, "state$" | "timefilter" | "filterManager">, kbnUrlStateStorage: IKbnUrlStateStorage) => { + stop: () => void; + hasInheritedQueryFromUrl: boolean; +} +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltercontract.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltercontract.md new file mode 100644 index 0000000000000..0e5e8707fec63 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltercontract.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TimefilterContract](./kibana-plugin-plugins-data-public.timefiltercontract.md) + +## TimefilterContract type + +Signature: + +```typescript +export declare type TimefilterContract = PublicMethodsOf; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltersetup.history.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltersetup.history.md new file mode 100644 index 0000000000000..b2ef4a92c5fef --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltersetup.history.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TimefilterSetup](./kibana-plugin-plugins-data-public.timefiltersetup.md) > [history](./kibana-plugin-plugins-data-public.timefiltersetup.history.md) + +## TimefilterSetup.history property + +Signature: + +```typescript +history: TimeHistoryContract; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltersetup.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltersetup.md new file mode 100644 index 0000000000000..3375b415e923b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltersetup.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TimefilterSetup](./kibana-plugin-plugins-data-public.timefiltersetup.md) + +## TimefilterSetup interface + + +Signature: + +```typescript +export interface TimefilterSetup +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [history](./kibana-plugin-plugins-data-public.timefiltersetup.history.md) | TimeHistoryContract | | +| [timefilter](./kibana-plugin-plugins-data-public.timefiltersetup.timefilter.md) | TimefilterContract | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltersetup.timefilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltersetup.timefilter.md new file mode 100644 index 0000000000000..897ace53a282d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timefiltersetup.timefilter.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TimefilterSetup](./kibana-plugin-plugins-data-public.timefiltersetup.md) > [timefilter](./kibana-plugin-plugins-data-public.timefiltersetup.timefilter.md) + +## TimefilterSetup.timefilter property + +Signature: + +```typescript +timefilter: TimefilterContract; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory._constructor_.md new file mode 100644 index 0000000000000..3d0e7aea5be1f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory._constructor_.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TimeHistory](./kibana-plugin-plugins-data-public.timehistory.md) > [(constructor)](./kibana-plugin-plugins-data-public.timehistory._constructor_.md) + +## TimeHistory.(constructor) + +Constructs a new instance of the `TimeHistory` class + +Signature: + +```typescript +constructor(storage: IStorageWrapper); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| storage | IStorageWrapper | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory.add.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory.add.md new file mode 100644 index 0000000000000..393e10403652d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory.add.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TimeHistory](./kibana-plugin-plugins-data-public.timehistory.md) > [add](./kibana-plugin-plugins-data-public.timehistory.add.md) + +## TimeHistory.add() method + +Signature: + +```typescript +add(time: TimeRange): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| time | TimeRange | | + +Returns: + +`void` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory.get.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory.get.md new file mode 100644 index 0000000000000..fc9983836cd0b --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory.get.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TimeHistory](./kibana-plugin-plugins-data-public.timehistory.md) > [get](./kibana-plugin-plugins-data-public.timehistory.get.md) + +## TimeHistory.get() method + +Signature: + +```typescript +get(): TimeRange[]; +``` +Returns: + +`TimeRange[]` + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory.md new file mode 100644 index 0000000000000..86b9865cbd53f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistory.md @@ -0,0 +1,25 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TimeHistory](./kibana-plugin-plugins-data-public.timehistory.md) + +## TimeHistory class + +Signature: + +```typescript +export declare class TimeHistory +``` + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)(storage)](./kibana-plugin-plugins-data-public.timehistory._constructor_.md) | | Constructs a new instance of the TimeHistory class | + +## Methods + +| Method | Modifiers | Description | +| --- | --- | --- | +| [add(time)](./kibana-plugin-plugins-data-public.timehistory.add.md) | | | +| [get()](./kibana-plugin-plugins-data-public.timehistory.get.md) | | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistorycontract.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistorycontract.md new file mode 100644 index 0000000000000..15dea14c08b19 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timehistorycontract.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TimeHistoryContract](./kibana-plugin-plugins-data-public.timehistorycontract.md) + +## TimeHistoryContract type + +Signature: + +```typescript +export declare type TimeHistoryContract = PublicMethodsOf; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.from.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.from.md new file mode 100644 index 0000000000000..b428bd9cd90ca --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.from.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TimeRange](./kibana-plugin-plugins-data-public.timerange.md) > [from](./kibana-plugin-plugins-data-public.timerange.from.md) + +## TimeRange.from property + +Signature: + +```typescript +from: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.md new file mode 100644 index 0000000000000..69078ca40d20d --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TimeRange](./kibana-plugin-plugins-data-public.timerange.md) + +## TimeRange interface + +Signature: + +```typescript +export interface TimeRange +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [from](./kibana-plugin-plugins-data-public.timerange.from.md) | string | | +| [mode](./kibana-plugin-plugins-data-public.timerange.mode.md) | 'absolute' | 'relative' | | +| [to](./kibana-plugin-plugins-data-public.timerange.to.md) | string | | + diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.mode.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.mode.md new file mode 100644 index 0000000000000..fb9ebd3c9165f --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.mode.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TimeRange](./kibana-plugin-plugins-data-public.timerange.md) > [mode](./kibana-plugin-plugins-data-public.timerange.mode.md) + +## TimeRange.mode property + +Signature: + +```typescript +mode?: 'absolute' | 'relative'; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.to.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.to.md new file mode 100644 index 0000000000000..342acd5e049f1 --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.timerange.to.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TimeRange](./kibana-plugin-plugins-data-public.timerange.md) > [to](./kibana-plugin-plugins-data-public.timerange.to.md) + +## TimeRange.to property + +Signature: + +```typescript +to: string; +``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.tsearchstrategyprovider.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.tsearchstrategyprovider.md new file mode 100644 index 0000000000000..3233bb48cea2c --- /dev/null +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.tsearchstrategyprovider.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [TSearchStrategyProvider](./kibana-plugin-plugins-data-public.tsearchstrategyprovider.md) + +## TSearchStrategyProvider type + +Search strategy provider creates an instance of a search strategy with the request handler context bound to it. This way every search strategy can use whatever information they require from the request context. + +Signature: + +```typescript +export declare type TSearchStrategyProvider = (context: ISearchContext) => ISearchStrategy; +``` diff --git a/docs/development/plugins/data/server/index.md b/docs/development/plugins/data/server/index.md new file mode 100644 index 0000000000000..d2cba1b6c2d9c --- /dev/null +++ b/docs/development/plugins/data/server/index.md @@ -0,0 +1,12 @@ + + +[Home](./index.md) + +## API Reference + +## Packages + +| Package | Description | +| --- | --- | +| [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.castestokbnfieldtypename.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.castestokbnfieldtypename.md new file mode 100644 index 0000000000000..68851503ae53c --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.castestokbnfieldtypename.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [castEsToKbnFieldTypeName](./kibana-plugin-plugins-data-server.castestokbnfieldtypename.md) + +## castEsToKbnFieldTypeName variable + +Get the KbnFieldType name for an esType string + +Signature: + +```typescript +castEsToKbnFieldTypeName: (esType: string) => KBN_FIELD_TYPES +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.es_field_types.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.es_field_types.md new file mode 100644 index 0000000000000..81a7cbca77c48 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.es_field_types.md @@ -0,0 +1,45 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ES\_FIELD\_TYPES](./kibana-plugin-plugins-data-server.es_field_types.md) + +## ES\_FIELD\_TYPES enum + +\* + +Signature: + +```typescript +export declare enum ES_FIELD_TYPES +``` + +## Enumeration Members + +| Member | Value | Description | +| --- | --- | --- | +| \_ID | "_id" | | +| \_INDEX | "_index" | | +| \_SOURCE | "_source" | | +| \_TYPE | "_type" | | +| ATTACHMENT | "attachment" | | +| BOOLEAN | "boolean" | | +| BYTE | "byte" | | +| DATE | "date" | | +| DATE\_NANOS | "date_nanos" | | +| DOUBLE | "double" | | +| FLOAT | "float" | | +| GEO\_POINT | "geo_point" | | +| GEO\_SHAPE | "geo_shape" | | +| HALF\_FLOAT | "half_float" | | +| INTEGER | "integer" | | +| IP | "ip" | | +| KEYWORD | "keyword" | | +| LONG | "long" | | +| MURMUR3 | "murmur3" | | +| NESTED | "nested" | | +| OBJECT | "object" | | +| SCALED\_FLOAT | "scaled_float" | | +| SHORT | "short" | | +| STRING | "string" | | +| TEXT | "text" | | +| TOKEN\_COUNT | "token_count" | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md new file mode 100644 index 0000000000000..d7e80d94db4e6 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esfilters.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [esFilters](./kibana-plugin-plugins-data-server.esfilters.md) + +## esFilters variable + +Signature: + +```typescript +esFilters: { + buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter; + buildCustomFilter: typeof buildCustomFilter; + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; + buildExistsFilter: (field: import("../common").IFieldType, indexPattern: import("../common").IIndexPattern) => import("../common").ExistsFilter; + buildFilter: typeof buildFilter; + buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").IIndexPattern) => import("../common").PhraseFilter; + buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").IIndexPattern) => import("../common").PhrasesFilter; + buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").IIndexPattern, formattedValue?: string | undefined) => import("../common").RangeFilter; + isFilterDisabled: (filter: import("../common").Filter) => boolean; +} +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md new file mode 100644 index 0000000000000..19cb742785e7b --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.eskuery.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [esKuery](./kibana-plugin-plugins-data-server.eskuery.md) + +## esKuery variable + +Signature: + +```typescript +esKuery: { + nodeTypes: import("../common/es_query/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial) => import("../common").KueryNode; + toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").IIndexPattern | undefined, config?: Record | undefined, context?: Record | undefined) => import("../../kibana_utils/common").JsonObject; +} +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md new file mode 100644 index 0000000000000..ac9be23bc6b6f --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esquery.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [esQuery](./kibana-plugin-plugins-data-server.esquery.md) + +## esQuery variable + +Signature: + +```typescript +esQuery: { + buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").IIndexPattern | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => { + must: never[]; + filter: import("../common").Filter[]; + should: never[]; + must_not: import("../common").Filter[]; + }; + getEsQueryConfig: typeof getEsQueryConfig; + buildEsQuery: typeof buildEsQuery; +} +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.allowleadingwildcards.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.allowleadingwildcards.md new file mode 100644 index 0000000000000..ce8303d720747 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.allowleadingwildcards.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) > [allowLeadingWildcards](./kibana-plugin-plugins-data-server.esqueryconfig.allowleadingwildcards.md) + +## EsQueryConfig.allowLeadingWildcards property + +Signature: + +```typescript +allowLeadingWildcards: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.dateformattz.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.dateformattz.md new file mode 100644 index 0000000000000..d3e86f19709f8 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.dateformattz.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) > [dateFormatTZ](./kibana-plugin-plugins-data-server.esqueryconfig.dateformattz.md) + +## EsQueryConfig.dateFormatTZ property + +Signature: + +```typescript +dateFormatTZ?: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.ignorefilteriffieldnotinindex.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.ignorefilteriffieldnotinindex.md new file mode 100644 index 0000000000000..93b3e8915c482 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.ignorefilteriffieldnotinindex.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) > [ignoreFilterIfFieldNotInIndex](./kibana-plugin-plugins-data-server.esqueryconfig.ignorefilteriffieldnotinindex.md) + +## EsQueryConfig.ignoreFilterIfFieldNotInIndex property + +Signature: + +```typescript +ignoreFilterIfFieldNotInIndex: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md new file mode 100644 index 0000000000000..9ae604e07cabd --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) + +## EsQueryConfig interface + +Signature: + +```typescript +export interface EsQueryConfig +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [allowLeadingWildcards](./kibana-plugin-plugins-data-server.esqueryconfig.allowleadingwildcards.md) | boolean | | +| [dateFormatTZ](./kibana-plugin-plugins-data-server.esqueryconfig.dateformattz.md) | string | | +| [ignoreFilterIfFieldNotInIndex](./kibana-plugin-plugins-data-server.esqueryconfig.ignorefilteriffieldnotinindex.md) | boolean | | +| [queryStringOptions](./kibana-plugin-plugins-data-server.esqueryconfig.querystringoptions.md) | Record<string, any> | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.querystringoptions.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.querystringoptions.md new file mode 100644 index 0000000000000..437d36112d015 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.esqueryconfig.querystringoptions.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) > [queryStringOptions](./kibana-plugin-plugins-data-server.esqueryconfig.querystringoptions.md) + +## EsQueryConfig.queryStringOptions property + +Signature: + +```typescript +queryStringOptions: Record; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.es.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.es.md new file mode 100644 index 0000000000000..a3c3ddc4e1649 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.es.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) > [es](./kibana-plugin-plugins-data-server.fieldformatconfig.es.md) + +## FieldFormatConfig.es property + +Signature: + +```typescript +es?: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.id.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.id.md new file mode 100644 index 0000000000000..c5173fba22533 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.id.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) > [id](./kibana-plugin-plugins-data-server.fieldformatconfig.id.md) + +## FieldFormatConfig.id property + +Signature: + +```typescript +id: FieldFormatId; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.md new file mode 100644 index 0000000000000..5d5c13784bc57 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) + +## FieldFormatConfig interface + +Signature: + +```typescript +export interface FieldFormatConfig +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [es](./kibana-plugin-plugins-data-server.fieldformatconfig.es.md) | boolean | | +| [id](./kibana-plugin-plugins-data-server.fieldformatconfig.id.md) | FieldFormatId | | +| [params](./kibana-plugin-plugins-data-server.fieldformatconfig.params.md) | Record<string, any> | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.params.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.params.md new file mode 100644 index 0000000000000..c5e5faef30860 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatconfig.params.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) > [params](./kibana-plugin-plugins-data-server.fieldformatconfig.params.md) + +## FieldFormatConfig.params property + +Signature: + +```typescript +params: Record; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformats.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformats.md new file mode 100644 index 0000000000000..1cc1d829d01cd --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformats.md @@ -0,0 +1,29 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [fieldFormats](./kibana-plugin-plugins-data-server.fieldformats.md) + +## fieldFormats variable + +Signature: + +```typescript +fieldFormats: { + FieldFormatsRegistry: typeof FieldFormatsRegistry; + FieldFormat: typeof FieldFormat; + serializeFieldFormat: (agg: import("../../../legacy/core_plugins/data/public/search").AggConfig) => import("../../expressions/common").SerializedFieldFormat; + BoolFormat: typeof BoolFormat; + BytesFormat: typeof BytesFormat; + ColorFormat: typeof ColorFormat; + DateNanosFormat: typeof DateNanosFormat; + DurationFormat: typeof DurationFormat; + IpFormat: typeof IpFormat; + NumberFormat: typeof NumberFormat; + PercentFormat: typeof PercentFormat; + RelativeDateFormat: typeof RelativeDateFormat; + SourceFormat: typeof SourceFormat; + StaticLookupFormat: typeof StaticLookupFormat; + UrlFormat: typeof UrlFormat; + StringFormat: typeof StringFormat; + TruncateFormat: typeof TruncateFormat; +} +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md new file mode 100644 index 0000000000000..c8815ed42d3b3 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md) + +## FieldFormatsGetConfigFn type + +Signature: + +```typescript +export declare type FieldFormatsGetConfigFn = (key: string, defaultOverride?: T) => T; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter._state.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter._state.md new file mode 100644 index 0000000000000..079f352609a70 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter._state.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Filter](./kibana-plugin-plugins-data-server.filter.md) > [$state](./kibana-plugin-plugins-data-server.filter._state.md) + +## Filter.$state property + +Signature: + +```typescript +$state?: FilterState; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md new file mode 100644 index 0000000000000..4e4c49b222f01 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Filter](./kibana-plugin-plugins-data-server.filter.md) + +## Filter interface + +Signature: + +```typescript +export interface Filter +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [$state](./kibana-plugin-plugins-data-server.filter._state.md) | FilterState | | +| [meta](./kibana-plugin-plugins-data-server.filter.meta.md) | FilterMeta | | +| [query](./kibana-plugin-plugins-data-server.filter.query.md) | any | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.meta.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.meta.md new file mode 100644 index 0000000000000..6d11804704d82 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.meta.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Filter](./kibana-plugin-plugins-data-server.filter.md) > [meta](./kibana-plugin-plugins-data-server.filter.meta.md) + +## Filter.meta property + +Signature: + +```typescript +meta: FilterMeta; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.query.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.query.md new file mode 100644 index 0000000000000..942c7930f449d --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.filter.query.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Filter](./kibana-plugin-plugins-data-server.filter.md) > [query](./kibana-plugin-plugins-data-server.filter.query.md) + +## Filter.query property + +Signature: + +```typescript +query?: any; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.getdefaultsearchparams.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.getdefaultsearchparams.md new file mode 100644 index 0000000000000..9de005c1fd0dd --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.getdefaultsearchparams.md @@ -0,0 +1,30 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [getDefaultSearchParams](./kibana-plugin-plugins-data-server.getdefaultsearchparams.md) + +## getDefaultSearchParams() function + +Signature: + +```typescript +export declare function getDefaultSearchParams(config: SharedGlobalConfig): { + timeout: string; + ignoreUnavailable: boolean; + restTotalHitsAsInt: boolean; +}; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| config | SharedGlobalConfig | | + +Returns: + +`{ + timeout: string; + ignoreUnavailable: boolean; + restTotalHitsAsInt: boolean; +}` + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.icancel.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.icancel.md new file mode 100644 index 0000000000000..27141c68ae1a7 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.icancel.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ICancel](./kibana-plugin-plugins-data-server.icancel.md) + +## ICancel type + +Signature: + +```typescript +export declare type ICancel = (id: string) => Promise; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldformatsregistry.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldformatsregistry.md new file mode 100644 index 0000000000000..c284d2c87fcaa --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldformatsregistry.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldFormatsRegistry](./kibana-plugin-plugins-data-server.ifieldformatsregistry.md) + +## IFieldFormatsRegistry type + +Signature: + +```typescript +declare type IFieldFormatsRegistry = PublicMethodsOf; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md new file mode 100644 index 0000000000000..70140e51a7316 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) + +## IFieldSubType interface + +Signature: + +```typescript +export interface IFieldSubType +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [multi](./kibana-plugin-plugins-data-server.ifieldsubtype.multi.md) | {
parent: string;
} | | +| [nested](./kibana-plugin-plugins-data-server.ifieldsubtype.nested.md) | {
path: string;
} | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.multi.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.multi.md new file mode 100644 index 0000000000000..31a3bc53d6343 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.multi.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) > [multi](./kibana-plugin-plugins-data-server.ifieldsubtype.multi.md) + +## IFieldSubType.multi property + +Signature: + +```typescript +multi?: { + parent: string; + }; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.nested.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.nested.md new file mode 100644 index 0000000000000..b53a4406aedc2 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldsubtype.nested.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) > [nested](./kibana-plugin-plugins-data-server.ifieldsubtype.nested.md) + +## IFieldSubType.nested property + +Signature: + +```typescript +nested?: { + path: string; + }; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.aggregatable.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.aggregatable.md new file mode 100644 index 0000000000000..74ea0e0181a11 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.aggregatable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [aggregatable](./kibana-plugin-plugins-data-server.ifieldtype.aggregatable.md) + +## IFieldType.aggregatable property + +Signature: + +```typescript +aggregatable?: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.count.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.count.md new file mode 100644 index 0000000000000..81dfce2024fc9 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.count.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [count](./kibana-plugin-plugins-data-server.ifieldtype.count.md) + +## IFieldType.count property + +Signature: + +```typescript +count?: number; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.displayname.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.displayname.md new file mode 100644 index 0000000000000..b00f829c8909d --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.displayname.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [displayName](./kibana-plugin-plugins-data-server.ifieldtype.displayname.md) + +## IFieldType.displayName property + +Signature: + +```typescript +displayName?: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.estypes.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.estypes.md new file mode 100644 index 0000000000000..779e3d0ecedf4 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.estypes.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [esTypes](./kibana-plugin-plugins-data-server.ifieldtype.estypes.md) + +## IFieldType.esTypes property + +Signature: + +```typescript +esTypes?: string[]; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.filterable.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.filterable.md new file mode 100644 index 0000000000000..eaf8e91e0fe7d --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.filterable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [filterable](./kibana-plugin-plugins-data-server.ifieldtype.filterable.md) + +## IFieldType.filterable property + +Signature: + +```typescript +filterable?: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.format.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.format.md new file mode 100644 index 0000000000000..afdbfc9b65d05 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.format.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [format](./kibana-plugin-plugins-data-server.ifieldtype.format.md) + +## IFieldType.format property + +Signature: + +```typescript +format?: any; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.lang.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.lang.md new file mode 100644 index 0000000000000..d033804cb6fcb --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.lang.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [lang](./kibana-plugin-plugins-data-server.ifieldtype.lang.md) + +## IFieldType.lang property + +Signature: + +```typescript +lang?: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md new file mode 100644 index 0000000000000..5375cf2a2ef43 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.md @@ -0,0 +1,33 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) + +## IFieldType interface + +Signature: + +```typescript +export interface IFieldType +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [aggregatable](./kibana-plugin-plugins-data-server.ifieldtype.aggregatable.md) | boolean | | +| [count](./kibana-plugin-plugins-data-server.ifieldtype.count.md) | number | | +| [displayName](./kibana-plugin-plugins-data-server.ifieldtype.displayname.md) | string | | +| [esTypes](./kibana-plugin-plugins-data-server.ifieldtype.estypes.md) | string[] | | +| [filterable](./kibana-plugin-plugins-data-server.ifieldtype.filterable.md) | boolean | | +| [format](./kibana-plugin-plugins-data-server.ifieldtype.format.md) | any | | +| [lang](./kibana-plugin-plugins-data-server.ifieldtype.lang.md) | string | | +| [name](./kibana-plugin-plugins-data-server.ifieldtype.name.md) | string | | +| [readFromDocValues](./kibana-plugin-plugins-data-server.ifieldtype.readfromdocvalues.md) | boolean | | +| [script](./kibana-plugin-plugins-data-server.ifieldtype.script.md) | string | | +| [scripted](./kibana-plugin-plugins-data-server.ifieldtype.scripted.md) | boolean | | +| [searchable](./kibana-plugin-plugins-data-server.ifieldtype.searchable.md) | boolean | | +| [sortable](./kibana-plugin-plugins-data-server.ifieldtype.sortable.md) | boolean | | +| [subType](./kibana-plugin-plugins-data-server.ifieldtype.subtype.md) | IFieldSubType | | +| [type](./kibana-plugin-plugins-data-server.ifieldtype.type.md) | string | | +| [visualizable](./kibana-plugin-plugins-data-server.ifieldtype.visualizable.md) | boolean | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.name.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.name.md new file mode 100644 index 0000000000000..8be33a3f56d97 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.name.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [name](./kibana-plugin-plugins-data-server.ifieldtype.name.md) + +## IFieldType.name property + +Signature: + +```typescript +name: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.readfromdocvalues.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.readfromdocvalues.md new file mode 100644 index 0000000000000..a77ce1821ed92 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.readfromdocvalues.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [readFromDocValues](./kibana-plugin-plugins-data-server.ifieldtype.readfromdocvalues.md) + +## IFieldType.readFromDocValues property + +Signature: + +```typescript +readFromDocValues?: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.script.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.script.md new file mode 100644 index 0000000000000..b54a952a11253 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.script.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [script](./kibana-plugin-plugins-data-server.ifieldtype.script.md) + +## IFieldType.script property + +Signature: + +```typescript +script?: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.scripted.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.scripted.md new file mode 100644 index 0000000000000..f7a8ed9aee0df --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.scripted.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [scripted](./kibana-plugin-plugins-data-server.ifieldtype.scripted.md) + +## IFieldType.scripted property + +Signature: + +```typescript +scripted?: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.searchable.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.searchable.md new file mode 100644 index 0000000000000..002a48b60ec7d --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.searchable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [searchable](./kibana-plugin-plugins-data-server.ifieldtype.searchable.md) + +## IFieldType.searchable property + +Signature: + +```typescript +searchable?: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.sortable.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.sortable.md new file mode 100644 index 0000000000000..c6c8bffc743be --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.sortable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [sortable](./kibana-plugin-plugins-data-server.ifieldtype.sortable.md) + +## IFieldType.sortable property + +Signature: + +```typescript +sortable?: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.subtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.subtype.md new file mode 100644 index 0000000000000..fa78b23a2b558 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.subtype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [subType](./kibana-plugin-plugins-data-server.ifieldtype.subtype.md) + +## IFieldType.subType property + +Signature: + +```typescript +subType?: IFieldSubType; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.type.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.type.md new file mode 100644 index 0000000000000..ef6a4dcc167c5 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [type](./kibana-plugin-plugins-data-server.ifieldtype.type.md) + +## IFieldType.type property + +Signature: + +```typescript +type: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.visualizable.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.visualizable.md new file mode 100644 index 0000000000000..3d0987f685db4 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.ifieldtype.visualizable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) > [visualizable](./kibana-plugin-plugins-data-server.ifieldtype.visualizable.md) + +## IFieldType.visualizable property + +Signature: + +```typescript +visualizable?: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.fieldformatmap.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.fieldformatmap.md new file mode 100644 index 0000000000000..ab9e3171d7d7b --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.fieldformatmap.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IIndexPattern](./kibana-plugin-plugins-data-server.iindexpattern.md) > [fieldFormatMap](./kibana-plugin-plugins-data-server.iindexpattern.fieldformatmap.md) + +## IIndexPattern.fieldFormatMap property + +Signature: + +```typescript +fieldFormatMap?: Record; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.fields.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.fields.md new file mode 100644 index 0000000000000..fb6d046ff2174 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.fields.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IIndexPattern](./kibana-plugin-plugins-data-server.iindexpattern.md) > [fields](./kibana-plugin-plugins-data-server.iindexpattern.fields.md) + +## IIndexPattern.fields property + +Signature: + +```typescript +fields: IFieldType[]; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.id.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.id.md new file mode 100644 index 0000000000000..cac263df0f9aa --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.id.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IIndexPattern](./kibana-plugin-plugins-data-server.iindexpattern.md) > [id](./kibana-plugin-plugins-data-server.iindexpattern.id.md) + +## IIndexPattern.id property + +Signature: + +```typescript +id?: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.md new file mode 100644 index 0000000000000..24b56a9b98621 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IIndexPattern](./kibana-plugin-plugins-data-server.iindexpattern.md) + +## IIndexPattern interface + +Signature: + +```typescript +export interface IIndexPattern +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [fieldFormatMap](./kibana-plugin-plugins-data-server.iindexpattern.fieldformatmap.md) | Record<string, {
id: string;
params: unknown;
}> | | +| [fields](./kibana-plugin-plugins-data-server.iindexpattern.fields.md) | IFieldType[] | | +| [id](./kibana-plugin-plugins-data-server.iindexpattern.id.md) | string | | +| [timeFieldName](./kibana-plugin-plugins-data-server.iindexpattern.timefieldname.md) | string | | +| [title](./kibana-plugin-plugins-data-server.iindexpattern.title.md) | string | | +| [type](./kibana-plugin-plugins-data-server.iindexpattern.type.md) | string | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.timefieldname.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.timefieldname.md new file mode 100644 index 0000000000000..14cf514477da4 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.timefieldname.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IIndexPattern](./kibana-plugin-plugins-data-server.iindexpattern.md) > [timeFieldName](./kibana-plugin-plugins-data-server.iindexpattern.timefieldname.md) + +## IIndexPattern.timeFieldName property + +Signature: + +```typescript +timeFieldName?: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.title.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.title.md new file mode 100644 index 0000000000000..119963d7ff95d --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.title.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IIndexPattern](./kibana-plugin-plugins-data-server.iindexpattern.md) > [title](./kibana-plugin-plugins-data-server.iindexpattern.title.md) + +## IIndexPattern.title property + +Signature: + +```typescript +title: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.type.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.type.md new file mode 100644 index 0000000000000..6b89b71664b23 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iindexpattern.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IIndexPattern](./kibana-plugin-plugins-data-server.iindexpattern.md) > [type](./kibana-plugin-plugins-data-server.iindexpattern.type.md) + +## IIndexPattern.type property + +Signature: + +```typescript +type?: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.fields.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.fields.md new file mode 100644 index 0000000000000..58a4066c02b20 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.fields.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-server.indexpatternattributes.md) > [fields](./kibana-plugin-plugins-data-server.indexpatternattributes.fields.md) + +## IndexPatternAttributes.fields property + +Signature: + +```typescript +fields: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.md new file mode 100644 index 0000000000000..1fcc49796f59e --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.md @@ -0,0 +1,28 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-server.indexpatternattributes.md) + +## IndexPatternAttributes interface + +> Warning: This API is now obsolete. +> +> + +Use data plugin interface instead + +Signature: + +```typescript +export interface IndexPatternAttributes +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [fields](./kibana-plugin-plugins-data-server.indexpatternattributes.fields.md) | string | | +| [timeFieldName](./kibana-plugin-plugins-data-server.indexpatternattributes.timefieldname.md) | string | | +| [title](./kibana-plugin-plugins-data-server.indexpatternattributes.title.md) | string | | +| [type](./kibana-plugin-plugins-data-server.indexpatternattributes.type.md) | string | | +| [typeMeta](./kibana-plugin-plugins-data-server.indexpatternattributes.typemeta.md) | string | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.timefieldname.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.timefieldname.md new file mode 100644 index 0000000000000..8e5f765020af4 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.timefieldname.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-server.indexpatternattributes.md) > [timeFieldName](./kibana-plugin-plugins-data-server.indexpatternattributes.timefieldname.md) + +## IndexPatternAttributes.timeFieldName property + +Signature: + +```typescript +timeFieldName?: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.title.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.title.md new file mode 100644 index 0000000000000..28e4fd418fabc --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.title.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-server.indexpatternattributes.md) > [title](./kibana-plugin-plugins-data-server.indexpatternattributes.title.md) + +## IndexPatternAttributes.title property + +Signature: + +```typescript +title: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.type.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.type.md new file mode 100644 index 0000000000000..e88be8fd31246 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-server.indexpatternattributes.md) > [type](./kibana-plugin-plugins-data-server.indexpatternattributes.type.md) + +## IndexPatternAttributes.type property + +Signature: + +```typescript +type: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.typemeta.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.typemeta.md new file mode 100644 index 0000000000000..44fee7c1a6317 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternattributes.typemeta.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-server.indexpatternattributes.md) > [typeMeta](./kibana-plugin-plugins-data-server.indexpatternattributes.typemeta.md) + +## IndexPatternAttributes.typeMeta property + +Signature: + +```typescript +typeMeta: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.aggregatable.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.aggregatable.md new file mode 100644 index 0000000000000..92994b851ec85 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.aggregatable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternFieldDescriptor](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md) > [aggregatable](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.aggregatable.md) + +## IndexPatternFieldDescriptor.aggregatable property + +Signature: + +```typescript +aggregatable: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.estypes.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.estypes.md new file mode 100644 index 0000000000000..f24ba9a48d85e --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.estypes.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternFieldDescriptor](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md) > [esTypes](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.estypes.md) + +## IndexPatternFieldDescriptor.esTypes property + +Signature: + +```typescript +esTypes: string[]; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md new file mode 100644 index 0000000000000..d84d0cba06ac6 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternFieldDescriptor](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md) + +## IndexPatternFieldDescriptor interface + +Signature: + +```typescript +export interface FieldDescriptor +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [aggregatable](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.aggregatable.md) | boolean | | +| [esTypes](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.estypes.md) | string[] | | +| [name](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.name.md) | string | | +| [readFromDocValues](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.readfromdocvalues.md) | boolean | | +| [searchable](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.searchable.md) | boolean | | +| [subType](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.subtype.md) | FieldSubType | | +| [type](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.type.md) | string | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.name.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.name.md new file mode 100644 index 0000000000000..16ea60c5b8ae2 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.name.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternFieldDescriptor](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md) > [name](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.name.md) + +## IndexPatternFieldDescriptor.name property + +Signature: + +```typescript +name: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.readfromdocvalues.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.readfromdocvalues.md new file mode 100644 index 0000000000000..fc8667196c879 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.readfromdocvalues.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternFieldDescriptor](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md) > [readFromDocValues](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.readfromdocvalues.md) + +## IndexPatternFieldDescriptor.readFromDocValues property + +Signature: + +```typescript +readFromDocValues: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.searchable.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.searchable.md new file mode 100644 index 0000000000000..7d159c65b40bd --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.searchable.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternFieldDescriptor](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md) > [searchable](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.searchable.md) + +## IndexPatternFieldDescriptor.searchable property + +Signature: + +```typescript +searchable: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.subtype.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.subtype.md new file mode 100644 index 0000000000000..7053eaf08138c --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.subtype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternFieldDescriptor](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md) > [subType](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.subtype.md) + +## IndexPatternFieldDescriptor.subType property + +Signature: + +```typescript +subType?: FieldSubType; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.type.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.type.md new file mode 100644 index 0000000000000..bb571d1bee14a --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternfielddescriptor.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternFieldDescriptor](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md) > [type](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.type.md) + +## IndexPatternFieldDescriptor.type property + +Signature: + +```typescript +type: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatterns.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatterns.md new file mode 100644 index 0000000000000..935d7fbacf946 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatterns.md @@ -0,0 +1,14 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [indexPatterns](./kibana-plugin-plugins-data-server.indexpatterns.md) + +## indexPatterns variable + +Signature: + +```typescript +indexPatterns: { + isFilterable: typeof isFilterable; + isNestedField: typeof isNestedField; +} +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher._constructor_.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher._constructor_.md new file mode 100644 index 0000000000000..f9bbcc5a356e1 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher._constructor_.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternsFetcher](./kibana-plugin-plugins-data-server.indexpatternsfetcher.md) > [(constructor)](./kibana-plugin-plugins-data-server.indexpatternsfetcher._constructor_.md) + +## IndexPatternsFetcher.(constructor) + +Constructs a new instance of the `IndexPatternsFetcher` class + +Signature: + +```typescript +constructor(callDataCluster: APICaller); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| callDataCluster | APICaller | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsfortimepattern.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsfortimepattern.md new file mode 100644 index 0000000000000..7d765d4c65eb1 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsfortimepattern.md @@ -0,0 +1,29 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternsFetcher](./kibana-plugin-plugins-data-server.indexpatternsfetcher.md) > [getFieldsForTimePattern](./kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsfortimepattern.md) + +## IndexPatternsFetcher.getFieldsForTimePattern() method + +Get a list of field objects for a time pattern + +Signature: + +```typescript +getFieldsForTimePattern(options: { + pattern: string; + metaFields: string[]; + lookBack: number; + interval: string; + }): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| options | {
pattern: string;
metaFields: string[];
lookBack: number;
interval: string;
} | | + +Returns: + +`Promise` + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsforwildcard.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsforwildcard.md new file mode 100644 index 0000000000000..6bd3bbf2433cd --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsforwildcard.md @@ -0,0 +1,27 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternsFetcher](./kibana-plugin-plugins-data-server.indexpatternsfetcher.md) > [getFieldsForWildcard](./kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsforwildcard.md) + +## IndexPatternsFetcher.getFieldsForWildcard() method + +Get a list of field objects for an index pattern that may contain wildcards + +Signature: + +```typescript +getFieldsForWildcard(options: { + pattern: string | string[]; + metaFields?: string[]; + }): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| options | {
pattern: string | string[];
metaFields?: string[];
} | | + +Returns: + +`Promise` + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.md new file mode 100644 index 0000000000000..f71a702f3381d --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpatternsfetcher.md @@ -0,0 +1,25 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternsFetcher](./kibana-plugin-plugins-data-server.indexpatternsfetcher.md) + +## IndexPatternsFetcher class + +Signature: + +```typescript +export declare class IndexPatternsFetcher +``` + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)(callDataCluster)](./kibana-plugin-plugins-data-server.indexpatternsfetcher._constructor_.md) | | Constructs a new instance of the IndexPatternsFetcher class | + +## Methods + +| Method | Modifiers | Description | +| --- | --- | --- | +| [getFieldsForTimePattern(options)](./kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsfortimepattern.md) | | Get a list of field objects for a time pattern | +| [getFieldsForWildcard(options)](./kibana-plugin-plugins-data-server.indexpatternsfetcher.getfieldsforwildcard.md) | | Get a list of field objects for an index pattern that may contain wildcards | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.irequesttypesmap.es.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.irequesttypesmap.es.md new file mode 100644 index 0000000000000..9cebff05dc9db --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.irequesttypesmap.es.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IRequestTypesMap](./kibana-plugin-plugins-data-server.irequesttypesmap.md) > [es](./kibana-plugin-plugins-data-server.irequesttypesmap.es.md) + +## IRequestTypesMap.es property + +Signature: + +```typescript +[ES_SEARCH_STRATEGY]: IEsSearchRequest; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.irequesttypesmap.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.irequesttypesmap.md new file mode 100644 index 0000000000000..a9bb8f1eb9d6d --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.irequesttypesmap.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IRequestTypesMap](./kibana-plugin-plugins-data-server.irequesttypesmap.md) + +## IRequestTypesMap interface + +Signature: + +```typescript +export interface IRequestTypesMap +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [es](./kibana-plugin-plugins-data-server.irequesttypesmap.es.md) | IEsSearchRequest | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iresponsetypesmap.es.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iresponsetypesmap.es.md new file mode 100644 index 0000000000000..1154fc141d6c7 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iresponsetypesmap.es.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IResponseTypesMap](./kibana-plugin-plugins-data-server.iresponsetypesmap.md) > [es](./kibana-plugin-plugins-data-server.iresponsetypesmap.es.md) + +## IResponseTypesMap.es property + +Signature: + +```typescript +[ES_SEARCH_STRATEGY]: IEsSearchResponse; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iresponsetypesmap.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iresponsetypesmap.md new file mode 100644 index 0000000000000..fe5fa0a5d3a33 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.iresponsetypesmap.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IResponseTypesMap](./kibana-plugin-plugins-data-server.iresponsetypesmap.md) + +## IResponseTypesMap interface + +Signature: + +```typescript +export interface IResponseTypesMap +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [es](./kibana-plugin-plugins-data-server.iresponsetypesmap.es.md) | IEsSearchResponse | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearch.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearch.md new file mode 100644 index 0000000000000..6e037f5161b53 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearch.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearch](./kibana-plugin-plugins-data-server.isearch.md) + +## ISearch type + +Signature: + +```typescript +export declare type ISearch = (request: IRequestTypesMap[T], options?: ISearchOptions) => Promise; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.config_.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.config_.md new file mode 100644 index 0000000000000..364d44dba758a --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.config_.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchContext](./kibana-plugin-plugins-data-server.isearchcontext.md) > [config$](./kibana-plugin-plugins-data-server.isearchcontext.config_.md) + +## ISearchContext.config$ property + +Signature: + +```typescript +config$: Observable; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.core.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.core.md new file mode 100644 index 0000000000000..9d571c25d94bd --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.core.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchContext](./kibana-plugin-plugins-data-server.isearchcontext.md) > [core](./kibana-plugin-plugins-data-server.isearchcontext.core.md) + +## ISearchContext.core property + +Signature: + +```typescript +core: CoreSetup; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.md new file mode 100644 index 0000000000000..1c3c5ec78f894 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchcontext.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchContext](./kibana-plugin-plugins-data-server.isearchcontext.md) + +## ISearchContext interface + +Signature: + +```typescript +export interface ISearchContext +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [config$](./kibana-plugin-plugins-data-server.isearchcontext.config_.md) | Observable<SharedGlobalConfig> | | +| [core](./kibana-plugin-plugins-data-server.isearchcontext.core.md) | CoreSetup | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.md new file mode 100644 index 0000000000000..0319048f4418b --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchOptions](./kibana-plugin-plugins-data-server.isearchoptions.md) + +## ISearchOptions interface + +Signature: + +```typescript +export interface ISearchOptions +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [signal](./kibana-plugin-plugins-data-server.isearchoptions.signal.md) | AbortSignal | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.signal.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.signal.md new file mode 100644 index 0000000000000..7da5c182b2e0f --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.isearchoptions.signal.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [ISearchOptions](./kibana-plugin-plugins-data-server.isearchoptions.md) > [signal](./kibana-plugin-plugins-data-server.isearchoptions.signal.md) + +## ISearchOptions.signal property + +Signature: + +```typescript +signal?: AbortSignal; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kbn_field_types.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kbn_field_types.md new file mode 100644 index 0000000000000..40b81d2f6ac4d --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kbn_field_types.md @@ -0,0 +1,33 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [KBN\_FIELD\_TYPES](./kibana-plugin-plugins-data-server.kbn_field_types.md) + +## KBN\_FIELD\_TYPES enum + +\* + +Signature: + +```typescript +export declare enum KBN_FIELD_TYPES +``` + +## Enumeration Members + +| Member | Value | Description | +| --- | --- | --- | +| \_SOURCE | "_source" | | +| ATTACHMENT | "attachment" | | +| BOOLEAN | "boolean" | | +| CONFLICT | "conflict" | | +| DATE | "date" | | +| GEO\_POINT | "geo_point" | | +| GEO\_SHAPE | "geo_shape" | | +| IP | "ip" | | +| MURMUR3 | "murmur3" | | +| NESTED | "nested" | | +| NUMBER | "number" | | +| OBJECT | "object" | | +| STRING | "string" | | +| UNKNOWN | "unknown" | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md new file mode 100644 index 0000000000000..3a258a5b98616 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [KueryNode](./kibana-plugin-plugins-data-server.kuerynode.md) + +## KueryNode interface + +Signature: + +```typescript +export interface KueryNode +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [type](./kibana-plugin-plugins-data-server.kuerynode.type.md) | keyof NodeTypes | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.type.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.type.md new file mode 100644 index 0000000000000..192a2c05191c7 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.kuerynode.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [KueryNode](./kibana-plugin-plugins-data-server.kuerynode.md) > [type](./kibana-plugin-plugins-data-server.kuerynode.type.md) + +## KueryNode.type property + +Signature: + +```typescript +type: keyof NodeTypes; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md new file mode 100644 index 0000000000000..507e60971526b --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.md @@ -0,0 +1,73 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) + +## kibana-plugin-plugins-data-server package + +## Classes + +| Class | Description | +| --- | --- | +| [IndexPatternsFetcher](./kibana-plugin-plugins-data-server.indexpatternsfetcher.md) | | +| [Plugin](./kibana-plugin-plugins-data-server.plugin.md) | | + +## Enumerations + +| Enumeration | Description | +| --- | --- | +| [ES\_FIELD\_TYPES](./kibana-plugin-plugins-data-server.es_field_types.md) | \* | +| [KBN\_FIELD\_TYPES](./kibana-plugin-plugins-data-server.kbn_field_types.md) | \* | + +## Functions + +| Function | Description | +| --- | --- | +| [getDefaultSearchParams(config)](./kibana-plugin-plugins-data-server.getdefaultsearchparams.md) | | +| [parseInterval(interval)](./kibana-plugin-plugins-data-server.parseinterval.md) | | +| [plugin(initializerContext)](./kibana-plugin-plugins-data-server.plugin.md) | Static code to be shared externally | +| [shouldReadFieldFromDocValues(aggregatable, esType)](./kibana-plugin-plugins-data-server.shouldreadfieldfromdocvalues.md) | | + +## Interfaces + +| Interface | Description | +| --- | --- | +| [EsQueryConfig](./kibana-plugin-plugins-data-server.esqueryconfig.md) | | +| [FieldFormatConfig](./kibana-plugin-plugins-data-server.fieldformatconfig.md) | | +| [Filter](./kibana-plugin-plugins-data-server.filter.md) | | +| [IFieldSubType](./kibana-plugin-plugins-data-server.ifieldsubtype.md) | | +| [IFieldType](./kibana-plugin-plugins-data-server.ifieldtype.md) | | +| [IIndexPattern](./kibana-plugin-plugins-data-server.iindexpattern.md) | | +| [IndexPatternAttributes](./kibana-plugin-plugins-data-server.indexpatternattributes.md) | Use data plugin interface instead | +| [IndexPatternFieldDescriptor](./kibana-plugin-plugins-data-server.indexpatternfielddescriptor.md) | | +| [IRequestTypesMap](./kibana-plugin-plugins-data-server.irequesttypesmap.md) | | +| [IResponseTypesMap](./kibana-plugin-plugins-data-server.iresponsetypesmap.md) | | +| [ISearchContext](./kibana-plugin-plugins-data-server.isearchcontext.md) | | +| [ISearchOptions](./kibana-plugin-plugins-data-server.isearchoptions.md) | | +| [KueryNode](./kibana-plugin-plugins-data-server.kuerynode.md) | | +| [PluginSetup](./kibana-plugin-plugins-data-server.pluginsetup.md) | | +| [PluginStart](./kibana-plugin-plugins-data-server.pluginstart.md) | | +| [Query](./kibana-plugin-plugins-data-server.query.md) | | +| [RefreshInterval](./kibana-plugin-plugins-data-server.refreshinterval.md) | | +| [TimeRange](./kibana-plugin-plugins-data-server.timerange.md) | | + +## Variables + +| Variable | Description | +| --- | --- | +| [castEsToKbnFieldTypeName](./kibana-plugin-plugins-data-server.castestokbnfieldtypename.md) | Get the KbnFieldType name for an esType string | +| [esFilters](./kibana-plugin-plugins-data-server.esfilters.md) | | +| [esKuery](./kibana-plugin-plugins-data-server.eskuery.md) | | +| [esQuery](./kibana-plugin-plugins-data-server.esquery.md) | | +| [fieldFormats](./kibana-plugin-plugins-data-server.fieldformats.md) | | +| [indexPatterns](./kibana-plugin-plugins-data-server.indexpatterns.md) | | + +## Type Aliases + +| Type Alias | Description | +| --- | --- | +| [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md) | | +| [ICancel](./kibana-plugin-plugins-data-server.icancel.md) | | +| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-server.ifieldformatsregistry.md) | | +| [ISearch](./kibana-plugin-plugins-data-server.isearch.md) | | +| [TSearchStrategyProvider](./kibana-plugin-plugins-data-server.tsearchstrategyprovider.md) | Search strategy provider creates an instance of a search strategy with the request handler context bound to it. This way every search strategy can use whatever information they require from the request context. | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.parseinterval.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.parseinterval.md new file mode 100644 index 0000000000000..c0cb9862973d7 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.parseinterval.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [parseInterval](./kibana-plugin-plugins-data-server.parseinterval.md) + +## parseInterval() function + +Signature: + +```typescript +export declare function parseInterval(interval: string): moment.Duration | null; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| interval | string | | + +Returns: + +`moment.Duration | null` + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin._constructor_.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin._constructor_.md new file mode 100644 index 0000000000000..454d8a059a252 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin._constructor_.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Plugin](./kibana-plugin-plugins-data-server.plugin.md) > [(constructor)](./kibana-plugin-plugins-data-server.plugin._constructor_.md) + +## Plugin.(constructor) + +Constructs a new instance of the `DataServerPlugin` class + +Signature: + +```typescript +constructor(initializerContext: PluginInitializerContext); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| initializerContext | PluginInitializerContext | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.md new file mode 100644 index 0000000000000..b3ba75ce29ab6 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [plugin](./kibana-plugin-plugins-data-server.plugin.md) + +## plugin() function + +Static code to be shared externally + +Signature: + +```typescript +export declare function plugin(initializerContext: PluginInitializerContext): DataServerPlugin; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| initializerContext | PluginInitializerContext | | + +Returns: + +`DataServerPlugin` + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md new file mode 100644 index 0000000000000..5c2f542204079 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.setup.md @@ -0,0 +1,33 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Plugin](./kibana-plugin-plugins-data-server.plugin.md) > [setup](./kibana-plugin-plugins-data-server.plugin.setup.md) + +## Plugin.setup() method + +Signature: + +```typescript +setup(core: CoreSetup, { usageCollection }: DataPluginSetupDependencies): { + fieldFormats: { + register: (customFieldFormat: import("../common").IFieldFormatType) => number; + }; + search: ISearchSetup; + }; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| core | CoreSetup | | +| { usageCollection } | DataPluginSetupDependencies | | + +Returns: + +`{ + fieldFormats: { + register: (customFieldFormat: import("../common").IFieldFormatType) => number; + }; + search: ISearchSetup; + }` + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.start.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.start.md new file mode 100644 index 0000000000000..2a30cd3e68158 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.start.md @@ -0,0 +1,30 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Plugin](./kibana-plugin-plugins-data-server.plugin.md) > [start](./kibana-plugin-plugins-data-server.plugin.start.md) + +## Plugin.start() method + +Signature: + +```typescript +start(core: CoreStart): { + fieldFormats: { + fieldFormatServiceFactory: (uiSettings: import("kibana/server").IUiSettingsClient) => Promise; + }; + }; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| core | CoreStart | | + +Returns: + +`{ + fieldFormats: { + fieldFormatServiceFactory: (uiSettings: import("kibana/server").IUiSettingsClient) => Promise; + }; + }` + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.stop.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.stop.md new file mode 100644 index 0000000000000..4b5b54f64128c --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.plugin.stop.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Plugin](./kibana-plugin-plugins-data-server.plugin.md) > [stop](./kibana-plugin-plugins-data-server.plugin.stop.md) + +## Plugin.stop() method + +Signature: + +```typescript +stop(): void; +``` +Returns: + +`void` + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.fieldformats.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.fieldformats.md new file mode 100644 index 0000000000000..648e23e597f4d --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.fieldformats.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [PluginSetup](./kibana-plugin-plugins-data-server.pluginsetup.md) > [fieldFormats](./kibana-plugin-plugins-data-server.pluginsetup.fieldformats.md) + +## PluginSetup.fieldFormats property + +Signature: + +```typescript +fieldFormats: FieldFormatsSetup; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.md new file mode 100644 index 0000000000000..fa289c0a3f4bd --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [PluginSetup](./kibana-plugin-plugins-data-server.pluginsetup.md) + +## PluginSetup interface + +Signature: + +```typescript +export interface DataPluginSetup +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [fieldFormats](./kibana-plugin-plugins-data-server.pluginsetup.fieldformats.md) | FieldFormatsSetup | | +| [search](./kibana-plugin-plugins-data-server.pluginsetup.search.md) | ISearchSetup | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.search.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.search.md new file mode 100644 index 0000000000000..eb1107604113b --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginsetup.search.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [PluginSetup](./kibana-plugin-plugins-data-server.pluginsetup.md) > [search](./kibana-plugin-plugins-data-server.pluginsetup.search.md) + +## PluginSetup.search property + +Signature: + +```typescript +search: ISearchSetup; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginstart.fieldformats.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginstart.fieldformats.md new file mode 100644 index 0000000000000..7a77c6c943cd7 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginstart.fieldformats.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [PluginStart](./kibana-plugin-plugins-data-server.pluginstart.md) > [fieldFormats](./kibana-plugin-plugins-data-server.pluginstart.fieldformats.md) + +## PluginStart.fieldFormats property + +Signature: + +```typescript +fieldFormats: FieldFormatsStart; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginstart.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginstart.md new file mode 100644 index 0000000000000..b7d6a7e8a83fd --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.pluginstart.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [PluginStart](./kibana-plugin-plugins-data-server.pluginstart.md) + +## PluginStart interface + +Signature: + +```typescript +export interface DataPluginStart +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [fieldFormats](./kibana-plugin-plugins-data-server.pluginstart.fieldformats.md) | FieldFormatsStart | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.language.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.language.md new file mode 100644 index 0000000000000..384fc77d801c0 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.language.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Query](./kibana-plugin-plugins-data-server.query.md) > [language](./kibana-plugin-plugins-data-server.query.language.md) + +## Query.language property + +Signature: + +```typescript +language: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.md new file mode 100644 index 0000000000000..5d61c75bc5e99 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Query](./kibana-plugin-plugins-data-server.query.md) + +## Query interface + +Signature: + +```typescript +export interface Query +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [language](./kibana-plugin-plugins-data-server.query.language.md) | string | | +| [query](./kibana-plugin-plugins-data-server.query.query.md) | string | {
[key: string]: any;
} | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.query.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.query.md new file mode 100644 index 0000000000000..5c2aa700bc603 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.query.query.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [Query](./kibana-plugin-plugins-data-server.query.md) > [query](./kibana-plugin-plugins-data-server.query.query.md) + +## Query.query property + +Signature: + +```typescript +query: string | { + [key: string]: any; + }; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.refreshinterval.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.refreshinterval.md new file mode 100644 index 0000000000000..ebb983de29942 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.refreshinterval.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [RefreshInterval](./kibana-plugin-plugins-data-server.refreshinterval.md) + +## RefreshInterval interface + +Signature: + +```typescript +export interface RefreshInterval +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [pause](./kibana-plugin-plugins-data-server.refreshinterval.pause.md) | boolean | | +| [value](./kibana-plugin-plugins-data-server.refreshinterval.value.md) | number | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.refreshinterval.pause.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.refreshinterval.pause.md new file mode 100644 index 0000000000000..d045a3c0b9a21 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.refreshinterval.pause.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [RefreshInterval](./kibana-plugin-plugins-data-server.refreshinterval.md) > [pause](./kibana-plugin-plugins-data-server.refreshinterval.pause.md) + +## RefreshInterval.pause property + +Signature: + +```typescript +pause: boolean; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.refreshinterval.value.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.refreshinterval.value.md new file mode 100644 index 0000000000000..8b48d97a649c0 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.refreshinterval.value.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [RefreshInterval](./kibana-plugin-plugins-data-server.refreshinterval.md) > [value](./kibana-plugin-plugins-data-server.refreshinterval.value.md) + +## RefreshInterval.value property + +Signature: + +```typescript +value: number; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.shouldreadfieldfromdocvalues.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.shouldreadfieldfromdocvalues.md new file mode 100644 index 0000000000000..b62317cd75b50 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.shouldreadfieldfromdocvalues.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [shouldReadFieldFromDocValues](./kibana-plugin-plugins-data-server.shouldreadfieldfromdocvalues.md) + +## shouldReadFieldFromDocValues() function + +Signature: + +```typescript +export declare function shouldReadFieldFromDocValues(aggregatable: boolean, esType: string): boolean; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| aggregatable | boolean | | +| esType | string | | + +Returns: + +`boolean` + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.from.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.from.md new file mode 100644 index 0000000000000..b6f40cc2e4203 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.from.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [TimeRange](./kibana-plugin-plugins-data-server.timerange.md) > [from](./kibana-plugin-plugins-data-server.timerange.from.md) + +## TimeRange.from property + +Signature: + +```typescript +from: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.md new file mode 100644 index 0000000000000..8280d924eb609 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [TimeRange](./kibana-plugin-plugins-data-server.timerange.md) + +## TimeRange interface + +Signature: + +```typescript +export interface TimeRange +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [from](./kibana-plugin-plugins-data-server.timerange.from.md) | string | | +| [mode](./kibana-plugin-plugins-data-server.timerange.mode.md) | 'absolute' | 'relative' | | +| [to](./kibana-plugin-plugins-data-server.timerange.to.md) | string | | + diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.mode.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.mode.md new file mode 100644 index 0000000000000..1408fb43cbf39 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.mode.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [TimeRange](./kibana-plugin-plugins-data-server.timerange.md) > [mode](./kibana-plugin-plugins-data-server.timerange.mode.md) + +## TimeRange.mode property + +Signature: + +```typescript +mode?: 'absolute' | 'relative'; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.to.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.to.md new file mode 100644 index 0000000000000..98aca5474d350 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.timerange.to.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [TimeRange](./kibana-plugin-plugins-data-server.timerange.md) > [to](./kibana-plugin-plugins-data-server.timerange.to.md) + +## TimeRange.to property + +Signature: + +```typescript +to: string; +``` diff --git a/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.tsearchstrategyprovider.md b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.tsearchstrategyprovider.md new file mode 100644 index 0000000000000..f528f48a68f72 --- /dev/null +++ b/docs/development/plugins/data/server/kibana-plugin-plugins-data-server.tsearchstrategyprovider.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [TSearchStrategyProvider](./kibana-plugin-plugins-data-server.tsearchstrategyprovider.md) + +## TSearchStrategyProvider type + +Search strategy provider creates an instance of a search strategy with the request handler context bound to it. This way every search strategy can use whatever information they require from the request context. + +Signature: + +```typescript +export declare type TSearchStrategyProvider = (context: ISearchContext, caller: APICaller, search: ISearchGeneric) => ISearchStrategy; +``` diff --git a/package.json b/package.json index 7a815856c3d5c..7e9db2662a558 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "uiFramework:documentComponent": "cd packages/kbn-ui-framework && yarn documentComponent", "kbn:watch": "node scripts/kibana --dev --logging.json=false", "build:types": "tsc --p tsconfig.types.json", - "core:acceptApiChanges": "node scripts/check_core_api_changes.js --accept", + "docs:acceptApiChanges": "node scripts/check_published_api_changes.js --accept", "kbn:bootstrap": "yarn build:types && node scripts/register_git_hook", "spec_to_console": "node scripts/spec_to_console", "backport-skip-ci": "backport --prDescription \"[skip-ci]\"", diff --git a/scripts/check_core_api_changes.js b/scripts/check_published_api_changes.js similarity index 93% rename from scripts/check_core_api_changes.js rename to scripts/check_published_api_changes.js index 153491e0aecda..bea07dfd63377 100644 --- a/scripts/check_core_api_changes.js +++ b/scripts/check_published_api_changes.js @@ -18,4 +18,4 @@ */ require('../src/setup_node_env'); -require('../src/dev/run_check_core_api_changes'); +require('../src/dev/run_check_published_api_changes'); diff --git a/src/core/README.md b/src/core/README.md index f4539191d448b..b30c62e21b296 100644 --- a/src/core/README.md +++ b/src/core/README.md @@ -37,7 +37,7 @@ well documented. To reduce the chance of regressions, development on the Core AP process described below. Changes to the API signature which have not been accepted will cause the build to fail. When changes to the Core API's signatures are made, the following process needs to be followed: -1. After changes have been made, run `yarn core:acceptApiChanges` which performs the following: +1. After changes have been made, run `yarn docs:acceptApiChanges` which performs the following: - Recompiles all typescript typings files - Updates the API review files `src/core/public/kibana.api.md` and `src/core/server/kibana.api.md` - Updates the Core API documentation in `docs/development/core/` diff --git a/src/dev/run_check_core_api_changes.ts b/src/dev/run_check_published_api_changes.ts similarity index 83% rename from src/dev/run_check_core_api_changes.ts rename to src/dev/run_check_published_api_changes.ts index 48f31c261c445..b12638d9b8661 100644 --- a/src/dev/run_check_core_api_changes.ts +++ b/src/dev/run_check_published_api_changes.ts @@ -17,6 +17,8 @@ * under the License. */ +/* eslint-disable no-console */ + import { ToolingLog } from '@kbn/dev-utils'; import { Extractor, @@ -33,23 +35,35 @@ import fs from 'fs'; import path from 'path'; import getopts from 'getopts'; +/* + * Step 1: execute build:types + * This users tsconfig.types.json to generate types in `target/types` + * Step 2: run Api Extractor to detect API changes + * Step 3: generate new docs if needed + */ + +const getReportFileName = (folder: string) => { + return folder.indexOf('public') > -1 ? 'public' : 'server'; +}; + const apiExtractorConfig = (folder: string): ExtractorConfig => { + const fname = getReportFileName(folder); const config: IConfigFile = { newlineKind: 'lf', compiler: { tsconfigFilePath: '/tsconfig.json', }, projectFolder: path.resolve('./'), - mainEntryPointFilePath: `target/types/core/${folder}/index.d.ts`, + mainEntryPointFilePath: `target/types/${folder}/index.d.ts`, apiReport: { enabled: true, - reportFileName: `${folder}.api.md`, - reportFolder: `/src/core/${folder}/`, + reportFileName: `${fname}.api.md`, + reportFolder: `/src/${folder}/`, reportTempFolder: `/build/${folder}/`, }, docModel: { enabled: true, - apiJsonFilePath: `./build/${folder}/${folder}.api.json`, + apiJsonFilePath: `./build/${folder}/${fname}.api.json`, }, tsdocMetadata: { enabled: false, @@ -81,20 +95,21 @@ const runBuildTypes = async () => { }; const runApiDocumenter = async (folder: string) => { - await execa( - 'api-documenter', - ['generate', '-i', `./build/${folder}`, '-o', `./docs/development/core/${folder}`], - { - preferLocal: true, - } - ); + const sourceFolder = `./build/${folder}`; + const targetFolder = `./docs/development/${folder}`; + console.log(`Generating docs from ${sourceFolder} into ${targetFolder}...`); + await execa('api-documenter', ['generate', '-i', sourceFolder, '-o', targetFolder], { + preferLocal: true, + }); }; const renameExtractedApiPackageName = async (folder: string) => { - const json = JSON.parse(fs.readFileSync(`build/${folder}/${folder}.api.json`).toString()); - json.canonicalReference = `kibana-plugin-${folder}`; - json.name = `kibana-plugin-${folder}`; - fs.writeFileSync(`build/${folder}/${folder}.api.json`, JSON.stringify(json, null, 2)); + const fname = getReportFileName(folder); + const jsonApiFile = `build/${folder}/${fname}.api.json`; + console.log(`Updating ${jsonApiFile}...`); + const json = JSON.parse(fs.readFileSync(jsonApiFile).toString()); + json.name = json.canonicalReference = `kibana-plugin-${folder.replace(/\//g, '-')}`; + fs.writeFileSync(jsonApiFile, JSON.stringify(json, null, 2)); }; /** @@ -243,10 +258,14 @@ async function run( return false; } - const folders = ['public', 'server']; + const folders = ['core/public', 'core/server', 'plugins/data/server', 'plugins/data/public']; + const results = await Promise.all(folders.map(folder => run(folder, { log, opts }))); if (results.find(r => r === false) !== undefined) { process.exitCode = 1; } -})(); +})().catch(e => { + console.log(e); + process.exitCode = 1; +}); diff --git a/src/plugins/data/common/field_formats/field_formats_registry.ts b/src/plugins/data/common/field_formats/field_formats_registry.ts index 9fdf1ad9c80fb..15b1687e22312 100644 --- a/src/plugins/data/common/field_formats/field_formats_registry.ts +++ b/src/plugins/data/common/field_formats/field_formats_registry.ts @@ -20,8 +20,6 @@ // eslint-disable-next-line max-classes-per-file import { forOwn, isFunction, memoize, identity } from 'lodash'; -import { ES_FIELD_TYPES, IFieldFormat, KBN_FIELD_TYPES } from '../../common'; - import { FieldFormatsGetConfigFn, FieldFormatConfig, @@ -29,10 +27,12 @@ import { IFieldFormatType, FieldFormatId, IFieldFormatMetaParams, + IFieldFormat, } from './types'; import { baseFormatters } from './constants/base_formatters'; import { FieldFormat } from './field_format'; import { SerializedFieldFormat } from '../../../expressions/common/types'; +import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '../types'; export class FieldFormatsRegistry { protected fieldFormats: Map = new Map(); diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md new file mode 100644 index 0000000000000..c41a4ef531443 --- /dev/null +++ b/src/plugins/data/public/public.api.md @@ -0,0 +1,1575 @@ +## API Report File for "kibana" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import _ from 'lodash'; +import { Action } from 'history'; +import { Breadcrumb } from '@elastic/eui'; +import { Component } from 'react'; +import { CoreSetup } from 'src/core/public'; +import { CoreStart } from 'kibana/public'; +import { CoreStart as CoreStart_2 } from 'src/core/public'; +import { EuiButtonEmptyProps } from '@elastic/eui'; +import { EuiComboBoxProps } from '@elastic/eui'; +import { EuiConfirmModalProps } from '@elastic/eui'; +import { EuiFieldText } from '@elastic/eui'; +import { EuiGlobalToastListToast } from '@elastic/eui'; +import { ExclusiveUnion } from '@elastic/eui'; +import { History } from 'history'; +import { HttpSetup } from 'src/core/public'; +import { HttpStart } from 'src/core/public'; +import { IconType } from '@elastic/eui'; +import { InjectedIntl } from '@kbn/i18n/react'; +import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; +import { IUiSettingsClient } from 'src/core/public'; +import { Location } from 'history'; +import { LocationDescriptorObject } from 'history'; +import { MaybePromise } from '@kbn/utility-types'; +import { Moment } from 'moment'; +import moment from 'moment'; +import { NameList } from 'elasticsearch'; +import { Observable } from 'rxjs'; +import { Plugin as Plugin_2 } from 'src/core/public'; +import { PluginInitializerContext as PluginInitializerContext_2 } from 'src/core/public'; +import { PopoverAnchorPosition } from '@elastic/eui'; +import React from 'react'; +import * as React_2 from 'react'; +import { Required } from '@kbn/utility-types'; +import * as Rx from 'rxjs'; +import { SavedObject as SavedObject_2 } from 'src/core/public'; +import { SavedObjectsClientContract } from 'src/core/public'; +import { SearchParams } from 'elasticsearch'; +import { SearchResponse as SearchResponse_2 } from 'elasticsearch'; +import { SimpleSavedObject } from 'src/core/public'; +import { UiActionsSetup } from 'src/plugins/ui_actions/public'; +import { UiActionsStart } from 'src/plugins/ui_actions/public'; +import { UiSettingsParams } from 'src/core/server/types'; +import { UnregisterCallback } from 'history'; +import { UserProvidedValues } from 'src/core/server/types'; + +// Warning: (ae-missing-release-tag) "addSearchStrategy" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const addSearchStrategy: (searchStrategy: SearchStrategyProvider) => void; + +// Warning: (ae-forgotten-export) The symbol "DateFormat" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "baseFormattersPublic" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const baseFormattersPublic: (import("../../common").IFieldFormatType | typeof DateFormat)[]; + +// Warning: (ae-missing-release-tag) "castEsToKbnFieldTypeName" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export const castEsToKbnFieldTypeName: (esType: string) => KBN_FIELD_TYPES; + +// Warning: (ae-forgotten-export) The symbol "BaseStateContainer" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "connectToQueryState" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export const connectToQueryState: ({ timefilter: { timefilter }, filterManager, state$, }: Pick<{ + filterManager: import("..").FilterManager; + timefilter: import("..").TimefilterSetup; + state$: import("rxjs").Observable<{ + changes: QueryStateChange; + state: QueryState; + }>; + savedQueries: import("..").SavedQueryService; +} | { + filterManager: import("..").FilterManager; + timefilter: import("..").TimefilterSetup; + state$: import("rxjs").Observable<{ + changes: QueryStateChange; + state: QueryState; + }>; +}, "state$" | "timefilter" | "filterManager">, stateContainer: BaseStateContainer, syncConfig: { + time?: boolean | undefined; + refreshInterval?: boolean | undefined; + filters?: boolean | FilterStateStore | undefined; +}) => () => void; + +// Warning: (ae-missing-release-tag) "createSavedQueryService" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const createSavedQueryService: (savedObjectsClient: Pick) => SavedQueryService; + +// Warning: (ae-missing-release-tag) "CustomFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type CustomFilter = Filter & { + query: any; +}; + +// Warning: (ae-missing-release-tag) "DataPublicPluginSetup" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface DataPublicPluginSetup { + // Warning: (ae-forgotten-export) The symbol "AutocompleteSetup" needs to be exported by the entry point index.d.ts + // + // (undocumented) + autocomplete: AutocompleteSetup; + // Warning: (ae-forgotten-export) The symbol "FieldFormatsSetup" needs to be exported by the entry point index.d.ts + // + // (undocumented) + fieldFormats: FieldFormatsSetup; + // Warning: (ae-forgotten-export) The symbol "QuerySetup" needs to be exported by the entry point index.d.ts + // + // (undocumented) + query: QuerySetup; + // Warning: (ae-forgotten-export) The symbol "ISearchSetup" needs to be exported by the entry point index.d.ts + // + // (undocumented) + search: ISearchSetup; +} + +// Warning: (ae-missing-release-tag) "DataPublicPluginStart" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface DataPublicPluginStart { + // Warning: (ae-forgotten-export) The symbol "AutocompleteStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + autocomplete: AutocompleteStart; + // Warning: (ae-forgotten-export) The symbol "FieldFormatsStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + fieldFormats: FieldFormatsStart; + // (undocumented) + indexPatterns: IndexPatternsContract; + // Warning: (ae-forgotten-export) The symbol "QueryStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + query: QueryStart; + // Warning: (ae-forgotten-export) The symbol "ISearchStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + search: ISearchStart; + // (undocumented) + ui: { + IndexPatternSelect: React.ComponentType; + SearchBar: React.ComponentType; + }; +} + +// Warning: (ae-missing-release-tag) "defaultSearchStrategy" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const defaultSearchStrategy: SearchStrategyProvider; + +// @public (undocumented) +export enum ES_FIELD_TYPES { + // (undocumented) + ATTACHMENT = "attachment", + // (undocumented) + BOOLEAN = "boolean", + // (undocumented) + BYTE = "byte", + // (undocumented) + DATE = "date", + // (undocumented) + DATE_NANOS = "date_nanos", + // (undocumented) + DOUBLE = "double", + // (undocumented) + FLOAT = "float", + // (undocumented) + GEO_POINT = "geo_point", + // (undocumented) + GEO_SHAPE = "geo_shape", + // (undocumented) + HALF_FLOAT = "half_float", + // (undocumented) + _ID = "_id", + // (undocumented) + _INDEX = "_index", + // (undocumented) + INTEGER = "integer", + // (undocumented) + IP = "ip", + // (undocumented) + KEYWORD = "keyword", + // (undocumented) + LONG = "long", + // (undocumented) + MURMUR3 = "murmur3", + // (undocumented) + NESTED = "nested", + // (undocumented) + OBJECT = "object", + // (undocumented) + SCALED_FLOAT = "scaled_float", + // (undocumented) + SHORT = "short", + // (undocumented) + _SOURCE = "_source", + // (undocumented) + STRING = "string", + // (undocumented) + TEXT = "text", + // (undocumented) + TOKEN_COUNT = "token_count", + // (undocumented) + _TYPE = "_type" +} + +// Warning: (ae-missing-release-tag) "ES_SEARCH_STRATEGY" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const ES_SEARCH_STRATEGY = "es"; + +// Warning: (ae-missing-release-tag) "esFilters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const esFilters: { + FilterLabel: typeof FilterLabel; + FILTERS: typeof FILTERS; + FilterStateStore: typeof FilterStateStore; + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; + buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").IIndexPattern) => import("../common").PhrasesFilter; + buildExistsFilter: (field: import("../common").IFieldType, indexPattern: import("../common").IIndexPattern) => import("../common").ExistsFilter; + buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").IIndexPattern) => import("../common").PhraseFilter; + buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter; + buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").IIndexPattern, formattedValue?: string | undefined) => import("../common").RangeFilter; + isPhraseFilter: (filter: any) => filter is import("../common").PhraseFilter; + isExistsFilter: (filter: any) => filter is import("../common").ExistsFilter; + isPhrasesFilter: (filter: any) => filter is import("../common").PhrasesFilter; + isRangeFilter: (filter: any) => filter is import("../common").RangeFilter; + isMatchAllFilter: (filter: any) => filter is import("../common").MatchAllFilter; + isMissingFilter: (filter: any) => filter is import("../common").MissingFilter; + isQueryStringFilter: (filter: any) => filter is import("../common").QueryStringFilter; + isFilterPinned: (filter: import("../common").Filter) => boolean | undefined; + toggleFilterNegated: (filter: import("../common").Filter) => { + meta: { + negate: boolean; + alias: string | null; + disabled: boolean; + controlledBy?: string | undefined; + index?: string | undefined; + type?: string | undefined; + key?: string | undefined; + params?: any; + value?: string | ((formatter?: import("../common").FilterValueFormatter | undefined) => string) | undefined; + }; + $state?: import("../common").FilterState | undefined; + query?: any; + }; + disableFilter: (filter: import("../common").Filter) => import("../common").Filter; + getPhraseFilterField: (filter: import("../common").PhraseFilter) => string; + getPhraseFilterValue: (filter: import("../common").PhraseFilter) => string | number | boolean; + getDisplayValueFromFilter: typeof getDisplayValueFromFilter; + compareFilters: (first: import("../common").Filter | import("../common").Filter[], second: import("../common").Filter | import("../common").Filter[], comparatorOptions?: import("./query/filter_manager/lib/compare_filters").FilterCompareOptions) => boolean; + COMPARE_ALL_OPTIONS: import("./query/filter_manager/lib/compare_filters").FilterCompareOptions; + generateFilters: typeof generateFilters; + onlyDisabledFiltersChanged: (newFilters?: import("../common").Filter[] | undefined, oldFilters?: import("../common").Filter[] | undefined) => boolean; + changeTimeFilter: typeof changeTimeFilter; + mapAndFlattenFilters: (filters: import("../common").Filter[]) => import("../common").Filter[]; + extractTimeFilter: typeof extractTimeFilter; +}; + +// Warning: (ae-missing-release-tag) "esKuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const esKuery: { + nodeTypes: import("../common/es_query/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial) => import("../common").KueryNode; + toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").IIndexPattern | undefined, config?: Record | undefined, context?: Record | undefined) => import("../../kibana_utils/common").JsonObject; +}; + +// Warning: (ae-missing-release-tag) "esQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const esQuery: { + buildEsQuery: typeof buildEsQuery; + getEsQueryConfig: typeof getEsQueryConfig; + buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").IIndexPattern | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => { + must: never[]; + filter: import("../common").Filter[]; + should: never[]; + must_not: import("../common").Filter[]; + }; + luceneStringToDsl: typeof luceneStringToDsl; + decorateQuery: typeof decorateQuery; +}; + +// Warning: (ae-missing-release-tag) "EsQueryConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface EsQueryConfig { + // (undocumented) + allowLeadingWildcards: boolean; + // (undocumented) + dateFormatTZ?: string; + // (undocumented) + ignoreFilterIfFieldNotInIndex: boolean; + // (undocumented) + queryStringOptions: Record; +} + +// Warning: (ae-forgotten-export) The symbol "SortDirectionNumeric" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "EsQuerySortValue" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type EsQuerySortValue = Record; + +// Warning: (ae-missing-release-tag) "esSearchStrategyProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const esSearchStrategyProvider: TSearchStrategyProvider; + +// Warning: (ae-missing-release-tag) "ExistsFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type ExistsFilter = Filter & { + meta: ExistsFilterMeta; + exists?: FilterExistsProperty; +}; + +// Warning: (ae-missing-release-tag) "FetchOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface FetchOptions { + // (undocumented) + abortSignal?: AbortSignal; + // (undocumented) + searchStrategyId?: string; +} + +// Warning: (ae-missing-release-tag) "FieldFormatConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface FieldFormatConfig { + // (undocumented) + es?: boolean; + // (undocumented) + id: FieldFormatId; + // (undocumented) + params: Record; +} + +// Warning: (ae-forgotten-export) The symbol "FIELD_FORMAT_IDS" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "FieldFormatId" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export type FieldFormatId = FIELD_FORMAT_IDS | string; + +// Warning: (ae-missing-release-tag) "fieldFormats" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const fieldFormats: { + FieldFormat: typeof FieldFormat; + FieldFormatsRegistry: typeof FieldFormatsRegistry; + serialize: (agg: import("../../../legacy/core_plugins/data/public/search").AggConfig) => import("../../expressions/common").SerializedFieldFormat; + DEFAULT_CONVERTER_COLOR: { + range: string; + regex: string; + text: string; + background: string; + }; + HTML_CONTEXT_TYPE: import("../common").FieldFormatsContentType; + TEXT_CONTEXT_TYPE: import("../common").FieldFormatsContentType; + FIELD_FORMAT_IDS: typeof FIELD_FORMAT_IDS; + BoolFormat: typeof BoolFormat; + BytesFormat: typeof BytesFormat; + ColorFormat: typeof ColorFormat; + DateFormat: typeof DateFormat; + DateNanosFormat: typeof DateNanosFormat; + DurationFormat: typeof DurationFormat; + IpFormat: typeof IpFormat; + NumberFormat: typeof NumberFormat; + PercentFormat: typeof PercentFormat; + RelativeDateFormat: typeof RelativeDateFormat; + SourceFormat: typeof SourceFormat; + StaticLookupFormat: typeof StaticLookupFormat; + UrlFormat: typeof UrlFormat; + StringFormat: typeof StringFormat; + TruncateFormat: typeof TruncateFormat; +}; + +// @public (undocumented) +export type FieldFormatsContentType = 'html' | 'text'; + +// Warning: (ae-missing-release-tag) "FieldFormatsGetConfigFn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type FieldFormatsGetConfigFn = (key: string, defaultOverride?: T) => T; + +// Warning: (ae-missing-release-tag) "Filter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface Filter { + // Warning: (ae-forgotten-export) The symbol "FilterState" needs to be exported by the entry point index.d.ts + // + // (undocumented) + $state?: FilterState; + // Warning: (ae-forgotten-export) The symbol "FilterMeta" needs to be exported by the entry point index.d.ts + // + // (undocumented) + meta: FilterMeta; + // (undocumented) + query?: any; +} + +// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "FilterBar" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const FilterBar: React.ComponentClass, any> & { + WrappedComponent: React.ComponentType; +}; + +// Warning: (ae-missing-release-tag) "FilterManager" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class FilterManager { + constructor(uiSettings: IUiSettingsClient); + // (undocumented) + addFilters(filters: Filter[] | Filter, pinFilterStatus?: boolean): void; + // (undocumented) + getAppFilters(): Filter[]; + // (undocumented) + getFetches$(): import("rxjs").Observable; + // (undocumented) + getFilters(): Filter[]; + // (undocumented) + getGlobalFilters(): Filter[]; + // Warning: (ae-forgotten-export) The symbol "PartitionedFilters" needs to be exported by the entry point index.d.ts + // + // (undocumented) + getPartitionedFilters(): PartitionedFilters; + // (undocumented) + getUpdates$(): import("rxjs").Observable; + // (undocumented) + removeAll(): void; + // (undocumented) + removeFilter(filter: Filter): void; + setAppFilters(newAppFilters: Filter[]): void; + // (undocumented) + setFilters(newFilters: Filter[], pinFilterStatus?: boolean): void; + // (undocumented) + static setFiltersStore(filters: Filter[], store: FilterStateStore, shouldOverrideStore?: boolean): void; + setGlobalFilters(newGlobalFilters: Filter[]): void; + } + +// Warning: (ae-forgotten-export) The symbol "QueryLanguage" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "getDefaultQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export function getDefaultQuery(language?: QueryLanguage): { + query: string; + language: QueryLanguage; +}; + +// Warning: (ae-forgotten-export) The symbol "IUiSettingsClient" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "getEsPreference" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export function getEsPreference(uiSettings: IUiSettingsClient_2, sessionId?: string): any; + +// Warning: (ae-missing-release-tag) "getKbnTypeNames" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export const getKbnTypeNames: () => string[]; + +// Warning: (ae-forgotten-export) The symbol "PersistedLog" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "getQueryLog" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export function getQueryLog(uiSettings: IUiSettingsClient, storage: IStorageWrapper, appName: string, language: string): PersistedLog; + +// Warning: (ae-missing-release-tag) "getSearchErrorType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export function getSearchErrorType({ message }: Pick): "UNSUPPORTED_QUERY" | undefined; + +// Warning: (ae-missing-release-tag) "getTime" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export function getTime(indexPattern: IIndexPattern | undefined, timeRange: TimeRange, forceNow?: Date): import("../..").RangeFilter | undefined; + +// Warning: (ae-missing-release-tag) "hasSearchStategyForIndexPattern" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const hasSearchStategyForIndexPattern: (indexPattern: IndexPattern) => boolean; + +// Warning: (ae-missing-release-tag) "IDataPluginServices" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IDataPluginServices extends Partial { + // (undocumented) + appName: string; + // (undocumented) + data: DataPublicPluginStart; + // (undocumented) + http: CoreStart_2['http']; + // (undocumented) + notifications: CoreStart_2['notifications']; + // (undocumented) + savedObjects: CoreStart_2['savedObjects']; + // (undocumented) + storage: IStorageWrapper; + // (undocumented) + uiSettings: CoreStart_2['uiSettings']; +} + +// Warning: (ae-missing-release-tag) "IEsSearchRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IEsSearchRequest extends IKibanaSearchRequest { + // (undocumented) + params: SearchParams; +} + +// Warning: (ae-missing-release-tag) "IEsSearchResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IEsSearchResponse extends IKibanaSearchResponse { + // (undocumented) + rawResponse: SearchResponse_2; +} + +// Warning: (ae-missing-release-tag) "IFieldFormat" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type IFieldFormat = PublicMethodsOf; + +// Warning: (ae-missing-release-tag) "IFieldFormatsRegistry" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type IFieldFormatsRegistry = PublicMethodsOf; + +// Warning: (ae-missing-release-tag) "IFieldSubType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IFieldSubType { + // (undocumented) + multi?: { + parent: string; + }; + // (undocumented) + nested?: { + path: string; + }; +} + +// Warning: (ae-missing-release-tag) "IFieldType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IFieldType { + // (undocumented) + aggregatable?: boolean; + // (undocumented) + count?: number; + // (undocumented) + displayName?: string; + // (undocumented) + esTypes?: string[]; + // (undocumented) + filterable?: boolean; + // (undocumented) + format?: any; + // (undocumented) + lang?: string; + // (undocumented) + name: string; + // (undocumented) + readFromDocValues?: boolean; + // (undocumented) + script?: string; + // (undocumented) + scripted?: boolean; + // (undocumented) + searchable?: boolean; + // (undocumented) + sortable?: boolean; + // (undocumented) + subType?: IFieldSubType; + // (undocumented) + type: string; + // (undocumented) + visualizable?: boolean; +} + +// Warning: (ae-missing-release-tag) "IIndexPattern" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IIndexPattern { + // (undocumented) + [key: string]: any; + // (undocumented) + fieldFormatMap?: Record; + // (undocumented) + fields: IFieldType[]; + // (undocumented) + id?: string; + // (undocumented) + timeFieldName?: string; + // (undocumented) + title: string; + // (undocumented) + type?: string; +} + +// Warning: (ae-missing-release-tag) "IKibanaSearchRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IKibanaSearchRequest { + debug?: boolean; + id?: string; +} + +// Warning: (ae-missing-release-tag) "IKibanaSearchResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IKibanaSearchResponse { + id?: string; + loaded?: number; + total?: number; +} + +// Warning: (ae-missing-release-tag) "IndexPattern" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class IndexPattern implements IIndexPattern { + // Warning: (ae-forgotten-export) The symbol "IIndexPatternsApiClient" needs to be exported by the entry point index.d.ts + constructor(id: string | undefined, getConfig: any, savedObjectsClient: SavedObjectsClientContract, apiClient: IIndexPatternsApiClient, patternCache: any); + // (undocumented) + [key: string]: any; + // (undocumented) + addScriptedField(name: string, script: string, fieldType: string | undefined, lang: string): Promise; + // (undocumented) + create(allowOverride?: boolean): Promise; + // (undocumented) + destroy(): Promise<{}> | undefined; + // (undocumented) + _fetchFields(): Promise; + // (undocumented) + fieldFormatMap: any; + // Warning: (ae-forgotten-export) The symbol "IFieldList" needs to be exported by the entry point index.d.ts + // + // (undocumented) + fields: IFieldList; + // (undocumented) + fieldsFetcher: any; + // (undocumented) + flattenHit: any; + // (undocumented) + formatField: any; + // (undocumented) + formatHit: any; + // (undocumented) + getAggregationRestrictions(): Record> | undefined; + // (undocumented) + getComputedFields(): { + storedFields: string[]; + scriptFields: any; + docvalueFields: { + field: any; + format: string; + }[]; + }; + // (undocumented) + getFieldByName(name: string): IndexPatternField | void; + // (undocumented) + getNonScriptedFields(): IndexPatternField[]; + // (undocumented) + getScriptedFields(): IndexPatternField[]; + // (undocumented) + getSourceFiltering(): { + excludes: any[]; + }; + // (undocumented) + getTimeField(): IndexPatternField | undefined; + // (undocumented) + id?: string; + // (undocumented) + init(forceFieldRefresh?: boolean): Promise; + // (undocumented) + isTimeBased(): boolean; + // (undocumented) + isTimeBasedWildcard(): boolean; + // (undocumented) + isTimeNanosBased(): boolean; + // (undocumented) + isWildcard(): boolean; + // (undocumented) + metaFields: string[]; + // (undocumented) + popularizeField(fieldName: string, unit?: number): Promise; + // (undocumented) + prepBody(): { + [key: string]: any; + }; + // (undocumented) + refreshFields(): Promise; + // (undocumented) + removeScriptedField(field: IFieldType): Promise; + // (undocumented) + get routes(): { + edit: string; + addField: string; + indexedFields: string; + scriptedFields: string; + sourceFilters: string; + }; + // (undocumented) + save(saveAttempts?: number): Promise; + // (undocumented) + timeFieldName: string | undefined; + // (undocumented) + title: string; + // (undocumented) + toJSON(): string | undefined; + // (undocumented) + toString(): string; + // (undocumented) + type?: string; + // (undocumented) + typeMeta?: IndexPatternTypeMeta; + } + +// Warning: (ae-missing-release-tag) "AggregationRestrictions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type IndexPatternAggRestrictions = Record; + +// Warning: (ae-missing-release-tag) "IndexPatternAttributes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated +export interface IndexPatternAttributes { + // (undocumented) + fields: string; + // (undocumented) + timeFieldName?: string; + // (undocumented) + title: string; + // (undocumented) + type: string; + // (undocumented) + typeMeta: string; +} + +// Warning: (ae-missing-release-tag) "Field" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class IndexPatternField implements IFieldType { + // Warning: (ae-forgotten-export) The symbol "FieldSpec" needs to be exported by the entry point index.d.ts + // + // (undocumented) + $$spec: FieldSpec; + constructor(indexPattern: IndexPattern, spec: FieldSpec | IndexPatternField, shortDotsEnable?: boolean); + // (undocumented) + aggregatable?: boolean; + // (undocumented) + count?: number; + // (undocumented) + displayName?: string; + // (undocumented) + esTypes?: string[]; + // (undocumented) + filterable?: boolean; + // (undocumented) + format: any; + // (undocumented) + lang?: string; + // (undocumented) + name: string; + // (undocumented) + routes: Record; + // (undocumented) + script?: string; + // (undocumented) + scripted?: boolean; + // (undocumented) + searchable?: boolean; + // (undocumented) + sortable?: boolean; + // (undocumented) + subType?: IFieldSubType; + // (undocumented) + type: string; + // (undocumented) + visualizable?: boolean; +} + +// Warning: (ae-missing-release-tag) "FieldList" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class IndexPatternFieldList extends Array implements IFieldList { + constructor(indexPattern: IndexPattern, specs?: FieldSpec[], shortDotsEnable?: boolean); + // (undocumented) + add: (field: Record) => void; + // (undocumented) + getByName: (name: string) => IndexPatternField | undefined; + // (undocumented) + getByType: (type: string) => any[]; + // (undocumented) + remove: (field: IFieldType) => void; + // (undocumented) + update: (field: IndexPatternField) => void; +} + +// Warning: (ae-missing-release-tag) "indexPatterns" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const indexPatterns: { + ILLEGAL_CHARACTERS_KEY: string; + CONTAINS_SPACES_KEY: string; + ILLEGAL_CHARACTERS_VISIBLE: string[]; + ILLEGAL_CHARACTERS: string[]; + isDefault: (indexPattern: import("../common").IIndexPattern) => boolean; + isFilterable: typeof isFilterable; + isNestedField: typeof isNestedField; + validate: typeof validateIndexPattern; + getFromSavedObject: typeof getFromSavedObject; + flattenHitWrapper: typeof flattenHitWrapper; + getRoutes: typeof getRoutes; + formatHitProvider: typeof formatHitProvider; +}; + +// Warning: (ae-forgotten-export) The symbol "IndexPatternsService" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "IndexPatternsContract" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type IndexPatternsContract = PublicMethodsOf; + +// Warning: (ae-missing-release-tag) "IndexPatternSelect" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class IndexPatternSelect extends Component { + constructor(props: IndexPatternSelectProps); + // (undocumented) + componentDidMount(): void; + // (undocumented) + componentWillUnmount(): void; + // (undocumented) + debouncedFetch: ((searchValue: string) => Promise) & _.Cancelable; + // (undocumented) + fetchOptions: (searchValue?: string) => void; + // (undocumented) + fetchSelectedIndexPattern: (indexPatternId: string) => Promise; + // (undocumented) + onChange: (selectedOptions: any) => void; + // (undocumented) + render(): JSX.Element; + // Warning: (ae-forgotten-export) The symbol "IndexPatternSelectState" needs to be exported by the entry point index.d.ts + // + // (undocumented) + state: IndexPatternSelectState; + // (undocumented) + UNSAFE_componentWillReceiveProps(nextProps: IndexPatternSelectProps): void; +} + +// Warning: (ae-missing-release-tag) "TypeMeta" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IndexPatternTypeMeta { + // (undocumented) + [key: string]: any; + // (undocumented) + aggs?: Record; +} + +// Warning: (ae-missing-release-tag) "InputTimeRange" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type InputTimeRange = TimeRange | { + from: Moment; + to: Moment; +}; + +// Warning: (ae-missing-release-tag) "IRequestTypesMap" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IRequestTypesMap { + // (undocumented) + [key: string]: IKibanaSearchRequest; + // (undocumented) + [ES_SEARCH_STRATEGY]: IEsSearchRequest; + // (undocumented) + [SYNC_SEARCH_STRATEGY]: ISyncSearchRequest; +} + +// Warning: (ae-missing-release-tag) "IResponseTypesMap" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IResponseTypesMap { + // (undocumented) + [key: string]: IKibanaSearchResponse; + // (undocumented) + [ES_SEARCH_STRATEGY]: IEsSearchResponse; + // (undocumented) + [SYNC_SEARCH_STRATEGY]: IKibanaSearchResponse; +} + +// Warning: (ae-forgotten-export) The symbol "TStrategyTypes" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DEFAULT_SEARCH_STRATEGY" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "ISearch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type ISearch = (request: IRequestTypesMap[T], options?: ISearchOptions) => Observable; + +// Warning: (ae-missing-release-tag) "ISearchContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface ISearchContext { + // (undocumented) + core: CoreStart; + // (undocumented) + getSearchStrategy: (name: T) => TSearchStrategyProvider; +} + +// Warning: (ae-missing-release-tag) "ISearchGeneric" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type ISearchGeneric = (request: IRequestTypesMap[T], options?: ISearchOptions, strategy?: T) => Observable; + +// Warning: (ae-missing-release-tag) "ISearchOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface ISearchOptions { + // (undocumented) + signal?: AbortSignal; +} + +// Warning: (ae-missing-release-tag) "ISearchSource" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type ISearchSource = Pick; + +// Warning: (ae-missing-release-tag) "ISearchStrategy" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export interface ISearchStrategy { + // (undocumented) + search: ISearch; +} + +// Warning: (ae-missing-release-tag) "ISyncSearchRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface ISyncSearchRequest extends IKibanaSearchRequest { + // (undocumented) + serverStrategy: string; +} + +// @public (undocumented) +export enum KBN_FIELD_TYPES { + // (undocumented) + ATTACHMENT = "attachment", + // (undocumented) + BOOLEAN = "boolean", + // (undocumented) + CONFLICT = "conflict", + // (undocumented) + DATE = "date", + // (undocumented) + GEO_POINT = "geo_point", + // (undocumented) + GEO_SHAPE = "geo_shape", + // (undocumented) + IP = "ip", + // (undocumented) + MURMUR3 = "murmur3", + // (undocumented) + NESTED = "nested", + // (undocumented) + NUMBER = "number", + // (undocumented) + OBJECT = "object", + // (undocumented) + _SOURCE = "_source", + // (undocumented) + STRING = "string", + // (undocumented) + UNKNOWN = "unknown" +} + +// Warning: (ae-missing-release-tag) "KueryNode" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface KueryNode { + // (undocumented) + [key: string]: any; + // Warning: (ae-forgotten-export) The symbol "NodeTypes" needs to be exported by the entry point index.d.ts + // + // (undocumented) + type: keyof NodeTypes; +} + +// Warning: (ae-missing-release-tag) "MatchAllFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type MatchAllFilter = Filter & { + meta: MatchAllFilterMeta; + match_all: any; +}; + +// Warning: (ae-missing-release-tag) "parseInterval" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export function parseInterval(interval: string): moment.Duration | null; + +// Warning: (ae-missing-release-tag) "PhraseFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type PhraseFilter = Filter & { + meta: PhraseFilterMeta; + script?: { + script: { + source?: any; + lang?: string; + params: any; + }; + }; +}; + +// Warning: (ae-missing-release-tag) "PhrasesFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type PhrasesFilter = Filter & { + meta: PhrasesFilterMeta; +}; + +// Warning: (ae-missing-release-tag) "DataPublicPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class Plugin implements Plugin_2 { + constructor(initializerContext: PluginInitializerContext_2); + // Warning: (ae-forgotten-export) The symbol "DataSetupDependencies" needs to be exported by the entry point index.d.ts + // + // (undocumented) + setup(core: CoreSetup, { uiActions }: DataSetupDependencies): DataPublicPluginSetup; + // Warning: (ae-forgotten-export) The symbol "DataStartDependencies" needs to be exported by the entry point index.d.ts + // + // (undocumented) + start(core: CoreStart_2, { uiActions }: DataStartDependencies): DataPublicPluginStart; + // (undocumented) + stop(): void; + } + +// Warning: (ae-forgotten-export) The symbol "PluginInitializerContext" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "plugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export function plugin(initializerContext: PluginInitializerContext): Plugin; + +// Warning: (ae-missing-release-tag) "Query" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface Query { + // (undocumented) + language: string; + // (undocumented) + query: string | { + [key: string]: any; + }; +} + +// Warning: (ae-missing-release-tag) "QueryState" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export interface QueryState { + // (undocumented) + filters?: Filter[]; + // (undocumented) + refreshInterval?: RefreshInterval; + // (undocumented) + time?: TimeRange; +} + +// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "QueryStringInput" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const QueryStringInput: React.FC>; + +// @public (undocumented) +export type QuerySuggestion = QuerySuggestionBasic | QuerySuggestionField; + +// @public (undocumented) +export interface QuerySuggestionBasic { + // (undocumented) + cursorIndex?: number; + // (undocumented) + description?: string | JSX.Element; + // (undocumented) + end: number; + // (undocumented) + start: number; + // (undocumented) + text: string; + // (undocumented) + type: QuerySuggestionTypes; +} + +// @public (undocumented) +export interface QuerySuggestionField extends QuerySuggestionBasic { + // (undocumented) + field: IFieldType; + // (undocumented) + type: QuerySuggestionTypes.Field; +} + +// Warning: (ae-missing-release-tag) "QuerySuggestionGetFn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type QuerySuggestionGetFn = (args: QuerySuggestionGetFnArgs) => Promise | undefined; + +// @public (undocumented) +export interface QuerySuggestionGetFnArgs { + // (undocumented) + boolFilter?: any; + // (undocumented) + indexPatterns: IIndexPattern[]; + // (undocumented) + language: string; + // (undocumented) + query: string; + // (undocumented) + selectionEnd: number; + // (undocumented) + selectionStart: number; + // (undocumented) + signal?: AbortSignal; +} + +// Warning: (ae-missing-release-tag) "QuerySuggestionTypes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export enum QuerySuggestionTypes { + // (undocumented) + Conjunction = "conjunction", + // (undocumented) + Field = "field", + // (undocumented) + Operator = "operator", + // (undocumented) + RecentSearch = "recentSearch", + // (undocumented) + Value = "value" +} + +// Warning: (ae-forgotten-export) The symbol "EsRangeFilter" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "RangeFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type RangeFilter = Filter & EsRangeFilter & { + meta: RangeFilterMeta; + script?: { + script: { + params: any; + lang: string; + source: any; + }; + }; + match_all?: any; +}; + +// Warning: (ae-missing-release-tag) "RangeFilterMeta" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type RangeFilterMeta = FilterMeta & { + params: RangeFilterParams; + field?: any; + formattedValue?: string; +}; + +// Warning: (ae-missing-release-tag) "RangeFilterParams" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface RangeFilterParams { + // (undocumented) + format?: string; + // (undocumented) + from?: number | string; + // (undocumented) + gt?: number | string; + // (undocumented) + gte?: number | string; + // (undocumented) + lt?: number | string; + // (undocumented) + lte?: number | string; + // (undocumented) + to?: number | string; +} + +// Warning: (ae-missing-release-tag) "RefreshInterval" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface RefreshInterval { + // (undocumented) + pause: boolean; + // (undocumented) + value: number; +} + +// Warning: (ae-missing-release-tag) "SavedQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface SavedQuery { + // (undocumented) + attributes: SavedQueryAttributes; + // (undocumented) + id: string; +} + +// Warning: (ae-missing-release-tag) "SavedQueryAttributes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface SavedQueryAttributes { + // (undocumented) + description: string; + // (undocumented) + filters?: Filter[]; + // (undocumented) + query: Query; + // (undocumented) + timefilter?: SavedQueryTimeFilter; + // (undocumented) + title: string; +} + +// Warning: (ae-missing-release-tag) "SavedQueryService" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface SavedQueryService { + // (undocumented) + deleteSavedQuery: (id: string) => Promise<{}>; + // (undocumented) + findSavedQueries: (searchText?: string, perPage?: number, activePage?: number) => Promise<{ + total: number; + queries: SavedQuery[]; + }>; + // (undocumented) + getAllSavedQueries: () => Promise; + // (undocumented) + getSavedQuery: (id: string) => Promise; + // (undocumented) + getSavedQueryCount: () => Promise; + // (undocumented) + saveQuery: (attributes: SavedQueryAttributes, config?: { + overwrite: boolean; + }) => Promise; +} + +// Warning: (ae-missing-release-tag) "SavedQueryTimeFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type SavedQueryTimeFilter = TimeRange & { + refreshInterval: RefreshInterval; +}; + +// Warning: (ae-missing-release-tag) "SearchBar" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const SearchBar: React.ComponentClass, "query" | "isLoading" | "indexPatterns" | "filters" | "refreshInterval" | "screenTitle" | "dataTestSubj" | "customSubmitButton" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "onRefresh" | "timeHistory" | "onFiltersUpdated" | "onRefreshChange">, any> & { + WrappedComponent: React.ComponentType & ReactIntl.InjectedIntlProps>; +}; + +// Warning: (ae-forgotten-export) The symbol "SearchBarOwnProps" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "SearchBarInjectedDeps" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "SearchBarProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type SearchBarProps = SearchBarOwnProps & SearchBarInjectedDeps; + +// Warning: (ae-missing-release-tag) "SearchError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class SearchError extends Error { + // Warning: (ae-forgotten-export) The symbol "SearchErrorOptions" needs to be exported by the entry point index.d.ts + constructor({ status, title, message, path, type }: SearchErrorOptions); + // (undocumented) + message: string; + // (undocumented) + name: string; + // (undocumented) + path: string; + // (undocumented) + status: string; + // (undocumented) + title: string; + // (undocumented) + type: string; +} + +// Warning: (ae-missing-release-tag) "SearchRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type SearchRequest = any; + +// Warning: (ae-missing-release-tag) "SearchResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type SearchResponse = any; + +// Warning: (ae-missing-release-tag) "SearchSource" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class SearchSource { + constructor(fields?: SearchSourceFields); + // (undocumented) + create(): SearchSource; + // (undocumented) + createChild(options?: {}): SearchSource; + // (undocumented) + createCopy(): SearchSource; + destroy(): void; + fetch(options?: FetchOptions): Promise; + getField(field: K, recurse?: boolean): SearchSourceFields[K]; + // (undocumented) + getFields(): { + type?: string | undefined; + query?: import("../..").Query | undefined; + filter?: Filter | Filter[] | (() => Filter | Filter[] | undefined) | undefined; + sort?: Record | Record[] | undefined; + highlight?: any; + highlightAll?: boolean | undefined; + aggs?: any; + from?: number | undefined; + size?: number | undefined; + source?: string | boolean | string[] | undefined; + version?: boolean | undefined; + fields?: string | boolean | string[] | undefined; + index?: import("../..").IndexPattern | undefined; + searchAfter?: import("./types").EsQuerySearchAfter | undefined; + timeout?: string | undefined; + terminate_after?: number | undefined; + }; + // (undocumented) + getId(): string; + getOwnField(field: K): SearchSourceFields[K]; + getParent(): SearchSource | undefined; + // (undocumented) + getSearchRequestBody(): Promise; + // (undocumented) + history: SearchRequest[]; + onRequestStart(handler: (searchSource: ISearchSource, options?: FetchOptions) => Promise): void; + // (undocumented) + setField(field: K, value: SearchSourceFields[K]): this; + // (undocumented) + setFields(newFields: SearchSourceFields): this; + // Warning: (ae-forgotten-export) The symbol "SearchSourceOptions" needs to be exported by the entry point index.d.ts + setParent(parent?: ISearchSource, options?: SearchSourceOptions): this; + setPreferredSearchStrategyId(searchStrategyId: string): void; +} + +// Warning: (ae-missing-release-tag) "SearchSourceFields" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface SearchSourceFields { + // (undocumented) + aggs?: any; + // (undocumented) + fields?: NameList; + // (undocumented) + filter?: Filter[] | Filter | (() => Filter[] | Filter | undefined); + // (undocumented) + from?: number; + // (undocumented) + highlight?: any; + // (undocumented) + highlightAll?: boolean; + // (undocumented) + index?: IndexPattern; + // (undocumented) + query?: Query; + // Warning: (ae-forgotten-export) The symbol "EsQuerySearchAfter" needs to be exported by the entry point index.d.ts + // + // (undocumented) + searchAfter?: EsQuerySearchAfter; + // (undocumented) + size?: number; + // (undocumented) + sort?: EsQuerySortValue | EsQuerySortValue[]; + // (undocumented) + source?: NameList; + // (undocumented) + terminate_after?: number; + // (undocumented) + timeout?: string; + // (undocumented) + type?: string; + // (undocumented) + version?: boolean; +} + +// Warning: (ae-missing-release-tag) "SearchStrategyProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface SearchStrategyProvider { + // (undocumented) + id: string; + // (undocumented) + isViable: (indexPattern: IndexPattern) => boolean; + // Warning: (ae-forgotten-export) The symbol "SearchStrategySearchParams" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "SearchStrategyResponse" needs to be exported by the entry point index.d.ts + // + // (undocumented) + search: (params: SearchStrategySearchParams) => SearchStrategyResponse; +} + +// Warning: (ae-missing-release-tag) "SortDirection" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export enum SortDirection { + // (undocumented) + asc = "asc", + // (undocumented) + desc = "desc" +} + +// Warning: (ae-missing-release-tag) "StatefulSearchBarProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type StatefulSearchBarProps = SearchBarOwnProps & { + appName: string; + useDefaultBehaviors?: boolean; + savedQueryId?: string; + onSavedQueryIdChange?: (savedQueryId?: string) => void; +}; + +// Warning: (ae-missing-release-tag) "SYNC_SEARCH_STRATEGY" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const SYNC_SEARCH_STRATEGY = "SYNC_SEARCH_STRATEGY"; + +// Warning: (ae-forgotten-export) The symbol "IKbnUrlStateStorage" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "syncQueryStateWithUrl" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export const syncQueryStateWithUrl: (query: Pick<{ + filterManager: import("..").FilterManager; + timefilter: import("..").TimefilterSetup; + state$: import("rxjs").Observable<{ + changes: import("./types").QueryStateChange; + state: QueryState; + }>; + savedQueries: import("..").SavedQueryService; +} | { + filterManager: import("..").FilterManager; + timefilter: import("..").TimefilterSetup; + state$: import("rxjs").Observable<{ + changes: import("./types").QueryStateChange; + state: QueryState; + }>; +}, "state$" | "timefilter" | "filterManager">, kbnUrlStateStorage: IKbnUrlStateStorage) => { + stop: () => void; + hasInheritedQueryFromUrl: boolean; +}; + +// Warning: (ae-forgotten-export) The symbol "Timefilter" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "TimefilterContract" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type TimefilterContract = PublicMethodsOf; + +// @public (undocumented) +export interface TimefilterSetup { + // (undocumented) + history: TimeHistoryContract; + // (undocumented) + timefilter: TimefilterContract; +} + +// Warning: (ae-missing-release-tag) "TimeHistory" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class TimeHistory { + constructor(storage: IStorageWrapper); + // (undocumented) + add(time: TimeRange): void; + // (undocumented) + get(): TimeRange[]; + } + +// Warning: (ae-missing-release-tag) "TimeHistoryContract" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type TimeHistoryContract = PublicMethodsOf; + +// Warning: (ae-missing-release-tag) "TimeRange" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface TimeRange { + // (undocumented) + from: string; + // (undocumented) + mode?: 'absolute' | 'relative'; + // (undocumented) + to: string; +} + +// Warning: (ae-missing-release-tag) "TSearchStrategyProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export type TSearchStrategyProvider = (context: ISearchContext) => ISearchStrategy; + + +// Warnings were encountered during analysis: +// +// src/plugins/data/common/es_query/filters/exists_filter.ts:30:3 - (ae-forgotten-export) The symbol "ExistsFilterMeta" needs to be exported by the entry point index.d.ts +// src/plugins/data/common/es_query/filters/exists_filter.ts:31:3 - (ae-forgotten-export) The symbol "FilterExistsProperty" needs to be exported by the entry point index.d.ts +// src/plugins/data/common/es_query/filters/match_all_filter.ts:28:3 - (ae-forgotten-export) The symbol "MatchAllFilterMeta" needs to be exported by the entry point index.d.ts +// src/plugins/data/common/es_query/filters/phrase_filter.ts:33:3 - (ae-forgotten-export) The symbol "PhraseFilterMeta" needs to be exported by the entry point index.d.ts +// src/plugins/data/common/es_query/filters/phrases_filter.ts:31:3 - (ae-forgotten-export) The symbol "PhrasesFilterMeta" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "FilterLabel" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "FILTERS" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "getDisplayValueFromFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "generateFilters" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "changeTimeFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "extractTimeFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:135:21 - (ae-forgotten-export) The symbol "buildEsQuery" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:135:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:135:21 - (ae-forgotten-export) The symbol "luceneStringToDsl" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:135:21 - (ae-forgotten-export) The symbol "decorateQuery" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "FieldFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "DateNanosFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "getFromSavedObject" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "getRoutes" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:234:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:34:33 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:38:1 - (ae-forgotten-export) The symbol "QueryStateChange" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/types.ts:54:5 - (ae-forgotten-export) The symbol "IndexPatternSelectProps" needs to be exported by the entry point index.d.ts + +// (No @packageDocumentation comment for this package) + +``` diff --git a/src/plugins/data/public/types.ts b/src/plugins/data/public/types.ts index 80646bb4668d2..c1480920809dd 100644 --- a/src/plugins/data/public/types.ts +++ b/src/plugins/data/public/types.ts @@ -17,6 +17,7 @@ * under the License. */ +import React from 'react'; import { CoreStart } from 'src/core/public'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; import { UiActionsSetup, UiActionsStart } from 'src/plugins/ui_actions/public'; diff --git a/src/plugins/data/public/ui/index.ts b/src/plugins/data/public/ui/index.ts index 5a1ad9957d7d7..cb46a838a8c30 100644 --- a/src/plugins/data/public/ui/index.ts +++ b/src/plugins/data/public/ui/index.ts @@ -17,7 +17,7 @@ * under the License. */ -export { SuggestionsComponent } from './typeahead/suggestions_component'; +export { SuggestionsComponent } from './typeahead'; export { IndexPatternSelect } from './index_pattern_select'; export { FilterBar } from './filter_bar'; export { QueryStringInput } from './query_string_input/query_string_input'; diff --git a/src/plugins/data/public/ui/saved_query_form/save_query_form.tsx b/src/plugins/data/public/ui/saved_query_form/save_query_form.tsx index f9a0ae4e803c4..7183f14bdb255 100644 --- a/src/plugins/data/public/ui/saved_query_form/save_query_form.tsx +++ b/src/plugins/data/public/ui/saved_query_form/save_query_form.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React, { FunctionComponent, useEffect, useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { EuiButtonEmpty, EuiOverlayMask, @@ -53,14 +53,14 @@ export interface SavedQueryMeta { shouldIncludeTimefilter: boolean; } -export const SaveQueryForm: FunctionComponent = ({ +export function SaveQueryForm({ savedQuery, savedQueryService, onSave, onClose, showFilterOption = true, showTimeFilterOption = true, -}) => { +}: Props) { const [title, setTitle] = useState(savedQuery ? savedQuery.title : ''); const [description, setDescription] = useState(savedQuery ? savedQuery.description : ''); const [savedQueries, setSavedQueries] = useState([]); @@ -254,4 +254,4 @@ export const SaveQueryForm: FunctionComponent = ({ ); -}; +} diff --git a/src/plugins/data/public/ui/saved_query_management/saved_query_management_component.tsx b/src/plugins/data/public/ui/saved_query_management/saved_query_management_component.tsx index 55615dea9fdb7..6ca1b7582001f 100644 --- a/src/plugins/data/public/ui/saved_query_management/saved_query_management_component.tsx +++ b/src/plugins/data/public/ui/saved_query_management/saved_query_management_component.tsx @@ -33,7 +33,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import React, { FunctionComponent, useEffect, useState, Fragment, useRef } from 'react'; +import React, { useEffect, useState, Fragment, useRef } from 'react'; import { sortBy } from 'lodash'; import { SavedQuery, SavedQueryService } from '../..'; import { SavedQueryListItem } from './saved_query_list_item'; @@ -49,7 +49,7 @@ interface Props { onClearSavedQuery: () => void; } -export const SavedQueryManagementComponent: FunctionComponent = ({ +export function SavedQueryManagementComponent({ showSaveQuery, loadedSavedQuery, onSave, @@ -57,7 +57,7 @@ export const SavedQueryManagementComponent: FunctionComponent = ({ onLoad, onClearSavedQuery, savedQueryService, -}) => { +}: Props) { const [isOpen, setIsOpen] = useState(false); const [savedQueries, setSavedQueries] = useState([] as SavedQuery[]); const [count, setTotalCount] = useState(0); @@ -316,4 +316,4 @@ export const SavedQueryManagementComponent: FunctionComponent = ({ ); -}; +} diff --git a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx index 7d65e947c0f04..5ca334d6bdcfe 100644 --- a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx +++ b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx @@ -21,12 +21,13 @@ import React, { useState, useEffect, useRef } from 'react'; import { CoreStart } from 'src/core/public'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; import { KibanaContextProvider } from '../../../../kibana_react/public'; -import { DataPublicPluginStart, Filter, Query, TimeRange, SavedQuery } from '../..'; -import { QueryStart } from '../../query'; +import { QueryStart, SavedQuery } from '../../query'; import { SearchBarOwnProps, SearchBar } from './search_bar'; import { useFilterManager } from './lib/use_filter_manager'; import { useTimefilter } from './lib/use_timefilter'; import { useSavedQuery } from './lib/use_saved_query'; +import { DataPublicPluginStart } from '../../types'; +import { Filter, Query, TimeRange } from '../../../common'; interface StatefulSearchBarDeps { core: CoreStart; diff --git a/src/plugins/data/public/ui/search_bar/search_bar.test.tsx b/src/plugins/data/public/ui/search_bar/search_bar.test.tsx index 56d444761153f..cf438eaa0e972 100644 --- a/src/plugins/data/public/ui/search_bar/search_bar.test.tsx +++ b/src/plugins/data/public/ui/search_bar/search_bar.test.tsx @@ -35,7 +35,7 @@ const mockTimeHistory = { }, }; -jest.mock('../..', () => { +jest.mock('..', () => { return { FilterBar: () =>
, }; diff --git a/src/plugins/data/public/ui/search_bar/search_bar.tsx b/src/plugins/data/public/ui/search_bar/search_bar.tsx index 5083a1e68c6dd..2371ccdde068c 100644 --- a/src/plugins/data/public/ui/search_bar/search_bar.tsx +++ b/src/plugins/data/public/ui/search_bar/search_bar.tsx @@ -25,18 +25,12 @@ import ResizeObserver from 'resize-observer-polyfill'; import { get, isEqual } from 'lodash'; import { withKibana, KibanaReactContextValue } from '../../../../kibana_react/public'; -import { - IDataPluginServices, - TimeRange, - Query, - Filter, - IIndexPattern, - FilterBar, - SavedQuery, -} from '../..'; + import { QueryBarTopRow } from '../query_string_input/query_bar_top_row'; -import { SavedQueryAttributes, TimeHistoryContract } from '../../query'; -import { SavedQueryMeta, SavedQueryManagementComponent, SaveQueryForm } from '..'; +import { SavedQueryAttributes, TimeHistoryContract, SavedQuery } from '../../query'; +import { IDataPluginServices } from '../../types'; +import { TimeRange, Query, Filter, IIndexPattern } from '../../../common'; +import { SavedQueryMeta, SavedQueryManagementComponent, SaveQueryForm, FilterBar } from '..'; interface SearchBarInjectedDeps { kibana: KibanaReactContextValue; diff --git a/src/plugins/data/public/ui/typeahead/index.ts b/src/plugins/data/public/ui/typeahead/index.ts new file mode 100644 index 0000000000000..38b51622b85f7 --- /dev/null +++ b/src/plugins/data/public/ui/typeahead/index.ts @@ -0,0 +1,20 @@ +/* + * 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. + */ + +export { SuggestionsComponent } from './suggestions_component'; diff --git a/src/plugins/data/public/ui/typeahead/suggestion_component.tsx b/src/plugins/data/public/ui/typeahead/suggestion_component.tsx index 4c46c4f802e6a..951e47165819f 100644 --- a/src/plugins/data/public/ui/typeahead/suggestion_component.tsx +++ b/src/plugins/data/public/ui/typeahead/suggestion_component.tsx @@ -19,7 +19,7 @@ import { EuiIcon } from '@elastic/eui'; import classNames from 'classnames'; -import React, { FunctionComponent } from 'react'; +import React from 'react'; import { QuerySuggestion } from '../../autocomplete'; function getEuiIconType(type: string) { @@ -48,7 +48,7 @@ interface Props { ariaId: string; } -export const SuggestionComponent: FunctionComponent = props => { +export function SuggestionComponent(props: Props) { return ( // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/interactive-supports-focus
= props => {
); -}; +} diff --git a/src/plugins/data/public/ui/typeahead/suggestions_component.tsx b/src/plugins/data/public/ui/typeahead/suggestions_component.tsx index 375bc63a2318c..cdc6cd5b9e772 100644 --- a/src/plugins/data/public/ui/typeahead/suggestions_component.tsx +++ b/src/plugins/data/public/ui/typeahead/suggestions_component.tsx @@ -19,7 +19,7 @@ import { isEmpty } from 'lodash'; import React, { Component } from 'react'; -import { QuerySuggestion } from '../..'; +import { QuerySuggestion } from '../../autocomplete'; import { SuggestionComponent } from './suggestion_component'; interface Props { diff --git a/src/plugins/data/server/plugins_data_server.api.md b/src/plugins/data/server/plugins_data_server.api.md new file mode 100644 index 0000000000000..0f0abe7df8a39 --- /dev/null +++ b/src/plugins/data/server/plugins_data_server.api.md @@ -0,0 +1,695 @@ +## API Report File for "kibana" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { APICaller as APICaller_2 } from 'kibana/server'; +import Boom from 'boom'; +import { BulkIndexDocumentsParams } from 'elasticsearch'; +import { CallCluster as CallCluster_2 } from 'src/legacy/core_plugins/elasticsearch'; +import { CatAliasesParams } from 'elasticsearch'; +import { CatAllocationParams } from 'elasticsearch'; +import { CatCommonParams } from 'elasticsearch'; +import { CatFielddataParams } from 'elasticsearch'; +import { CatHealthParams } from 'elasticsearch'; +import { CatHelpParams } from 'elasticsearch'; +import { CatIndicesParams } from 'elasticsearch'; +import { CatRecoveryParams } from 'elasticsearch'; +import { CatSegmentsParams } from 'elasticsearch'; +import { CatShardsParams } from 'elasticsearch'; +import { CatSnapshotsParams } from 'elasticsearch'; +import { CatTasksParams } from 'elasticsearch'; +import { CatThreadPoolParams } from 'elasticsearch'; +import { ClearScrollParams } from 'elasticsearch'; +import { Client } from 'elasticsearch'; +import { ClusterAllocationExplainParams } from 'elasticsearch'; +import { ClusterGetSettingsParams } from 'elasticsearch'; +import { ClusterHealthParams } from 'elasticsearch'; +import { ClusterPendingTasksParams } from 'elasticsearch'; +import { ClusterPutSettingsParams } from 'elasticsearch'; +import { ClusterRerouteParams } from 'elasticsearch'; +import { ClusterStateParams } from 'elasticsearch'; +import { ClusterStatsParams } from 'elasticsearch'; +import { ConfigOptions } from 'elasticsearch'; +import { CountParams } from 'elasticsearch'; +import { CreateDocumentParams } from 'elasticsearch'; +import { DeleteDocumentByQueryParams } from 'elasticsearch'; +import { DeleteDocumentParams } from 'elasticsearch'; +import { DeleteScriptParams } from 'elasticsearch'; +import { DeleteTemplateParams } from 'elasticsearch'; +import { DetailedPeerCertificate } from 'tls'; +import { Duration } from 'moment'; +import { ExistsParams } from 'elasticsearch'; +import { ExplainParams } from 'elasticsearch'; +import { FieldStatsParams } from 'elasticsearch'; +import { GenericParams } from 'elasticsearch'; +import { GetParams } from 'elasticsearch'; +import { GetResponse } from 'elasticsearch'; +import { GetScriptParams } from 'elasticsearch'; +import { GetSourceParams } from 'elasticsearch'; +import { GetTemplateParams } from 'elasticsearch'; +import { IContextProvider as IContextProvider_2 } from 'kibana/server'; +import { IncomingHttpHeaders } from 'http'; +import { IndexDocumentParams } from 'elasticsearch'; +import { IndicesAnalyzeParams } from 'elasticsearch'; +import { IndicesClearCacheParams } from 'elasticsearch'; +import { IndicesCloseParams } from 'elasticsearch'; +import { IndicesCreateParams } from 'elasticsearch'; +import { IndicesDeleteAliasParams } from 'elasticsearch'; +import { IndicesDeleteParams } from 'elasticsearch'; +import { IndicesDeleteTemplateParams } from 'elasticsearch'; +import { IndicesExistsAliasParams } from 'elasticsearch'; +import { IndicesExistsParams } from 'elasticsearch'; +import { IndicesExistsTemplateParams } from 'elasticsearch'; +import { IndicesExistsTypeParams } from 'elasticsearch'; +import { IndicesFlushParams } from 'elasticsearch'; +import { IndicesFlushSyncedParams } from 'elasticsearch'; +import { IndicesForcemergeParams } from 'elasticsearch'; +import { IndicesGetAliasParams } from 'elasticsearch'; +import { IndicesGetFieldMappingParams } from 'elasticsearch'; +import { IndicesGetMappingParams } from 'elasticsearch'; +import { IndicesGetParams } from 'elasticsearch'; +import { IndicesGetSettingsParams } from 'elasticsearch'; +import { IndicesGetTemplateParams } from 'elasticsearch'; +import { IndicesGetUpgradeParams } from 'elasticsearch'; +import { IndicesOpenParams } from 'elasticsearch'; +import { IndicesPutAliasParams } from 'elasticsearch'; +import { IndicesPutMappingParams } from 'elasticsearch'; +import { IndicesPutSettingsParams } from 'elasticsearch'; +import { IndicesPutTemplateParams } from 'elasticsearch'; +import { IndicesRecoveryParams } from 'elasticsearch'; +import { IndicesRefreshParams } from 'elasticsearch'; +import { IndicesRolloverParams } from 'elasticsearch'; +import { IndicesSegmentsParams } from 'elasticsearch'; +import { IndicesShardStoresParams } from 'elasticsearch'; +import { IndicesShrinkParams } from 'elasticsearch'; +import { IndicesStatsParams } from 'elasticsearch'; +import { IndicesUpdateAliasesParams } from 'elasticsearch'; +import { IndicesUpgradeParams } from 'elasticsearch'; +import { IndicesValidateQueryParams } from 'elasticsearch'; +import { InfoParams } from 'elasticsearch'; +import { IngestDeletePipelineParams } from 'elasticsearch'; +import { IngestGetPipelineParams } from 'elasticsearch'; +import { IngestPutPipelineParams } from 'elasticsearch'; +import { IngestSimulateParams } from 'elasticsearch'; +import { KibanaConfigType as KibanaConfigType_2 } from 'src/core/server/kibana_config'; +import { Logger as Logger_2 } from 'src/core/server/logging'; +import { Logger as Logger_3 } from 'kibana/server'; +import { MGetParams } from 'elasticsearch'; +import { MGetResponse } from 'elasticsearch'; +import moment from 'moment'; +import { MSearchParams } from 'elasticsearch'; +import { MSearchResponse } from 'elasticsearch'; +import { MSearchTemplateParams } from 'elasticsearch'; +import { MTermVectorsParams } from 'elasticsearch'; +import { NodesHotThreadsParams } from 'elasticsearch'; +import { NodesInfoParams } from 'elasticsearch'; +import { NodesStatsParams } from 'elasticsearch'; +import { ObjectType } from '@kbn/config-schema'; +import { Observable } from 'rxjs'; +import { PeerCertificate } from 'tls'; +import { PingParams } from 'elasticsearch'; +import { PutScriptParams } from 'elasticsearch'; +import { PutTemplateParams } from 'elasticsearch'; +import { RecursiveReadonly } from 'kibana/public'; +import { ReindexParams } from 'elasticsearch'; +import { ReindexRethrottleParams } from 'elasticsearch'; +import { RenderSearchTemplateParams } from 'elasticsearch'; +import { Request } from 'hapi'; +import { ResponseObject } from 'hapi'; +import { ResponseToolkit } from 'hapi'; +import { SchemaTypeError } from '@kbn/config-schema'; +import { ScrollParams } from 'elasticsearch'; +import { SearchParams } from 'elasticsearch'; +import { SearchResponse } from 'elasticsearch'; +import { SearchShardsParams } from 'elasticsearch'; +import { SearchTemplateParams } from 'elasticsearch'; +import { ShallowPromise } from '@kbn/utility-types'; +import { SnapshotCreateParams } from 'elasticsearch'; +import { SnapshotCreateRepositoryParams } from 'elasticsearch'; +import { SnapshotDeleteParams } from 'elasticsearch'; +import { SnapshotDeleteRepositoryParams } from 'elasticsearch'; +import { SnapshotGetParams } from 'elasticsearch'; +import { SnapshotGetRepositoryParams } from 'elasticsearch'; +import { SnapshotRestoreParams } from 'elasticsearch'; +import { SnapshotStatusParams } from 'elasticsearch'; +import { SnapshotVerifyRepositoryParams } from 'elasticsearch'; +import { Stream } from 'stream'; +import { SuggestParams } from 'elasticsearch'; +import { TasksCancelParams } from 'elasticsearch'; +import { TasksGetParams } from 'elasticsearch'; +import { TasksListParams } from 'elasticsearch'; +import { TermvectorsParams } from 'elasticsearch'; +import { Type } from '@kbn/config-schema'; +import { TypeOf } from '@kbn/config-schema'; +import { UpdateDocumentByQueryParams } from 'elasticsearch'; +import { UpdateDocumentParams } from 'elasticsearch'; +import { Url } from 'url'; + +// Warning: (ae-missing-release-tag) "castEsToKbnFieldTypeName" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export const castEsToKbnFieldTypeName: (esType: string) => KBN_FIELD_TYPES; + +// @public (undocumented) +export enum ES_FIELD_TYPES { + // (undocumented) + ATTACHMENT = "attachment", + // (undocumented) + BOOLEAN = "boolean", + // (undocumented) + BYTE = "byte", + // (undocumented) + DATE = "date", + // (undocumented) + DATE_NANOS = "date_nanos", + // (undocumented) + DOUBLE = "double", + // (undocumented) + FLOAT = "float", + // (undocumented) + GEO_POINT = "geo_point", + // (undocumented) + GEO_SHAPE = "geo_shape", + // (undocumented) + HALF_FLOAT = "half_float", + // (undocumented) + _ID = "_id", + // (undocumented) + _INDEX = "_index", + // (undocumented) + INTEGER = "integer", + // (undocumented) + IP = "ip", + // (undocumented) + KEYWORD = "keyword", + // (undocumented) + LONG = "long", + // (undocumented) + MURMUR3 = "murmur3", + // (undocumented) + NESTED = "nested", + // (undocumented) + OBJECT = "object", + // (undocumented) + SCALED_FLOAT = "scaled_float", + // (undocumented) + SHORT = "short", + // (undocumented) + _SOURCE = "_source", + // (undocumented) + STRING = "string", + // (undocumented) + TEXT = "text", + // (undocumented) + TOKEN_COUNT = "token_count", + // (undocumented) + _TYPE = "_type" +} + +// Warning: (ae-missing-release-tag) "esFilters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const esFilters: { + buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter; + buildCustomFilter: typeof buildCustomFilter; + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; + buildExistsFilter: (field: import("../common").IFieldType, indexPattern: import("../common").IIndexPattern) => import("../common").ExistsFilter; + buildFilter: typeof buildFilter; + buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").IIndexPattern) => import("../common").PhraseFilter; + buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").IIndexPattern) => import("../common").PhrasesFilter; + buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").IIndexPattern, formattedValue?: string | undefined) => import("../common").RangeFilter; + isFilterDisabled: (filter: import("../common").Filter) => boolean; +}; + +// Warning: (ae-missing-release-tag) "esKuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const esKuery: { + nodeTypes: import("../common/es_query/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial) => import("../common").KueryNode; + toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").IIndexPattern | undefined, config?: Record | undefined, context?: Record | undefined) => import("../../kibana_utils/common").JsonObject; +}; + +// Warning: (ae-missing-release-tag) "esQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const esQuery: { + getEsQueryConfig: typeof getEsQueryConfig; + buildEsQuery: typeof buildEsQuery; +}; + +// Warning: (ae-missing-release-tag) "EsQueryConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface EsQueryConfig { + // (undocumented) + allowLeadingWildcards: boolean; + // (undocumented) + dateFormatTZ?: string; + // (undocumented) + ignoreFilterIfFieldNotInIndex: boolean; + // (undocumented) + queryStringOptions: Record; +} + +// Warning: (ae-missing-release-tag) "FieldFormatConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface FieldFormatConfig { + // (undocumented) + es?: boolean; + // Warning: (ae-forgotten-export) The symbol "FieldFormatId" needs to be exported by the entry point index.d.ts + // + // (undocumented) + id: FieldFormatId; + // (undocumented) + params: Record; +} + +// Warning: (ae-missing-release-tag) "fieldFormats" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const fieldFormats: { + FieldFormatsRegistry: typeof FieldFormatsRegistry; + FieldFormat: typeof FieldFormat; + serializeFieldFormat: (agg: import("../../../legacy/core_plugins/data/public/search").AggConfig) => import("../../expressions/common").SerializedFieldFormat; + BoolFormat: typeof BoolFormat; + BytesFormat: typeof BytesFormat; + ColorFormat: typeof ColorFormat; + DateNanosFormat: typeof DateNanosFormat; + DurationFormat: typeof DurationFormat; + IpFormat: typeof IpFormat; + NumberFormat: typeof NumberFormat; + PercentFormat: typeof PercentFormat; + RelativeDateFormat: typeof RelativeDateFormat; + SourceFormat: typeof SourceFormat; + StaticLookupFormat: typeof StaticLookupFormat; + UrlFormat: typeof UrlFormat; + StringFormat: typeof StringFormat; + TruncateFormat: typeof TruncateFormat; +}; + +// Warning: (ae-missing-release-tag) "FieldFormatsGetConfigFn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type FieldFormatsGetConfigFn = (key: string, defaultOverride?: T) => T; + +// Warning: (ae-missing-release-tag) "Filter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface Filter { + // Warning: (ae-forgotten-export) The symbol "FilterState" needs to be exported by the entry point index.d.ts + // + // (undocumented) + $state?: FilterState; + // Warning: (ae-forgotten-export) The symbol "FilterMeta" needs to be exported by the entry point index.d.ts + // + // (undocumented) + meta: FilterMeta; + // (undocumented) + query?: any; +} + +// Warning: (ae-missing-release-tag) "IFieldFormatsRegistry" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type IFieldFormatsRegistry = PublicMethodsOf; + +// Warning: (ae-missing-release-tag) "IFieldSubType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IFieldSubType { + // (undocumented) + multi?: { + parent: string; + }; + // (undocumented) + nested?: { + path: string; + }; +} + +// Warning: (ae-missing-release-tag) "IFieldType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IFieldType { + // (undocumented) + aggregatable?: boolean; + // (undocumented) + count?: number; + // (undocumented) + displayName?: string; + // (undocumented) + esTypes?: string[]; + // (undocumented) + filterable?: boolean; + // (undocumented) + format?: any; + // (undocumented) + lang?: string; + // (undocumented) + name: string; + // (undocumented) + readFromDocValues?: boolean; + // (undocumented) + script?: string; + // (undocumented) + scripted?: boolean; + // (undocumented) + searchable?: boolean; + // (undocumented) + sortable?: boolean; + // (undocumented) + subType?: IFieldSubType; + // (undocumented) + type: string; + // (undocumented) + visualizable?: boolean; +} + +// Warning: (ae-missing-release-tag) "IIndexPattern" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IIndexPattern { + // (undocumented) + [key: string]: any; + // (undocumented) + fieldFormatMap?: Record; + // (undocumented) + fields: IFieldType[]; + // (undocumented) + id?: string; + // (undocumented) + timeFieldName?: string; + // (undocumented) + title: string; + // (undocumented) + type?: string; +} + +// Warning: (ae-missing-release-tag) "IndexPatternAttributes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated +export interface IndexPatternAttributes { + // (undocumented) + fields: string; + // (undocumented) + timeFieldName?: string; + // (undocumented) + title: string; + // (undocumented) + type: string; + // (undocumented) + typeMeta: string; +} + +// Warning: (ae-missing-release-tag) "FieldDescriptor" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IndexPatternFieldDescriptor { + // (undocumented) + aggregatable: boolean; + // (undocumented) + esTypes: string[]; + // (undocumented) + name: string; + // (undocumented) + readFromDocValues: boolean; + // (undocumented) + searchable: boolean; + // Warning: (ae-forgotten-export) The symbol "FieldSubType" needs to be exported by the entry point index.d.ts + // + // (undocumented) + subType?: FieldSubType; + // (undocumented) + type: string; +} + +// Warning: (ae-missing-release-tag) "indexPatterns" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const indexPatterns: { + isFilterable: typeof isFilterable; + isNestedField: typeof isNestedField; +}; + +// Warning: (ae-missing-release-tag) "IndexPatternsFetcher" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class IndexPatternsFetcher { + constructor(callDataCluster: APICaller_2); + getFieldsForTimePattern(options: { + pattern: string; + metaFields: string[]; + lookBack: number; + interval: string; + }): Promise; + getFieldsForWildcard(options: { + pattern: string | string[]; + metaFields?: string[]; + }): Promise; +} + +// Warning: (ae-missing-release-tag) "IRequestTypesMap" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IRequestTypesMap { + // Warning: (ae-forgotten-export) The symbol "IKibanaSearchRequest" needs to be exported by the entry point index.d.ts + // + // (undocumented) + [key: string]: IKibanaSearchRequest; + // Warning: (ae-forgotten-export) The symbol "ES_SEARCH_STRATEGY" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "IEsSearchRequest" needs to be exported by the entry point index.d.ts + // + // (undocumented) + [ES_SEARCH_STRATEGY]: IEsSearchRequest; +} + +// Warning: (ae-missing-release-tag) "IResponseTypesMap" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IResponseTypesMap { + // Warning: (ae-forgotten-export) The symbol "IKibanaSearchResponse" needs to be exported by the entry point index.d.ts + // + // (undocumented) + [key: string]: IKibanaSearchResponse; + // Warning: (ae-forgotten-export) The symbol "IEsSearchResponse" needs to be exported by the entry point index.d.ts + // + // (undocumented) + [ES_SEARCH_STRATEGY]: IEsSearchResponse; +} + +// Warning: (ae-missing-release-tag) "ISearchContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface ISearchContext { + // Warning: (ae-forgotten-export) The symbol "SharedGlobalConfig" needs to be exported by the entry point index.d.ts + // + // (undocumented) + config$: Observable; + // Warning: (ae-forgotten-export) The symbol "CoreSetup" needs to be exported by the entry point index.d.ts + // + // (undocumented) + core: CoreSetup; +} + +// Warning: (ae-missing-release-tag) "ISearchSetup" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export interface ISearchSetup { + // (undocumented) + __LEGACY: { + search: (caller: APICaller_2, request: IRequestTypesMap[T], strategyName?: T) => Promise; + }; + // (undocumented) + registerSearchStrategyContext: (pluginId: symbol, strategyName: TContextName, provider: IContextProvider_2, TContextName>) => void; + // Warning: (ae-forgotten-export) The symbol "TRegisterSearchStrategyProvider" needs to be exported by the entry point index.d.ts + registerSearchStrategyProvider: TRegisterSearchStrategyProvider; +} + +// @public (undocumented) +export enum KBN_FIELD_TYPES { + // (undocumented) + ATTACHMENT = "attachment", + // (undocumented) + BOOLEAN = "boolean", + // (undocumented) + CONFLICT = "conflict", + // (undocumented) + DATE = "date", + // (undocumented) + GEO_POINT = "geo_point", + // (undocumented) + GEO_SHAPE = "geo_shape", + // (undocumented) + IP = "ip", + // (undocumented) + MURMUR3 = "murmur3", + // (undocumented) + NESTED = "nested", + // (undocumented) + NUMBER = "number", + // (undocumented) + OBJECT = "object", + // (undocumented) + _SOURCE = "_source", + // (undocumented) + STRING = "string", + // (undocumented) + UNKNOWN = "unknown" +} + +// Warning: (ae-missing-release-tag) "KueryNode" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface KueryNode { + // (undocumented) + [key: string]: any; + // Warning: (ae-forgotten-export) The symbol "NodeTypes" needs to be exported by the entry point index.d.ts + // + // (undocumented) + type: keyof NodeTypes; +} + +// Warning: (ae-missing-release-tag) "parseInterval" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export function parseInterval(interval: string): moment.Duration | null; + +// Warning: (ae-forgotten-export) The symbol "Plugin" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "DataServerPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class Plugin implements Plugin_2 { + // Warning: (ae-forgotten-export) The symbol "PluginInitializerContext" needs to be exported by the entry point index.d.ts + constructor(initializerContext: PluginInitializerContext); + // Warning: (ae-forgotten-export) The symbol "DataPluginSetupDependencies" needs to be exported by the entry point index.d.ts + // + // (undocumented) + setup(core: CoreSetup, { usageCollection }: DataPluginSetupDependencies): { + fieldFormats: { + register: (customFieldFormat: import("../common").IFieldFormatType) => number; + }; + search: ISearchSetup; + }; + // Warning: (ae-forgotten-export) The symbol "CoreStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + start(core: CoreStart): { + fieldFormats: { + fieldFormatServiceFactory: (uiSettings: import("kibana/server").IUiSettingsClient) => Promise; + }; + }; + // (undocumented) + stop(): void; +} + +// @public +export function plugin(initializerContext: PluginInitializerContext): Plugin; + +// Warning: (ae-missing-release-tag) "DataPluginSetup" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface PluginSetup { + // Warning: (ae-forgotten-export) The symbol "FieldFormatsSetup" needs to be exported by the entry point index.d.ts + // + // (undocumented) + fieldFormats: FieldFormatsSetup; + // (undocumented) + search: ISearchSetup; +} + +// Warning: (ae-missing-release-tag) "DataPluginStart" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface PluginStart { + // Warning: (ae-forgotten-export) The symbol "FieldFormatsStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + fieldFormats: FieldFormatsStart; +} + +// Warning: (ae-missing-release-tag) "Query" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface Query { + // (undocumented) + language: string; + // (undocumented) + query: string | { + [key: string]: any; + }; +} + +// Warning: (ae-missing-release-tag) "RefreshInterval" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface RefreshInterval { + // (undocumented) + pause: boolean; + // (undocumented) + value: number; +} + +// Warning: (ae-missing-release-tag) "shouldReadFieldFromDocValues" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export function shouldReadFieldFromDocValues(aggregatable: boolean, esType: string): boolean; + +// Warning: (ae-missing-release-tag) "TimeRange" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface TimeRange { + // (undocumented) + from: string; + // (undocumented) + to: string; +} + +// Warning: (ae-forgotten-export) The symbol "ISearchGeneric" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ISearchStrategy" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "TSearchStrategyProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export type TSearchStrategyProvider = (context: ISearchContext, caller: APICaller_2, search: ISearchGeneric) => ISearchStrategy; + +// Warning: (ae-missing-release-tag) "TStrategyTypes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export type TStrategyTypes = typeof ES_SEARCH_STRATEGY | string; + + +// Warnings were encountered during analysis: +// +// src/plugins/data/server/index.ts:39:23 - (ae-forgotten-export) The symbol "buildCustomFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:39:23 - (ae-forgotten-export) The symbol "buildFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:69:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:69:21 - (ae-forgotten-export) The symbol "buildEsQuery" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "FieldFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "DateNanosFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:100:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:128:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:128:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/search/i_search_setup.ts:45:5 - (ae-forgotten-export) The symbol "DEFAULT_SEARCH_STRATEGY" needs to be exported by the entry point index.d.ts + +// (No @packageDocumentation comment for this package) + +``` diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md new file mode 100644 index 0000000000000..a1f59b776328c --- /dev/null +++ b/src/plugins/data/server/server.api.md @@ -0,0 +1,711 @@ +## API Report File for "kibana" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { APICaller as APICaller_2 } from 'kibana/server'; +import Boom from 'boom'; +import { BulkIndexDocumentsParams } from 'elasticsearch'; +import { CallCluster as CallCluster_2 } from 'src/legacy/core_plugins/elasticsearch'; +import { CatAliasesParams } from 'elasticsearch'; +import { CatAllocationParams } from 'elasticsearch'; +import { CatCommonParams } from 'elasticsearch'; +import { CatFielddataParams } from 'elasticsearch'; +import { CatHealthParams } from 'elasticsearch'; +import { CatHelpParams } from 'elasticsearch'; +import { CatIndicesParams } from 'elasticsearch'; +import { CatRecoveryParams } from 'elasticsearch'; +import { CatSegmentsParams } from 'elasticsearch'; +import { CatShardsParams } from 'elasticsearch'; +import { CatSnapshotsParams } from 'elasticsearch'; +import { CatTasksParams } from 'elasticsearch'; +import { CatThreadPoolParams } from 'elasticsearch'; +import { ClearScrollParams } from 'elasticsearch'; +import { Client } from 'elasticsearch'; +import { ClusterAllocationExplainParams } from 'elasticsearch'; +import { ClusterGetSettingsParams } from 'elasticsearch'; +import { ClusterHealthParams } from 'elasticsearch'; +import { ClusterPendingTasksParams } from 'elasticsearch'; +import { ClusterPutSettingsParams } from 'elasticsearch'; +import { ClusterRerouteParams } from 'elasticsearch'; +import { ClusterStateParams } from 'elasticsearch'; +import { ClusterStatsParams } from 'elasticsearch'; +import { ConfigOptions } from 'elasticsearch'; +import { CountParams } from 'elasticsearch'; +import { CreateDocumentParams } from 'elasticsearch'; +import { DeleteDocumentByQueryParams } from 'elasticsearch'; +import { DeleteDocumentParams } from 'elasticsearch'; +import { DeleteScriptParams } from 'elasticsearch'; +import { DeleteTemplateParams } from 'elasticsearch'; +import { DetailedPeerCertificate } from 'tls'; +import { Duration } from 'moment'; +import { ExistsParams } from 'elasticsearch'; +import { ExplainParams } from 'elasticsearch'; +import { FieldStatsParams } from 'elasticsearch'; +import { GenericParams } from 'elasticsearch'; +import { GetParams } from 'elasticsearch'; +import { GetResponse } from 'elasticsearch'; +import { GetScriptParams } from 'elasticsearch'; +import { GetSourceParams } from 'elasticsearch'; +import { GetTemplateParams } from 'elasticsearch'; +import { IContextProvider as IContextProvider_2 } from 'kibana/server'; +import { IncomingHttpHeaders } from 'http'; +import { IndexDocumentParams } from 'elasticsearch'; +import { IndicesAnalyzeParams } from 'elasticsearch'; +import { IndicesClearCacheParams } from 'elasticsearch'; +import { IndicesCloseParams } from 'elasticsearch'; +import { IndicesCreateParams } from 'elasticsearch'; +import { IndicesDeleteAliasParams } from 'elasticsearch'; +import { IndicesDeleteParams } from 'elasticsearch'; +import { IndicesDeleteTemplateParams } from 'elasticsearch'; +import { IndicesExistsAliasParams } from 'elasticsearch'; +import { IndicesExistsParams } from 'elasticsearch'; +import { IndicesExistsTemplateParams } from 'elasticsearch'; +import { IndicesExistsTypeParams } from 'elasticsearch'; +import { IndicesFlushParams } from 'elasticsearch'; +import { IndicesFlushSyncedParams } from 'elasticsearch'; +import { IndicesForcemergeParams } from 'elasticsearch'; +import { IndicesGetAliasParams } from 'elasticsearch'; +import { IndicesGetFieldMappingParams } from 'elasticsearch'; +import { IndicesGetMappingParams } from 'elasticsearch'; +import { IndicesGetParams } from 'elasticsearch'; +import { IndicesGetSettingsParams } from 'elasticsearch'; +import { IndicesGetTemplateParams } from 'elasticsearch'; +import { IndicesGetUpgradeParams } from 'elasticsearch'; +import { IndicesOpenParams } from 'elasticsearch'; +import { IndicesPutAliasParams } from 'elasticsearch'; +import { IndicesPutMappingParams } from 'elasticsearch'; +import { IndicesPutSettingsParams } from 'elasticsearch'; +import { IndicesPutTemplateParams } from 'elasticsearch'; +import { IndicesRecoveryParams } from 'elasticsearch'; +import { IndicesRefreshParams } from 'elasticsearch'; +import { IndicesRolloverParams } from 'elasticsearch'; +import { IndicesSegmentsParams } from 'elasticsearch'; +import { IndicesShardStoresParams } from 'elasticsearch'; +import { IndicesShrinkParams } from 'elasticsearch'; +import { IndicesStatsParams } from 'elasticsearch'; +import { IndicesUpdateAliasesParams } from 'elasticsearch'; +import { IndicesUpgradeParams } from 'elasticsearch'; +import { IndicesValidateQueryParams } from 'elasticsearch'; +import { InfoParams } from 'elasticsearch'; +import { IngestDeletePipelineParams } from 'elasticsearch'; +import { IngestGetPipelineParams } from 'elasticsearch'; +import { IngestPutPipelineParams } from 'elasticsearch'; +import { IngestSimulateParams } from 'elasticsearch'; +import { KibanaConfigType as KibanaConfigType_2 } from 'src/core/server/kibana_config'; +import { Logger as Logger_2 } from 'src/core/server/logging'; +import { Logger as Logger_3 } from 'kibana/server'; +import { MGetParams } from 'elasticsearch'; +import { MGetResponse } from 'elasticsearch'; +import moment from 'moment'; +import { MSearchParams } from 'elasticsearch'; +import { MSearchResponse } from 'elasticsearch'; +import { MSearchTemplateParams } from 'elasticsearch'; +import { MTermVectorsParams } from 'elasticsearch'; +import { NodesHotThreadsParams } from 'elasticsearch'; +import { NodesInfoParams } from 'elasticsearch'; +import { NodesStatsParams } from 'elasticsearch'; +import { ObjectType } from '@kbn/config-schema'; +import { Observable } from 'rxjs'; +import { PeerCertificate } from 'tls'; +import { PingParams } from 'elasticsearch'; +import { PutScriptParams } from 'elasticsearch'; +import { PutTemplateParams } from 'elasticsearch'; +import { RecursiveReadonly } from 'kibana/public'; +import { ReindexParams } from 'elasticsearch'; +import { ReindexRethrottleParams } from 'elasticsearch'; +import { RenderSearchTemplateParams } from 'elasticsearch'; +import { Request } from 'hapi'; +import { ResponseObject } from 'hapi'; +import { ResponseToolkit } from 'hapi'; +import { SchemaTypeError } from '@kbn/config-schema'; +import { ScrollParams } from 'elasticsearch'; +import { SearchParams } from 'elasticsearch'; +import { SearchResponse } from 'elasticsearch'; +import { SearchShardsParams } from 'elasticsearch'; +import { SearchTemplateParams } from 'elasticsearch'; +import { ShallowPromise } from '@kbn/utility-types'; +import { SnapshotCreateParams } from 'elasticsearch'; +import { SnapshotCreateRepositoryParams } from 'elasticsearch'; +import { SnapshotDeleteParams } from 'elasticsearch'; +import { SnapshotDeleteRepositoryParams } from 'elasticsearch'; +import { SnapshotGetParams } from 'elasticsearch'; +import { SnapshotGetRepositoryParams } from 'elasticsearch'; +import { SnapshotRestoreParams } from 'elasticsearch'; +import { SnapshotStatusParams } from 'elasticsearch'; +import { SnapshotVerifyRepositoryParams } from 'elasticsearch'; +import { Stream } from 'stream'; +import { SuggestParams } from 'elasticsearch'; +import { TasksCancelParams } from 'elasticsearch'; +import { TasksGetParams } from 'elasticsearch'; +import { TasksListParams } from 'elasticsearch'; +import { TermvectorsParams } from 'elasticsearch'; +import { Type } from '@kbn/config-schema'; +import { TypeOf } from '@kbn/config-schema'; +import { UpdateDocumentByQueryParams } from 'elasticsearch'; +import { UpdateDocumentParams } from 'elasticsearch'; +import { Url } from 'url'; + +// Warning: (ae-missing-release-tag) "castEsToKbnFieldTypeName" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export const castEsToKbnFieldTypeName: (esType: string) => KBN_FIELD_TYPES; + +// @public (undocumented) +export enum ES_FIELD_TYPES { + // (undocumented) + ATTACHMENT = "attachment", + // (undocumented) + BOOLEAN = "boolean", + // (undocumented) + BYTE = "byte", + // (undocumented) + DATE = "date", + // (undocumented) + DATE_NANOS = "date_nanos", + // (undocumented) + DOUBLE = "double", + // (undocumented) + FLOAT = "float", + // (undocumented) + GEO_POINT = "geo_point", + // (undocumented) + GEO_SHAPE = "geo_shape", + // (undocumented) + HALF_FLOAT = "half_float", + // (undocumented) + _ID = "_id", + // (undocumented) + _INDEX = "_index", + // (undocumented) + INTEGER = "integer", + // (undocumented) + IP = "ip", + // (undocumented) + KEYWORD = "keyword", + // (undocumented) + LONG = "long", + // (undocumented) + MURMUR3 = "murmur3", + // (undocumented) + NESTED = "nested", + // (undocumented) + OBJECT = "object", + // (undocumented) + SCALED_FLOAT = "scaled_float", + // (undocumented) + SHORT = "short", + // (undocumented) + _SOURCE = "_source", + // (undocumented) + STRING = "string", + // (undocumented) + TEXT = "text", + // (undocumented) + TOKEN_COUNT = "token_count", + // (undocumented) + _TYPE = "_type" +} + +// Warning: (ae-missing-release-tag) "esFilters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const esFilters: { + buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter; + buildCustomFilter: typeof buildCustomFilter; + buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter; + buildExistsFilter: (field: import("../common").IFieldType, indexPattern: import("../common").IIndexPattern) => import("../common").ExistsFilter; + buildFilter: typeof buildFilter; + buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").IIndexPattern) => import("../common").PhraseFilter; + buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").IIndexPattern) => import("../common").PhrasesFilter; + buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").IIndexPattern, formattedValue?: string | undefined) => import("../common").RangeFilter; + isFilterDisabled: (filter: import("../common").Filter) => boolean; +}; + +// Warning: (ae-missing-release-tag) "esKuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const esKuery: { + nodeTypes: import("../common/es_query/kuery/node_types").NodeTypes; + fromKueryExpression: (expression: any, parseOptions?: Partial) => import("../common").KueryNode; + toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").IIndexPattern | undefined, config?: Record | undefined, context?: Record | undefined) => import("../../kibana_utils/common").JsonObject; +}; + +// Warning: (ae-missing-release-tag) "esQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const esQuery: { + buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").IIndexPattern | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => { + must: never[]; + filter: import("../common").Filter[]; + should: never[]; + must_not: import("../common").Filter[]; + }; + getEsQueryConfig: typeof getEsQueryConfig; + buildEsQuery: typeof buildEsQuery; +}; + +// Warning: (ae-missing-release-tag) "EsQueryConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface EsQueryConfig { + // (undocumented) + allowLeadingWildcards: boolean; + // (undocumented) + dateFormatTZ?: string; + // (undocumented) + ignoreFilterIfFieldNotInIndex: boolean; + // (undocumented) + queryStringOptions: Record; +} + +// Warning: (ae-missing-release-tag) "FieldFormatConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface FieldFormatConfig { + // (undocumented) + es?: boolean; + // Warning: (ae-forgotten-export) The symbol "FieldFormatId" needs to be exported by the entry point index.d.ts + // + // (undocumented) + id: FieldFormatId; + // (undocumented) + params: Record; +} + +// Warning: (ae-missing-release-tag) "fieldFormats" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const fieldFormats: { + FieldFormatsRegistry: typeof FieldFormatsRegistry; + FieldFormat: typeof FieldFormat; + serializeFieldFormat: (agg: import("../../../legacy/core_plugins/data/public/search").AggConfig) => import("../../expressions/common").SerializedFieldFormat; + BoolFormat: typeof BoolFormat; + BytesFormat: typeof BytesFormat; + ColorFormat: typeof ColorFormat; + DateNanosFormat: typeof DateNanosFormat; + DurationFormat: typeof DurationFormat; + IpFormat: typeof IpFormat; + NumberFormat: typeof NumberFormat; + PercentFormat: typeof PercentFormat; + RelativeDateFormat: typeof RelativeDateFormat; + SourceFormat: typeof SourceFormat; + StaticLookupFormat: typeof StaticLookupFormat; + UrlFormat: typeof UrlFormat; + StringFormat: typeof StringFormat; + TruncateFormat: typeof TruncateFormat; +}; + +// Warning: (ae-missing-release-tag) "FieldFormatsGetConfigFn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type FieldFormatsGetConfigFn = (key: string, defaultOverride?: T) => T; + +// Warning: (ae-missing-release-tag) "Filter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface Filter { + // Warning: (ae-forgotten-export) The symbol "FilterState" needs to be exported by the entry point index.d.ts + // + // (undocumented) + $state?: FilterState; + // Warning: (ae-forgotten-export) The symbol "FilterMeta" needs to be exported by the entry point index.d.ts + // + // (undocumented) + meta: FilterMeta; + // (undocumented) + query?: any; +} + +// Warning: (ae-forgotten-export) The symbol "SharedGlobalConfig" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "getDefaultSearchParams" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export function getDefaultSearchParams(config: SharedGlobalConfig): { + timeout: string; + ignoreUnavailable: boolean; + restTotalHitsAsInt: boolean; +}; + +// Warning: (ae-forgotten-export) The symbol "TStrategyTypes" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "ICancel" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type ICancel = (id: string) => Promise; + +// Warning: (ae-missing-release-tag) "IFieldFormatsRegistry" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type IFieldFormatsRegistry = PublicMethodsOf; + +// Warning: (ae-missing-release-tag) "IFieldSubType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IFieldSubType { + // (undocumented) + multi?: { + parent: string; + }; + // (undocumented) + nested?: { + path: string; + }; +} + +// Warning: (ae-missing-release-tag) "IFieldType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IFieldType { + // (undocumented) + aggregatable?: boolean; + // (undocumented) + count?: number; + // (undocumented) + displayName?: string; + // (undocumented) + esTypes?: string[]; + // (undocumented) + filterable?: boolean; + // (undocumented) + format?: any; + // (undocumented) + lang?: string; + // (undocumented) + name: string; + // (undocumented) + readFromDocValues?: boolean; + // (undocumented) + script?: string; + // (undocumented) + scripted?: boolean; + // (undocumented) + searchable?: boolean; + // (undocumented) + sortable?: boolean; + // (undocumented) + subType?: IFieldSubType; + // (undocumented) + type: string; + // (undocumented) + visualizable?: boolean; +} + +// Warning: (ae-missing-release-tag) "IIndexPattern" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IIndexPattern { + // (undocumented) + [key: string]: any; + // (undocumented) + fieldFormatMap?: Record; + // (undocumented) + fields: IFieldType[]; + // (undocumented) + id?: string; + // (undocumented) + timeFieldName?: string; + // (undocumented) + title: string; + // (undocumented) + type?: string; +} + +// Warning: (ae-missing-release-tag) "IndexPatternAttributes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public @deprecated +export interface IndexPatternAttributes { + // (undocumented) + fields: string; + // (undocumented) + timeFieldName?: string; + // (undocumented) + title: string; + // (undocumented) + type: string; + // (undocumented) + typeMeta: string; +} + +// Warning: (ae-missing-release-tag) "FieldDescriptor" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IndexPatternFieldDescriptor { + // (undocumented) + aggregatable: boolean; + // (undocumented) + esTypes: string[]; + // (undocumented) + name: string; + // (undocumented) + readFromDocValues: boolean; + // (undocumented) + searchable: boolean; + // Warning: (ae-forgotten-export) The symbol "FieldSubType" needs to be exported by the entry point index.d.ts + // + // (undocumented) + subType?: FieldSubType; + // (undocumented) + type: string; +} + +// Warning: (ae-missing-release-tag) "indexPatterns" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const indexPatterns: { + isFilterable: typeof isFilterable; + isNestedField: typeof isNestedField; +}; + +// Warning: (ae-missing-release-tag) "IndexPatternsFetcher" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class IndexPatternsFetcher { + constructor(callDataCluster: APICaller_2); + getFieldsForTimePattern(options: { + pattern: string; + metaFields: string[]; + lookBack: number; + interval: string; + }): Promise; + getFieldsForWildcard(options: { + pattern: string | string[]; + metaFields?: string[]; + }): Promise; +} + +// Warning: (ae-missing-release-tag) "IRequestTypesMap" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IRequestTypesMap { + // Warning: (ae-forgotten-export) The symbol "IKibanaSearchRequest" needs to be exported by the entry point index.d.ts + // + // (undocumented) + [key: string]: IKibanaSearchRequest; + // Warning: (ae-forgotten-export) The symbol "ES_SEARCH_STRATEGY" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "IEsSearchRequest" needs to be exported by the entry point index.d.ts + // + // (undocumented) + [ES_SEARCH_STRATEGY]: IEsSearchRequest; +} + +// Warning: (ae-missing-release-tag) "IResponseTypesMap" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface IResponseTypesMap { + // Warning: (ae-forgotten-export) The symbol "IKibanaSearchResponse" needs to be exported by the entry point index.d.ts + // + // (undocumented) + [key: string]: IKibanaSearchResponse; + // Warning: (ae-forgotten-export) The symbol "IEsSearchResponse" needs to be exported by the entry point index.d.ts + // + // (undocumented) + [ES_SEARCH_STRATEGY]: IEsSearchResponse; +} + +// Warning: (ae-missing-release-tag) "ISearch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type ISearch = (request: IRequestTypesMap[T], options?: ISearchOptions) => Promise; + +// Warning: (ae-missing-release-tag) "ISearchContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface ISearchContext { + // (undocumented) + config$: Observable; + // Warning: (ae-forgotten-export) The symbol "CoreSetup" needs to be exported by the entry point index.d.ts + // + // (undocumented) + core: CoreSetup; +} + +// Warning: (ae-missing-release-tag) "ISearchOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface ISearchOptions { + // (undocumented) + signal?: AbortSignal; +} + +// @public (undocumented) +export enum KBN_FIELD_TYPES { + // (undocumented) + ATTACHMENT = "attachment", + // (undocumented) + BOOLEAN = "boolean", + // (undocumented) + CONFLICT = "conflict", + // (undocumented) + DATE = "date", + // (undocumented) + GEO_POINT = "geo_point", + // (undocumented) + GEO_SHAPE = "geo_shape", + // (undocumented) + IP = "ip", + // (undocumented) + MURMUR3 = "murmur3", + // (undocumented) + NESTED = "nested", + // (undocumented) + NUMBER = "number", + // (undocumented) + OBJECT = "object", + // (undocumented) + _SOURCE = "_source", + // (undocumented) + STRING = "string", + // (undocumented) + UNKNOWN = "unknown" +} + +// Warning: (ae-missing-release-tag) "KueryNode" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface KueryNode { + // (undocumented) + [key: string]: any; + // Warning: (ae-forgotten-export) The symbol "NodeTypes" needs to be exported by the entry point index.d.ts + // + // (undocumented) + type: keyof NodeTypes; +} + +// Warning: (ae-missing-release-tag) "parseInterval" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export function parseInterval(interval: string): moment.Duration | null; + +// Warning: (ae-forgotten-export) The symbol "Plugin" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "DataServerPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export class Plugin implements Plugin_2 { + // Warning: (ae-forgotten-export) The symbol "PluginInitializerContext" needs to be exported by the entry point index.d.ts + constructor(initializerContext: PluginInitializerContext); + // Warning: (ae-forgotten-export) The symbol "DataPluginSetupDependencies" needs to be exported by the entry point index.d.ts + // + // (undocumented) + setup(core: CoreSetup, { usageCollection }: DataPluginSetupDependencies): { + fieldFormats: { + register: (customFieldFormat: import("../common").IFieldFormatType) => number; + }; + search: ISearchSetup; + }; + // Warning: (ae-forgotten-export) The symbol "CoreStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + start(core: CoreStart): { + fieldFormats: { + fieldFormatServiceFactory: (uiSettings: import("kibana/server").IUiSettingsClient) => Promise; + }; + }; + // (undocumented) + stop(): void; +} + +// @public +export function plugin(initializerContext: PluginInitializerContext): Plugin; + +// Warning: (ae-missing-release-tag) "DataPluginSetup" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface PluginSetup { + // Warning: (ae-forgotten-export) The symbol "FieldFormatsSetup" needs to be exported by the entry point index.d.ts + // + // (undocumented) + fieldFormats: FieldFormatsSetup; + // (undocumented) + search: ISearchSetup; +} + +// Warning: (ae-missing-release-tag) "DataPluginStart" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface PluginStart { + // Warning: (ae-forgotten-export) The symbol "FieldFormatsStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + fieldFormats: FieldFormatsStart; +} + +// Warning: (ae-missing-release-tag) "Query" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface Query { + // (undocumented) + language: string; + // (undocumented) + query: string | { + [key: string]: any; + }; +} + +// Warning: (ae-missing-release-tag) "RefreshInterval" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface RefreshInterval { + // (undocumented) + pause: boolean; + // (undocumented) + value: number; +} + +// Warning: (ae-missing-release-tag) "shouldReadFieldFromDocValues" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export function shouldReadFieldFromDocValues(aggregatable: boolean, esType: string): boolean; + +// Warning: (ae-missing-release-tag) "TimeRange" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface TimeRange { + // (undocumented) + from: string; + // (undocumented) + mode?: 'absolute' | 'relative'; + // (undocumented) + to: string; +} + +// Warning: (ae-forgotten-export) The symbol "ISearchGeneric" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ISearchStrategy" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "TSearchStrategyProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +export type TSearchStrategyProvider = (context: ISearchContext, caller: APICaller_2, search: ISearchGeneric) => ISearchStrategy; + + +// Warnings were encountered during analysis: +// +// src/plugins/data/server/index.ts:39:23 - (ae-forgotten-export) The symbol "buildCustomFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:39:23 - (ae-forgotten-export) The symbol "buildFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:70:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:70:21 - (ae-forgotten-export) The symbol "buildEsQuery" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "FieldFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "DateNanosFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:102:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:130:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/index.ts:130:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts +// src/plugins/data/server/plugin.ts:62:14 - (ae-forgotten-export) The symbol "ISearchSetup" needs to be exported by the entry point index.d.ts + +// (No @packageDocumentation comment for this package) + +``` diff --git a/tasks/config/run.js b/tasks/config/run.js index a1b98422af4f3..e19de8e894e33 100644 --- a/tasks/config/run.js +++ b/tasks/config/run.js @@ -118,10 +118,10 @@ module.exports = function(grunt) { // used by the test tasks // runs the check_core_api_changes script to ensure API changes are explictily accepted - checkCoreApiChanges: scriptWithGithubChecks({ + checkDocApiChanges: scriptWithGithubChecks({ title: 'Check core API changes', cmd: NODE, - args: ['scripts/check_core_api_changes'], + args: ['scripts/check_published_api_changes'], }), // used by the test and jenkins:unit tasks diff --git a/tasks/jenkins.js b/tasks/jenkins.js index 2225abc7d04df..33cbb0c6b2e17 100644 --- a/tasks/jenkins.js +++ b/tasks/jenkins.js @@ -24,7 +24,7 @@ module.exports = function(grunt) { 'run:eslint', 'run:sasslint', 'run:checkTsProjects', - 'run:checkCoreApiChanges', + 'run:checkDocApiChanges', 'run:typeCheck', 'run:i18nCheck', 'run:checkFileCasing', diff --git a/tasks/test.js b/tasks/test.js index c995502836378..504247f5b5355 100644 --- a/tasks/test.js +++ b/tasks/test.js @@ -72,7 +72,7 @@ module.exports = function(grunt) { !grunt.option('quick') && 'run:eslint', !grunt.option('quick') && 'run:sasslint', !grunt.option('quick') && 'run:checkTsProjects', - !grunt.option('quick') && 'run:checkCoreApiChanges', + !grunt.option('quick') && 'run:checkDocApiChanges', !grunt.option('quick') && 'run:typeCheck', !grunt.option('quick') && 'run:i18nCheck', 'run:checkFileCasing', From f1272b5ffe34d7efacb359260e930b872e8e4b06 Mon Sep 17 00:00:00 2001 From: Pierre Gayvallet Date: Tue, 10 Mar 2020 11:13:45 +0100 Subject: [PATCH 04/23] Add SavedObject management section registration in core (#59291) * add management section to SavedObjectsType * adapt import/export routes to get types accessor * add documentation * update generated doc * update migration guide * use request context to access exportable types * update generated doc * adapt SavedObjectsManagement to use the registry * stop magical tricks about the config type, register it as any other so type. * fix FTR assertions * fix so_mixin tests * register the `config` type from the uiSettings service * nits and comments * update generated doc * remove true from dynamic property definition, use force-cast back for config type * remove obsolete test comment --- .../kibana-plugin-server.authtoolkit.md | 2 +- ...na-plugin-server.authtoolkit.redirected.md | 2 +- ...-plugin-server.isavedobjecttyperegistry.md | 2 +- .../core/server/kibana-plugin-server.md | 3 +- ...lugin-server.requesthandlercontext.core.md | 1 + ...ana-plugin-server.requesthandlercontext.md | 4 +- ...ugin-server.savedobjectstype.management.md | 13 + .../kibana-plugin-server.savedobjectstype.md | 1 + ...managementdefinition.defaultsearchfield.md | 13 + ...ectstypemanagementdefinition.getediturl.md | 13 + ...ctstypemanagementdefinition.getinappurl.md | 16 ++ ...bjectstypemanagementdefinition.gettitle.md | 13 + ...vedobjectstypemanagementdefinition.icon.md | 13 + ...ementdefinition.importableandexportable.md | 13 + ...er.savedobjectstypemanagementdefinition.md | 25 ++ ...vedobjectstypemappingdefinition.dynamic.md | 2 +- ...erver.savedobjectstypemappingdefinition.md | 2 +- ...egistry.getimportableandexportabletypes.md | 17 ++ ...ttyperegistry.isimportableandexportable.md | 24 ++ ...a-plugin-server.savedobjecttyperegistry.md | 2 + src/core/MIGRATION.md | 1 + src/core/MIGRATION_EXAMPLES.md | 54 +++- src/core/server/index.ts | 12 +- src/core/server/mocks.ts | 2 + .../__snapshots__/utils.test.ts.snap | 8 + src/core/server/saved_objects/index.ts | 2 +- .../server/saved_objects/management/index.ts | 2 +- .../management/management.mock.ts | 1 + .../management/management.test.ts | 268 ++++++++++-------- .../saved_objects/management/management.ts | 64 ++--- .../server/saved_objects/mappings/types.ts | 2 +- .../build_active_mappings.test.ts.snap | 18 -- .../migrations/core/build_active_mappings.ts | 8 - .../migrations/core/index_migrator.test.ts | 10 - .../kibana_migrator.test.ts.snap | 9 - .../server/saved_objects/routes/export.ts | 48 ++-- .../server/saved_objects/routes/import.ts | 10 +- src/core/server/saved_objects/routes/index.ts | 8 +- .../routes/integration_tests/export.test.ts | 10 +- .../routes/integration_tests/import.test.ts | 9 +- .../resolve_import_errors.test.ts | 8 +- .../routes/integration_tests/test_utils.ts | 15 + .../routes/resolve_import_errors.ts | 11 +- .../server/saved_objects/routes/utils.test.ts | 52 +++- src/core/server/saved_objects/routes/utils.ts | 19 ++ .../saved_objects_service.test.ts | 3 +- .../saved_objects/saved_objects_service.ts | 20 +- .../saved_objects_type_registry.mock.ts | 6 + .../saved_objects_type_registry.test.ts | 41 +++ .../saved_objects_type_registry.ts | 23 +- .../lib/repository_create_repository.test.ts | 2 - src/core/server/saved_objects/types.ts | 69 ++++- src/core/server/saved_objects/utils.test.ts | 69 +++++ src/core/server/saved_objects/utils.ts | 20 +- src/core/server/server.api.md | 19 +- src/core/server/server.ts | 10 +- .../server/ui_settings/saved_objects/index.ts | 20 ++ .../ui_settings/saved_objects/ui_settings.ts | 49 ++++ .../ui_settings/ui_settings_service.test.ts | 45 +-- .../server/ui_settings/ui_settings_service.ts | 12 +- src/legacy/core_plugins/kibana/index.js | 12 - .../plugin_spec/plugin_spec_options.d.ts | 4 +- src/legacy/plugin_discovery/types.ts | 4 +- src/legacy/server/kbn_server.d.ts | 2 +- .../saved_objects/saved_objects_mixin.js | 2 +- .../saved_objects/saved_objects_mixin.test.js | 20 +- .../apis/saved_objects/export.js | 26 +- .../common/suites/export.ts | 2 +- 68 files changed, 952 insertions(+), 360 deletions(-) create mode 100644 docs/development/core/server/kibana-plugin-server.savedobjectstype.management.md create mode 100644 docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.defaultsearchfield.md create mode 100644 docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.getediturl.md create mode 100644 docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.getinappurl.md create mode 100644 docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.gettitle.md create mode 100644 docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.icon.md create mode 100644 docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.importableandexportable.md create mode 100644 docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.md create mode 100644 docs/development/core/server/kibana-plugin-server.savedobjecttyperegistry.getimportableandexportabletypes.md create mode 100644 docs/development/core/server/kibana-plugin-server.savedobjecttyperegistry.isimportableandexportable.md create mode 100644 src/core/server/ui_settings/saved_objects/index.ts create mode 100644 src/core/server/ui_settings/saved_objects/ui_settings.ts diff --git a/docs/development/core/server/kibana-plugin-server.authtoolkit.md b/docs/development/core/server/kibana-plugin-server.authtoolkit.md index a6a30dae894ad..4e523a7ce3cf5 100644 --- a/docs/development/core/server/kibana-plugin-server.authtoolkit.md +++ b/docs/development/core/server/kibana-plugin-server.authtoolkit.md @@ -18,5 +18,5 @@ export interface AuthToolkit | --- | --- | --- | | [authenticated](./kibana-plugin-server.authtoolkit.authenticated.md) | (data?: AuthResultParams) => AuthResult | Authentication is successful with given credentials, allow request to pass through | | [notHandled](./kibana-plugin-server.authtoolkit.nothandled.md) | () => AuthResult | User has no credentials. Allows user to access a resource when authRequired: 'optional' Rejects a request when authRequired: true | -| [redirected](./kibana-plugin-server.authtoolkit.redirected.md) | (headers: {
location: string;
} & ResponseHeaders) => AuthResult | Redirect user to IdP when authRequired: true Allows user to access a resource without redirection when authRequired: 'optional' | +| [redirected](./kibana-plugin-server.authtoolkit.redirected.md) | (headers: {
location: string;
} & ResponseHeaders) => AuthResult | Redirects user to another location to complete authentication when authRequired: true Allows user to access a resource without redirection when authRequired: 'optional' | diff --git a/docs/development/core/server/kibana-plugin-server.authtoolkit.redirected.md b/docs/development/core/server/kibana-plugin-server.authtoolkit.redirected.md index 64d1d04a4abc0..15d5498d90119 100644 --- a/docs/development/core/server/kibana-plugin-server.authtoolkit.redirected.md +++ b/docs/development/core/server/kibana-plugin-server.authtoolkit.redirected.md @@ -4,7 +4,7 @@ ## AuthToolkit.redirected property -Redirect user to IdP when authRequired: true Allows user to access a resource without redirection when authRequired: 'optional' +Redirects user to another location to complete authentication when authRequired: true Allows user to access a resource without redirection when authRequired: 'optional' Signature: diff --git a/docs/development/core/server/kibana-plugin-server.isavedobjecttyperegistry.md b/docs/development/core/server/kibana-plugin-server.isavedobjecttyperegistry.md index bbcba50c81027..6b0012b4ce46c 100644 --- a/docs/development/core/server/kibana-plugin-server.isavedobjecttyperegistry.md +++ b/docs/development/core/server/kibana-plugin-server.isavedobjecttyperegistry.md @@ -9,5 +9,5 @@ See [SavedObjectTypeRegistry](./kibana-plugin-server.savedobjecttyperegistry.md) Signature: ```typescript -export declare type ISavedObjectTypeRegistry = Pick; +export declare type ISavedObjectTypeRegistry = Pick; ``` diff --git a/docs/development/core/server/kibana-plugin-server.md b/docs/development/core/server/kibana-plugin-server.md index c84585bf6cb65..ff243dbb91a89 100644 --- a/docs/development/core/server/kibana-plugin-server.md +++ b/docs/development/core/server/kibana-plugin-server.md @@ -116,7 +116,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [PluginManifest](./kibana-plugin-server.pluginmanifest.md) | Describes the set of required and optional properties plugin can define in its mandatory JSON manifest file. | | [PluginsServiceSetup](./kibana-plugin-server.pluginsservicesetup.md) | | | [PluginsServiceStart](./kibana-plugin-server.pluginsservicestart.md) | | -| [RequestHandlerContext](./kibana-plugin-server.requesthandlercontext.md) | Plugin specific context passed to a route handler.Provides the following clients: - [rendering](./kibana-plugin-server.iscopedrenderingclient.md) - Rendering client which uses the data of the incoming request - [savedObjects.client](./kibana-plugin-server.savedobjectsclient.md) - Saved Objects client which uses the credentials of the incoming request - [elasticsearch.dataClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch data client which uses the credentials of the incoming request - [elasticsearch.adminClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch admin client which uses the credentials of the incoming request - [uiSettings.client](./kibana-plugin-server.iuisettingsclient.md) - uiSettings client which uses the credentials of the incoming request | +| [RequestHandlerContext](./kibana-plugin-server.requesthandlercontext.md) | Plugin specific context passed to a route handler.Provides the following clients and services: - [rendering](./kibana-plugin-server.iscopedrenderingclient.md) - Rendering client which uses the data of the incoming request - [savedObjects.client](./kibana-plugin-server.savedobjectsclient.md) - Saved Objects client which uses the credentials of the incoming request - [savedObjects.typeRegistry](./kibana-plugin-server.isavedobjecttyperegistry.md) - Type registry containing all the registered types. - [elasticsearch.dataClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch data client which uses the credentials of the incoming request - [elasticsearch.adminClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch admin client which uses the credentials of the incoming request - [uiSettings.client](./kibana-plugin-server.iuisettingsclient.md) - uiSettings client which uses the credentials of the incoming request | | [RouteConfig](./kibana-plugin-server.routeconfig.md) | Route specific configuration. | | [RouteConfigOptions](./kibana-plugin-server.routeconfigoptions.md) | Additional route options. | | [RouteConfigOptionsBody](./kibana-plugin-server.routeconfigoptionsbody.md) | Additional body options for a route | @@ -164,6 +164,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [SavedObjectsServiceSetup](./kibana-plugin-server.savedobjectsservicesetup.md) | Saved Objects is Kibana's data persistence mechanism allowing plugins to use Elasticsearch for storing and querying state. The SavedObjectsServiceSetup API exposes methods for registering Saved Object types, creating and registering Saved Object client wrappers and factories. | | [SavedObjectsServiceStart](./kibana-plugin-server.savedobjectsservicestart.md) | Saved Objects is Kibana's data persisentence mechanism allowing plugins to use Elasticsearch for storing and querying state. The SavedObjectsServiceStart API provides a scoped Saved Objects client for interacting with Saved Objects. | | [SavedObjectsType](./kibana-plugin-server.savedobjectstype.md) | | +| [SavedObjectsTypeManagementDefinition](./kibana-plugin-server.savedobjectstypemanagementdefinition.md) | Configuration options for the [type](./kibana-plugin-server.savedobjectstype.md)'s management section. | | [SavedObjectsTypeMappingDefinition](./kibana-plugin-server.savedobjectstypemappingdefinition.md) | Describe a saved object type mapping. | | [SavedObjectsUpdateOptions](./kibana-plugin-server.savedobjectsupdateoptions.md) | | | [SavedObjectsUpdateResponse](./kibana-plugin-server.savedobjectsupdateresponse.md) | | diff --git a/docs/development/core/server/kibana-plugin-server.requesthandlercontext.core.md b/docs/development/core/server/kibana-plugin-server.requesthandlercontext.core.md index 77bfd85e6e54b..18787d1c7c9a4 100644 --- a/docs/development/core/server/kibana-plugin-server.requesthandlercontext.core.md +++ b/docs/development/core/server/kibana-plugin-server.requesthandlercontext.core.md @@ -11,6 +11,7 @@ core: { rendering: IScopedRenderingClient; savedObjects: { client: SavedObjectsClientContract; + typeRegistry: ISavedObjectTypeRegistry; }; elasticsearch: { dataClient: IScopedClusterClient; diff --git a/docs/development/core/server/kibana-plugin-server.requesthandlercontext.md b/docs/development/core/server/kibana-plugin-server.requesthandlercontext.md index 4d14d890f51a2..4365da24d1489 100644 --- a/docs/development/core/server/kibana-plugin-server.requesthandlercontext.md +++ b/docs/development/core/server/kibana-plugin-server.requesthandlercontext.md @@ -6,7 +6,7 @@ Plugin specific context passed to a route handler. -Provides the following clients: - [rendering](./kibana-plugin-server.iscopedrenderingclient.md) - Rendering client which uses the data of the incoming request - [savedObjects.client](./kibana-plugin-server.savedobjectsclient.md) - Saved Objects client which uses the credentials of the incoming request - [elasticsearch.dataClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch data client which uses the credentials of the incoming request - [elasticsearch.adminClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch admin client which uses the credentials of the incoming request - [uiSettings.client](./kibana-plugin-server.iuisettingsclient.md) - uiSettings client which uses the credentials of the incoming request +Provides the following clients and services: - [rendering](./kibana-plugin-server.iscopedrenderingclient.md) - Rendering client which uses the data of the incoming request - [savedObjects.client](./kibana-plugin-server.savedobjectsclient.md) - Saved Objects client which uses the credentials of the incoming request - [savedObjects.typeRegistry](./kibana-plugin-server.isavedobjecttyperegistry.md) - Type registry containing all the registered types. - [elasticsearch.dataClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch data client which uses the credentials of the incoming request - [elasticsearch.adminClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch admin client which uses the credentials of the incoming request - [uiSettings.client](./kibana-plugin-server.iuisettingsclient.md) - uiSettings client which uses the credentials of the incoming request Signature: @@ -18,5 +18,5 @@ export interface RequestHandlerContext | Property | Type | Description | | --- | --- | --- | -| [core](./kibana-plugin-server.requesthandlercontext.core.md) | {
rendering: IScopedRenderingClient;
savedObjects: {
client: SavedObjectsClientContract;
};
elasticsearch: {
dataClient: IScopedClusterClient;
adminClient: IScopedClusterClient;
};
uiSettings: {
client: IUiSettingsClient;
};
} | | +| [core](./kibana-plugin-server.requesthandlercontext.core.md) | {
rendering: IScopedRenderingClient;
savedObjects: {
client: SavedObjectsClientContract;
typeRegistry: ISavedObjectTypeRegistry;
};
elasticsearch: {
dataClient: IScopedClusterClient;
adminClient: IScopedClusterClient;
};
uiSettings: {
client: IUiSettingsClient;
};
} | | diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstype.management.md b/docs/development/core/server/kibana-plugin-server.savedobjectstype.management.md new file mode 100644 index 0000000000000..301e80d74ed57 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstype.management.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [SavedObjectsType](./kibana-plugin-server.savedobjectstype.md) > [management](./kibana-plugin-server.savedobjectstype.management.md) + +## SavedObjectsType.management property + +An optional [saved objects management section](./kibana-plugin-server.savedobjectstypemanagementdefinition.md) definition for the type. + +Signature: + +```typescript +management?: SavedObjectsTypeManagementDefinition; +``` diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstype.md b/docs/development/core/server/kibana-plugin-server.savedobjectstype.md index 1e989652e52bf..546d83ad0d8dc 100644 --- a/docs/development/core/server/kibana-plugin-server.savedobjectstype.md +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstype.md @@ -21,6 +21,7 @@ This is only internal for now, and will only be public when we expose the regist | [convertToAliasScript](./kibana-plugin-server.savedobjectstype.converttoaliasscript.md) | string | If defined, will be used to convert the type to an alias. | | [hidden](./kibana-plugin-server.savedobjectstype.hidden.md) | boolean | Is the type hidden by default. If true, repositories will not have access to this type unless explicitly declared as an extraType when creating the repository.See [createInternalRepository](./kibana-plugin-server.savedobjectsservicestart.createinternalrepository.md). | | [indexPattern](./kibana-plugin-server.savedobjectstype.indexpattern.md) | string | If defined, the type instances will be stored in the given index instead of the default one. | +| [management](./kibana-plugin-server.savedobjectstype.management.md) | SavedObjectsTypeManagementDefinition | An optional [saved objects management section](./kibana-plugin-server.savedobjectstypemanagementdefinition.md) definition for the type. | | [mappings](./kibana-plugin-server.savedobjectstype.mappings.md) | SavedObjectsTypeMappingDefinition | The [mapping definition](./kibana-plugin-server.savedobjectstypemappingdefinition.md) for the type. | | [migrations](./kibana-plugin-server.savedobjectstype.migrations.md) | SavedObjectMigrationMap | An optional map of [migrations](./kibana-plugin-server.savedobjectmigrationfn.md) to be used to migrate the type. | | [name](./kibana-plugin-server.savedobjectstype.name.md) | string | The name of the type, which is also used as the internal id. | diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.defaultsearchfield.md b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.defaultsearchfield.md new file mode 100644 index 0000000000000..229f0fd567b5d --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.defaultsearchfield.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [SavedObjectsTypeManagementDefinition](./kibana-plugin-server.savedobjectstypemanagementdefinition.md) > [defaultSearchField](./kibana-plugin-server.savedobjectstypemanagementdefinition.defaultsearchfield.md) + +## SavedObjectsTypeManagementDefinition.defaultSearchField property + +The default search field to use for this type. Defaults to `id`. + +Signature: + +```typescript +defaultSearchField?: string; +``` diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.getediturl.md b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.getediturl.md new file mode 100644 index 0000000000000..276167560ebbf --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.getediturl.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [SavedObjectsTypeManagementDefinition](./kibana-plugin-server.savedobjectstypemanagementdefinition.md) > [getEditUrl](./kibana-plugin-server.savedobjectstypemanagementdefinition.getediturl.md) + +## SavedObjectsTypeManagementDefinition.getEditUrl property + +Function returning the url to use to redirect to the editing page of this object. If not defined, editing will not be allowed. + +Signature: + +```typescript +getEditUrl?: (savedObject: SavedObject) => string; +``` diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.getinappurl.md b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.getinappurl.md new file mode 100644 index 0000000000000..82934985f3ad5 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.getinappurl.md @@ -0,0 +1,16 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [SavedObjectsTypeManagementDefinition](./kibana-plugin-server.savedobjectstypemanagementdefinition.md) > [getInAppUrl](./kibana-plugin-server.savedobjectstypemanagementdefinition.getinappurl.md) + +## SavedObjectsTypeManagementDefinition.getInAppUrl property + +Function returning the url to use to redirect to this object from the management section. If not defined, redirecting to the object will not be allowed. + +Signature: + +```typescript +getInAppUrl?: (savedObject: SavedObject) => { + path: string; + uiCapabilitiesPath: string; + }; +``` diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.gettitle.md b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.gettitle.md new file mode 100644 index 0000000000000..348d80031a2e1 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.gettitle.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [SavedObjectsTypeManagementDefinition](./kibana-plugin-server.savedobjectstypemanagementdefinition.md) > [getTitle](./kibana-plugin-server.savedobjectstypemanagementdefinition.gettitle.md) + +## SavedObjectsTypeManagementDefinition.getTitle property + +Function returning the title to display in the management table. If not defined, will use the object's type and id to generate a label. + +Signature: + +```typescript +getTitle?: (savedObject: SavedObject) => string; +``` diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.icon.md b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.icon.md new file mode 100644 index 0000000000000..1126c77106609 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.icon.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [SavedObjectsTypeManagementDefinition](./kibana-plugin-server.savedobjectstypemanagementdefinition.md) > [icon](./kibana-plugin-server.savedobjectstypemanagementdefinition.icon.md) + +## SavedObjectsTypeManagementDefinition.icon property + +The eui icon name to display in the management table. If not defined, the default icon will be used. + +Signature: + +```typescript +icon?: string; +``` diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.importableandexportable.md b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.importableandexportable.md new file mode 100644 index 0000000000000..30a20f1a1b03e --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.importableandexportable.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [SavedObjectsTypeManagementDefinition](./kibana-plugin-server.savedobjectstypemanagementdefinition.md) > [importableAndExportable](./kibana-plugin-server.savedobjectstypemanagementdefinition.importableandexportable.md) + +## SavedObjectsTypeManagementDefinition.importableAndExportable property + +Is the type importable or exportable. Defaults to `false`. + +Signature: + +```typescript +importableAndExportable?: boolean; +``` diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.md b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.md new file mode 100644 index 0000000000000..b54944b24035a --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstypemanagementdefinition.md @@ -0,0 +1,25 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [SavedObjectsTypeManagementDefinition](./kibana-plugin-server.savedobjectstypemanagementdefinition.md) + +## SavedObjectsTypeManagementDefinition interface + +Configuration options for the [type](./kibana-plugin-server.savedobjectstype.md)'s management section. + +Signature: + +```typescript +export interface SavedObjectsTypeManagementDefinition +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [defaultSearchField](./kibana-plugin-server.savedobjectstypemanagementdefinition.defaultsearchfield.md) | string | The default search field to use for this type. Defaults to id. | +| [getEditUrl](./kibana-plugin-server.savedobjectstypemanagementdefinition.getediturl.md) | (savedObject: SavedObject<any>) => string | Function returning the url to use to redirect to the editing page of this object. If not defined, editing will not be allowed. | +| [getInAppUrl](./kibana-plugin-server.savedobjectstypemanagementdefinition.getinappurl.md) | (savedObject: SavedObject<any>) => {
path: string;
uiCapabilitiesPath: string;
} | Function returning the url to use to redirect to this object from the management section. If not defined, redirecting to the object will not be allowed. | +| [getTitle](./kibana-plugin-server.savedobjectstypemanagementdefinition.gettitle.md) | (savedObject: SavedObject<any>) => string | Function returning the title to display in the management table. If not defined, will use the object's type and id to generate a label. | +| [icon](./kibana-plugin-server.savedobjectstypemanagementdefinition.icon.md) | string | The eui icon name to display in the management table. If not defined, the default icon will be used. | +| [importableAndExportable](./kibana-plugin-server.savedobjectstypemanagementdefinition.importableandexportable.md) | boolean | Is the type importable or exportable. Defaults to false. | + diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md b/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md index 0efab7bebfbe5..b6a3fa7a39811 100644 --- a/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md @@ -4,7 +4,7 @@ ## SavedObjectsTypeMappingDefinition.dynamic property -The dynamic property of the mapping. either `false` or 'strict'. Defaults to strict +The dynamic property of the mapping. either `false` or 'strict'. Defaults to `false` Signature: diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.md b/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.md index 8c1a279894ffd..2f60c04f5f917 100644 --- a/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.md +++ b/docs/development/core/server/kibana-plugin-server.savedobjectstypemappingdefinition.md @@ -41,6 +41,6 @@ const typeDefinition: SavedObjectsTypeMappingDefinition = { | Property | Type | Description | | --- | --- | --- | -| [dynamic](./kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md) | false | 'strict' | The dynamic property of the mapping. either false or 'strict'. Defaults to strict | +| [dynamic](./kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md) | false | 'strict' | The dynamic property of the mapping. either false or 'strict'. Defaults to false | | [properties](./kibana-plugin-server.savedobjectstypemappingdefinition.properties.md) | SavedObjectsMappingProperties | The underlying properties of the type mapping | diff --git a/docs/development/core/server/kibana-plugin-server.savedobjecttyperegistry.getimportableandexportabletypes.md b/docs/development/core/server/kibana-plugin-server.savedobjecttyperegistry.getimportableandexportabletypes.md new file mode 100644 index 0000000000000..c9eb9c9c0c468 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.savedobjecttyperegistry.getimportableandexportabletypes.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [SavedObjectTypeRegistry](./kibana-plugin-server.savedobjecttyperegistry.md) > [getImportableAndExportableTypes](./kibana-plugin-server.savedobjecttyperegistry.getimportableandexportabletypes.md) + +## SavedObjectTypeRegistry.getImportableAndExportableTypes() method + +Return all [types](./kibana-plugin-server.savedobjectstype.md) currently registered that are importable/exportable. + +Signature: + +```typescript +getImportableAndExportableTypes(): SavedObjectsType[]; +``` +Returns: + +`SavedObjectsType[]` + diff --git a/docs/development/core/server/kibana-plugin-server.savedobjecttyperegistry.isimportableandexportable.md b/docs/development/core/server/kibana-plugin-server.savedobjecttyperegistry.isimportableandexportable.md new file mode 100644 index 0000000000000..4d6e95e100646 --- /dev/null +++ b/docs/development/core/server/kibana-plugin-server.savedobjecttyperegistry.isimportableandexportable.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [SavedObjectTypeRegistry](./kibana-plugin-server.savedobjecttyperegistry.md) > [isImportableAndExportable](./kibana-plugin-server.savedobjecttyperegistry.isimportableandexportable.md) + +## SavedObjectTypeRegistry.isImportableAndExportable() method + +Returns the `management.importableAndExportable` property for given type, or `false` if the type is not registered or does not define a management section. + +Signature: + +```typescript +isImportableAndExportable(type: string): boolean; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| type | string | | + +Returns: + +`boolean` + diff --git a/docs/development/core/server/kibana-plugin-server.savedobjecttyperegistry.md b/docs/development/core/server/kibana-plugin-server.savedobjecttyperegistry.md index 3daad35808624..66ca9768b7187 100644 --- a/docs/development/core/server/kibana-plugin-server.savedobjecttyperegistry.md +++ b/docs/development/core/server/kibana-plugin-server.savedobjecttyperegistry.md @@ -17,9 +17,11 @@ export declare class SavedObjectTypeRegistry | Method | Modifiers | Description | | --- | --- | --- | | [getAllTypes()](./kibana-plugin-server.savedobjecttyperegistry.getalltypes.md) | | Return all [types](./kibana-plugin-server.savedobjectstype.md) currently registered. | +| [getImportableAndExportableTypes()](./kibana-plugin-server.savedobjecttyperegistry.getimportableandexportabletypes.md) | | Return all [types](./kibana-plugin-server.savedobjectstype.md) currently registered that are importable/exportable. | | [getIndex(type)](./kibana-plugin-server.savedobjecttyperegistry.getindex.md) | | Returns the indexPattern property for given type, or undefined if the type is not registered. | | [getType(type)](./kibana-plugin-server.savedobjecttyperegistry.gettype.md) | | Return the [type](./kibana-plugin-server.savedobjectstype.md) definition for given type name. | | [isHidden(type)](./kibana-plugin-server.savedobjecttyperegistry.ishidden.md) | | Returns the hidden property for given type, or false if the type is not registered. | +| [isImportableAndExportable(type)](./kibana-plugin-server.savedobjecttyperegistry.isimportableandexportable.md) | | Returns the management.importableAndExportable property for given type, or false if the type is not registered or does not define a management section. | | [isNamespaceAgnostic(type)](./kibana-plugin-server.savedobjecttyperegistry.isnamespaceagnostic.md) | | Returns the namespaceAgnostic property for given type, or false if the type is not registered. | | [registerType(type)](./kibana-plugin-server.savedobjecttyperegistry.registertype.md) | | Register a [type](./kibana-plugin-server.savedobjectstype.md) inside the registry. A type can only be registered once. subsequent calls with the same type name will throw an error. | diff --git a/src/core/MIGRATION.md b/src/core/MIGRATION.md index c5e649f7d9d5c..e04d45f77db5d 100644 --- a/src/core/MIGRATION.md +++ b/src/core/MIGRATION.md @@ -1210,6 +1210,7 @@ In server code, `core` can be accessed from either `server.newPlatform` or `kbnS | `kibana.Plugin.savedObjectSchemas` | [`core.savedObjects.registerType`](docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.registertype.md) | [Examples](./MIGRATION_EXAMPLES.md#saved-objects-types) | | `kibana.Plugin.mappings` | [`core.savedObjects.registerType`](docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.registertype.md) | [Examples](./MIGRATION_EXAMPLES.md#saved-objects-types) | | `kibana.Plugin.migrations` | [`core.savedObjects.registerType`](docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.registertype.md) | [Examples](./MIGRATION_EXAMPLES.md#saved-objects-types) | +| `kibana.Plugin.savedObjectsManagement` | [`core.savedObjects.registerType`](docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.registertype.md) | [Examples](./MIGRATION_EXAMPLES.md#saved-objects-types) | _See also: [Server's CoreSetup API Docs](/docs/development/core/server/kibana-plugin-server.coresetup.md)_ diff --git a/src/core/MIGRATION_EXAMPLES.md b/src/core/MIGRATION_EXAMPLES.md index 2953edb535f47..29edef476d7c3 100644 --- a/src/core/MIGRATION_EXAMPLES.md +++ b/src/core/MIGRATION_EXAMPLES.md @@ -749,7 +749,7 @@ using the core `savedObjects`'s `registerType` setup API. The most notable difference is that in the new platform, the type registration is performed in a single call to `registerType`, passing a new `SavedObjectsType` structure that is a superset of the legacy `schema`, `migrations` -and `mappings`. +`mappings` and `savedObjectsManagement`. ### Concrete example @@ -775,6 +775,32 @@ new kibana.Plugin({ isHidden: true, }, }, + savedObjectsManagement: { + 'first-type': { + isImportableAndExportable: true, + icon: 'myFirstIcon', + defaultSearchField: 'title', + getTitle(obj) { + return obj.attributes.title; + }, + getEditUrl(obj) { + return `/some-url/${encodeURIComponent(obj.id)}`; + }, + }, + 'second-type': { + isImportableAndExportable: false, + icon: 'mySecondIcon', + getTitle(obj) { + return obj.attributes.myTitleField; + }, + getInAppUrl(obj) { + return { + path: `/some-url/${encodeURIComponent(obj.id)}`, + uiCapabilitiesPath: 'myPlugin.myType.show', + }; + }, + }, + }, }, }) ``` @@ -844,6 +870,17 @@ export const firstType: SavedObjectsType = { '1.0.0': migrateFirstTypeToV1, '2.0.0': migrateFirstTypeToV2, }, + management: { + importableAndExportable: true, + icon: 'myFirstIcon', + defaultSearchField: 'title', + getTitle(obj) { + return obj.attributes.title; + }, + getEditUrl(obj) { + return `/some-url/${encodeURIComponent(obj.id)}`; + }, + }, }; ``` @@ -870,6 +907,19 @@ export const secondType: SavedObjectsType = { migrations: { '1.5.0': migrateSecondTypeToV15, }, + management: { + importableAndExportable: false, + icon: 'mySecondIcon', + getTitle(obj) { + return obj.attributes.myTitleField; + }, + getInAppUrl(obj) { + return { + path: `/some-url/${encodeURIComponent(obj.id)}`, + uiCapabilitiesPath: 'myPlugin.myType.show', + }; + }, + }, }; ``` @@ -895,6 +945,8 @@ The NP `registerType` expected input is very close to the legacy format. However - The `schema.indexPattern` was accepting either a `string` or a `(config: LegacyConfig) => string`. `SavedObjectsType.indexPattern` only accepts a string, as you can access the configuration during your plugin's setup phase. +- The `savedObjectsManagement.isImportableAndExportable` property has been renamed: `SavedObjectsType.management.importableAndExportable` + - The migration function signature has changed: In legacy, it was `(doc: SavedObjectUnsanitizedDoc, log: SavedObjectsMigrationLogger) => SavedObjectUnsanitizedDoc;` In new platform, it is now `(doc: SavedObjectUnsanitizedDoc, context: SavedObjectMigrationContext) => SavedObjectUnsanitizedDoc;` diff --git a/src/core/server/index.ts b/src/core/server/index.ts index 80eabe778ece3..e2faf49ba7a9e 100644 --- a/src/core/server/index.ts +++ b/src/core/server/index.ts @@ -51,7 +51,11 @@ import { PluginsServiceSetup, PluginsServiceStart, PluginOpaqueId } from './plug import { ContextSetup } from './context'; import { IUiSettingsClient, UiSettingsServiceSetup, UiSettingsServiceStart } from './ui_settings'; import { SavedObjectsClientContract } from './saved_objects/types'; -import { SavedObjectsServiceSetup, SavedObjectsServiceStart } from './saved_objects'; +import { + ISavedObjectTypeRegistry, + SavedObjectsServiceSetup, + SavedObjectsServiceStart, +} from './saved_objects'; import { CapabilitiesSetup, CapabilitiesStart } from './capabilities'; import { UuidServiceSetup } from './uuid'; import { MetricsServiceSetup } from './metrics'; @@ -233,6 +237,7 @@ export { SavedObjectTypeRegistry, ISavedObjectTypeRegistry, SavedObjectsType, + SavedObjectsTypeManagementDefinition, SavedObjectMigrationMap, SavedObjectMigrationFn, exportSavedObjectsToStream, @@ -289,11 +294,13 @@ export { /** * Plugin specific context passed to a route handler. * - * Provides the following clients: + * Provides the following clients and services: * - {@link IScopedRenderingClient | rendering} - Rendering client * which uses the data of the incoming request * - {@link SavedObjectsClient | savedObjects.client} - Saved Objects client * which uses the credentials of the incoming request + * - {@link ISavedObjectTypeRegistry | savedObjects.typeRegistry} - Type registry containing + * all the registered types. * - {@link ScopedClusterClient | elasticsearch.dataClient} - Elasticsearch * data client which uses the credentials of the incoming request * - {@link ScopedClusterClient | elasticsearch.adminClient} - Elasticsearch @@ -308,6 +315,7 @@ export interface RequestHandlerContext { rendering: IScopedRenderingClient; savedObjects: { client: SavedObjectsClientContract; + typeRegistry: ISavedObjectTypeRegistry; }; elasticsearch: { dataClient: IScopedClusterClient; diff --git a/src/core/server/mocks.ts b/src/core/server/mocks.ts index 93d8e2c632e38..a0bbe623289d8 100644 --- a/src/core/server/mocks.ts +++ b/src/core/server/mocks.ts @@ -26,6 +26,7 @@ import { httpServiceMock } from './http/http_service.mock'; import { contextServiceMock } from './context/context_service.mock'; import { savedObjectsServiceMock } from './saved_objects/saved_objects_service.mock'; import { savedObjectsClientMock } from './saved_objects/service/saved_objects_client.mock'; +import { typeRegistryMock as savedObjectsTypeRegistryMock } from './saved_objects/saved_objects_type_registry.mock'; import { uiSettingsServiceMock } from './ui_settings/ui_settings_service.mock'; import { SharedGlobalConfig } from './plugins'; import { InternalCoreSetup, InternalCoreStart } from './internal_types'; @@ -177,6 +178,7 @@ function createCoreRequestHandlerContextMock() { }, savedObjects: { client: savedObjectsClientMock.create(), + typeRegistry: savedObjectsTypeRegistryMock.create(), }, elasticsearch: { adminClient: elasticsearchServiceMock.createScopedClusterClient(), diff --git a/src/core/server/saved_objects/__snapshots__/utils.test.ts.snap b/src/core/server/saved_objects/__snapshots__/utils.test.ts.snap index 89ff2b542c60f..5431d2ca47892 100644 --- a/src/core/server/saved_objects/__snapshots__/utils.test.ts.snap +++ b/src/core/server/saved_objects/__snapshots__/utils.test.ts.snap @@ -6,6 +6,7 @@ Array [ "convertToAliasScript": undefined, "hidden": false, "indexPattern": undefined, + "management": undefined, "mappings": Object { "properties": Object { "fieldA": Object { @@ -21,6 +22,7 @@ Array [ "convertToAliasScript": undefined, "hidden": false, "indexPattern": undefined, + "management": undefined, "mappings": Object { "properties": Object { "fieldB": Object { @@ -36,6 +38,7 @@ Array [ "convertToAliasScript": undefined, "hidden": false, "indexPattern": undefined, + "management": undefined, "mappings": Object { "properties": Object { "fieldC": Object { @@ -56,6 +59,7 @@ Array [ "convertToAliasScript": undefined, "hidden": true, "indexPattern": "myIndex", + "management": undefined, "mappings": Object { "properties": Object { "fieldA": Object { @@ -74,6 +78,7 @@ Array [ "convertToAliasScript": "some alias script", "hidden": false, "indexPattern": undefined, + "management": undefined, "mappings": Object { "properties": Object { "anotherFieldB": Object { @@ -92,6 +97,7 @@ Array [ "convertToAliasScript": undefined, "hidden": false, "indexPattern": undefined, + "management": undefined, "mappings": Object { "properties": Object { "fieldC": Object { @@ -114,6 +120,7 @@ Array [ "convertToAliasScript": undefined, "hidden": true, "indexPattern": "fooBar", + "management": undefined, "mappings": Object { "properties": Object { "fieldA": Object { @@ -129,6 +136,7 @@ Array [ "convertToAliasScript": undefined, "hidden": false, "indexPattern": undefined, + "management": undefined, "mappings": Object { "properties": Object { "fieldC": Object { diff --git a/src/core/server/saved_objects/index.ts b/src/core/server/saved_objects/index.ts index 661c6cbb79e58..0af8ea7d0e830 100644 --- a/src/core/server/saved_objects/index.ts +++ b/src/core/server/saved_objects/index.ts @@ -70,7 +70,7 @@ export { SavedObjectMigrationContext, } from './migrations'; -export { SavedObjectsType } from './types'; +export { SavedObjectsType, SavedObjectsTypeManagementDefinition } from './types'; export { savedObjectsConfig, savedObjectsMigrationConfig } from './saved_objects_config'; export { SavedObjectTypeRegistry, ISavedObjectTypeRegistry } from './saved_objects_type_registry'; diff --git a/src/core/server/saved_objects/management/index.ts b/src/core/server/saved_objects/management/index.ts index c32639e74d079..a256a1333c5cc 100644 --- a/src/core/server/saved_objects/management/index.ts +++ b/src/core/server/saved_objects/management/index.ts @@ -17,4 +17,4 @@ * under the License. */ -export { SavedObjectsManagement, SavedObjectsManagementDefinition } from './management'; +export { SavedObjectsManagement } from './management'; diff --git a/src/core/server/saved_objects/management/management.mock.ts b/src/core/server/saved_objects/management/management.mock.ts index 2099cc0f77bcc..e7242c30d3961 100644 --- a/src/core/server/saved_objects/management/management.mock.ts +++ b/src/core/server/saved_objects/management/management.mock.ts @@ -24,6 +24,7 @@ const createManagementMock = () => { const mocked: jest.Mocked = { isImportAndExportable: jest.fn().mockReturnValue(true), getDefaultSearchField: jest.fn(), + getImportableAndExportableTypes: jest.fn(), getIcon: jest.fn(), getTitle: jest.fn(), getEditUrl: jest.fn(), diff --git a/src/core/server/saved_objects/management/management.test.ts b/src/core/server/saved_objects/management/management.test.ts index e936326d957f9..dc110dec020f0 100644 --- a/src/core/server/saved_objects/management/management.test.ts +++ b/src/core/server/saved_objects/management/management.test.ts @@ -18,157 +18,185 @@ */ import { SavedObjectsManagement } from './management'; +import { SavedObjectsType } from '../types'; +import { SavedObjectTypeRegistry } from '../saved_objects_type_registry'; -describe('isImportAndExportable()', () => { - it('returns false for unknown types', () => { - const management = new SavedObjectsManagement(); - const result = management.isImportAndExportable('bar'); - expect(result).toBe(false); - }); +describe('SavedObjectsManagement', () => { + let registry: SavedObjectTypeRegistry; + let management: SavedObjectsManagement; - it('returns true for explicitly importable and exportable type', () => { - const management = new SavedObjectsManagement({ - foo: { - isImportableAndExportable: true, - }, + const registerType = (type: Partial) => + registry.registerType({ + name: 'unknown', + hidden: false, + namespaceAgnostic: false, + mappings: { properties: {} }, + migrations: {}, + ...type, }); - const result = management.isImportAndExportable('foo'); - expect(result).toBe(true); + + beforeEach(() => { + registry = new SavedObjectTypeRegistry(); + management = new SavedObjectsManagement(registry); }); - it('returns false for explicitly importable and exportable type', () => { - const management = new SavedObjectsManagement({ - foo: { - isImportableAndExportable: false, - }, + describe('isImportAndExportable()', () => { + it('returns false for unknown types', () => { + const result = management.isImportAndExportable('bar'); + expect(result).toBe(false); }); - const result = management.isImportAndExportable('foo'); - expect(result).toBe(false); - }); -}); -describe('getDefaultSearchField()', () => { - it('returns empty for unknown types', () => { - const management = new SavedObjectsManagement(); - const result = management.getDefaultSearchField('bar'); - expect(result).toEqual(undefined); - }); + it('returns true for explicitly importable and exportable type', () => { + registerType({ + name: 'foo', + management: { + importableAndExportable: true, + }, + }); - it('returns explicit value', () => { - const management = new SavedObjectsManagement({ - foo: { - defaultSearchField: 'value', - }, + const result = management.isImportAndExportable('foo'); + expect(result).toBe(true); }); - const result = management.getDefaultSearchField('foo'); - expect(result).toEqual('value'); - }); -}); -describe('getIcon', () => { - it('returns empty for unknown types', () => { - const management = new SavedObjectsManagement(); - const result = management.getIcon('bar'); - expect(result).toEqual(undefined); - }); + it('returns false for explicitly importable and exportable type', () => { + registerType({ + name: 'foo', + management: { + importableAndExportable: false, + }, + }); - it('returns explicit value', () => { - const management = new SavedObjectsManagement({ - foo: { - icon: 'value', - }, + const result = management.isImportAndExportable('foo'); + expect(result).toBe(false); }); - const result = management.getIcon('foo'); - expect(result).toEqual('value'); }); -}); -describe('getTitle', () => { - it('returns empty for unknown type', () => { - const management = new SavedObjectsManagement(); - const result = management.getTitle({ - id: '1', - type: 'foo', - attributes: {}, - references: [], + describe('getDefaultSearchField()', () => { + it('returns empty for unknown types', () => { + const result = management.getDefaultSearchField('bar'); + expect(result).toEqual(undefined); }); - expect(result).toEqual(undefined); - }); - it('returns explicit value', () => { - const management = new SavedObjectsManagement({ - foo: { - getTitle() { - return 'called'; + it('returns explicit value', () => { + registerType({ + name: 'foo', + management: { + defaultSearchField: 'value', }, - }, - }); - const result = management.getTitle({ - id: '1', - type: 'foo', - attributes: {}, - references: [], + }); + + const result = management.getDefaultSearchField('foo'); + expect(result).toEqual('value'); }); - expect(result).toEqual('called'); }); -}); -describe('getEditUrl()', () => { - it('returns empty for unknown type', () => { - const management = new SavedObjectsManagement(); - const result = management.getEditUrl({ - id: '1', - type: 'foo', - attributes: {}, - references: [], + describe('getIcon()', () => { + it('returns empty for unknown types', () => { + const result = management.getIcon('bar'); + expect(result).toEqual(undefined); }); - expect(result).toEqual(undefined); - }); - it('returns explicit value', () => { - const management = new SavedObjectsManagement({ - foo: { - getEditUrl() { - return 'called'; + it('returns explicit value', () => { + registerType({ + name: 'foo', + management: { + icon: 'value', }, - }, - }); - const result = management.getEditUrl({ - id: '1', - type: 'foo', - attributes: {}, - references: [], + }); + const result = management.getIcon('foo'); + expect(result).toEqual('value'); }); - expect(result).toEqual('called'); }); -}); -describe('getInAppUrl()', () => { - it('returns empty array for unknown type', () => { - const management = new SavedObjectsManagement(); - const result = management.getInAppUrl({ - id: '1', - type: 'foo', - attributes: {}, - references: [], + describe('getTitle()', () => { + it('returns empty for unknown type', () => { + const result = management.getTitle({ + id: '1', + type: 'foo', + attributes: {}, + references: [], + }); + expect(result).toEqual(undefined); + }); + + it('returns explicit value', () => { + registerType({ + name: 'foo', + management: { + getTitle() { + return 'called'; + }, + }, + }); + const result = management.getTitle({ + id: '1', + type: 'foo', + attributes: {}, + references: [], + }); + expect(result).toEqual('called'); }); - expect(result).toEqual(undefined); }); - it('returns explicit value', () => { - const management = new SavedObjectsManagement({ - foo: { - getInAppUrl() { - return { path: 'called', uiCapabilitiesPath: 'my.path' }; + describe('getEditUrl()', () => { + it('returns empty for unknown type', () => { + const result = management.getEditUrl({ + id: '1', + type: 'foo', + attributes: {}, + references: [], + }); + expect(result).toEqual(undefined); + }); + + it('returns explicit value', () => { + registerType({ + name: 'foo', + management: { + getEditUrl() { + return 'called'; + }, }, - }, + }); + + const result = management.getEditUrl({ + id: '1', + type: 'foo', + attributes: {}, + references: [], + }); + expect(result).toEqual('called'); + }); + }); + + describe('getInAppUrl()', () => { + it('returns empty array for unknown type', () => { + const result = management.getInAppUrl({ + id: '1', + type: 'foo', + attributes: {}, + references: [], + }); + expect(result).toEqual(undefined); }); - const result = management.getInAppUrl({ - id: '1', - type: 'foo', - attributes: {}, - references: [], + + it('returns explicit value', () => { + registerType({ + name: 'foo', + management: { + getInAppUrl() { + return { path: 'called', uiCapabilitiesPath: 'my.path' }; + }, + }, + }); + + const result = management.getInAppUrl({ + id: '1', + type: 'foo', + attributes: {}, + references: [], + }); + expect(result).toEqual({ path: 'called', uiCapabilitiesPath: 'my.path' }); }); - expect(result).toEqual({ path: 'called', uiCapabilitiesPath: 'my.path' }); }); }); diff --git a/src/core/server/saved_objects/management/management.ts b/src/core/server/saved_objects/management/management.ts index b7dce2c087c5f..db759c4aec752 100644 --- a/src/core/server/saved_objects/management/management.ts +++ b/src/core/server/saved_objects/management/management.ts @@ -18,74 +18,42 @@ */ import { SavedObject } from '../types'; - -interface SavedObjectsManagementTypeDefinition { - isImportableAndExportable?: boolean; - defaultSearchField?: string; - icon?: string; - getTitle?: (savedObject: SavedObject) => string; - getEditUrl?: (savedObject: SavedObject) => string; - getInAppUrl?: (savedObject: SavedObject) => { path: string; uiCapabilitiesPath: string }; -} - -export interface SavedObjectsManagementDefinition { - [key: string]: SavedObjectsManagementTypeDefinition; -} +import { ISavedObjectTypeRegistry } from '../saved_objects_type_registry'; export class SavedObjectsManagement { - private readonly definition?: SavedObjectsManagementDefinition; + constructor(private readonly registry: ISavedObjectTypeRegistry) {} - constructor(managementDefinition?: SavedObjectsManagementDefinition) { - this.definition = managementDefinition; + public getImportableAndExportableTypes() { + return this.registry + .getAllTypes() + .map(type => type.name) + .filter(type => this.isImportAndExportable(type)); } public isImportAndExportable(type: string) { - if (this.definition && this.definition.hasOwnProperty(type)) { - return this.definition[type].isImportableAndExportable === true; - } - - return false; + return this.registry.isImportableAndExportable(type); } public getDefaultSearchField(type: string) { - if (this.definition && this.definition.hasOwnProperty(type)) { - return this.definition[type].defaultSearchField; - } + return this.registry.getType(type)?.management?.defaultSearchField; } public getIcon(type: string) { - if (this.definition && this.definition.hasOwnProperty(type)) { - return this.definition[type].icon; - } + return this.registry.getType(type)?.management?.icon; } public getTitle(savedObject: SavedObject) { - const { type } = savedObject; - if (this.definition && this.definition.hasOwnProperty(type) && this.definition[type].getTitle) { - const { getTitle } = this.definition[type]; - if (getTitle) { - return getTitle(savedObject); - } - } + const getTitle = this.registry.getType(savedObject.type)?.management?.getTitle; + return getTitle ? getTitle(savedObject) : undefined; } public getEditUrl(savedObject: SavedObject) { - const { type } = savedObject; - if (this.definition && this.definition.hasOwnProperty(type)) { - const { getEditUrl } = this.definition[type]; - if (getEditUrl) { - return getEditUrl(savedObject); - } - } + const getEditUrl = this.registry.getType(savedObject.type)?.management?.getEditUrl; + return getEditUrl ? getEditUrl(savedObject) : undefined; } public getInAppUrl(savedObject: SavedObject) { - const { type } = savedObject; - if (this.definition && this.definition.hasOwnProperty(type)) { - const { getInAppUrl } = this.definition[type]; - if (getInAppUrl) { - return getInAppUrl(savedObject); - } - } + const getInAppUrl = this.registry.getType(savedObject.type)?.management?.getInAppUrl; + return getInAppUrl ? getInAppUrl(savedObject) : undefined; } } diff --git a/src/core/server/saved_objects/mappings/types.ts b/src/core/server/saved_objects/mappings/types.ts index bc556c0429981..47fc29f8cf7d2 100644 --- a/src/core/server/saved_objects/mappings/types.ts +++ b/src/core/server/saved_objects/mappings/types.ts @@ -45,7 +45,7 @@ * @public */ export interface SavedObjectsTypeMappingDefinition { - /** The dynamic property of the mapping. either `false` or 'strict'. Defaults to strict */ + /** The dynamic property of the mapping. either `false` or 'strict'. Defaults to `false` */ dynamic?: false | 'strict'; /** The underlying properties of the type mapping */ properties: SavedObjectsMappingProperties; diff --git a/src/core/server/saved_objects/migrations/core/__snapshots__/build_active_mappings.test.ts.snap b/src/core/server/saved_objects/migrations/core/__snapshots__/build_active_mappings.test.ts.snap index 68f90ea70a0c6..fc26d7e9cf6e9 100644 --- a/src/core/server/saved_objects/migrations/core/__snapshots__/build_active_mappings.test.ts.snap +++ b/src/core/server/saved_objects/migrations/core/__snapshots__/build_active_mappings.test.ts.snap @@ -6,7 +6,6 @@ Object { "migrationMappingPropertyHashes": Object { "aaa": "625b32086eb1d1203564cf85062dd22e", "bbb": "18c78c995965207ed3f6e7fc5c6e55fe", - "config": "87aca8fdb053154f11383fce3dbf3edf", "migrationVersion": "4a1746014a75ade3a714e1db5763276f", "namespace": "2f4316de49999235636386fe51dc06c1", "references": "7997cf5a56cc02bdc9c93361bde732b0", @@ -22,14 +21,6 @@ Object { "bbb": Object { "type": "long", }, - "config": Object { - "dynamic": "true", - "properties": Object { - "buildNum": Object { - "type": "keyword", - }, - }, - }, "migrationVersion": Object { "dynamic": "true", "type": "object", @@ -65,7 +56,6 @@ exports[`buildActiveMappings handles the \`dynamic\` property of types 1`] = ` Object { "_meta": Object { "migrationMappingPropertyHashes": Object { - "config": "87aca8fdb053154f11383fce3dbf3edf", "firstType": "635418ab953d81d93f1190b70a8d3f57", "migrationVersion": "4a1746014a75ade3a714e1db5763276f", "namespace": "2f4316de49999235636386fe51dc06c1", @@ -78,14 +68,6 @@ Object { }, "dynamic": "strict", "properties": Object { - "config": Object { - "dynamic": "true", - "properties": Object { - "buildNum": Object { - "type": "keyword", - }, - }, - }, "firstType": Object { "dynamic": "strict", "properties": Object { diff --git a/src/core/server/saved_objects/migrations/core/build_active_mappings.ts b/src/core/server/saved_objects/migrations/core/build_active_mappings.ts index 3afe8aae119d9..4d1a607414ca6 100644 --- a/src/core/server/saved_objects/migrations/core/build_active_mappings.ts +++ b/src/core/server/saved_objects/migrations/core/build_active_mappings.ts @@ -132,14 +132,6 @@ function defaultMapping(): IndexMapping { return { dynamic: 'strict', properties: { - config: { - dynamic: 'true', - properties: { - buildNum: { - type: 'keyword', - }, - }, - }, migrationVersion: { dynamic: 'true', type: 'object', diff --git a/src/core/server/saved_objects/migrations/core/index_migrator.test.ts b/src/core/server/saved_objects/migrations/core/index_migrator.test.ts index a9d0a339c229f..1c2d3f501ff80 100644 --- a/src/core/server/saved_objects/migrations/core/index_migrator.test.ts +++ b/src/core/server/saved_objects/migrations/core/index_migrator.test.ts @@ -58,7 +58,6 @@ describe('IndexMigrator', () => { dynamic: 'strict', _meta: { migrationMappingPropertyHashes: { - config: '87aca8fdb053154f11383fce3dbf3edf', foo: '18c78c995965207ed3f6e7fc5c6e55fe', migrationVersion: '4a1746014a75ade3a714e1db5763276f', namespace: '2f4316de49999235636386fe51dc06c1', @@ -68,10 +67,6 @@ describe('IndexMigrator', () => { }, }, properties: { - config: { - dynamic: 'true', - properties: { buildNum: { type: 'keyword' } }, - }, foo: { type: 'long' }, migrationVersion: { dynamic: 'true', type: 'object' }, namespace: { type: 'keyword' }, @@ -180,7 +175,6 @@ describe('IndexMigrator', () => { dynamic: 'strict', _meta: { migrationMappingPropertyHashes: { - config: '87aca8fdb053154f11383fce3dbf3edf', foo: '625b32086eb1d1203564cf85062dd22e', migrationVersion: '4a1746014a75ade3a714e1db5763276f', namespace: '2f4316de49999235636386fe51dc06c1', @@ -191,10 +185,6 @@ describe('IndexMigrator', () => { }, properties: { author: { type: 'text' }, - config: { - dynamic: 'true', - properties: { buildNum: { type: 'keyword' } }, - }, foo: { type: 'text' }, migrationVersion: { dynamic: 'true', type: 'object' }, namespace: { type: 'keyword' }, diff --git a/src/core/server/saved_objects/migrations/kibana/__snapshots__/kibana_migrator.test.ts.snap b/src/core/server/saved_objects/migrations/kibana/__snapshots__/kibana_migrator.test.ts.snap index 37a73b11bbc48..507c0b0d9339f 100644 --- a/src/core/server/saved_objects/migrations/kibana/__snapshots__/kibana_migrator.test.ts.snap +++ b/src/core/server/saved_objects/migrations/kibana/__snapshots__/kibana_migrator.test.ts.snap @@ -6,7 +6,6 @@ Object { "migrationMappingPropertyHashes": Object { "amap": "510f1f0adb69830cf8a1c5ce2923ed82", "bmap": "510f1f0adb69830cf8a1c5ce2923ed82", - "config": "87aca8fdb053154f11383fce3dbf3edf", "migrationVersion": "4a1746014a75ade3a714e1db5763276f", "namespace": "2f4316de49999235636386fe51dc06c1", "references": "7997cf5a56cc02bdc9c93361bde732b0", @@ -30,14 +29,6 @@ Object { }, }, }, - "config": Object { - "dynamic": "true", - "properties": Object { - "buildNum": Object { - "type": "keyword", - }, - }, - }, "migrationVersion": Object { "dynamic": "true", "type": "object", diff --git a/src/core/server/saved_objects/routes/export.ts b/src/core/server/saved_objects/routes/export.ts index 04d310681aec5..7205699ddc702 100644 --- a/src/core/server/saved_objects/routes/export.ts +++ b/src/core/server/saved_objects/routes/export.ts @@ -27,32 +27,21 @@ import { import { IRouter } from '../../http'; import { SavedObjectConfig } from '../saved_objects_config'; import { exportSavedObjectsToStream } from '../export'; +import { validateTypes, validateObjects } from './utils'; -export const registerExportRoute = ( - router: IRouter, - config: SavedObjectConfig, - supportedTypes: string[] -) => { +export const registerExportRoute = (router: IRouter, config: SavedObjectConfig) => { const { maxImportExportSize } = config; - const typeSchema = schema.string({ - validate: (type: string) => { - if (!supportedTypes.includes(type)) { - return `${type} is not exportable`; - } - }, - }); - router.post( { path: '/_export', validate: { body: schema.object({ - type: schema.maybe(schema.oneOf([typeSchema, schema.arrayOf(typeSchema)])), + type: schema.maybe(schema.oneOf([schema.string(), schema.arrayOf(schema.string())])), objects: schema.maybe( schema.arrayOf( schema.object({ - type: typeSchema, + type: schema.string(), id: schema.string(), }), { maxSize: maxImportExportSize } @@ -67,9 +56,36 @@ export const registerExportRoute = ( router.handleLegacyErrors(async (context, req, res) => { const savedObjectsClient = context.core.savedObjects.client; const { type, objects, search, excludeExportDetails, includeReferencesDeep } = req.body; + const types = typeof type === 'string' ? [type] : type; + + // need to access the registry for type validation, can't use the schema for this + const supportedTypes = context.core.savedObjects.typeRegistry + .getImportableAndExportableTypes() + .map(t => t.name); + if (types) { + const validationError = validateTypes(types, supportedTypes); + if (validationError) { + return res.badRequest({ + body: { + message: validationError, + }, + }); + } + } + if (objects) { + const validationError = validateObjects(objects, supportedTypes); + if (validationError) { + return res.badRequest({ + body: { + message: validationError, + }, + }); + } + } + const exportStream = await exportSavedObjectsToStream({ savedObjectsClient, - types: typeof type === 'string' ? [type] : type, + types, search, objects, exportSizeLimit: maxImportExportSize, diff --git a/src/core/server/saved_objects/routes/import.ts b/src/core/server/saved_objects/routes/import.ts index 313e84c0b301d..0731d4159356d 100644 --- a/src/core/server/saved_objects/routes/import.ts +++ b/src/core/server/saved_objects/routes/import.ts @@ -31,11 +31,7 @@ interface FileStream extends Readable { }; } -export const registerImportRoute = ( - router: IRouter, - config: SavedObjectConfig, - supportedTypes: string[] -) => { +export const registerImportRoute = (router: IRouter, config: SavedObjectConfig) => { const { maxImportExportSize, maxImportPayloadBytes } = config; router.post( @@ -65,6 +61,10 @@ export const registerImportRoute = ( return res.badRequest({ body: `Invalid file extension ${fileExtension}` }); } + const supportedTypes = context.core.savedObjects.typeRegistry + .getImportableAndExportableTypes() + .map(type => type.name); + const result = await importSavedObjectsFromStream({ supportedTypes, savedObjectsClient: context.core.savedObjects.client, diff --git a/src/core/server/saved_objects/routes/index.ts b/src/core/server/saved_objects/routes/index.ts index 0afa24b18760b..fd57a9f3059e3 100644 --- a/src/core/server/saved_objects/routes/index.ts +++ b/src/core/server/saved_objects/routes/index.ts @@ -39,13 +39,11 @@ export function registerRoutes({ http, logger, config, - importableExportableTypes, migratorPromise, }: { http: InternalHttpServiceSetup; logger: Logger; config: SavedObjectConfig; - importableExportableTypes: string[]; migratorPromise: Promise; }) { const router = http.createRouter('/api/saved_objects/'); @@ -59,9 +57,9 @@ export function registerRoutes({ registerBulkCreateRoute(router); registerBulkUpdateRoute(router); registerLogLegacyImportRoute(router, logger); - registerExportRoute(router, config, importableExportableTypes); - registerImportRoute(router, config, importableExportableTypes); - registerResolveImportErrorsRoute(router, config, importableExportableTypes); + registerExportRoute(router, config); + registerImportRoute(router, config); + registerResolveImportErrorsRoute(router, config); const internalRouter = http.createRouter('/internal/saved_objects/'); diff --git a/src/core/server/saved_objects/routes/integration_tests/export.test.ts b/src/core/server/saved_objects/routes/integration_tests/export.test.ts index a81079b6825d6..858d34d5a93bf 100644 --- a/src/core/server/saved_objects/routes/integration_tests/export.test.ts +++ b/src/core/server/saved_objects/routes/integration_tests/export.test.ts @@ -27,7 +27,7 @@ import supertest from 'supertest'; import { UnwrapPromise } from '@kbn/utility-types'; import { SavedObjectConfig } from '../../saved_objects_config'; import { registerExportRoute } from '../export'; -import { setupServer } from './test_utils'; +import { setupServer, createExportableType } from './test_utils'; type setupServerReturn = UnwrapPromise>; const exportSavedObjectsToStream = exportMock.exportSavedObjectsToStream as jest.Mock; @@ -40,12 +40,16 @@ const config = { describe('POST /api/saved_objects/_export', () => { let server: setupServerReturn['server']; let httpSetup: setupServerReturn['httpSetup']; + let handlerContext: setupServerReturn['handlerContext']; beforeEach(async () => { - ({ server, httpSetup } = await setupServer()); + ({ server, httpSetup, handlerContext } = await setupServer()); + handlerContext.savedObjects.typeRegistry.getImportableAndExportableTypes.mockReturnValue( + allowedTypes.map(createExportableType) + ); const router = httpSetup.createRouter('/api/saved_objects/'); - registerExportRoute(router, config, allowedTypes); + registerExportRoute(router, config); await server.start(); }); diff --git a/src/core/server/saved_objects/routes/integration_tests/import.test.ts b/src/core/server/saved_objects/routes/integration_tests/import.test.ts index 954e6d9e4831a..c72d3e241b882 100644 --- a/src/core/server/saved_objects/routes/integration_tests/import.test.ts +++ b/src/core/server/saved_objects/routes/integration_tests/import.test.ts @@ -22,7 +22,7 @@ import { UnwrapPromise } from '@kbn/utility-types'; import { registerImportRoute } from '../import'; import { savedObjectsClientMock } from '../../../../../core/server/mocks'; import { SavedObjectConfig } from '../../saved_objects_config'; -import { setupServer } from './test_utils'; +import { setupServer, createExportableType } from './test_utils'; type setupServerReturn = UnwrapPromise>; @@ -47,12 +47,15 @@ describe('POST /internal/saved_objects/_import', () => { beforeEach(async () => { ({ server, httpSetup, handlerContext } = await setupServer()); - savedObjectsClient = handlerContext.savedObjects.client; + handlerContext.savedObjects.typeRegistry.getImportableAndExportableTypes.mockReturnValue( + allowedTypes.map(createExportableType) + ); + savedObjectsClient = handlerContext.savedObjects.client; savedObjectsClient.find.mockResolvedValue(emptyResponse); const router = httpSetup.createRouter('/internal/saved_objects/'); - registerImportRoute(router, config, allowedTypes); + registerImportRoute(router, config); await server.start(); }); diff --git a/src/core/server/saved_objects/routes/integration_tests/resolve_import_errors.test.ts b/src/core/server/saved_objects/routes/integration_tests/resolve_import_errors.test.ts index c2974395217f8..a36f246f9dbc5 100644 --- a/src/core/server/saved_objects/routes/integration_tests/resolve_import_errors.test.ts +++ b/src/core/server/saved_objects/routes/integration_tests/resolve_import_errors.test.ts @@ -21,7 +21,7 @@ import supertest from 'supertest'; import { UnwrapPromise } from '@kbn/utility-types'; import { registerResolveImportErrorsRoute } from '../resolve_import_errors'; import { savedObjectsClientMock } from '../../../../../core/server/mocks'; -import { setupServer } from './test_utils'; +import { setupServer, createExportableType } from './test_utils'; import { SavedObjectConfig } from '../../saved_objects_config'; type setupServerReturn = UnwrapPromise>; @@ -40,10 +40,14 @@ describe('POST /api/saved_objects/_resolve_import_errors', () => { beforeEach(async () => { ({ server, httpSetup, handlerContext } = await setupServer()); + handlerContext.savedObjects.typeRegistry.getImportableAndExportableTypes.mockReturnValue( + allowedTypes.map(createExportableType) + ); + savedObjectsClient = handlerContext.savedObjects.client; const router = httpSetup.createRouter('/api/saved_objects/'); - registerResolveImportErrorsRoute(router, config, allowedTypes); + registerResolveImportErrorsRoute(router, config); await server.start(); }); diff --git a/src/core/server/saved_objects/routes/integration_tests/test_utils.ts b/src/core/server/saved_objects/routes/integration_tests/test_utils.ts index 093b36a413214..82a889f75d3c1 100644 --- a/src/core/server/saved_objects/routes/integration_tests/test_utils.ts +++ b/src/core/server/saved_objects/routes/integration_tests/test_utils.ts @@ -20,6 +20,7 @@ import { ContextService } from '../../../context'; import { createHttpServer, createCoreContext } from '../../../http/test_utils'; import { coreMock } from '../../../mocks'; +import { SavedObjectsType } from '../../types'; const coreId = Symbol('core'); @@ -43,3 +44,17 @@ export const setupServer = async () => { handlerContext, }; }; + +export const createExportableType = (name: string): SavedObjectsType => { + return { + name, + hidden: false, + namespaceAgnostic: false, + mappings: { + properties: {}, + }, + management: { + importableAndExportable: true, + }, + }; +}; diff --git a/src/core/server/saved_objects/routes/resolve_import_errors.ts b/src/core/server/saved_objects/routes/resolve_import_errors.ts index a10a19ba1d8ff..05bff871b3520 100644 --- a/src/core/server/saved_objects/routes/resolve_import_errors.ts +++ b/src/core/server/saved_objects/routes/resolve_import_errors.ts @@ -31,11 +31,7 @@ interface FileStream extends Readable { }; } -export const registerResolveImportErrorsRoute = ( - router: IRouter, - config: SavedObjectConfig, - supportedTypes: string[] -) => { +export const registerResolveImportErrorsRoute = (router: IRouter, config: SavedObjectConfig) => { const { maxImportExportSize, maxImportPayloadBytes } = config; router.post( @@ -75,6 +71,11 @@ export const registerResolveImportErrorsRoute = ( if (fileExtension !== '.ndjson') { return res.badRequest({ body: `Invalid file extension ${fileExtension}` }); } + + const supportedTypes = context.core.savedObjects.typeRegistry + .getImportableAndExportableTypes() + .map(type => type.name); + const result = await resolveSavedObjectsImportErrors({ supportedTypes, savedObjectsClient: context.core.savedObjects.client, diff --git a/src/core/server/saved_objects/routes/utils.test.ts b/src/core/server/saved_objects/routes/utils.test.ts index 83dceda2e1398..24719724785af 100644 --- a/src/core/server/saved_objects/routes/utils.test.ts +++ b/src/core/server/saved_objects/routes/utils.test.ts @@ -17,7 +17,7 @@ * under the License. */ -import { createSavedObjectsStreamFromNdJson } from './utils'; +import { createSavedObjectsStreamFromNdJson, validateTypes, validateObjects } from './utils'; import { Readable } from 'stream'; import { createPromiseFromStreams, createConcatStream } from '../../../../legacy/utils/streams'; @@ -104,3 +104,53 @@ describe('createSavedObjectsStreamFromNdJson', () => { ]); }); }); + +describe('validateTypes', () => { + const allowedTypes = ['config', 'index-pattern', 'dashboard']; + + it('returns an error message if some types are not allowed', () => { + expect(validateTypes(['config', 'not-allowed-type'], allowedTypes)).toMatchInlineSnapshot( + `"Trying to export non-exportable type(s): not-allowed-type"` + ); + expect( + validateTypes(['index-pattern', 'not-allowed-type', 'not-allowed-type-2'], allowedTypes) + ).toMatchInlineSnapshot( + `"Trying to export non-exportable type(s): not-allowed-type, not-allowed-type-2"` + ); + }); + it('returns undefined if all types are allowed', () => { + expect(validateTypes(allowedTypes, allowedTypes)).toBeUndefined(); + expect(validateTypes(['config'], allowedTypes)).toBeUndefined(); + }); +}); + +describe('validateObjects', () => { + const allowedTypes = ['config', 'index-pattern', 'dashboard']; + + it('returns an error message if some objects have types that are not allowed', () => { + expect( + validateObjects( + [ + { id: '1', type: 'config' }, + { id: '1', type: 'not-allowed' }, + { id: '42', type: 'not-allowed-either' }, + ], + allowedTypes + ) + ).toMatchInlineSnapshot( + `"Trying to export object(s) with non-exportable types: not-allowed:1, not-allowed-either:42"` + ); + }); + it('returns undefined if all objects have allowed types', () => { + expect( + validateObjects( + [ + { id: '1', type: 'config' }, + { id: '2', type: 'config' }, + { id: '1', type: 'index-pattern' }, + ], + allowedTypes + ) + ).toBeUndefined(); + }); +}); diff --git a/src/core/server/saved_objects/routes/utils.ts b/src/core/server/saved_objects/routes/utils.ts index 5536391341da3..5f0db3c4d548c 100644 --- a/src/core/server/saved_objects/routes/utils.ts +++ b/src/core/server/saved_objects/routes/utils.ts @@ -41,3 +41,22 @@ export function createSavedObjectsStreamFromNdJson(ndJsonStream: Readable) { ) ); } + +export function validateTypes(types: string[], supportedTypes: string[]): string | undefined { + const invalidTypes = types.filter(t => !supportedTypes.includes(t)); + if (invalidTypes.length) { + return `Trying to export non-exportable type(s): ${invalidTypes.join(', ')}`; + } +} + +export function validateObjects( + objects: Array<{ id: string; type: string }>, + supportedTypes: string[] +): string | undefined { + const invalidObjects = objects.filter(obj => !supportedTypes.includes(obj.type)); + if (invalidObjects.length) { + return `Trying to export object(s) with non-exportable types: ${invalidObjects + .map(obj => `${obj.type}:${obj.id}`) + .join(', ')}`; + } +} diff --git a/src/core/server/saved_objects/saved_objects_service.test.ts b/src/core/server/saved_objects/saved_objects_service.test.ts index 554acf8d43dcb..58b9abfbcdb3a 100644 --- a/src/core/server/saved_objects/saved_objects_service.test.ts +++ b/src/core/server/saved_objects/saved_objects_service.test.ts @@ -23,7 +23,7 @@ import { clientProviderInstanceMock, typeRegistryInstanceMock, } from './saved_objects_service.test.mocks'; - +import { BehaviorSubject } from 'rxjs'; import { ByteSizeValue } from '@kbn/config-schema'; import { SavedObjectsService } from './saved_objects_service'; import { mockCoreContext } from '../core_context.mock'; @@ -34,7 +34,6 @@ import { elasticsearchServiceMock } from '../elasticsearch/elasticsearch_service import { legacyServiceMock } from '../legacy/legacy_service.mock'; import { httpServiceMock } from '../http/http_service.mock'; import { SavedObjectsClientFactoryProvider } from './service/lib'; -import { BehaviorSubject } from 'rxjs'; import { NodesVersionCompatibility } from '../elasticsearch/version_check/ensure_es_version'; describe('SavedObjectsService', () => { diff --git a/src/core/server/saved_objects/saved_objects_service.ts b/src/core/server/saved_objects/saved_objects_service.ts index 89f7990c771c8..175eac3c1bd95 100644 --- a/src/core/server/saved_objects/saved_objects_service.ts +++ b/src/core/server/saved_objects/saved_objects_service.ts @@ -38,7 +38,7 @@ import { SavedObjectConfig, } from './saved_objects_config'; import { KibanaRequest, InternalHttpServiceSetup } from '../http'; -import { SavedObjectsClientContract, SavedObjectsType, SavedObjectsLegacyUiExports } from './types'; +import { SavedObjectsClientContract, SavedObjectsType } from './types'; import { ISavedObjectsRepository, SavedObjectsRepository } from './service/lib/repository'; import { SavedObjectsClientFactoryProvider, @@ -301,10 +301,6 @@ export class SavedObjectsService legacyTypes.forEach(type => this.typeRegistry.registerType(type)); this.validations = setupDeps.legacyPlugins.uiExports.savedObjectValidations || {}; - const importableExportableTypes = getImportableAndExportableTypes( - setupDeps.legacyPlugins.uiExports - ); - const savedObjectsConfig = await this.coreContext.configService .atPath('savedObjects') .pipe(first()) @@ -320,7 +316,6 @@ export class SavedObjectsService logger: this.logger, config: this.config, migratorPromise: this.migrator$.pipe(first()).toPromise(), - importableExportableTypes, }); return { @@ -479,16 +474,3 @@ export class SavedObjectsService }); } } - -function getImportableAndExportableTypes({ - savedObjectMappings = [], - savedObjectsManagement = {}, -}: SavedObjectsLegacyUiExports) { - const visibleTypes = savedObjectMappings.reduce( - (types, mapping) => [...types, ...Object.keys(mapping.properties)], - [] as string[] - ); - return visibleTypes.filter( - type => savedObjectsManagement[type]?.isImportableAndExportable === true ?? false - ); -} diff --git a/src/core/server/saved_objects/saved_objects_type_registry.mock.ts b/src/core/server/saved_objects/saved_objects_type_registry.mock.ts index 435e352335ecf..8c8458d7a5ce4 100644 --- a/src/core/server/saved_objects/saved_objects_type_registry.mock.ts +++ b/src/core/server/saved_objects/saved_objects_type_registry.mock.ts @@ -25,14 +25,20 @@ const createRegistryMock = (): jest.Mocked type === 'global'); + mock.isImportableAndExportable.mockReturnValue(true); return mock; }; diff --git a/src/core/server/saved_objects/saved_objects_type_registry.test.ts b/src/core/server/saved_objects/saved_objects_type_registry.test.ts index 4268ab7718f8d..4d1d5c1eacc25 100644 --- a/src/core/server/saved_objects/saved_objects_type_registry.test.ts +++ b/src/core/server/saved_objects/saved_objects_type_registry.test.ts @@ -212,4 +212,45 @@ describe('SavedObjectTypeRegistry', () => { expect(registry.getIndex('unknownType')).toBeUndefined(); }); }); + + describe('#isImportableAndExportable', () => { + it('returns correct value for the type', () => { + registry.registerType( + createType({ name: 'typeA', management: { importableAndExportable: true } }) + ); + registry.registerType( + createType({ name: 'typeB', management: { importableAndExportable: false } }) + ); + + expect(registry.isImportableAndExportable('typeA')).toBe(true); + expect(registry.isImportableAndExportable('typeB')).toBe(false); + }); + it('returns false when the type is not registered', () => { + registry.registerType(createType({ name: 'typeA', management: {} })); + registry.registerType(createType({ name: 'typeB', management: {} })); + + expect(registry.isImportableAndExportable('typeA')).toBe(false); + }); + it('returns false when management is not defined for the type', () => { + registry.registerType(createType({ name: 'typeA' })); + expect(registry.isImportableAndExportable('unknownType')).toBe(false); + }); + }); + + describe('#getImportableAndExportableTypes', () => { + it('returns all registered types that are importable/exportable', () => { + const typeA = createType({ name: 'typeA', management: { importableAndExportable: true } }); + const typeB = createType({ name: 'typeB' }); + const typeC = createType({ name: 'typeC', management: { importableAndExportable: false } }); + const typeD = createType({ name: 'typeD', management: { importableAndExportable: true } }); + registry.registerType(typeA); + registry.registerType(typeB); + registry.registerType(typeC); + registry.registerType(typeD); + + const types = registry.getImportableAndExportableTypes(); + expect(types.length).toEqual(2); + expect(types.map(t => t.name)).toEqual(['typeA', 'typeD']); + }); + }); }); diff --git a/src/core/server/saved_objects/saved_objects_type_registry.ts b/src/core/server/saved_objects/saved_objects_type_registry.ts index b73c80ad9dff7..5580ce3815d0d 100644 --- a/src/core/server/saved_objects/saved_objects_type_registry.ts +++ b/src/core/server/saved_objects/saved_objects_type_registry.ts @@ -27,7 +27,13 @@ import { SavedObjectsType } from './types'; */ export type ISavedObjectTypeRegistry = Pick< SavedObjectTypeRegistry, - 'getType' | 'getAllTypes' | 'getIndex' | 'isNamespaceAgnostic' | 'isHidden' + | 'getType' + | 'getAllTypes' + | 'getIndex' + | 'isNamespaceAgnostic' + | 'isHidden' + | 'getImportableAndExportableTypes' + | 'isImportableAndExportable' >; /** @@ -63,6 +69,13 @@ export class SavedObjectTypeRegistry { return [...this.types.values()]; } + /** + * Return all {@link SavedObjectsType | types} currently registered that are importable/exportable. + */ + public getImportableAndExportableTypes() { + return this.getAllTypes().filter(type => this.isImportableAndExportable(type.name)); + } + /** * Returns the `namespaceAgnostic` property for given type, or `false` if * the type is not registered. @@ -86,4 +99,12 @@ export class SavedObjectTypeRegistry { public getIndex(type: string) { return this.types.get(type)?.indexPattern; } + + /** + * Returns the `management.importableAndExportable` property for given type, or + * `false` if the type is not registered or does not define a management section. + */ + public isImportableAndExportable(type: string) { + return this.types.get(type)?.management?.importableAndExportable ?? false; + } } diff --git a/src/core/server/saved_objects/service/lib/repository_create_repository.test.ts b/src/core/server/saved_objects/service/lib/repository_create_repository.test.ts index 4a87bb1043ca2..a6b580e9b3461 100644 --- a/src/core/server/saved_objects/service/lib/repository_create_repository.test.ts +++ b/src/core/server/saved_objects/service/lib/repository_create_repository.test.ts @@ -102,7 +102,6 @@ describe('SavedObjectsRepository#createRepository', () => { expect(repository).toBeDefined(); expect(RepositoryConstructor.mock.calls[0][0].allowedTypes).toMatchInlineSnapshot(` Array [ - "config", "nsAgnosticType", "nsType", ] @@ -121,7 +120,6 @@ describe('SavedObjectsRepository#createRepository', () => { expect(repository).toBeDefined(); expect(RepositoryConstructor.mock.calls[0][0].allowedTypes).toMatchInlineSnapshot(` Array [ - "config", "nsAgnosticType", "nsType", "hiddenType", diff --git a/src/core/server/saved_objects/types.ts b/src/core/server/saved_objects/types.ts index c9c672d0f8b1c..1d927211b43e5 100644 --- a/src/core/server/saved_objects/types.ts +++ b/src/core/server/saved_objects/types.ts @@ -21,7 +21,6 @@ import { SavedObjectsClient } from './service/saved_objects_client'; import { SavedObjectsTypeMappingDefinition, SavedObjectsTypeMappingDefinitions } from './mappings'; import { SavedObjectMigrationMap } from './migrations'; import { PropertyValidators } from './validation'; -import { SavedObjectsManagementDefinition } from './management'; export { SavedObjectsImportResponse, @@ -246,6 +245,50 @@ export interface SavedObjectsType { * An optional map of {@link SavedObjectMigrationFn | migrations} to be used to migrate the type. */ migrations?: SavedObjectMigrationMap; + /** + * An optional {@link SavedObjectsTypeManagementDefinition | saved objects management section} definition for the type. + */ + management?: SavedObjectsTypeManagementDefinition; +} + +/** + * Configuration options for the {@link SavedObjectsType | type}'s management section. + * + * @public + */ +export interface SavedObjectsTypeManagementDefinition { + /** + * Is the type importable or exportable. Defaults to `false`. + */ + importableAndExportable?: boolean; + /** + * The default search field to use for this type. Defaults to `id`. + */ + defaultSearchField?: string; + /** + * The eui icon name to display in the management table. + * If not defined, the default icon will be used. + */ + icon?: string; + /** + * Function returning the title to display in the management table. + * If not defined, will use the object's type and id to generate a label. + */ + getTitle?: (savedObject: SavedObject) => string; + /** + * Function returning the url to use to redirect to the editing page of this object. + * If not defined, editing will not be allowed. + */ + getEditUrl?: (savedObject: SavedObject) => string; + /** + * Function returning the url to use to redirect to this object from the management section. + * If not defined, redirecting to the object will not be allowed. + * + * @returns an object containing a `path` and `uiCapabilitiesPath` properties. the `path` is the path to + * the object page, relative to the base path. `uiCapabilitiesPath` is the path to check in the + * {@link Capabilities | uiCapabilities} to check if the user has permission to access the object. + */ + getInAppUrl?: (savedObject: SavedObject) => { path: string; uiCapabilitiesPath: string }; } /** @@ -257,7 +300,7 @@ export interface SavedObjectsLegacyUiExports { savedObjectMigrations: SavedObjectsLegacyMigrationDefinitions; savedObjectSchemas: SavedObjectsLegacySchemaDefinitions; savedObjectValidations: PropertyValidators; - savedObjectsManagement: SavedObjectsManagementDefinition; + savedObjectsManagement: SavedObjectsLegacyManagementDefinition; } /** @@ -269,6 +312,28 @@ export interface SavedObjectsLegacyMapping { properties: SavedObjectsTypeMappingDefinitions; } +/** + * @internal + * @deprecated Use {@link SavedObjectsTypeManagementDefinition | management definition} when registering + * from new platform plugins + */ +export interface SavedObjectsLegacyManagementDefinition { + [key: string]: SavedObjectsLegacyManagementTypeDefinition; +} + +/** + * @internal + * @deprecated + */ +export interface SavedObjectsLegacyManagementTypeDefinition { + isImportableAndExportable?: boolean; + defaultSearchField?: string; + icon?: string; + getTitle?: (savedObject: SavedObject) => string; + getEditUrl?: (savedObject: SavedObject) => string; + getInAppUrl?: (savedObject: SavedObject) => { path: string; uiCapabilitiesPath: string }; +} + /** * @internal * @deprecated diff --git a/src/core/server/saved_objects/utils.test.ts b/src/core/server/saved_objects/utils.test.ts index 0a56535ac8509..0719fe7138e8a 100644 --- a/src/core/server/saved_objects/utils.test.ts +++ b/src/core/server/saved_objects/utils.test.ts @@ -235,6 +235,75 @@ describe('convertLegacyTypes', () => { expect(legacyMigration).toHaveBeenCalledWith(doc, context.log); }); + it('imports type management information', () => { + const uiExports: SavedObjectsLegacyUiExports = { + savedObjectMappings: [ + { + pluginId: 'pluginA', + properties: { + typeA: { + properties: { + fieldA: { type: 'text' }, + }, + }, + }, + }, + { + pluginId: 'pluginB', + properties: { + typeB: { + properties: { + fieldB: { type: 'text' }, + }, + }, + typeC: { + properties: { + fieldC: { type: 'text' }, + }, + }, + }, + }, + ], + savedObjectsManagement: { + typeA: { + isImportableAndExportable: true, + icon: 'iconA', + defaultSearchField: 'searchFieldA', + getTitle: savedObject => savedObject.id, + }, + typeB: { + isImportableAndExportable: false, + icon: 'iconB', + getEditUrl: savedObject => `/some-url/${savedObject.id}`, + getInAppUrl: savedObject => ({ path: 'path', uiCapabilitiesPath: 'ui-path' }), + }, + }, + savedObjectMigrations: {}, + savedObjectSchemas: {}, + savedObjectValidations: {}, + }; + + const converted = convertLegacyTypes(uiExports, legacyConfig); + expect(converted.length).toEqual(3); + const [typeA, typeB, typeC] = converted; + + expect(typeA.management).toEqual({ + importableAndExportable: true, + icon: 'iconA', + defaultSearchField: 'searchFieldA', + getTitle: uiExports.savedObjectsManagement.typeA.getTitle, + }); + + expect(typeB.management).toEqual({ + importableAndExportable: false, + icon: 'iconB', + getEditUrl: uiExports.savedObjectsManagement.typeB.getEditUrl, + getInAppUrl: uiExports.savedObjectsManagement.typeB.getInAppUrl, + }); + + expect(typeC.management).toBeUndefined(); + }); + it('merges everything when all are present', () => { const uiExports: SavedObjectsLegacyUiExports = { savedObjectMappings: [ diff --git a/src/core/server/saved_objects/utils.ts b/src/core/server/saved_objects/utils.ts index bb2c42c6a362c..ea90efd8b9fbd 100644 --- a/src/core/server/saved_objects/utils.ts +++ b/src/core/server/saved_objects/utils.ts @@ -23,6 +23,8 @@ import { SavedObjectsType, SavedObjectsLegacyUiExports, SavedObjectLegacyMigrationMap, + SavedObjectsLegacyManagementTypeDefinition, + SavedObjectsTypeManagementDefinition, } from './types'; import { SavedObjectsSchemaDefinition } from './schema'; @@ -35,15 +37,17 @@ export const convertLegacyTypes = ( savedObjectMappings = [], savedObjectMigrations = {}, savedObjectSchemas = {}, + savedObjectsManagement = {}, }: SavedObjectsLegacyUiExports, legacyConfig: LegacyConfig ): SavedObjectsType[] => { - return savedObjectMappings.reduce((types, { pluginId, properties }) => { + return savedObjectMappings.reduce((types, { properties }) => { return [ ...types, ...Object.entries(properties).map(([type, mappings]) => { const schema = savedObjectSchemas[type]; const migrations = savedObjectMigrations[type]; + const management = savedObjectsManagement[type]; return { name: type, hidden: schema?.hidden ?? false, @@ -55,6 +59,7 @@ export const convertLegacyTypes = ( : schema?.indexPattern, convertToAliasScript: schema?.convertToAliasScript, migrations: convertLegacyMigrations(migrations ?? {}), + management: management ? convertLegacyTypeManagement(management) : undefined, }; }), ]; @@ -90,3 +95,16 @@ const convertLegacyMigrations = ( }; }, {} as SavedObjectMigrationMap); }; + +const convertLegacyTypeManagement = ( + legacyTypeManagement: SavedObjectsLegacyManagementTypeDefinition +): SavedObjectsTypeManagementDefinition => { + return { + importableAndExportable: legacyTypeManagement.isImportableAndExportable, + defaultSearchField: legacyTypeManagement.defaultSearchField, + icon: legacyTypeManagement.icon, + getTitle: legacyTypeManagement.getTitle, + getEditUrl: legacyTypeManagement.getEditUrl, + getInAppUrl: legacyTypeManagement.getInAppUrl, + }; +}; diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index f7afe7a6a290a..5ede98a1e6e6d 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -968,7 +968,7 @@ export type IsAuthenticated = (request: KibanaRequest | LegacyRequest) => boolea export type ISavedObjectsRepository = Pick; // @public -export type ISavedObjectTypeRegistry = Pick; +export type ISavedObjectTypeRegistry = Pick; // @public export type IScopedClusterClient = Pick; @@ -1456,6 +1456,7 @@ export interface RequestHandlerContext { rendering: IScopedRenderingClient; savedObjects: { client: SavedObjectsClientContract; + typeRegistry: ISavedObjectTypeRegistry; }; elasticsearch: { dataClient: IScopedClusterClient; @@ -2150,12 +2151,26 @@ export interface SavedObjectsType { convertToAliasScript?: string; hidden: boolean; indexPattern?: string; + management?: SavedObjectsTypeManagementDefinition; mappings: SavedObjectsTypeMappingDefinition; migrations?: SavedObjectMigrationMap; name: string; namespaceAgnostic: boolean; } +// @public +export interface SavedObjectsTypeManagementDefinition { + defaultSearchField?: string; + getEditUrl?: (savedObject: SavedObject) => string; + getInAppUrl?: (savedObject: SavedObject) => { + path: string; + uiCapabilitiesPath: string; + }; + getTitle?: (savedObject: SavedObject) => string; + icon?: string; + importableAndExportable?: boolean; +} + // @public export interface SavedObjectsTypeMappingDefinition { dynamic?: false | 'strict'; @@ -2180,9 +2195,11 @@ export interface SavedObjectsUpdateResponse extends Omit { + let service: UiSettingsService; + let setupDeps: SetupDeps; + let savedObjectsClient: ReturnType; + + beforeEach(() => { + const coreContext = mockCoreContext.create(); + coreContext.configService.atPath.mockReturnValue(new BehaviorSubject({ overrides })); + const httpSetup = httpServiceMock.createSetupContract(); + const savedObjectsSetup = savedObjectsServiceMock.createInternalSetupContract(); + setupDeps = { http: httpSetup, savedObjects: savedObjectsSetup }; + savedObjectsClient = savedObjectsClientMock.create(); + service = new UiSettingsService(coreContext); + }); -afterEach(() => { - MockUiSettingsClientConstructor.mockClear(); -}); + afterEach(() => { + MockUiSettingsClientConstructor.mockClear(); + }); -describe('uiSettings', () => { describe('#setup', () => { + it('registers the uiSettings type to the savedObjects registry', async () => { + await service.setup(setupDeps); + expect(setupDeps.savedObjects.registerType).toHaveBeenCalledTimes(1); + expect(setupDeps.savedObjects.registerType).toHaveBeenCalledWith(uiSettingsType); + }); + describe('#asScopedToClient', () => { it('passes saved object type "config" to UiSettingsClient', async () => { - const service = new UiSettingsService(coreContext); const setup = await service.setup(setupDeps); setup.asScopedToClient(savedObjectsClient); expect(MockUiSettingsClientConstructor).toBeCalledTimes(1); @@ -60,7 +73,6 @@ describe('uiSettings', () => { }); it('passes overrides to UiSettingsClient', async () => { - const service = new UiSettingsService(coreContext); const setup = await service.setup(setupDeps); setup.asScopedToClient(savedObjectsClient); expect(MockUiSettingsClientConstructor).toBeCalledTimes(1); @@ -69,7 +81,6 @@ describe('uiSettings', () => { }); it('passes a copy of set defaults to UiSettingsClient', async () => { - const service = new UiSettingsService(coreContext); const setup = await service.setup(setupDeps); setup.register(defaults); @@ -83,7 +94,6 @@ describe('uiSettings', () => { describe('#register', () => { it('throws if registers the same key twice', async () => { - const service = new UiSettingsService(coreContext); const setup = await service.setup(setupDeps); setup.register(defaults); expect(() => setup.register(defaults)).toThrowErrorMatchingInlineSnapshot( @@ -96,7 +106,6 @@ describe('uiSettings', () => { describe('#start', () => { describe('#asScopedToClient', () => { it('passes saved object type "config" to UiSettingsClient', async () => { - const service = new UiSettingsService(coreContext); await service.setup(setupDeps); const start = await service.start(); start.asScopedToClient(savedObjectsClient); @@ -106,7 +115,6 @@ describe('uiSettings', () => { }); it('passes overrides to UiSettingsClient', async () => { - const service = new UiSettingsService(coreContext); await service.setup(setupDeps); const start = await service.start(); start.asScopedToClient(savedObjectsClient); @@ -116,7 +124,6 @@ describe('uiSettings', () => { }); it('passes a copy of set defaults to UiSettingsClient', async () => { - const service = new UiSettingsService(coreContext); const setup = await service.setup(setupDeps); setup.register(defaults); const start = await service.start(); diff --git a/src/core/server/ui_settings/ui_settings_service.ts b/src/core/server/ui_settings/ui_settings_service.ts index 942c2625ac8e7..de2cc9d510e0c 100644 --- a/src/core/server/ui_settings/ui_settings_service.ts +++ b/src/core/server/ui_settings/ui_settings_service.ts @@ -24,6 +24,7 @@ import { CoreContext } from '../core_context'; import { Logger } from '../logging'; import { SavedObjectsClientContract } from '../saved_objects/types'; +import { InternalSavedObjectsServiceSetup } from '../saved_objects'; import { InternalHttpServiceSetup } from '../http'; import { UiSettingsConfigType, config as uiConfigDefinition } from './ui_settings_config'; import { UiSettingsClient } from './ui_settings_client'; @@ -33,11 +34,12 @@ import { UiSettingsParams, } from './types'; import { mapToObject } from '../../utils/'; - +import { uiSettingsType } from './saved_objects'; import { registerRoutes } from './routes'; -interface SetupDeps { +export interface SetupDeps { http: InternalHttpServiceSetup; + savedObjects: InternalSavedObjectsServiceSetup; } /** @internal */ @@ -53,9 +55,11 @@ export class UiSettingsService this.config$ = coreContext.configService.atPath(uiConfigDefinition.path); } - public async setup(deps: SetupDeps): Promise { - registerRoutes(deps.http.createRouter('')); + public async setup({ http, savedObjects }: SetupDeps): Promise { this.log.debug('Setting up ui settings service'); + + savedObjects.registerType(uiSettingsType); + registerRoutes(http.createRouter('')); const config = await this.config$.pipe(first()).toPromise(); this.overrides = config.overrides; diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index 221133a17d59a..092eed924f330 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -201,18 +201,6 @@ export default function(kibana) { return `/goto/${encodeURIComponent(obj.id)}`; }, }, - config: { - isImportableAndExportable: true, - getInAppUrl() { - return { - path: `/app/kibana#/management/kibana/settings`, - uiCapabilitiesPath: 'advancedSettings.show', - }; - }, - getTitle(obj) { - return `Advanced Settings [${obj.id}]`; - }, - }, }, savedObjectSchemas: { diff --git a/src/legacy/plugin_discovery/plugin_spec/plugin_spec_options.d.ts b/src/legacy/plugin_discovery/plugin_spec/plugin_spec_options.d.ts index 228ef96f8c9f3..d668739436726 100644 --- a/src/legacy/plugin_discovery/plugin_spec/plugin_spec_options.d.ts +++ b/src/legacy/plugin_discovery/plugin_spec/plugin_spec_options.d.ts @@ -19,13 +19,13 @@ import { Server } from '../../server/kbn_server'; import { Capabilities } from '../../../core/server'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { SavedObjectsManagementDefinition } from '../../../core/server/saved_objects/management'; +import { SavedObjectsLegacyManagementDefinition } from '../../../core/server/saved_objects/types'; export type InitPluginFunction = (server: Server) => void; export interface UiExports { injectDefaultVars?: (server: Server) => { [key: string]: any }; styleSheetPaths?: string; - savedObjectsManagement?: SavedObjectsManagementDefinition; + savedObjectsManagement?: SavedObjectsLegacyManagementDefinition; mappings?: unknown; visTypes?: string[]; interpreter?: string[]; diff --git a/src/legacy/plugin_discovery/types.ts b/src/legacy/plugin_discovery/types.ts index 9425003eae874..4d8090a138ffb 100644 --- a/src/legacy/plugin_discovery/types.ts +++ b/src/legacy/plugin_discovery/types.ts @@ -23,7 +23,7 @@ import { Capabilities } from '../../core/server'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SavedObjectsSchemaDefinition } from '../../core/server/saved_objects/schema'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { SavedObjectsManagementDefinition } from '../../core/server/saved_objects/management'; +import { SavedObjectsLegacyManagementDefinition } from '../../core/server/saved_objects/types'; import { AppCategory } from '../../core/types'; /** @@ -73,7 +73,7 @@ export interface LegacyPluginOptions { mappings: any; migrations: any; savedObjectSchemas: SavedObjectsSchemaDefinition; - savedObjectsManagement: SavedObjectsManagementDefinition; + savedObjectsManagement: SavedObjectsLegacyManagementDefinition; visTypes: string[]; embeddableActions?: string[]; embeddableFactories?: string[]; diff --git a/src/legacy/server/kbn_server.d.ts b/src/legacy/server/kbn_server.d.ts index 8da1b3b05fa76..68b5a63871372 100644 --- a/src/legacy/server/kbn_server.d.ts +++ b/src/legacy/server/kbn_server.d.ts @@ -77,7 +77,7 @@ declare module 'hapi' { addScopedTutorialContextFactory: ( scopedTutorialContextFactory: (...args: any[]) => any ) => void; - savedObjectsManagement(): SavedObjectsManagement; + getSavedObjectsManagement(): SavedObjectsManagement; getInjectedUiAppVars: (pluginName: string) => { [key: string]: any }; getUiNavLinks(): Array<{ _id: string }>; addMemoizedFactoryToRequest: ( diff --git a/src/legacy/server/saved_objects/saved_objects_mixin.js b/src/legacy/server/saved_objects/saved_objects_mixin.js index 0039fb19bb086..cc63099c8a211 100644 --- a/src/legacy/server/saved_objects/saved_objects_mixin.js +++ b/src/legacy/server/saved_objects/saved_objects_mixin.js @@ -43,7 +43,7 @@ export function savedObjectsMixin(kbnServer, server) { server.decorate( 'server', 'getSavedObjectsManagement', - () => new SavedObjectsManagement(kbnServer.uiExports.savedObjectsManagement) + () => new SavedObjectsManagement(typeRegistry) ); const warn = message => server.log(['warning', 'saved-objects'], message); diff --git a/src/legacy/server/saved_objects/saved_objects_mixin.test.js b/src/legacy/server/saved_objects/saved_objects_mixin.test.js index b8636d510b979..3745f0b92123c 100644 --- a/src/legacy/server/saved_objects/saved_objects_mixin.test.js +++ b/src/legacy/server/saved_objects/saved_objects_mixin.test.js @@ -201,7 +201,7 @@ describe('Saved Objects Mixin', () => { it('should return all but hidden types', async () => { expect(service).toBeDefined(); - expect(service.types).toEqual(['config', 'testtype', 'doc1', 'doc2']); + expect(service.types).toEqual(['testtype', 'doc1', 'doc2']); }); const mockCallEs = jest.fn(); @@ -215,16 +215,12 @@ describe('Saved Objects Mixin', () => { it('should create a repository without hidden types', () => { const repository = service.getSavedObjectsRepository(mockCallEs); expect(repository).toBeDefined(); - expect(repository._allowedTypes).toEqual(['config', 'testtype', 'doc1', 'doc2']); + expect(repository._allowedTypes).toEqual(['testtype', 'doc1', 'doc2']); }); it('should create a repository with a unique list of allowed types', () => { - const repository = service.getSavedObjectsRepository(mockCallEs, [ - 'config', - 'config', - 'config', - ]); - expect(repository._allowedTypes).toEqual(['config', 'testtype', 'doc1', 'doc2']); + const repository = service.getSavedObjectsRepository(mockCallEs, ['doc1', 'doc1', 'doc1']); + expect(repository._allowedTypes).toEqual(['testtype', 'doc1', 'doc2']); }); it('should create a repository with extraTypes minus duplicate', () => { @@ -232,13 +228,7 @@ describe('Saved Objects Mixin', () => { 'hiddentype', 'hiddentype', ]); - expect(repository._allowedTypes).toEqual([ - 'config', - 'testtype', - 'doc1', - 'doc2', - 'hiddentype', - ]); + expect(repository._allowedTypes).toEqual(['testtype', 'doc1', 'doc2', 'hiddentype']); }); it('should not allow a repository without a callCluster function', () => { diff --git a/test/api_integration/apis/saved_objects/export.js b/test/api_integration/apis/saved_objects/export.js index ace65f190dec2..fc9ab8140869c 100644 --- a/test/api_integration/apis/saved_objects/export.js +++ b/test/api_integration/apis/saved_objects/export.js @@ -191,10 +191,28 @@ export default function({ getService }) { expect(resp.body).to.eql({ statusCode: 400, error: 'Bad Request', - message: - '[request body.type]: types that failed validation:\n' + - '- [request body.type.0]: expected value of type [string] but got [Array]\n' + - '- [request body.type.1.0]: wigwags is not exportable', + message: 'Trying to export non-exportable type(s): wigwags', + }); + }); + }); + + it(`should return 400 when exporting objects with unsupported type`, async () => { + await supertest + .post('/api/saved_objects/_export') + .send({ + objects: [ + { + type: 'wigwags', + id: '1', + }, + ], + }) + .expect(400) + .then(resp => { + expect(resp.body).to.eql({ + statusCode: 400, + error: 'Bad Request', + message: 'Trying to export object(s) with non-exportable types: wigwags:1', }); }); }); diff --git a/x-pack/test/saved_object_api_integration/common/suites/export.ts b/x-pack/test/saved_object_api_integration/common/suites/export.ts index caf149a23cdbf..e6853096962ec 100644 --- a/x-pack/test/saved_object_api_integration/common/suites/export.ts +++ b/x-pack/test/saved_object_api_integration/common/suites/export.ts @@ -59,7 +59,7 @@ export function exportTestSuiteFactory(esArchiver: any, supertest: SuperTest Date: Tue, 10 Mar 2020 10:36:13 +0000 Subject: [PATCH 05/23] [Logs / Metrics UI] Link handling / stop page reloads (#58478) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add a hook for seamlessly handling onClick and href props of links, buttons etc Co-authored-by: Elastic Machine Co-authored-by: Felix Stürmer --- .../analyze_in_ml_button.tsx | 62 ++--- .../user_management_link.tsx | 23 +- .../log_entry_actions_menu.test.tsx | 227 ++++++++++-------- .../log_entry_actions_menu.tsx | 67 +++--- .../chart_context_menu.test.tsx | 22 +- .../metrics_explorer/chart_context_menu.tsx | 19 +- .../helpers/create_tsvb_link.test.ts | 104 ++++++-- .../helpers/create_tsvb_link.ts | 20 +- .../components/navigation/routed_tabs.tsx | 74 +++--- .../view_source_configuration_button.tsx | 19 +- .../waffle/lib/create_uptime_link.test.ts | 28 ++- .../waffle/lib/create_uptime_link.ts | 19 +- .../components/waffle/node_context_menu.tsx | 79 +++--- .../public/hooks/use_link_props.test.tsx | 186 ++++++++++++++ .../infra/public/hooks/use_link_props.tsx | 109 +++++++++ .../public/pages/infrastructure/index.tsx | 9 +- .../pages/infrastructure/snapshot/index.tsx | 14 +- .../pages/link_to/redirect_to_node_detail.tsx | 16 +- .../pages/link_to/redirect_to_node_logs.tsx | 13 +- .../infra/public/pages/logs/page_content.tsx | 22 +- .../logs/stream/page_no_indices_content.tsx | 14 +- .../pages/metrics/components/invalid_node.tsx | 17 +- .../infra/public/pages/metrics/index.tsx | 8 +- 23 files changed, 801 insertions(+), 370 deletions(-) create mode 100644 x-pack/plugins/infra/public/hooks/use_link_props.test.tsx create mode 100644 x-pack/plugins/infra/public/hooks/use_link_props.tsx diff --git a/x-pack/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx index 6b946898f6330..7d523faafdb3c 100644 --- a/x-pack/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx @@ -8,22 +8,19 @@ import { EuiButton } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; import { encode } from 'rison-node'; -import url from 'url'; -import { stringify } from 'query-string'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { TimeRange } from '../../../../common/http_api/shared/time_range'; -import { url as urlUtils } from '../../../../../../../src/plugins/kibana_utils/public'; +import { useLinkProps, LinkDescriptor } from '../../../hooks/use_link_props'; export const AnalyzeInMlButton: React.FunctionComponent<{ jobId: string; partition?: string; timeRange: TimeRange; }> = ({ jobId, partition, timeRange }) => { - const prependBasePath = useKibana().services.http?.basePath?.prepend; - if (!prependBasePath) { - return null; - } - const pathname = prependBasePath('/app/ml'); + const linkProps = useLinkProps( + typeof partition === 'string' + ? getPartitionSpecificSingleMetricViewerLinkDescriptor(jobId, partition, timeRange) + : getOverallAnomalyExplorerLinkDescriptor(jobId, timeRange) + ); const buttonLabel = ( ); return typeof partition === 'string' ? ( - + {buttonLabel} ) : ( - + {buttonLabel} ); }; -const getOverallAnomalyExplorerLink = (pathname: string, jobId: string, timeRange: TimeRange) => { +const getOverallAnomalyExplorerLinkDescriptor = ( + jobId: string, + timeRange: TimeRange +): LinkDescriptor => { const { from, to } = convertTimeRangeToParams(timeRange); const _g = encode({ @@ -62,20 +54,18 @@ const getOverallAnomalyExplorerLink = (pathname: string, jobId: string, timeRang }, }); - const hash = `/explorer?${stringify(urlUtils.encodeQuery({ _g }), { encode: false })}`; - - return url.format({ - pathname, - hash, - }); + return { + app: 'ml', + hash: '/explorer', + search: { _g }, + }; }; -const getPartitionSpecificSingleMetricViewerLink = ( - pathname: string, +const getPartitionSpecificSingleMetricViewerLinkDescriptor = ( jobId: string, partition: string, timeRange: TimeRange -) => { +): LinkDescriptor => { const { from, to } = convertTimeRangeToParams(timeRange); const _g = encode({ @@ -95,15 +85,11 @@ const getPartitionSpecificSingleMetricViewerLink = ( }, }); - const hash = `/timeseriesexplorer?${stringify(urlUtils.encodeQuery({ _g, _a }), { - sort: false, - encode: false, - })}`; - - return url.format({ - pathname, - hash, - }); + return { + app: 'ml', + hash: '/timeseriesexplorer', + search: { _g, _a }, + }; }; const convertTimeRangeToParams = (timeRange: TimeRange): { from: string; to: string } => { diff --git a/x-pack/plugins/infra/public/components/logging/log_analysis_setup/user_management_link.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/user_management_link.tsx index 9a2bbd3dabffc..e045e78471513 100644 --- a/x-pack/plugins/infra/public/components/logging/log_analysis_setup/user_management_link.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/user_management_link.tsx @@ -7,12 +7,19 @@ import { EuiButton, EuiButtonProps } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; +import { useLinkProps } from '../../../hooks/use_link_props'; -export const UserManagementLink: React.FunctionComponent = props => ( - - - -); +export const UserManagementLink: React.FunctionComponent = props => { + const linkProps = useLinkProps({ + app: 'kibana', + hash: '/management/security/users', + }); + return ( + + + + ); +}; diff --git a/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.test.tsx b/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.test.tsx index 16a91e3727c98..b4fa6b8800fba 100644 --- a/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.test.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.test.tsx @@ -10,22 +10,35 @@ import { act } from 'react-dom/test-utils'; import { mount } from 'enzyme'; import { LogEntryActionsMenu } from './log_entry_actions_menu'; +import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public'; +import { coreMock } from 'src/core/public/mocks'; + +const coreStartMock = coreMock.createStart(); +coreStartMock.application.getUrlForApp.mockImplementation((app, options) => { + return `/test-basepath/s/test-space/app/${app}${options?.path}`; +}); + +const ProviderWrapper: React.FC = ({ children }) => { + return {children}; +}; describe('LogEntryActionsMenu component', () => { describe('uptime link', () => { it('renders with a host ip filter when present in log entry', () => { const elementWrapper = mount( - + + + ); act(() => { @@ -38,22 +51,24 @@ describe('LogEntryActionsMenu component', () => { expect( elementWrapper.find(`a${testSubject('~uptimeLogEntryActionsMenuItem')}`).prop('href') - ).toMatchInlineSnapshot(`"/app/uptime#/?search=(host.ip:HOST_IP)"`); + ).toBe('/test-basepath/s/test-space/app/uptime#/?search=host.ip:HOST_IP'); }); it('renders with a container id filter when present in log entry', () => { const elementWrapper = mount( - + + + ); act(() => { @@ -66,22 +81,24 @@ describe('LogEntryActionsMenu component', () => { expect( elementWrapper.find(`a${testSubject('~uptimeLogEntryActionsMenuItem')}`).prop('href') - ).toMatchInlineSnapshot(`"/app/uptime#/?search=(container.id:CONTAINER_ID)"`); + ).toBe('/test-basepath/s/test-space/app/uptime#/?search=container.id:CONTAINER_ID'); }); it('renders with a pod uid filter when present in log entry', () => { const elementWrapper = mount( - + + + ); act(() => { @@ -94,26 +111,28 @@ describe('LogEntryActionsMenu component', () => { expect( elementWrapper.find(`a${testSubject('~uptimeLogEntryActionsMenuItem')}`).prop('href') - ).toMatchInlineSnapshot(`"/app/uptime#/?search=(kubernetes.pod.uid:POD_UID)"`); + ).toBe('/test-basepath/s/test-space/app/uptime#/?search=kubernetes.pod.uid:POD_UID'); }); it('renders with a disjunction of filters when multiple present in log entry', () => { const elementWrapper = mount( - + + + ); act(() => { @@ -126,24 +145,26 @@ describe('LogEntryActionsMenu component', () => { expect( elementWrapper.find(`a${testSubject('~uptimeLogEntryActionsMenuItem')}`).prop('href') - ).toMatchInlineSnapshot( - `"/app/uptime#/?search=(container.id:CONTAINER_ID OR host.ip:HOST_IP OR kubernetes.pod.uid:POD_UID)"` + ).toBe( + '/test-basepath/s/test-space/app/uptime#/?search=container.id:CONTAINER_ID%20or%20host.ip:HOST_IP%20or%20kubernetes.pod.uid:POD_UID' ); }); it('renders as disabled when no supported field is present in log entry', () => { const elementWrapper = mount( - + + + ); act(() => { @@ -165,17 +186,19 @@ describe('LogEntryActionsMenu component', () => { describe('apm link', () => { it('renders with a trace id filter when present in log entry', () => { const elementWrapper = mount( - + + + ); act(() => { @@ -194,20 +217,22 @@ describe('LogEntryActionsMenu component', () => { it('renders with a trace id filter and timestamp when present in log entry', () => { const timestamp = '2019-06-27T17:44:08.693Z'; const elementWrapper = mount( - + + + ); act(() => { @@ -225,17 +250,19 @@ describe('LogEntryActionsMenu component', () => { it('renders as disabled when no supported field is present in log entry', () => { const elementWrapper = mount( - + + + ); act(() => { diff --git a/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx b/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx index 60e50f486d22a..206e9821190fb 100644 --- a/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx @@ -4,41 +4,44 @@ * you may not use this file except in compliance with the Elastic License. */ +import * as rt from 'io-ts'; import { EuiButtonEmpty, EuiContextMenuItem, EuiContextMenuPanel, EuiPopover } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import React, { useMemo } from 'react'; -import url from 'url'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { useVisibilityState } from '../../../utils/use_visibility_state'; import { getTraceUrl } from '../../../../../../legacy/plugins/apm/public/components/shared/Links/apm/ExternalLinks'; import { LogEntriesItem } from '../../../../common/http_api'; +import { useLinkProps, LinkDescriptor } from '../../../hooks/use_link_props'; +import { decodeOrThrow } from '../../../../common/runtime_types'; const UPTIME_FIELDS = ['container.id', 'host.ip', 'kubernetes.pod.uid']; export const LogEntryActionsMenu: React.FunctionComponent<{ logItem: LogEntriesItem; }> = ({ logItem }) => { - const prependBasePath = useKibana().services.http?.basePath?.prepend; const { hide, isVisible, show } = useVisibilityState(false); - const uptimeLink = useMemo(() => { - const link = getUptimeLink(logItem); - return prependBasePath && link ? prependBasePath(link) : link; - }, [logItem, prependBasePath]); + const apmLinkDescriptor = useMemo(() => getAPMLink(logItem), [logItem]); + const uptimeLinkDescriptor = useMemo(() => getUptimeLink(logItem), [logItem]); - const apmLink = useMemo(() => { - const link = getAPMLink(logItem); - return prependBasePath && link ? prependBasePath(link) : link; - }, [logItem, prependBasePath]); + const uptimeLinkProps = useLinkProps({ + app: 'uptime', + ...(uptimeLinkDescriptor ? uptimeLinkDescriptor : {}), + }); + + const apmLinkProps = useLinkProps({ + app: 'apm', + ...(apmLinkDescriptor ? apmLinkDescriptor : {}), + }); const menuItems = useMemo( () => [ , , ], - [apmLink, uptimeLink] + [uptimeLinkDescriptor, apmLinkDescriptor, apmLinkProps, uptimeLinkProps] ); const hasMenuItems = useMemo(() => menuItems.length > 0, [menuItems]); @@ -89,22 +92,32 @@ export const LogEntryActionsMenu: React.FunctionComponent<{ ); }; -const getUptimeLink = (logItem: LogEntriesItem) => { +const getUptimeLink = (logItem: LogEntriesItem): LinkDescriptor | undefined => { const searchExpressions = logItem.fields .filter(({ field, value }) => value != null && UPTIME_FIELDS.includes(field)) - .map(({ field, value }) => `${field}:${value}`); + .reduce((acc, fieldItem) => { + const { field, value } = fieldItem; + try { + const parsedValue = decodeOrThrow(rt.array(rt.string))(JSON.parse(value)); + return acc.concat(parsedValue.map(val => `${field}:${val}`)); + } catch (e) { + return acc.concat([`${field}:${value}`]); + } + }, []); if (searchExpressions.length === 0) { return undefined; } - - return url.format({ - pathname: '/app/uptime', - hash: `/?search=(${searchExpressions.join(' OR ')})`, - }); + return { + app: 'uptime', + hash: '/', + search: { + search: `${searchExpressions.join(' or ')}`, + }, + }; }; -const getAPMLink = (logItem: LogEntriesItem) => { +const getAPMLink = (logItem: LogEntriesItem): LinkDescriptor | undefined => { const traceIdEntry = logItem.fields.find( ({ field, value }) => value != null && field === 'trace.id' ); @@ -127,8 +140,8 @@ const getAPMLink = (logItem: LogEntriesItem) => { })() : { rangeFrom: 'now-1y', rangeTo: 'now' }; - return url.format({ - pathname: '/app/apm', + return { + app: 'apm', hash: getTraceUrl({ traceId: traceIdEntry.value, rangeFrom, rangeTo }), - }); + }; }; diff --git a/x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.test.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.test.tsx index 9c3319d467ae2..a23a2739a8e23 100644 --- a/x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.test.tsx +++ b/x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.test.tsx @@ -8,10 +8,11 @@ import React from 'react'; import { MetricsExplorerChartContextMenu, createNodeDetailLink, Props } from './chart_context_menu'; import { ReactWrapper, mount } from 'enzyme'; import { options, source, timeRange, chartOptions } from '../../utils/fixtures/metrics_explorer'; -import DateMath from '@elastic/datemath'; import { Capabilities } from 'src/core/public'; import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; +import { coreMock } from 'src/core/public/mocks'; +const coreStartMock = coreMock.createStart(); const series = { id: 'exmaple-01', rows: [], columns: [] }; const uiCapabilities: Capabilities = { navLinks: { show: false }, @@ -25,17 +26,8 @@ const getTestSubject = (component: ReactWrapper, name: string) => { }; const mountComponentWithProviders = (props: Props): ReactWrapper => { - const services = { - http: { - fetch: jest.fn(), - }, - application: { - getUrlForApp: jest.fn(), - }, - }; - return mount( - + ); @@ -159,10 +151,12 @@ describe('MetricsExplorerChartContextMenu', () => { test('createNodeDetailLink()', () => { const fromDateStrig = '2019-01-01T11:00:00Z'; const toDateStrig = '2019-01-01T12:00:00Z'; - const to = DateMath.parse(toDateStrig, { roundUp: true })!; - const from = DateMath.parse(fromDateStrig)!; const link = createNodeDetailLink('host', 'example-01', fromDateStrig, toDateStrig); - expect(link).toBe(`link-to/host-detail/example-01?to=${to.valueOf()}&from=${from.valueOf()}`); + expect(link).toStrictEqual({ + app: 'metrics', + pathname: 'link-to/host-detail/example-01', + search: { from: '1546340400000', to: '1546344000000' }, + }); }); }); }); diff --git a/x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx index f7c97033f8d50..c50550f1de56f 100644 --- a/x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx +++ b/x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx @@ -24,7 +24,7 @@ import { createTSVBLink } from './helpers/create_tsvb_link'; import { getNodeDetailUrl } from '../../pages/link_to/redirect_to_node_detail'; import { SourceConfiguration } from '../../utils/source_configuration'; import { InventoryItemType } from '../../../common/inventory_models/types'; -import { usePrefixPathWithBasepath } from '../../hooks/use_prefix_path_with_basepath'; +import { useLinkProps } from '../../hooks/use_link_props'; export interface Props { options: MetricsExplorerOptions; @@ -80,7 +80,6 @@ export const MetricsExplorerChartContextMenu: React.FC = ({ uiCapabilities, chartOptions, }: Props) => { - const urlPrefixer = usePrefixPathWithBasepath(); const [isPopoverOpen, setPopoverState] = useState(false); const supportFiltering = options.groupBy != null && onFilter != null; const handleFilter = useCallback(() => { @@ -92,8 +91,6 @@ export const MetricsExplorerChartContextMenu: React.FC = ({ setPopoverState(false); }, [supportFiltering, options.groupBy, series.id, onFilter]); - const tsvbUrl = createTSVBLink(source, options, series, timeRange, chartOptions); - // Only display the "Add Filter" option if it's supported const filterByItem = supportFiltering ? [ @@ -109,6 +106,13 @@ export const MetricsExplorerChartContextMenu: React.FC = ({ : []; const nodeType = source && options.groupBy && fieldToNodeType(source, options.groupBy); + const nodeDetailLinkProps = useLinkProps({ + app: 'metrics', + ...(nodeType ? createNodeDetailLink(nodeType, series.id, timeRange.from, timeRange.to) : {}), + }); + const tsvbLinkProps = useLinkProps({ + ...createTSVBLink(source, options, series, timeRange, chartOptions), + }); const viewNodeDetail = nodeType ? [ { @@ -117,10 +121,7 @@ export const MetricsExplorerChartContextMenu: React.FC = ({ values: { name: nodeType }, }), icon: 'metricsApp', - href: urlPrefixer( - 'metrics', - createNodeDetailLink(nodeType, series.id, timeRange.from, timeRange.to) - ), + ...(nodeType ? nodeDetailLinkProps : {}), 'data-test-subj': 'metricsExplorerAction-ViewNodeMetrics', }, ] @@ -132,7 +133,7 @@ export const MetricsExplorerChartContextMenu: React.FC = ({ name: i18n.translate('xpack.infra.metricsExplorer.openInTSVB', { defaultMessage: 'Open in Visualize', }), - href: tsvbUrl, + ...tsvbLinkProps, icon: 'visualizeApp', disabled: options.metrics.length === 0, 'data-test-subj': 'metricsExplorerAction-OpenInTSVB', diff --git a/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.test.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.test.ts index 111f6678081f7..05637642b8dd9 100644 --- a/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.test.ts +++ b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.test.ts @@ -22,9 +22,16 @@ const series = { id: 'example-01', rows: [], columns: [] }; describe('createTSVBLink()', () => { it('should just work', () => { const link = createTSVBLink(source, options, series, timeRange, chartOptions); - expect(link).toBe( - "../app/kibana#/visualize/create?type=metrics&_g=(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))&_a=(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:%236092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))" - ); + expect(link).toStrictEqual({ + app: 'kibana', + hash: '/visualize/create', + search: { + _a: + "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))", + _g: '(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))', + type: 'metrics', + }, + }); }); it('should work with rates', () => { @@ -33,16 +40,30 @@ describe('createTSVBLink()', () => { metrics: [{ aggregation: 'rate', field: 'system.network.out.bytes' }], }; const link = createTSVBLink(source, customOptions, series, timeRange, chartOptions); - expect(link).toBe( - "../app/kibana#/visualize/create?type=metrics&_g=(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))&_a=(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:%236092C0,fill:0,formatter:bytes,id:test-id,label:'rate(system.network.out.bytes)',line_width:2,metrics:!((field:system.network.out.bytes,id:test-id,type:max),(field:test-id,id:test-id,type:derivative,unit:'1s'),(field:test-id,id:test-id,type:positive_only)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}}/s)),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))" - ); + expect(link).toStrictEqual({ + app: 'kibana', + hash: '/visualize/create', + search: { + _a: + "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0,formatter:bytes,id:test-id,label:'rate(system.network.out.bytes)',line_width:2,metrics:!((field:system.network.out.bytes,id:test-id,type:max),(field:test-id,id:test-id,type:derivative,unit:'1s'),(field:test-id,id:test-id,type:positive_only)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}}/s)),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))", + _g: '(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))', + type: 'metrics', + }, + }); }); it('should work with time range', () => { const customTimeRange = { ...timeRange, from: 'now-10m', to: 'now' }; const link = createTSVBLink(source, options, series, customTimeRange, chartOptions); - expect(link).toBe( - "../app/kibana#/visualize/create?type=metrics&_g=(refreshInterval:(pause:!t,value:0),time:(from:now-10m,to:now))&_a=(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:%236092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))" - ); + expect(link).toStrictEqual({ + app: 'kibana', + hash: '/visualize/create', + search: { + _a: + "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))", + _g: '(refreshInterval:(pause:!t,value:0),time:(from:now-10m,to:now))', + type: 'metrics', + }, + }); }); it('should work with source', () => { const customSource = { @@ -51,9 +72,16 @@ describe('createTSVBLink()', () => { fields: { ...source.fields, timestamp: 'time' }, }; const link = createTSVBLink(customSource, options, series, timeRange, chartOptions); - expect(link).toBe( - "../app/kibana#/visualize/create?type=metrics&_g=(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))&_a=(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'my-beats-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'my-beats-*',interval:auto,series:!((axis_position:right,chart_type:line,color:%236092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:time,type:timeseries),title:example-01,type:metrics))" - ); + expect(link).toStrictEqual({ + app: 'kibana', + hash: '/visualize/create', + search: { + _a: + "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'my-beats-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'my-beats-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:time,type:timeseries),title:example-01,type:metrics))", + _g: '(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))', + type: 'metrics', + }, + }); }); it('should work with filterQuery', () => { const customSource = { @@ -63,25 +91,46 @@ describe('createTSVBLink()', () => { }; const customOptions = { ...options, filterQuery: 'system.network.name:lo*' }; const link = createTSVBLink(customSource, customOptions, series, timeRange, chartOptions); - expect(link).toBe( - "../app/kibana#/visualize/create?type=metrics&_g=(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))&_a=(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'my-beats-*',filter:(language:kuery,query:'system.network.name:lo* and host.name : \"example-01\"'),id:test-id,index_pattern:'my-beats-*',interval:auto,series:!((axis_position:right,chart_type:line,color:%236092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:time,type:timeseries),title:example-01,type:metrics))" - ); + expect(link).toStrictEqual({ + app: 'kibana', + hash: '/visualize/create', + search: { + _a: + "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'my-beats-*',filter:(language:kuery,query:'system.network.name:lo* and host.name : \"example-01\"'),id:test-id,index_pattern:'my-beats-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:time,type:timeseries),title:example-01,type:metrics))", + _g: '(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))', + type: 'metrics', + }, + }); }); it('should remove axis_min from link', () => { const customChartOptions = { ...chartOptions, yAxisMode: MetricsExplorerYAxisMode.auto }; const link = createTSVBLink(source, options, series, timeRange, customChartOptions); - expect(link).toBe( - "../app/kibana#/visualize/create?type=metrics&_g=(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))&_a=(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:%236092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))" - ); + expect(link).toStrictEqual({ + app: 'kibana', + hash: '/visualize/create', + search: { + _a: + "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))", + _g: '(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))', + type: 'metrics', + }, + }); }); it('should change series to area', () => { const customChartOptions = { ...chartOptions, type: MetricsExplorerChartType.area }; const link = createTSVBLink(source, options, series, timeRange, customChartOptions); - expect(link).toBe( - "../app/kibana#/visualize/create?type=metrics&_g=(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))&_a=(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:%236092C0,fill:0.5,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))" - ); + expect(link).toStrictEqual({ + app: 'kibana', + hash: '/visualize/create', + search: { + _a: + "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0.5,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))", + _g: '(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))', + type: 'metrics', + }, + }); }); it('should change series to area and stacked', () => { @@ -91,9 +140,16 @@ describe('createTSVBLink()', () => { stack: true, }; const link = createTSVBLink(source, options, series, timeRange, customChartOptions); - expect(link).toBe( - "../app/kibana#/visualize/create?type=metrics&_g=(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))&_a=(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:%236092C0,fill:0.5,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:stacked,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))" - ); + expect(link).toStrictEqual({ + app: 'kibana', + hash: '/visualize/create', + search: { + _a: + "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0.5,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:stacked,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))", + _g: '(refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))', + type: 'metrics', + }, + }); }); test('createFilterFromOptions()', () => { diff --git a/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts index cb23a96b9c163..20706f563ec63 100644 --- a/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts +++ b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts @@ -21,6 +21,7 @@ import { metricToFormat } from './metric_to_format'; import { InfraFormatterType } from '../../../lib/lib'; import { SourceQuery } from '../../../graphql/types'; import { createMetricLabel } from './create_metric_label'; +import { LinkDescriptor } from '../../../hooks/use_link_props'; export const metricsExplorerMetricToTSVBMetric = (metric: MetricsExplorerOptionsMetric) => { if (metric.aggregation === 'rate') { @@ -64,10 +65,9 @@ const mapMetricToSeries = (chartOptions: MetricsExplorerChartOptions) => ( label: createMetricLabel(metric), axis_position: 'right', chart_type: 'line', - color: encodeURIComponent( + color: (metric.color && colorTransformer(metric.color)) || - colorTransformer(MetricsExplorerColor.color0) - ), + colorTransformer(MetricsExplorerColor.color0), fill: chartOptions.type === MetricsExplorerChartType.area ? 0.5 : 0, formatter: format === InfraFormatterType.bits ? InfraFormatterType.bytes : format, value_template: 'rate' === metric.aggregation ? '{{value}}/s' : '{{value}}', @@ -102,7 +102,7 @@ export const createTSVBLink = ( series: MetricsExplorerSeries, timeRange: MetricsExplorerTimeOptions, chartOptions: MetricsExplorerChartOptions -) => { +): LinkDescriptor => { const appState = { filters: [], linked: false, @@ -139,7 +139,13 @@ export const createTSVBLink = ( time: { from: timeRange.from, to: timeRange.to }, }; - return `../app/kibana#/visualize/create?type=metrics&_g=${encode(globalState)}&_a=${encode( - appState as any - )}`; + return { + app: 'kibana', + hash: '/visualize/create', + search: { + type: 'metrics', + _g: encode(globalState), + _a: encode(appState as any), + }, + }; }; diff --git a/x-pack/plugins/infra/public/components/navigation/routed_tabs.tsx b/x-pack/plugins/infra/public/components/navigation/routed_tabs.tsx index 2838ac6cda6dd..d9ea44e2f1f6a 100644 --- a/x-pack/plugins/infra/public/components/navigation/routed_tabs.tsx +++ b/x-pack/plugins/infra/public/components/navigation/routed_tabs.tsx @@ -9,55 +9,51 @@ import React from 'react'; import { Route } from 'react-router-dom'; import { euiStyled } from '../../../../observability/public'; +import { useLinkProps } from '../../hooks/use_link_props'; +import { LinkDescriptor } from '../../hooks/use_link_props'; -interface TabConfiguration { +interface TabConfig { title: string | React.ReactNode; - path: string; } +type TabConfiguration = TabConfig & LinkDescriptor; + interface RoutedTabsProps { tabs: TabConfiguration[]; } const noop = () => {}; -export class RoutedTabs extends React.Component { - public render() { - return {this.renderTabs()}; - } - - private renderTabs() { - return this.props.tabs.map(tab => { - return ( - { - return ( - - {/* eslint-disable-next-line @elastic/eui/href-or-on-click */} - ) => { - e.preventDefault(); - history.push(tab.path); - }} - > - - {tab.title} - - - - ); - }} - /> - ); - }); - } -} +export const RoutedTabs = ({ tabs }: RoutedTabsProps) => { + return ( + + {tabs.map(tab => { + return ; + })} + + ); +}; + +const Tab = ({ title, pathname, app }: TabConfiguration) => { + const linkProps = useLinkProps({ app, pathname }); + return ( + { + return ( + + {/* eslint-disable-next-line @elastic/eui/href-or-on-click */} + + + {title} + + + + ); + }} + /> + ); +}; const TabContainer = euiStyled.div` .euiLink { diff --git a/x-pack/plugins/infra/public/components/source_configuration/view_source_configuration_button.tsx b/x-pack/plugins/infra/public/components/source_configuration/view_source_configuration_button.tsx index 9c3a40fb7ecf0..93cec8a1c7242 100644 --- a/x-pack/plugins/infra/public/components/source_configuration/view_source_configuration_button.tsx +++ b/x-pack/plugins/infra/public/components/source_configuration/view_source_configuration_button.tsx @@ -6,28 +6,23 @@ import { EuiButton } from '@elastic/eui'; import React from 'react'; -import { Route } from 'react-router-dom'; +import { useLinkProps } from '../../hooks/use_link_props'; interface ViewSourceConfigurationButtonProps { 'data-test-subj'?: string; children: React.ReactNode; + app: 'logs' | 'metrics'; } export const ViewSourceConfigurationButton = ({ 'data-test-subj': dataTestSubj, + app, children, }: ViewSourceConfigurationButtonProps) => { - const href = '/settings'; - + const linkProps = useLinkProps({ app, pathname: '/settings' }); return ( - ( - history.push(href)}> - {children} - - )} - /> + + {children} + ); }; diff --git a/x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.test.ts b/x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.test.ts index fb9791fae9b5e..18e5838a15b56 100644 --- a/x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.test.ts +++ b/x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.test.ts @@ -46,7 +46,11 @@ describe('createUptimeLink()', () => { avg: 0.6, }, }; - expect(createUptimeLink(options, 'host', node)).toBe('#/?search=host.ip:"10.0.1.2"'); + expect(createUptimeLink(options, 'host', node)).toStrictEqual({ + app: 'uptime', + hash: '/', + search: { search: 'host.ip:"10.0.1.2"' }, + }); }); it('should work for hosts without ip', () => { @@ -62,7 +66,11 @@ describe('createUptimeLink()', () => { avg: 0.6, }, }; - expect(createUptimeLink(options, 'host', node)).toBe('#/?search=host.name:"host-01"'); + expect(createUptimeLink(options, 'host', node)).toStrictEqual({ + app: 'uptime', + hash: '/', + search: { search: 'host.name:"host-01"' }, + }); }); it('should work for pods', () => { @@ -78,9 +86,11 @@ describe('createUptimeLink()', () => { avg: 0.6, }, }; - expect(createUptimeLink(options, 'pod', node)).toBe( - '#/?search=kubernetes.pod.uid:"29193-pod-02939"' - ); + expect(createUptimeLink(options, 'pod', node)).toStrictEqual({ + app: 'uptime', + hash: '/', + search: { search: 'kubernetes.pod.uid:"29193-pod-02939"' }, + }); }); it('should work for container', () => { @@ -96,8 +106,10 @@ describe('createUptimeLink()', () => { avg: 0.6, }, }; - expect(createUptimeLink(options, 'container', node)).toBe( - '#/?search=container.id:"docker-1234"' - ); + expect(createUptimeLink(options, 'container', node)).toStrictEqual({ + app: 'uptime', + hash: '/', + search: { search: 'container.id:"docker-1234"' }, + }); }); }); diff --git a/x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.ts b/x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.ts index 023a1a4b6ecef..72b46f4fb5c7b 100644 --- a/x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.ts +++ b/x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.ts @@ -7,15 +7,28 @@ import { get } from 'lodash'; import { InfraWaffleMapNode, InfraWaffleMapOptions } from '../../../lib/lib'; import { InventoryItemType } from '../../../../common/inventory_models/types'; +import { LinkDescriptor } from '../../../hooks/use_link_props'; export const createUptimeLink = ( options: InfraWaffleMapOptions, nodeType: InventoryItemType, node: InfraWaffleMapNode -) => { +): LinkDescriptor => { if (nodeType === 'host' && node.ip) { - return `#/?search=host.ip:"${node.ip}"`; + return { + app: 'uptime', + hash: '/', + search: { + search: `host.ip:"${node.ip}"`, + }, + }; } const field = get(options, ['fields', nodeType], ''); - return `#/?search=${field ? field + ':' : ''}"${node.id}"`; + return { + app: 'uptime', + hash: '/', + search: { + search: `${field ? field + ':' : ''}"${node.id}"`, + }, + }; }; diff --git a/x-pack/plugins/infra/public/components/waffle/node_context_menu.tsx b/x-pack/plugins/infra/public/components/waffle/node_context_menu.tsx index 43d27bb8259b3..cc6a94c8a41a2 100644 --- a/x-pack/plugins/infra/public/components/waffle/node_context_menu.tsx +++ b/x-pack/plugins/infra/public/components/waffle/node_context_menu.tsx @@ -24,7 +24,7 @@ import { SectionLinks, SectionLink, } from '../../../../observability/public'; -import { usePrefixPathWithBasepath } from '../../hooks/use_prefix_path_with_basepath'; +import { useLinkProps } from '../../hooks/use_link_props'; interface Props { options: InfraWaffleMapOptions; @@ -46,10 +46,9 @@ export const NodeContextMenu: React.FC = ({ nodeType, popoverPosition, }) => { - const urlPrefixer = usePrefixPathWithBasepath(); - const uiCapabilities = useKibana().services.application?.capabilities; const inventoryModel = findInventoryModel(nodeType); const nodeDetailFrom = currentTime - inventoryModel.metrics.defaultTimeRangeInSeconds * 1000; + const uiCapabilities = useKibana().services.application?.capabilities; // Due to the changing nature of the fields between APM and this UI, // We need to have some exceptions until 7.0 & ECS is finalized. Reference // #26620 for the details for these fields. @@ -81,19 +80,37 @@ export const NodeContextMenu: React.FC = ({ return { label: '', value: '' }; }, [nodeType, node.ip, node.id, options.fields]); + const nodeLogsMenuItemLinkProps = useLinkProps({ + app: 'logs', + ...getNodeLogsUrl({ + nodeType, + nodeId: node.id, + time: currentTime, + }), + }); + const nodeDetailMenuItemLinkProps = useLinkProps({ + ...getNodeDetailUrl({ + nodeType, + nodeId: node.id, + from: nodeDetailFrom, + to: currentTime, + }), + }); + const apmTracesMenuItemLinkProps = useLinkProps({ + app: 'apm', + hash: 'traces', + search: { + kuery: `${apmField}:"${node.id}"`, + }, + }); + const uptimeMenuItemLinkProps = useLinkProps(createUptimeLink(options, nodeType, node)); + const nodeLogsMenuItem: SectionLinkProps = { label: i18n.translate('xpack.infra.nodeContextMenu.viewLogsName', { defaultMessage: '{inventoryName} logs', values: { inventoryName: inventoryModel.singularDisplayName }, }), - href: urlPrefixer( - 'logs', - getNodeLogsUrl({ - nodeType, - nodeId: node.id, - time: currentTime, - }) - ), + ...nodeLogsMenuItemLinkProps, 'data-test-subj': 'viewLogsContextMenuItem', isDisabled: !showLogsLink, }; @@ -103,15 +120,7 @@ export const NodeContextMenu: React.FC = ({ defaultMessage: '{inventoryName} metrics', values: { inventoryName: inventoryModel.singularDisplayName }, }), - href: urlPrefixer( - 'metrics', - getNodeDetailUrl({ - nodeType, - nodeId: node.id, - from: nodeDetailFrom, - to: currentTime, - }) - ), + ...nodeDetailMenuItemLinkProps, isDisabled: !showDetail, }; @@ -120,7 +129,7 @@ export const NodeContextMenu: React.FC = ({ defaultMessage: '{inventoryName} APM traces', values: { inventoryName: inventoryModel.singularDisplayName }, }), - href: urlPrefixer('apm', `#traces?_g=()&kuery=${apmField}:"${node.id}"`), + ...apmTracesMenuItemLinkProps, 'data-test-subj': 'viewApmTracesContextMenuItem', isDisabled: !showAPMTraceLink, }; @@ -130,7 +139,7 @@ export const NodeContextMenu: React.FC = ({ defaultMessage: '{inventoryName} in Uptime', values: { inventoryName: inventoryModel.singularDisplayName }, }), - href: urlPrefixer('uptime', createUptimeLink(options, nodeType, node)), + ...uptimeMenuItemLinkProps, isDisabled: !showUptimeLink, }; @@ -163,28 +172,10 @@ export const NodeContextMenu: React.FC = ({ )} - - - - + + + + diff --git a/x-pack/plugins/infra/public/hooks/use_link_props.test.tsx b/x-pack/plugins/infra/public/hooks/use_link_props.test.tsx new file mode 100644 index 0000000000000..13e054de2dcf7 --- /dev/null +++ b/x-pack/plugins/infra/public/hooks/use_link_props.test.tsx @@ -0,0 +1,186 @@ +/* + * 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 { encode } from 'rison-node'; +import { createMemoryHistory, LocationDescriptorObject } from 'history'; +import { renderHook } from '@testing-library/react-hooks'; +import React from 'react'; +import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public'; +import { HistoryContext } from '../utils/history_context'; +import { coreMock } from 'src/core/public/mocks'; +import { useLinkProps, LinkDescriptor } from './use_link_props'; + +const PREFIX = '/test-basepath/s/test-space/app/'; + +const coreStartMock = coreMock.createStart(); + +coreStartMock.application.getUrlForApp.mockImplementation((app, options) => { + return `${PREFIX}${app}${options?.path}`; +}); + +const INTERNAL_APP = 'metrics'; + +// Note: Memory history doesn't support basename, +// we'll work around this by re-assigning 'createHref' so that +// it includes a basename, this then acts as our browserHistory instance would. +const history = createMemoryHistory(); +const originalCreateHref = history.createHref; +history.createHref = (location: LocationDescriptorObject): string => { + return `${PREFIX}${INTERNAL_APP}${originalCreateHref.call(history, location)}`; +}; + +const ProviderWrapper: React.FC = ({ children }) => { + return ( + + {children}; + + ); +}; + +const renderUseLinkPropsHook = (props?: Partial) => { + return renderHook(() => useLinkProps({ app: INTERNAL_APP, ...props }), { + wrapper: ProviderWrapper, + }); +}; +describe('useLinkProps hook', () => { + describe('Handles internal linking', () => { + it('Provides the correct baseline props', () => { + const { result } = renderUseLinkPropsHook({ pathname: '/' }); + expect(result.current.href).toBe('/test-basepath/s/test-space/app/metrics/'); + expect(result.current.onClick).toBeDefined(); + }); + + it('Provides the correct props with options', () => { + const { result } = renderUseLinkPropsHook({ + pathname: '/inventory', + search: { + type: 'host', + id: 'some-id', + count: '12345', + }, + }); + expect(result.current.href).toBe( + '/test-basepath/s/test-space/app/metrics/inventory?type=host&id=some-id&count=12345' + ); + expect(result.current.onClick).toBeDefined(); + }); + + it('Provides the correct props with more complex encoding', () => { + const { result } = renderUseLinkPropsHook({ + pathname: '/inventory', + search: { + type: 'host + host', + name: 'this name has spaces and ** and %', + id: 'some-id', + count: '12345', + animals: ['dog', 'cat', 'bear'], + }, + }); + expect(result.current.href).toBe( + '/test-basepath/s/test-space/app/metrics/inventory?type=host%20%2B%20host&name=this%20name%20has%20spaces%20and%20**%20and%20%25&id=some-id&count=12345&animals=dog,cat,bear' + ); + expect(result.current.onClick).toBeDefined(); + }); + + it('Provides the correct props with a consumer using Rison encoding for search', () => { + const state = { + refreshInterval: { pause: true, value: 0 }, + time: { from: 12345, to: 54321 }, + }; + const { result } = renderUseLinkPropsHook({ + pathname: '/inventory', + search: { + type: 'host + host', + state: encode(state), + }, + }); + expect(result.current.href).toBe( + '/test-basepath/s/test-space/app/metrics/inventory?type=host%20%2B%20host&state=(refreshInterval:(pause:!t,value:0),time:(from:12345,to:54321))' + ); + expect(result.current.onClick).toBeDefined(); + }); + }); + + describe('Handles external linking', () => { + it('Provides the correct baseline props', () => { + const { result } = renderUseLinkPropsHook({ + app: 'ml', + pathname: '/', + }); + expect(result.current.href).toBe('/test-basepath/s/test-space/app/ml/'); + expect(result.current.onClick).not.toBeDefined(); + }); + + it('Provides the correct props with pathname options', () => { + const { result } = renderUseLinkPropsHook({ + app: 'ml', + pathname: '/explorer', + search: { + type: 'host', + id: 'some-id', + count: '12345', + }, + }); + expect(result.current.href).toBe( + '/test-basepath/s/test-space/app/ml/explorer?type=host&id=some-id&count=12345' + ); + expect(result.current.onClick).not.toBeDefined(); + }); + + it('Provides the correct props with hash options', () => { + const { result } = renderUseLinkPropsHook({ + app: 'ml', + hash: '/explorer', + search: { + type: 'host', + id: 'some-id', + count: '12345', + }, + }); + expect(result.current.href).toBe( + '/test-basepath/s/test-space/app/ml#/explorer?type=host&id=some-id&count=12345' + ); + expect(result.current.onClick).not.toBeDefined(); + }); + + it('Provides the correct props with more complex encoding', () => { + const { result } = renderUseLinkPropsHook({ + app: 'ml', + hash: '/explorer', + search: { + type: 'host + host', + name: 'this name has spaces and ** and %', + id: 'some-id', + count: '12345', + animals: ['dog', 'cat', 'bear'], + }, + }); + expect(result.current.href).toBe( + '/test-basepath/s/test-space/app/ml#/explorer?type=host%20%2B%20host&name=this%20name%20has%20spaces%20and%20**%20and%20%25&id=some-id&count=12345&animals=dog,cat,bear' + ); + expect(result.current.onClick).not.toBeDefined(); + }); + + it('Provides the correct props with a consumer using Rison encoding for search', () => { + const state = { + refreshInterval: { pause: true, value: 0 }, + time: { from: 12345, to: 54321 }, + }; + const { result } = renderUseLinkPropsHook({ + app: 'rison-app', + hash: 'rison-route', + search: { + type: 'host + host', + state: encode(state), + }, + }); + expect(result.current.href).toBe( + '/test-basepath/s/test-space/app/rison-app#rison-route?type=host%20%2B%20host&state=(refreshInterval:(pause:!t,value:0),time:(from:12345,to:54321))' + ); + expect(result.current.onClick).not.toBeDefined(); + }); + }); +}); diff --git a/x-pack/plugins/infra/public/hooks/use_link_props.tsx b/x-pack/plugins/infra/public/hooks/use_link_props.tsx new file mode 100644 index 0000000000000..e60ab32046832 --- /dev/null +++ b/x-pack/plugins/infra/public/hooks/use_link_props.tsx @@ -0,0 +1,109 @@ +/* + * 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 { useMemo } from 'react'; +import { stringify } from 'query-string'; +import url from 'url'; +import { url as urlUtils } from '../../../../../src/plugins/kibana_utils/public'; +import { usePrefixPathWithBasepath } from './use_prefix_path_with_basepath'; +import { useHistory } from '../utils/history_context'; + +type Search = Record; + +export interface LinkDescriptor { + app: string; + pathname?: string; + hash?: string; + search?: Search; +} + +interface LinkProps { + href?: string; + onClick?: (e: React.MouseEvent | React.MouseEvent) => void; +} + +export const useLinkProps = ({ app, pathname, hash, search }: LinkDescriptor): LinkProps => { + validateParams({ app, pathname, hash, search }); + + const history = useHistory(); + const prefixer = usePrefixPathWithBasepath(); + + const encodedSearch = useMemo(() => { + return search ? encodeSearch(search) : undefined; + }, [search]); + + const internalLinkResult = useMemo(() => { + // When the logs / metrics apps are first mounted a history instance is setup with a 'basename' equal to the + // 'appBasePath' received from Core's 'AppMountParams', e.g. /BASE_PATH/s/SPACE_ID/app/APP_ID. With internal + // linking we are using 'createHref' and 'push' on top of this history instance. So a pathname of /inventory used within + // the metrics app will ultimatey end up as /BASE_PATH/s/SPACE_ID/app/metrics/inventory. React-router responds to this + // as it is instantiated with the same history instance. + return history?.createHref({ + pathname: pathname ? formatPathname(pathname) : undefined, + search: encodedSearch, + }); + }, [history, pathname, encodedSearch]); + + const externalLinkResult = useMemo(() => { + // The URI spec defines that the query should appear before the fragment + // https://tools.ietf.org/html/rfc3986#section-3 (e.g. url.format()). However, in Kibana, apps that use + // hash based routing expect the query to be part of the hash. This will handle that. + const mergedHash = hash && encodedSearch ? `${hash}?${encodedSearch}` : hash; + + const link = url.format({ + pathname, + hash: mergedHash, + search: !hash ? encodedSearch : undefined, + }); + + return prefixer(app, link); + }, [hash, encodedSearch, pathname, prefixer, app]); + + const onClick = useMemo(() => { + // If these results are equal we know we're trying to navigate within the same application + // that the current history instance is representing + if (internalLinkResult && linksAreEquivalent(externalLinkResult, internalLinkResult)) { + return (e: React.MouseEvent | React.MouseEvent) => { + e.preventDefault(); + if (history) { + history.push({ + pathname: pathname ? formatPathname(pathname) : undefined, + search: encodedSearch, + }); + } + }; + } else { + return undefined; + } + }, [internalLinkResult, externalLinkResult, history, pathname, encodedSearch]); + + return { + href: externalLinkResult, + onClick, + }; +}; + +const encodeSearch = (search: Search) => { + return stringify(urlUtils.encodeQuery(search), { sort: false, encode: false }); +}; + +const formatPathname = (pathname: string) => { + return pathname[0] === '/' ? pathname : `/${pathname}`; +}; + +const validateParams = ({ app, pathname, hash, search }: LinkDescriptor) => { + if (!app && hash) { + throw new Error( + 'The metrics and logs apps use browserHistory. Please provide a pathname rather than a hash.' + ); + } +}; + +const linksAreEquivalent = (externalLink: string, internalLink: string): boolean => { + // Compares with trailing slashes removed. This handles the case where the pathname is '/' + // and 'createHref' will include the '/' but Kibana's 'getUrlForApp' will remove it. + return externalLink.replace(/\/$/, '') === internalLink.replace(/\/$/, ''); +}; diff --git a/x-pack/plugins/infra/public/pages/infrastructure/index.tsx b/x-pack/plugins/infra/public/pages/infrastructure/index.tsx index 2271147c9d088..b4ff7aeff696c 100644 --- a/x-pack/plugins/infra/public/pages/infrastructure/index.tsx +++ b/x-pack/plugins/infra/public/pages/infrastructure/index.tsx @@ -62,22 +62,25 @@ export const InfrastructurePage = ({ match }: RouteComponentProps) => { diff --git a/x-pack/plugins/infra/public/pages/infrastructure/snapshot/index.tsx b/x-pack/plugins/infra/public/pages/infrastructure/snapshot/index.tsx index ba0e9b436e4e7..dbb8b2d8e2952 100644 --- a/x-pack/plugins/infra/public/pages/infrastructure/snapshot/index.tsx +++ b/x-pack/plugins/infra/public/pages/infrastructure/snapshot/index.tsx @@ -6,7 +6,6 @@ import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { identity } from 'fp-ts/lib/function'; import React, { useContext } from 'react'; import { SnapshotPageContent } from './page_content'; @@ -25,6 +24,7 @@ import { WithWaffleOptionsUrlState } from '../../../containers/waffle/with_waffl import { WithWaffleTimeUrlState } from '../../../containers/waffle/with_waffle_time'; import { useTrackPageview } from '../../../../../observability/public'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +import { useLinkProps } from '../../../hooks/use_link_props'; export const SnapshotPage = () => { const uiCapabilities = useKibana().services.application?.capabilities; @@ -39,7 +39,10 @@ export const SnapshotPage = () => { useTrackPageview({ app: 'infra_metrics', path: 'inventory' }); useTrackPageview({ app: 'infra_metrics', path: 'inventory', delay: 15000 }); - const prependBasePath = useKibana().services.http?.basePath.prepend ?? identity; + const tutorialLinkProps = useLinkProps({ + app: 'kibana', + hash: '/home/tutorial_directory/metrics', + }); return ( @@ -77,7 +80,7 @@ export const SnapshotPage = () => { { {uiCapabilities?.infrastructure?.configureSource ? ( - + {i18n.translate('xpack.infra.configureSourceActionLabel', { defaultMessage: 'Change source configuration', })} diff --git a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_detail.tsx b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_detail.tsx index 55dd15158b96f..9eae632756a3f 100644 --- a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_detail.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_detail.tsx @@ -10,6 +10,7 @@ import { Redirect, RouteComponentProps } from 'react-router-dom'; import { replaceMetricTimeInQueryString } from '../metrics/containers/with_metrics_time'; import { getFromFromLocation, getToFromLocation } from './query_params'; import { InventoryItemType } from '../../../common/inventory_models/types'; +import { LinkDescriptor } from '../../hooks/use_link_props'; type RedirectToNodeDetailProps = RouteComponentProps<{ nodeId: string; @@ -40,7 +41,16 @@ export const getNodeDetailUrl = ({ nodeId: string; to?: number; from?: number; -}) => { - const args = to && from ? `?to=${to}&from=${from}` : ''; - return `link-to/${nodeType}-detail/${nodeId}${args}`; +}): LinkDescriptor => { + return { + app: 'metrics', + pathname: `link-to/${nodeType}-detail/${nodeId}`, + search: + to && from + ? { + to: `${to}`, + from: `${from}`, + } + : undefined, + }; }; diff --git a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx index 9c998085400ca..d9aaa2da7bbc8 100644 --- a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx @@ -19,6 +19,7 @@ import { getFilterFromLocation, getTimeFromLocation } from './query_params'; import { useSource } from '../../containers/source/source'; import { findInventoryFields } from '../../../common/inventory_models'; import { InventoryItemType } from '../../../common/inventory_models/types'; +import { LinkDescriptor } from '../../hooks/use_link_props'; type RedirectToNodeLogsType = RouteComponentProps<{ nodeId: string; @@ -81,6 +82,14 @@ export const getNodeLogsUrl = ({ nodeId: string; nodeType: InventoryItemType; time?: number; -}) => { - return [`link-to/${nodeType}-logs/`, nodeId, ...(time ? [`?time=${time}`] : [])].join(''); +}): LinkDescriptor => { + return { + app: 'logs', + pathname: `link-to/${nodeType}-logs/${nodeId}`, + search: time + ? { + time: `${time}`, + } + : undefined, + }; }; diff --git a/x-pack/plugins/infra/public/pages/logs/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/page_content.tsx index 48ead15b2a232..3ead026b10065 100644 --- a/x-pack/plugins/infra/public/pages/logs/page_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/page_content.tsx @@ -31,23 +31,27 @@ export const LogsPageContent: React.FunctionComponent = () => { const logAnalysisCapabilities = useLogAnalysisCapabilitiesContext(); const streamTab = { + app: 'logs', title: streamTabTitle, - path: '/stream', + pathname: '/stream', }; const logRateTab = { + app: 'logs', title: logRateTabTitle, - path: '/log-rate', + pathname: '/log-rate', }; const logCategoriesTab = { + app: 'logs', title: logCategoriesTabTitle, - path: '/log-categories', + pathname: '/log-categories', }; const settingsTab = { + app: 'logs', title: settingsTabTitle, - path: '/settings', + pathname: '/settings', }; return ( @@ -85,11 +89,11 @@ export const LogsPageContent: React.FunctionComponent = () => { - - - - - + + + + + )} diff --git a/x-pack/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx index 739bad5689a96..7a84e67e8fc3d 100644 --- a/x-pack/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx @@ -6,20 +6,24 @@ import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { identity } from 'fp-ts/lib/function'; import React from 'react'; import { NoIndices } from '../../../components/empty_states/no_indices'; import { ViewSourceConfigurationButton } from '../../../components/source_configuration'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +import { useLinkProps } from '../../../hooks/use_link_props'; export const LogsPageNoIndicesContent = () => { const { - services: { application, http }, + services: { application }, } = useKibana<{}>(); const canConfigureSource = application?.capabilities?.logs?.configureSource ? true : false; - const prependBasePath = http?.basePath.prepend ?? identity; + + const tutorialLinkProps = useLinkProps({ + app: 'kibana', + hash: '/home/tutorial_directory/logging', + }); return ( { { {canConfigureSource ? ( - + {i18n.translate('xpack.infra.configureSourceActionLabel', { defaultMessage: 'Change source configuration', })} diff --git a/x-pack/plugins/infra/public/pages/metrics/components/invalid_node.tsx b/x-pack/plugins/infra/public/pages/metrics/components/invalid_node.tsx index 43f684cd5a585..b089e2237c2e5 100644 --- a/x-pack/plugins/infra/public/pages/metrics/components/invalid_node.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/components/invalid_node.tsx @@ -6,19 +6,20 @@ import { EuiButton, EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { identity } from 'fp-ts/lib/function'; import React from 'react'; - import { euiStyled } from '../../../../../observability/public'; import { ViewSourceConfigurationButton } from '../../../components/source_configuration'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +import { useLinkProps } from '../../../hooks/use_link_props'; interface InvalidNodeErrorProps { nodeName: string; } export const InvalidNodeError: React.FunctionComponent = ({ nodeName }) => { - const prependBasePath = useKibana().services.http?.basePath.prepend ?? identity; + const tutorialLinkProps = useLinkProps({ + app: 'kibana', + hash: '/home/tutorial_directory/metrics', + }); return ( = actions={ - + = - + Date: Tue, 10 Mar 2020 12:45:46 +0100 Subject: [PATCH 06/23] [Console] Remove unused code (#59554) * Remove unused code * fix: remove use of undeclared variable Co-authored-by: Elastic Machine --- src/plugins/console/public/application/index.tsx | 8 +------- .../models/sense_editor/sense_editor.test.mocks.ts | 3 --- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/plugins/console/public/application/index.tsx b/src/plugins/console/public/application/index.tsx index 1fef52da6f31b..051eaea27a7de 100644 --- a/src/plugins/console/public/application/index.tsx +++ b/src/plugins/console/public/application/index.tsx @@ -22,16 +22,11 @@ import { render, unmountComponentAtNode } from 'react-dom'; import { NotificationsSetup } from 'src/core/public'; import { ServicesContextProvider, EditorContextProvider, RequestContextProvider } from './contexts'; import { Main } from './containers'; -import { createStorage, createHistory, createSettings, Settings } from '../services'; +import { createStorage, createHistory, createSettings } from '../services'; import * as localStorageObjectClient from '../lib/local_storage_object_client'; import { createUsageTracker } from '../services/tracker'; import { UsageCollectionSetup } from '../../../usage_collection/public'; -let settingsRef: Settings; -export function legacyBackDoorToSettings() { - return settingsRef; -} - export interface BootDependencies { docLinkVersion: string; I18nContext: any; @@ -59,7 +54,6 @@ export function renderApp({ const history = createHistory({ storage }); const settings = createSettings({ storage }); const objectStorageClient = localStorageObjectClient.create(storage); - settingsRef = settings; render( diff --git a/src/plugins/console/public/application/models/sense_editor/sense_editor.test.mocks.ts b/src/plugins/console/public/application/models/sense_editor/sense_editor.test.mocks.ts index 8df9bb8ef9a0b..76556fd0e1880 100644 --- a/src/plugins/console/public/application/models/sense_editor/sense_editor.test.mocks.ts +++ b/src/plugins/console/public/application/models/sense_editor/sense_editor.test.mocks.ts @@ -20,9 +20,6 @@ import '../legacy_core_editor/legacy_core_editor.test.mocks'; -// TODO: Remove this mock -jest.mock('../../../application', () => ({ legacyBackDoorToSettings: () => {} })); - import jQuery from 'jquery'; jest.spyOn(jQuery, 'ajax').mockImplementation( () => From 8a3e9c6b32ca5bcd4fc6c5fc5b0addfae898aeae Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Tue, 10 Mar 2020 13:16:58 +0100 Subject: [PATCH 07/23] [Unit Testing] Configure react-testing-library queries to use Kibana's data-test-subj instead of default data-testid (#59445) --- src/dev/jest/config.js | 5 ++- src/dev/jest/setup/react_testing_library.js | 32 +++++++++++++++++ x-pack/dev-tools/jest/create_jest_config.js | 1 + x-pack/dev-tools/jest/setup/setup_test.js | 1 - .../components/shared/KeyValueTable/index.tsx | 4 +-- .../custom_selection_table.js | 4 +-- .../analytics_list/action_delete.test.tsx | 15 ++++---- .../__snapshots__/calendar_form.test.js.snap | 2 +- .../edit/calendar_form/calendar_form.js | 2 +- .../__snapshots__/events_table.test.js.snap | 4 +-- .../edit/events_table/events_table.js | 6 ++-- .../edit/import_modal/import_modal.test.js | 2 +- .../calendars/edit/new_calendar.test.js | 6 ++-- .../ml/public/application/util/test_utils.ts | 18 ---------- .../endpoint/components/header_nav.tsx | 1 - .../endpoint/view/alerts/index.test.tsx | 34 +++---------------- .../endpoint/view/alerts/index.tsx | 7 ++-- .../endpoint/view/alerts/resolver.tsx | 2 +- .../endpoint/view/managing/index.test.tsx | 24 +++---------- .../resolver/view/use_camera.test.tsx | 2 +- 20 files changed, 72 insertions(+), 100 deletions(-) create mode 100644 src/dev/jest/setup/react_testing_library.js delete mode 100644 x-pack/legacy/plugins/ml/public/application/util/test_utils.ts diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js index 807a3fbf4782b..e54384be7323f 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -68,7 +68,10 @@ export default { '/src/dev/jest/setup/polyfills.js', '/src/dev/jest/setup/enzyme.js', ], - setupFilesAfterEnv: ['/src/dev/jest/setup/mocks.js'], + setupFilesAfterEnv: [ + '/src/dev/jest/setup/mocks.js', + '/src/dev/jest/setup/react_testing_library.js', + ], coverageDirectory: '/target/kibana-coverage/jest', coverageReporters: !!process.env.CODE_COVERAGE ? ['json'] : ['html', 'text'], moduleFileExtensions: ['js', 'json', 'ts', 'tsx'], diff --git a/src/dev/jest/setup/react_testing_library.js b/src/dev/jest/setup/react_testing_library.js new file mode 100644 index 0000000000000..879292b540ba6 --- /dev/null +++ b/src/dev/jest/setup/react_testing_library.js @@ -0,0 +1,32 @@ +/* + * 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 '@testing-library/jest-dom/extend-expect'; +/** + * Have to import "/pure" here to not register afterEach() hook clean up + * in the very beginning. There are couple tests which fail with clean up hook. + * On CI they run before first test which imports '@testing-library/react' + * and registers afterEach hook so the whole suite is passing. + * This have to be fixed as we depend on test order execution + * https://github.com/elastic/kibana/issues/59469 + */ +import { configure } from '@testing-library/react/pure'; + +// instead of default 'data-testid', use kibana's 'data-test-subj' +configure({ testIdAttribute: 'data-test-subj' }); diff --git a/x-pack/dev-tools/jest/create_jest_config.js b/x-pack/dev-tools/jest/create_jest_config.js index 2d8a0be7a416f..6d15072f720c1 100644 --- a/x-pack/dev-tools/jest/create_jest_config.js +++ b/x-pack/dev-tools/jest/create_jest_config.js @@ -40,6 +40,7 @@ export function createJestConfig({ kibanaDirectory, xPackKibanaDirectory }) { setupFilesAfterEnv: [ `/dev-tools/jest/setup/setup_test.js`, `${kibanaDirectory}/src/dev/jest/setup/mocks.js`, + `${kibanaDirectory}/src/dev/jest/setup/react_testing_library.js`, ], testMatch: ['**/*.test.{js,ts,tsx}'], transform: { diff --git a/x-pack/dev-tools/jest/setup/setup_test.js b/x-pack/dev-tools/jest/setup/setup_test.js index f54be89f30955..533ea58a561ac 100644 --- a/x-pack/dev-tools/jest/setup/setup_test.js +++ b/x-pack/dev-tools/jest/setup/setup_test.js @@ -10,4 +10,3 @@ */ import 'jest-styled-components'; -import '@testing-library/jest-dom/extend-expect'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/KeyValueTable/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/KeyValueTable/index.tsx index b58f142f1abaa..e8ed39bf9ac33 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/KeyValueTable/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/KeyValueTable/index.tsx @@ -28,9 +28,9 @@ export function KeyValueTable({ {keyValuePairs.map(({ key, value }) => ( - {key} + {key} - + diff --git a/x-pack/legacy/plugins/ml/public/application/components/job_selector/custom_selection_table/custom_selection_table.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/custom_selection_table/custom_selection_table.js index c6667ef1df55e..a7edb7184df00 100644 --- a/x-pack/legacy/plugins/ml/public/application/components/job_selector/custom_selection_table/custom_selection_table.js +++ b/x-pack/legacy/plugins/ml/public/application/components/job_selector/custom_selection_table/custom_selection_table.js @@ -256,7 +256,7 @@ export function CustomSelectionTable({ {!singleSelection && ( toggleItem(item.id)} type="inList" @@ -265,7 +265,7 @@ export function CustomSelectionTable({ {singleSelection && ( toggleItem(item.id)} disabled={timeseriesOnly && item.isSingleMetricViewerJob === false} diff --git a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/action_delete.test.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/action_delete.test.tsx index 08cc54ec39c6f..6d1db5033863b 100644 --- a/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/action_delete.test.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/action_delete.test.tsx @@ -8,7 +8,6 @@ import React from 'react'; import { render } from '@testing-library/react'; import * as CheckPrivilige from '../../../../../privilege/check_privilege'; -import { queryByTestSubj } from '../../../../../util/test_utils'; import { DeleteAction } from './action_delete'; @@ -21,24 +20,22 @@ jest.mock('../../../../../privilege/check_privilege', () => ({ describe('DeleteAction', () => { test('When canDeleteDataFrameAnalytics permission is false, button should be disabled.', () => { - const { container } = render(); - expect(queryByTestSubj(container, 'mlAnalyticsJobDeleteButton')).toHaveAttribute('disabled'); + const { getByTestId } = render(); + expect(getByTestId('mlAnalyticsJobDeleteButton')).toHaveAttribute('disabled'); }); test('When canDeleteDataFrameAnalytics permission is true, button should not be disabled.', () => { const mock = jest.spyOn(CheckPrivilige, 'checkPermission'); mock.mockImplementation(p => p === 'canDeleteDataFrameAnalytics'); - const { container } = render(); + const { getByTestId } = render(); - expect(queryByTestSubj(container, 'mlAnalyticsJobDeleteButton')).not.toHaveAttribute( - 'disabled' - ); + expect(getByTestId('mlAnalyticsJobDeleteButton')).not.toHaveAttribute('disabled'); mock.mockRestore(); }); test('When job is running, delete button should be disabled.', () => { - const { container } = render( + const { getByTestId } = render( { /> ); - expect(queryByTestSubj(container, 'mlAnalyticsJobDeleteButton')).toHaveAttribute('disabled'); + expect(getByTestId('mlAnalyticsJobDeleteButton')).toHaveAttribute('disabled'); }); }); diff --git a/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/calendar_form/__snapshots__/calendar_form.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/calendar_form/__snapshots__/calendar_form.test.js.snap index acce01f1994db..e5026778fec1c 100644 --- a/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/calendar_form/__snapshots__/calendar_form.test.js.snap +++ b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/calendar_form/__snapshots__/calendar_form.test.js.snap @@ -149,7 +149,7 @@ exports[`CalendarForm Renders calendar form 1`] = ` grow={false} > , ( { onDeleteClick(event.event_id); @@ -106,7 +106,7 @@ export const EventsTable = ({ { instance.setState(testState); wrapper.update(); expect(wrapper.state('selectedEvents').length).toBe(2); - const deleteButton = wrapper.find('[data-testid="event_delete"]'); + const deleteButton = wrapper.find('[data-test-subj="event_delete"]'); const button = deleteButton.find('EuiButtonEmpty').first(); button.simulate('click'); diff --git a/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js index 5f61ccf47e9d7..f9f236496904d 100644 --- a/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js +++ b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js @@ -117,7 +117,7 @@ describe('NewCalendar', () => { test('Import modal shown on Import Events button click', () => { const wrapper = mountWithIntl(); - const importButton = wrapper.find('[data-testid="ml_import_events"]'); + const importButton = wrapper.find('[data-test-subj="ml_import_events"]'); const button = importButton.find('EuiButton'); button.simulate('click'); @@ -127,7 +127,7 @@ describe('NewCalendar', () => { test('New event modal shown on New event button click', () => { const wrapper = mountWithIntl(); - const importButton = wrapper.find('[data-testid="ml_new_event"]'); + const importButton = wrapper.find('[data-test-subj="ml_new_event"]'); const button = importButton.find('EuiButton'); button.simulate('click'); @@ -154,7 +154,7 @@ describe('NewCalendar', () => { const wrapper = mountWithIntl(); - const buttons = wrapper.find('[data-testid="ml_save_calendar_button"]'); + const buttons = wrapper.find('[data-test-subj="ml_save_calendar_button"]'); const saveButton = buttons.find('EuiButton'); expect(saveButton.prop('isDisabled')).toBe(true); diff --git a/x-pack/legacy/plugins/ml/public/application/util/test_utils.ts b/x-pack/legacy/plugins/ml/public/application/util/test_utils.ts deleted file mode 100644 index 5c020840182e5..0000000000000 --- a/x-pack/legacy/plugins/ml/public/application/util/test_utils.ts +++ /dev/null @@ -1,18 +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 { queryHelpers } from '@testing-library/react'; - -/** - * 'react-testing-library provides 'queryByTestId()' to get - * elements with a 'data-testid' attribut. This custom method - * supports querying for the Kibana style 'data-test-subj' attribute. - * @param {HTMLElement} container The wrapping HTML element. - * @param {Matcher} id The 'data-test-subj' id. - * @returns {HTMLElement | null} - */ - -export const queryByTestSubj = queryHelpers.queryByAttribute.bind(null, 'data-test-subj'); diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/components/header_nav.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/components/header_nav.tsx index 84570fe82ed44..f7d6551f9093b 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/components/header_nav.tsx +++ b/x-pack/plugins/endpoint/public/applications/endpoint/components/header_nav.tsx @@ -55,7 +55,6 @@ export const HeaderNavigation: React.FunctionComponent<{ basename: string }> = R return tabs.map((tab, index) => { return ( { let history: MemoryHistory; let store: ReturnType; - /** - * @testing-library/react provides `queryByTestId`, but that uses the data attribute - * 'data-testid' whereas our FTR and EUI's tests all use 'data-test-subj'. While @testing-library/react - * could be configured to use 'data-test-subj', it is not currently configured that way. - * - * This provides an equivalent function to `queryByTestId` but that uses our 'data-test-subj' attribute. - */ - let queryByTestSubjId: ( - renderResult: reactTestingLibrary.RenderResult, - testSubjId: string - ) => Promise; - beforeEach(async () => { /** * Create a 'history' instance that is only in-memory and causes no side effects to the testing environment. @@ -70,17 +58,6 @@ describe('when on the alerting page', () => { ); }; - queryByTestSubjId = async (renderResult, testSubjId) => { - return await waitForElement( - /** - * Use document.body instead of container because EUI renders things like popover out of the DOM heirarchy. - */ - () => document.body.querySelector(`[data-test-subj="${testSubjId}"]`), - { - container: renderResult.container, - } - ); - }; }); it('should show a data grid', async () => { await render().findByTestId('alertListGrid'); @@ -147,7 +124,7 @@ describe('when on the alerting page', () => { /** * Use our helper function to find the flyout's close button, as it uses a different test ID attribute. */ - const closeButton = await queryByTestSubjId(renderResult, 'euiFlyoutCloseButton'); + const closeButton = await renderResult.findByTestId('euiFlyoutCloseButton'); if (closeButton) { fireEvent.click(closeButton); } @@ -169,16 +146,13 @@ describe('when on the alerting page', () => { describe('when the user changes page size to 10', () => { beforeEach(async () => { const renderResult = render(); - const paginationButton = await queryByTestSubjId( - renderResult, - 'tablePaginationPopoverButton' - ); + const paginationButton = await renderResult.findByTestId('tablePaginationPopoverButton'); if (paginationButton) { act(() => { fireEvent.click(paginationButton); }); } - const show10RowsButton = await queryByTestSubjId(renderResult, 'tablePagination-10-rows'); + const show10RowsButton = await renderResult.findByTestId('tablePagination-10-rows'); if (show10RowsButton) { act(() => { fireEvent.click(show10RowsButton); diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/alerts/index.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/alerts/index.tsx index 5d405f8c6fbae..4cda2001de3c3 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/view/alerts/index.tsx +++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/alerts/index.tsx @@ -142,7 +142,7 @@ export const AlertIndex = memo(() => { if (columnId === 'alert_type') { return ( history.push(urlFromQueryParams({ ...queryParams, selected_alert: row.id })) } @@ -211,7 +211,7 @@ export const AlertIndex = memo(() => { return ( <> {hasSelectedAlert && ( - +

@@ -226,7 +226,7 @@ export const AlertIndex = memo(() => { )} - + @@ -250,7 +250,6 @@ export const AlertIndex = memo(() => { renderCellValue={renderCellValue} pagination={pagination} data-test-subj="alertListGrid" - data-testid="alertListGrid" /> diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/alerts/resolver.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/alerts/resolver.tsx index ec1dab45d50ab..52ef480bbb930 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/view/alerts/resolver.tsx +++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/alerts/resolver.tsx @@ -20,7 +20,7 @@ export const AlertDetailResolver = styled( const { store } = storeFactory(context); return ( -
+
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/managing/index.test.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/managing/index.test.tsx index 216e4df61b0dd..74742a0ea1ef8 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/view/managing/index.test.tsx +++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/managing/index.test.tsx @@ -22,11 +22,6 @@ describe('when on the managing page', () => { let history: MemoryHistory; let store: ReturnType; - let queryByTestSubjId: ( - renderResult: reactTestingLibrary.RenderResult, - testSubjId: string - ) => Promise; - beforeEach(async () => { history = createMemoryHistory(); store = appStoreFactory(coreMock.createStart(), true); @@ -43,20 +38,11 @@ describe('when on the managing page', () => { ); }; - - queryByTestSubjId = async (renderResult, testSubjId) => { - return await reactTestingLibrary.waitForElement( - () => document.body.querySelector(`[data-test-subj="${testSubjId}"]`), - { - container: renderResult.container, - } - ); - }; }); it('should show a table', async () => { const renderResult = render(); - const table = await queryByTestSubjId(renderResult, 'managementListTable'); + const table = await renderResult.findByTestId('managementListTable'); expect(table).not.toBeNull(); }); @@ -64,7 +50,7 @@ describe('when on the managing page', () => { it('should not show the flyout', () => { const renderResult = render(); expect.assertions(1); - return queryByTestSubjId(renderResult, 'managementDetailsFlyout').catch(e => { + return renderResult.findByTestId('managementDetailsFlyout').catch(e => { expect(e).not.toBeNull(); }); }); @@ -89,14 +75,14 @@ describe('when on the managing page', () => { let renderResult: reactTestingLibrary.RenderResult; beforeEach(async () => { renderResult = render(); - const detailsLink = await queryByTestSubjId(renderResult, 'hostnameCellLink'); + const detailsLink = await renderResult.findByTestId('hostnameCellLink'); if (detailsLink) { reactTestingLibrary.fireEvent.click(detailsLink); } }); it('should show the flyout', () => { - return queryByTestSubjId(renderResult, 'managementDetailsFlyout').then(flyout => { + return renderResult.findByTestId('managementDetailsFlyout').then(flyout => { expect(flyout).not.toBeNull(); }); }); @@ -115,7 +101,7 @@ describe('when on the managing page', () => { }); it('should show the flyout', () => { const renderResult = render(); - return queryByTestSubjId(renderResult, 'managementDetailsFlyout').then(flyout => { + return renderResult.findByTestId('managementDetailsFlyout').then(flyout => { expect(flyout).not.toBeNull(); }); }); diff --git a/x-pack/plugins/endpoint/public/embeddables/resolver/view/use_camera.test.tsx b/x-pack/plugins/endpoint/public/embeddables/resolver/view/use_camera.test.tsx index 1948c6cae505b..711e4f9a5c537 100644 --- a/x-pack/plugins/endpoint/public/embeddables/resolver/view/use_camera.test.tsx +++ b/x-pack/plugins/endpoint/public/embeddables/resolver/view/use_camera.test.tsx @@ -32,7 +32,7 @@ describe('useCamera on an unpainted element', () => { const camera = useCamera(); const { ref, onMouseDown } = camera; projectionMatrix = camera.projectionMatrix; - return
; + return
; }; simulator = sideEffectSimulator(); From 914df7996d59676ee1e3b934fd4f018bad1e187c Mon Sep 17 00:00:00 2001 From: Larry Gregory Date: Tue, 10 Mar 2020 08:19:14 -0400 Subject: [PATCH 08/23] Update misc dependencies (#59542) * update deps * updating to @hapi/good-squeeze * consolidate fast-safe-stringify deps Co-authored-by: Elastic Machine --- package.json | 6 +- src/legacy/server/logging/log_reporter.js | 2 +- yarn.lock | 205 +++++----------------- 3 files changed, 47 insertions(+), 166 deletions(-) diff --git a/package.json b/package.json index 7e9db2662a558..9f4d4450f459d 100644 --- a/package.json +++ b/package.json @@ -126,7 +126,8 @@ "@elastic/numeral": "2.4.0", "@elastic/request-crypto": "^1.0.2", "@elastic/ui-ace": "0.2.3", - "@hapi/wreck": "^15.0.1", + "@hapi/good-squeeze": "5.2.1", + "@hapi/wreck": "^15.0.2", "@kbn/analytics": "1.0.0", "@kbn/babel-code-parser": "1.0.0", "@kbn/babel-preset": "1.0.0", @@ -179,7 +180,6 @@ "glob": "^7.1.2", "glob-all": "^3.1.0", "globby": "^8.0.1", - "good-squeeze": "2.1.0", "h2o2": "^8.1.2", "handlebars": "4.5.3", "hapi": "^17.5.3", @@ -203,7 +203,7 @@ "leaflet-responsive-popup": "0.6.4", "leaflet-vega": "^0.8.6", "leaflet.heat": "0.2.0", - "less": "^2.7.3", + "less": "^3.0.2", "less-loader": "5.0.0", "lodash": "npm:@elastic/lodash@3.10.1-kibana4", "lodash.clonedeep": "^4.5.0", diff --git a/src/legacy/server/logging/log_reporter.js b/src/legacy/server/logging/log_reporter.js index b64f08c1cbbb6..6e62a5ee284e3 100644 --- a/src/legacy/server/logging/log_reporter.js +++ b/src/legacy/server/logging/log_reporter.js @@ -17,7 +17,7 @@ * under the License. */ -import { Squeeze } from 'good-squeeze'; +import { Squeeze } from '@hapi/good-squeeze'; import { createWriteStream as writeStr } from 'fs'; import LogFormatJson from './log_format_json'; diff --git a/yarn.lock b/yarn.lock index fbbd71dac7a7f..23a2e8e4718d9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2200,19 +2200,32 @@ resolved "https://registry.yarnpkg.com/@hapi/bourne/-/bourne-1.3.2.tgz#0a7095adea067243ce3283e1b56b8a8f453b242a" integrity sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA== +"@hapi/good-squeeze@5.2.1": + version "5.2.1" + resolved "https://registry.yarnpkg.com/@hapi/good-squeeze/-/good-squeeze-5.2.1.tgz#a7ed3f344c9602348af8f059beda663610ab8a4c" + integrity sha512-ZBiRgEDMtI5XowD0i4jgYD3wntN2JneY5EA1lUbSk9YoVIV9rWc77+6S0oqwfG0nj4xU/FjrXHvAahNEvRc6tg== + dependencies: + "@hapi/hoek" "8.x.x" + fast-safe-stringify "2.x.x" + "@hapi/hoek@6.x.x": version "6.2.1" resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-6.2.1.tgz#d3a66329159af879bfdf0b0cff2229c43c5a3451" integrity sha512-+ryw4GU9pjr1uT6lBuErHJg3NYqzwJTvZ75nKuJijEzpd00Uqi6oiawTGDDf5Hl0zWmI7qHfOtaqB0kpQZJQzA== -"@hapi/wreck@^15.0.1": - version "15.0.1" - resolved "https://registry.yarnpkg.com/@hapi/wreck/-/wreck-15.0.1.tgz#b9f881965a7e649a8fffe6de25ba41973ed28415" - integrity sha512-ByXQna/W1FZk7dg8NEhL79u4QkhzszRz76VpgyGstSH8bLM01a0C8RsxmUBgi6Tjkag5jA9kaEIhF9dLpMrtBw== +"@hapi/hoek@8.x.x": + version "8.5.1" + resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-8.5.1.tgz#fde96064ca446dec8c55a8c2f130957b070c6e06" + integrity sha512-yN7kbciD87WzLGc5539Tn0sApjyiGHAJgKvG9W8C7O+6c7qmoQMfVs0W4bX17eqz6C78QJqqFrtgdK5EWf6Qow== + +"@hapi/wreck@^15.0.2": + version "15.1.0" + resolved "https://registry.yarnpkg.com/@hapi/wreck/-/wreck-15.1.0.tgz#7917cd25950ce9b023f7fd2bea6e2ef72c71e59d" + integrity sha512-tQczYRTTeYBmvhsek/D49En/5khcShaBEmzrAaDjMrFXKJRuF8xA8+tlq1ETLBFwGd6Do6g2OC74rt11kzawzg== dependencies: "@hapi/boom" "7.x.x" "@hapi/bourne" "1.x.x" - "@hapi/hoek" "6.x.x" + "@hapi/hoek" "8.x.x" "@icons/material@^0.2.4": version "0.2.4" @@ -6044,7 +6057,7 @@ ajv-keywords@^3.4.1: resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da" integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ== -ajv@^4.7.0, ajv@^4.9.1: +ajv@^4.7.0: version "4.11.8" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" integrity sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY= @@ -6897,11 +6910,6 @@ assert-plus@1.0.0, assert-plus@^1.0.0: resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= -assert-plus@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" - integrity sha1-104bh+ev/A24qttwIfP+SBAasjQ= - assert@1.4.1, assert@^1.1.1: version "1.4.1" resolved "https://registry.yarnpkg.com/assert/-/assert-1.4.1.tgz#99912d591836b5a6f5b345c0f07eefc08fc65d91" @@ -7114,26 +7122,21 @@ await-event@^2.1.0: resolved "https://registry.yarnpkg.com/await-event/-/await-event-2.1.0.tgz#78e9f92684bae4022f9fa0b5f314a11550f9aa76" integrity sha1-eOn5JoS65AIvn6C18xShFVD5qnY= -aws-sign2@~0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" - integrity sha1-FDQt0428yU0OW4fXY81jYSwOeU8= - aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= -aws4@^1.2.1, aws4@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" - integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== - aws4@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" integrity sha1-g+9cqGCysy5KDe7e6MdxudtXRx4= +aws4@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" + integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== + axe-core@^3.4.1: version "3.5.1" resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-3.5.1.tgz#d8d5aaef73f003e8b766ea28bb078343f3622201" @@ -8029,13 +8032,6 @@ boolbase@^1.0.0, boolbase@~1.0.0: resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= -boom@2.x.x: - version "2.10.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" - integrity sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8= - dependencies: - hoek "2.x.x" - boom@4.x.x: version "4.3.1" resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" @@ -9394,7 +9390,7 @@ clone@^1.0.0, clone@^1.0.1, clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= -clone@^2.1.1: +clone@^2.1.1, clone@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= @@ -9590,7 +9586,7 @@ combine-lists@^1.0.0: dependencies: lodash "^4.5.0" -combined-stream@^1.0.5, combined-stream@^1.0.6, combined-stream@~1.0.5, combined-stream@~1.0.6: +combined-stream@^1.0.6, combined-stream@~1.0.5, combined-stream@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.7.tgz#2d1d24317afb8abe95d6d2c0b07b57813539d828" integrity sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w== @@ -10364,13 +10360,6 @@ crypt@~0.0.1: resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs= -cryptiles@2.x.x: - version "2.0.5" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" - integrity sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g= - dependencies: - boom "2.x.x" - cryptiles@3.x.x: version "3.1.4" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.4.tgz#769a68c95612b56faadfcebf57ac86479cbe8322" @@ -13384,7 +13373,7 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: assign-symbols "^1.0.0" is-extendable "^1.0.1" -extend@^3.0.0, extend@~3.0.0, extend@~3.0.1, extend@~3.0.2: +extend@^3.0.0, extend@~3.0.1, extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== @@ -13599,12 +13588,7 @@ fast-memoize@^2.5.1: resolved "https://registry.yarnpkg.com/fast-memoize/-/fast-memoize-2.5.1.tgz#c3519241e80552ce395e1a32dcdde8d1fd680f5d" integrity sha512-xdmw296PCL01tMOXx9mdJSmWY29jQgxyuZdq0rEHMu+Tpe1eOEtCycoG6chzlcrWsNgpZP7oL8RiQr7+G6Bl6g== -fast-safe-stringify@^2.0.4: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.6.tgz#04b26106cc56681f51a044cfc0d76cf0008ac2c2" - integrity sha512-q8BZ89jjc+mz08rSxROs8VsrBBcn1SIw1kq9NjolL509tkABRk9io01RAjSaEv1Xb2uFLt8VtRiZbGp5H8iDtg== - -fast-safe-stringify@^2.0.7: +fast-safe-stringify@2.x.x, fast-safe-stringify@^2.0.4, fast-safe-stringify@^2.0.7: version "2.0.7" resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743" integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA== @@ -14267,15 +14251,6 @@ form-data@^2.5.0: combined-stream "^1.0.6" mime-types "^2.1.12" -form-data@~2.1.1: - version "2.1.4" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1" - integrity sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE= - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.5" - mime-types "^2.1.12" - formidable@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.1.1.tgz#96b8886f7c3c3508b932d6bd70c4d3a88f35f1a9" @@ -15168,14 +15143,6 @@ good-listener@^1.2.2: dependencies: delegate "^3.1.2" -good-squeeze@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/good-squeeze/-/good-squeeze-2.1.0.tgz#99cee91d26d591698a899c28e9310bcf3c6ae28a" - integrity sha1-mc7pHSbVkWmKiZwo6TELzzxq4oo= - dependencies: - hoek "2.x.x" - json-stringify-safe "5.0.x" - got@5.6.0: version "5.6.0" resolved "https://registry.yarnpkg.com/got/-/got-5.6.0.tgz#bb1d7ee163b78082bbc8eb836f3f395004ea6fbf" @@ -15833,24 +15800,11 @@ hapi@^17.5.3: teamwork "3.x.x" topo "3.x.x" -har-schema@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" - integrity sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4= - har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= -har-validator@~4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" - integrity sha1-M0gdDxu/9gDdID11gSpqX7oALio= - dependencies: - ajv "^4.9.1" - har-schema "^1.0.5" - har-validator@~5.0.3: version "5.0.3" resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd" @@ -16046,16 +16000,6 @@ hat@0.0.3: resolved "https://registry.yarnpkg.com/hat/-/hat-0.0.3.tgz#bb014a9e64b3788aed8005917413d4ff3d502d8a" integrity sha1-uwFKnmSzeIrtgAWRdBPU/z1QLYo= -hawk@~3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" - integrity sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ= - dependencies: - boom "2.x.x" - cryptiles "2.x.x" - hoek "2.x.x" - sntp "1.x.x" - hawk@~6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" @@ -16144,11 +16088,6 @@ hmac-drbg@^1.0.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -hoek@2.x.x: - version "2.16.3" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" - integrity sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0= - hoek@4.x.x: version "4.2.1" resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb" @@ -16394,15 +16333,6 @@ http-request-to-url@^1.0.0: await-event "^2.1.0" socket-location "^1.0.0" -http-signature@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" - integrity sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8= - dependencies: - assert-plus "^0.2.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - http-signature@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" @@ -18599,7 +18529,7 @@ json-stringify-pretty-compact@1.2.0, json-stringify-pretty-compact@^1.0.1: resolved "https://registry.yarnpkg.com/json-stringify-pretty-compact/-/json-stringify-pretty-compact-1.2.0.tgz#0bc316b5e6831c07041fc35612487fb4e9ab98b8" integrity sha512-/11Pj1OyX814QMKO7K8l85SHPTr/KsFxHp8GE2zVa0BtJgGimDjXHfM3FhC7keQdWDea7+nXf+f1de7ATZcZkQ== -json-stringify-safe@5.0.1, json-stringify-safe@5.0.x, json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: +json-stringify-safe@5.0.1, json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= @@ -19159,19 +19089,22 @@ less-loader@5.0.0: loader-utils "^1.1.0" pify "^4.0.1" -less@^2.7.3: - version "2.7.3" - resolved "https://registry.yarnpkg.com/less/-/less-2.7.3.tgz#cc1260f51c900a9ec0d91fb6998139e02507b63b" - integrity sha512-KPdIJKWcEAb02TuJtaLrhue0krtRLoRoo7x6BNJIBelO00t/CCdJQUnHW5V34OnHMWzIktSalJxRO+FvytQlCQ== +less@^3.0.2: + version "3.11.1" + resolved "https://registry.yarnpkg.com/less/-/less-3.11.1.tgz#c6bf08e39e02404fe6b307a3dfffafdc55bd36e2" + integrity sha512-tlWX341RECuTOvoDIvtFqXsKj072hm3+9ymRBe76/mD6O5ZZecnlAOVDlWAleF2+aohFrxNidXhv2773f6kY7g== + dependencies: + clone "^2.1.2" + tslib "^1.10.0" optionalDependencies: errno "^0.1.1" graceful-fs "^4.1.2" image-size "~0.5.0" - mime "^1.2.11" + mime "^1.4.1" mkdirp "^0.5.0" promise "^7.1.1" - request "2.81.0" - source-map "^0.5.3" + request "^2.83.0" + source-map "~0.6.0" leven@^3.1.0: version "3.1.0" @@ -20509,11 +20442,6 @@ mime-db@1.x.x, mime-db@~1.37.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.37.0.tgz#0b6a0ce6fdbe9576e25f1f2d2fde8830dc0ad0d8" integrity sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg== -mime-db@~1.38.0: - version "1.38.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.38.0.tgz#1a2aab16da9eb167b49c6e4df2d9c68d63d8e2ad" - integrity sha512-bqVioMFFzc2awcdJZIzR3HjZFX20QhilVS7hytkKrv7xFAn8bM1gzc/FOX2awLISvWe0PV8ptFKcon+wZ5qYkg== - mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.18, mime-types@~2.1.19: version "2.1.21" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.21.tgz#28995aa1ecb770742fe6ae7e58f9181c744b3f96" @@ -20528,19 +20456,12 @@ mime-types@~2.1.24: dependencies: mime-db "1.40.0" -mime-types@~2.1.7: - version "2.1.22" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.22.tgz#fe6b355a190926ab7698c9a0556a11199b2199bd" - integrity sha512-aGl6TZGnhm/li6F7yx82bJiBZwgiEa4Hf6CNr8YO+r5UHr53tSTYZb102zyU50DOWWKeOv0uQLRL0/9EiKWCog== - dependencies: - mime-db "~1.38.0" - mime@1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" integrity sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ== -mime@1.6.0, mime@^1.2.11, mime@^1.3.4, mime@^1.4.1: +mime@1.6.0, mime@^1.3.4, mime@^1.4.1: version "1.6.0" resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== @@ -21784,7 +21705,7 @@ nyc@^14.1.1: yargs "^13.2.2" yargs-parser "^13.0.0" -oauth-sign@~0.8.1, oauth-sign@~0.8.2: +oauth-sign@~0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" integrity sha1-Rqarfwrq2N6unsBWV4C31O/rnUM= @@ -23876,11 +23797,6 @@ qs@^6.6.0: resolved "https://registry.yarnpkg.com/qs/-/qs-6.8.0.tgz#87b763f0d37ca54200334cd57bb2ef8f68a1d081" integrity sha512-tPSkj8y92PfZVbinY1n84i1Qdx75lZjMQYx9WZhnkofyxzw2r7Ho39G3/aEvSUdebxpnnM4LZJCtvE/Aq3+s9w== -qs@~6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" - integrity sha1-E+JtKK1rD/qpExLNO/cI7TUecjM= - query-string@6.10.1: version "6.10.1" resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.10.1.tgz#30b3505f6fca741d5ae541964d1b3ae9dc2a0de8" @@ -25714,34 +25630,6 @@ request-promise@^4.2.2: stealthy-require "^1.1.1" tough-cookie "^2.3.3" -request@2.81.0: - version "2.81.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" - integrity sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA= - dependencies: - aws-sign2 "~0.6.0" - aws4 "^1.2.1" - caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.0" - forever-agent "~0.6.1" - form-data "~2.1.1" - har-validator "~4.2.1" - hawk "~3.1.3" - http-signature "~1.1.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.7" - oauth-sign "~0.8.1" - performance-now "^0.2.0" - qs "~6.4.0" - safe-buffer "^5.0.1" - stringstream "~0.0.4" - tough-cookie "~2.3.0" - tunnel-agent "^0.6.0" - uuid "^3.0.0" - request@2.88.0, request@^2.88.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" @@ -27155,13 +27043,6 @@ snapdragon@^0.8.1: source-map-resolve "^0.5.0" use "^2.0.0" -sntp@1.x.x: - version "1.0.9" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" - integrity sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg= - dependencies: - hoek "2.x.x" - sntp@2.x.x: version "2.1.0" resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8" @@ -27973,7 +27854,7 @@ stringify-object@^3.2.1: is-obj "^1.0.1" is-regexp "^1.0.0" -stringstream@~0.0.4, stringstream@~0.0.5: +stringstream@~0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.6.tgz#7880225b0d4ad10e30927d167a1d6f2fd3b33a72" integrity sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA== @@ -29142,7 +29023,7 @@ tough-cookie@^3.0.1: psl "^1.1.28" punycode "^2.1.1" -tough-cookie@~2.3.0, tough-cookie@~2.3.3: +tough-cookie@~2.3.3: version "2.3.4" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655" integrity sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA== From e982bed7c6d19228ad244718b9955ed59e9cd654 Mon Sep 17 00:00:00 2001 From: Corey Robertson Date: Tue, 10 Mar 2020 09:11:58 -0400 Subject: [PATCH 09/23] Move canvas to use NP Expressions service (#58387) Co-authored-by: Elastic Machine --- .../kbn-interpreter/src/common/index.d.ts | 1 + .../src/common/lib/get_type.d.ts | 20 +++++ .../canvas/.storybook/webpack.config.js | 10 +-- .../functions/common/staticColumn.ts | 8 +- .../canvas/canvas_plugin_src/plugin.ts | 55 ++++++++++++ .../canvas/i18n/functions/dict/filters.ts | 5 +- .../plugins/canvas/i18n/functions/dict/to.ts | 4 +- x-pack/legacy/plugins/canvas/index.js | 6 +- .../plugins/canvas/public/application.tsx | 3 +- .../canvas/public/components/app/index.js | 53 ----------- .../datasource/datasource_preview/index.js | 2 +- .../components/element_content/index.js | 7 +- .../public/components/expression/index.js | 12 ++- .../components/function_form_list/index.js | 2 +- .../canvas/public/functions/filters.ts | 72 ++++++++------- .../plugins/canvas/public/functions/index.ts | 13 ++- .../plugins/canvas/public/functions/to.ts | 46 +++++----- .../public/interpreter_expression_types.ts | 12 --- x-pack/legacy/plugins/canvas/public/legacy.ts | 8 +- .../canvas/public/legacy_plugin_support.ts | 47 ++++++++++ ...ions.ts => legacy_register_interpreter.ts} | 5 ++ .../plugins/canvas/public/legacy_start.ts | 7 +- .../canvas/public/lib/monaco_language_def.ts | 7 +- .../canvas/public/lib/run_interpreter.js | 42 --------- .../canvas/public/lib/run_interpreter.ts | 87 ++++++++++++++++++ .../legacy/plugins/canvas/public/plugin.tsx | 86 ++++++++++++++++-- .../plugins/canvas/public/plugin_api.ts | 89 +++++++++++++++++++ .../plugins/canvas/public/registries.ts | 81 +++++++++++++++++ .../legacy/plugins/canvas/public/renderers.js | 12 --- .../canvas/public/state/actions/elements.js | 3 +- x-pack/legacy/plugins/canvas/server/plugin.ts | 5 +- .../legacy/plugins/canvas/types/functions.ts | 6 +- x-pack/plugins/canvas/kibana.json | 2 +- x-pack/plugins/canvas/server/plugin.ts | 7 +- .../canvas/server/setup_interpreter.ts | 12 +++ 35 files changed, 594 insertions(+), 243 deletions(-) create mode 100644 packages/kbn-interpreter/src/common/lib/get_type.d.ts create mode 100644 x-pack/legacy/plugins/canvas/canvas_plugin_src/plugin.ts delete mode 100644 x-pack/legacy/plugins/canvas/public/interpreter_expression_types.ts create mode 100644 x-pack/legacy/plugins/canvas/public/legacy_plugin_support.ts rename x-pack/legacy/plugins/canvas/public/{browser_functions.ts => legacy_register_interpreter.ts} (62%) delete mode 100644 x-pack/legacy/plugins/canvas/public/lib/run_interpreter.js create mode 100644 x-pack/legacy/plugins/canvas/public/lib/run_interpreter.ts create mode 100644 x-pack/legacy/plugins/canvas/public/plugin_api.ts create mode 100644 x-pack/legacy/plugins/canvas/public/registries.ts delete mode 100644 x-pack/legacy/plugins/canvas/public/renderers.js create mode 100644 x-pack/plugins/canvas/server/setup_interpreter.ts diff --git a/packages/kbn-interpreter/src/common/index.d.ts b/packages/kbn-interpreter/src/common/index.d.ts index bf03795d0a15c..ec6d1116b94cc 100644 --- a/packages/kbn-interpreter/src/common/index.d.ts +++ b/packages/kbn-interpreter/src/common/index.d.ts @@ -20,3 +20,4 @@ export { Registry } from './lib/registry'; export { fromExpression, toExpression, Ast, ExpressionFunctionAST } from './lib/ast'; +export { getType } from './lib/get_type'; diff --git a/packages/kbn-interpreter/src/common/lib/get_type.d.ts b/packages/kbn-interpreter/src/common/lib/get_type.d.ts new file mode 100644 index 0000000000000..db8592713abbf --- /dev/null +++ b/packages/kbn-interpreter/src/common/lib/get_type.d.ts @@ -0,0 +1,20 @@ +/* + * 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. + */ + +export declare function getType(node: any): string; diff --git a/x-pack/legacy/plugins/canvas/.storybook/webpack.config.js b/x-pack/legacy/plugins/canvas/.storybook/webpack.config.js index e566952eea86b..85cb6d45c595d 100644 --- a/x-pack/legacy/plugins/canvas/.storybook/webpack.config.js +++ b/x-pack/legacy/plugins/canvas/.storybook/webpack.config.js @@ -49,7 +49,7 @@ module.exports = async ({ config }) => { // Parse props data for .tsx files // This is notoriously slow, and is making Storybook unusable. Disabling for now. // See: https://github.com/storybookjs/storybook/issues/7998 - // + // // config.module.rules.push({ // test: /\.tsx$/, // // Exclude example files, as we don't display props info for them @@ -177,14 +177,6 @@ module.exports = async ({ config }) => { config.resolve.alias['ui/chrome'] = path.resolve(__dirname, '../tasks/mocks/uiChrome'); config.resolve.alias.ui = path.resolve(KIBANA_ROOT, 'src/legacy/ui/public'); config.resolve.alias.ng_mock$ = path.resolve(KIBANA_ROOT, 'src/test_utils/public/ng_mock'); - config.resolve.alias['plugins/interpreter/interpreter'] = path.resolve( - KIBANA_ROOT, - 'packages/kbn-interpreter/target/common' - ); - config.resolve.alias['plugins/interpreter/registries'] = path.resolve( - KIBANA_ROOT, - 'packages/kbn-interpreter/target/common/registries' - ); return config; }; diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/staticColumn.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/staticColumn.ts index 2354f2405de76..228d879c91a9c 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/staticColumn.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/staticColumn.ts @@ -6,7 +6,11 @@ // @ts-ignore untyped Elastic library import { getType } from '@kbn/interpreter/common'; -import { ExpressionFunctionDefinition, Datatable } from 'src/plugins/expressions/common'; +import { + ExpressionFunctionDefinition, + Datatable, + DatatableColumnType, +} from 'src/plugins/expressions/common'; import { getFunctionHelp } from '../../../i18n'; interface Arguments { @@ -42,7 +46,7 @@ export function staticColumn(): ExpressionFunctionDefinition< }, fn: (input, args) => { const rows = input.rows.map(row => ({ ...row, [args.name]: args.value })); - const type = getType(args.value); + const type = getType(args.value) as DatatableColumnType; const columns = [...input.columns]; const existingColumnIndex = columns.findIndex(({ name }) => name === args.name); const newColumn = { name: args.name, type }; diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/plugin.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/plugin.ts new file mode 100644 index 0000000000000..7cd1efe9e27c8 --- /dev/null +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/plugin.ts @@ -0,0 +1,55 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { CoreSetup, CoreStart, Plugin } from 'src/core/public'; +import { CanvasSetup } from '../public'; + +import { functions } from './functions/browser'; +import { typeFunctions } from './expression_types'; +// @ts-ignore: untyped local +import { renderFunctions } from './renderers'; + +import { elementSpecs } from './elements'; +// @ts-ignore Untyped Local +import { transformSpecs } from './uis/transforms'; +// @ts-ignore Untyped Local +import { datasourceSpecs } from './uis/datasources'; +// @ts-ignore Untyped Local +import { modelSpecs } from './uis/models'; +// @ts-ignore Untyped Local +import { viewSpecs } from './uis/views'; +// @ts-ignore Untyped Local +import { args as argSpecs } from './uis/arguments'; +import { tagSpecs } from './uis/tags'; +import { templateSpecs } from './templates'; + +interface SetupDeps { + canvas: CanvasSetup; +} + +/** @internal */ +export class CanvasSrcPlugin implements Plugin<{}, {}, SetupDeps, {}> { + public setup(core: CoreSetup, plugins: SetupDeps) { + plugins.canvas.addFunctions(functions); + plugins.canvas.addTypes(typeFunctions); + plugins.canvas.addRenderers(renderFunctions); + + plugins.canvas.addElements(elementSpecs); + plugins.canvas.addDatasourceUIs(datasourceSpecs); + plugins.canvas.addModelUIs(modelSpecs); + plugins.canvas.addViewUIs(viewSpecs); + plugins.canvas.addArgumentUIs(argSpecs); + plugins.canvas.addTagUIs(tagSpecs); + plugins.canvas.addTemplates(templateSpecs); + plugins.canvas.addTransformUIs(transformSpecs); + + return {}; + } + + public start(core: CoreStart, plugins: {}) { + return {}; + } +} diff --git a/x-pack/legacy/plugins/canvas/i18n/functions/dict/filters.ts b/x-pack/legacy/plugins/canvas/i18n/functions/dict/filters.ts index 4f5cb395b9d88..d0aad05ddd5d3 100644 --- a/x-pack/legacy/plugins/canvas/i18n/functions/dict/filters.ts +++ b/x-pack/legacy/plugins/canvas/i18n/functions/dict/filters.ts @@ -3,13 +3,12 @@ * 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'; -import { filters } from '../../../public/functions/filters'; +import { filtersFunctionFactory } from '../../../public/functions/filters'; import { FunctionHelp } from '../function_help'; import { FunctionFactory } from '../../../types'; -export const help: FunctionHelp> = { +export const help: FunctionHelp>> = { help: i18n.translate('xpack.canvas.functions.filtersHelpText', { defaultMessage: 'Aggregates element filters from the workpad for use elsewhere, usually a data source.', diff --git a/x-pack/legacy/plugins/canvas/i18n/functions/dict/to.ts b/x-pack/legacy/plugins/canvas/i18n/functions/dict/to.ts index 2cf812cfb13db..c618f84aeaf2b 100644 --- a/x-pack/legacy/plugins/canvas/i18n/functions/dict/to.ts +++ b/x-pack/legacy/plugins/canvas/i18n/functions/dict/to.ts @@ -5,12 +5,12 @@ */ import { i18n } from '@kbn/i18n'; -import { to } from '../../../public/functions/to'; +import { toFunctionFactory } from '../../../public/functions/to'; import { FunctionHelp } from '../function_help'; import { FunctionFactory } from '../../../types'; import { CONTEXT } from '../../constants'; -export const help: FunctionHelp> = { +export const help: FunctionHelp>> = { help: i18n.translate('xpack.canvas.functions.toHelpText', { defaultMessage: 'Explicitly casts the type of the {CONTEXT} to the specified type.', values: { diff --git a/x-pack/legacy/plugins/canvas/index.js b/x-pack/legacy/plugins/canvas/index.js index b357ec9c0b61e..489b9600f200e 100644 --- a/x-pack/legacy/plugins/canvas/index.js +++ b/x-pack/legacy/plugins/canvas/index.js @@ -26,11 +26,7 @@ export function canvas(kibana) { main: 'plugins/canvas/legacy_start', category: DEFAULT_APP_CATEGORIES.analyze, }, - interpreter: [ - 'plugins/canvas/browser_functions', - 'plugins/canvas/renderers', - 'plugins/canvas/interpreter_expression_types', - ], + interpreter: ['plugins/canvas/legacy_register_interpreter'], styleSheetPaths: resolve(__dirname, 'public/style/index.scss'), hacks: [ // window.onerror override diff --git a/x-pack/legacy/plugins/canvas/public/application.tsx b/x-pack/legacy/plugins/canvas/public/application.tsx index 9bdc8e6308e07..15b5d2543fbc6 100644 --- a/x-pack/legacy/plugins/canvas/public/application.tsx +++ b/x-pack/legacy/plugins/canvas/public/application.tsx @@ -12,13 +12,14 @@ import { Provider } from 'react-redux'; import { AppMountParameters, CoreStart } from 'kibana/public'; +import { CanvasStartDeps } from './plugin'; // @ts-ignore Untyped local import { App } from './components/app'; import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public'; export const renderApp = ( coreStart: CoreStart, - plugins: object, + plugins: CanvasStartDeps, { element }: AppMountParameters, canvasStore: Store ) => { diff --git a/x-pack/legacy/plugins/canvas/public/components/app/index.js b/x-pack/legacy/plugins/canvas/public/components/app/index.js index 65b811fe68134..36af5477631b4 100644 --- a/x-pack/legacy/plugins/canvas/public/components/app/index.js +++ b/x-pack/legacy/plugins/canvas/public/components/app/index.js @@ -4,35 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -import { register, addRegistries } from '@kbn/interpreter/common'; import { connect } from 'react-redux'; import { compose, withProps } from 'recompose'; -import { registries } from 'plugins/interpreter/registries'; -import { getInterpreter } from 'plugins/interpreter/interpreter'; -import { loadLegacyServerFunctionWrappers } from 'plugins/interpreter/canvas/load_legacy_server_function_wrappers'; import { getAppReady, getBasePath } from '../../state/selectors/app'; import { appReady, appError } from '../../state/actions/app'; -import { elementsRegistry } from '../../lib/elements_registry'; -import { registerLanguage } from '../../lib/monaco_language_def'; -import { templatesRegistry } from '../../lib/templates_registry'; -import { tagsRegistry } from '../../lib/tags_registry'; -import { elementSpecs } from '../../../canvas_plugin_src/elements'; -import { transformSpecs } from '../../../canvas_plugin_src/uis/transforms'; -import { modelSpecs } from '../../../canvas_plugin_src/uis/models'; -import { viewSpecs } from '../../../canvas_plugin_src/uis/views'; -import { datasourceSpecs } from '../../../canvas_plugin_src/uis/datasources'; -import { args as argSpecs } from '../../../canvas_plugin_src/uis/arguments'; -import { tagSpecs } from '../../../canvas_plugin_src/uis/tags'; -import { templateSpecs } from '../../../canvas_plugin_src/templates'; -import { clientFunctions } from '../../functions'; -import { - argTypeRegistry, - datasourceRegistry, - modelRegistry, - transformRegistry, - viewRegistry, -} from '../../expression_types'; import { App as Component } from './app'; import { trackRouteChange } from './track_route_change'; @@ -46,38 +22,9 @@ const mapStateToProps = state => { }; }; -addRegistries(registries, { - elements: elementsRegistry, - transformUIs: transformRegistry, - datasourceUIs: datasourceRegistry, - modelUIs: modelRegistry, - viewUIs: viewRegistry, - argumentUIs: argTypeRegistry, - templates: templatesRegistry, - tagUIs: tagsRegistry, -}); - -register(registries, { - elements: elementSpecs, - transformUIs: transformSpecs, - modelUIs: modelSpecs, - viewUIs: viewSpecs, - datasourceUIs: datasourceSpecs, - argumentUIs: argSpecs, - browserFunctions: clientFunctions, - templates: templateSpecs, - tagUIs: tagSpecs, -}); - const mapDispatchToProps = dispatch => ({ setAppReady: () => async () => { try { - await loadLegacyServerFunctionWrappers(); - await getInterpreter(); - - // Register the expression language with the Monaco Editor - registerLanguage(); - // set app state to ready dispatch(appReady()); } catch (e) { diff --git a/x-pack/legacy/plugins/canvas/public/components/datasource/datasource_preview/index.js b/x-pack/legacy/plugins/canvas/public/components/datasource/datasource_preview/index.js index 5030e5cfeaae3..045e98bab870e 100644 --- a/x-pack/legacy/plugins/canvas/public/components/datasource/datasource_preview/index.js +++ b/x-pack/legacy/plugins/canvas/public/components/datasource/datasource_preview/index.js @@ -6,7 +6,7 @@ import { pure, compose, lifecycle, withState, branch, renderComponent } from 'recompose'; import { PropTypes } from 'prop-types'; -import { interpretAst } from 'plugins/interpreter/interpreter'; +import { interpretAst } from '../../../lib/run_interpreter'; import { Loading } from '../../loading'; import { DatasourcePreview as Component } from './datasource_preview'; diff --git a/x-pack/legacy/plugins/canvas/public/components/element_content/index.js b/x-pack/legacy/plugins/canvas/public/components/element_content/index.js index f05222452b1ee..df411b6d11f1c 100644 --- a/x-pack/legacy/plugins/canvas/public/components/element_content/index.js +++ b/x-pack/legacy/plugins/canvas/public/components/element_content/index.js @@ -8,8 +8,8 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { compose, withProps } from 'recompose'; import { get } from 'lodash'; -import { npStart } from 'ui/new_platform'; import { getSelectedPage, getPageById } from '../../state/selectors/workpad'; +import { withKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { ElementContent as Component } from './element_content'; const mapStateToProps = state => ({ @@ -18,8 +18,9 @@ const mapStateToProps = state => ({ export const ElementContent = compose( connect(mapStateToProps), - withProps(({ renderable }) => ({ - renderFunction: npStart.plugins.expressions.getRenderer(get(renderable, 'as')), + withKibana, + withProps(({ renderable, kibana }) => ({ + renderFunction: kibana.services.expressions.getRenderer(get(renderable, 'as')), })) )(Component); diff --git a/x-pack/legacy/plugins/canvas/public/components/expression/index.js b/x-pack/legacy/plugins/canvas/public/components/expression/index.js index d6eefca4e1461..29d22c0e1804a 100644 --- a/x-pack/legacy/plugins/canvas/public/components/expression/index.js +++ b/x-pack/legacy/plugins/canvas/public/components/expression/index.js @@ -15,16 +15,15 @@ import { renderComponent, } from 'recompose'; import { fromExpression } from '@kbn/interpreter/common'; +import { withKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { getSelectedPage, getSelectedElement } from '../../state/selectors/workpad'; import { setExpression, flushContext } from '../../state/actions/elements'; -import { getFunctionDefinitions } from '../../lib/function_definitions'; import { ElementNotSelected } from './element_not_selected'; import { Expression as Component } from './expression'; const mapStateToProps = state => ({ pageId: getSelectedPage(state), element: getSelectedElement(state), - functionDefinitionsPromise: getFunctionDefinitions(state), }); const mapDispatchToProps = dispatch => ({ @@ -47,9 +46,12 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => { const { expression } = element; + const functions = Object.values(allProps.kibana.services.expressions.getFunctions()); + return { ...allProps, expression, + functionDefinitions: functions, setExpression: dispatchProps.setExpression(element.id, pageId), }; }; @@ -66,15 +68,11 @@ const expressionLifecycle = lifecycle({ }); } }, - componentDidMount() { - const { functionDefinitionsPromise, setFunctionDefinitions } = this.props; - functionDefinitionsPromise.then(defs => setFunctionDefinitions(defs)); - }, }); export const Expression = compose( + withKibana, connect(mapStateToProps, mapDispatchToProps, mergeProps), - withState('functionDefinitions', 'setFunctionDefinitions', []), withState('formState', 'setFormState', ({ expression }) => ({ expression, dirty: false, diff --git a/x-pack/legacy/plugins/canvas/public/components/function_form_list/index.js b/x-pack/legacy/plugins/canvas/public/components/function_form_list/index.js index 80159b69ad994..a903847a7b6c5 100644 --- a/x-pack/legacy/plugins/canvas/public/components/function_form_list/index.js +++ b/x-pack/legacy/plugins/canvas/public/components/function_form_list/index.js @@ -7,7 +7,7 @@ import { compose, withProps } from 'recompose'; import { get } from 'lodash'; import { toExpression } from '@kbn/interpreter/common'; -import { interpretAst } from 'plugins/interpreter/interpreter'; +import { interpretAst } from '../../lib/run_interpreter'; import { modelRegistry, viewRegistry, transformRegistry } from '../../expression_types'; import { FunctionFormList as Component } from './function_form_list'; diff --git a/x-pack/legacy/plugins/canvas/public/functions/filters.ts b/x-pack/legacy/plugins/canvas/public/functions/filters.ts index 44b321e00091a..2a3bc481d7dae 100644 --- a/x-pack/legacy/plugins/canvas/public/functions/filters.ts +++ b/x-pack/legacy/plugins/canvas/public/functions/filters.ts @@ -6,16 +6,14 @@ import { fromExpression } from '@kbn/interpreter/common'; import { get } from 'lodash'; -// @ts-ignore untyped Elastic lib -import { interpretAst } from 'plugins/interpreter/interpreter'; -// @ts-ignore untyped Elastic lib -import { registries } from 'plugins/interpreter/registries'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/public'; +import { interpretAst } from '../lib/run_interpreter'; // @ts-ignore untyped local import { getState } from '../state/store'; import { getGlobalFilters } from '../state/selectors/workpad'; import { Filter } from '../../types'; import { getFunctionHelp } from '../../i18n'; +import { InitializeArguments } from '.'; interface Arguments { group: string[]; @@ -43,39 +41,45 @@ function getFiltersByGroup(allFilters: string[], groups?: string[], ungrouped = }); } -export function filters(): ExpressionFunctionDefinition<'filters', null, Arguments, Filter> { - const { help, args: argHelp } = getFunctionHelp().filters; +type FiltersFunction = ExpressionFunctionDefinition<'filters', null, Arguments, Filter>; - return { - name: 'filters', - type: 'filter', - help, - inputTypes: ['null'], - args: { - group: { - aliases: ['_'], - types: ['string'], - help: argHelp.group, - multi: true, +export function filtersFunctionFactory(initialize: InitializeArguments): () => FiltersFunction { + return function filters(): FiltersFunction { + const { help, args: argHelp } = getFunctionHelp().filters; + + return { + name: 'filters', + type: 'filter', + help, + context: { + types: ['null'], }, - ungrouped: { - aliases: ['nogroup', 'nogroups'], - types: ['boolean'], - help: argHelp.ungrouped, - default: false, + args: { + group: { + aliases: ['_'], + types: ['string'], + help: argHelp.group, + multi: true, + }, + ungrouped: { + aliases: ['nogroup', 'nogroups'], + types: ['boolean'], + help: argHelp.ungrouped, + default: false, + }, }, - }, - fn: (input, { group, ungrouped }) => { - const filterList = getFiltersByGroup(getGlobalFilters(getState()), group, ungrouped); + fn: (input, { group, ungrouped }) => { + const filterList = getFiltersByGroup(getGlobalFilters(getState()), group, ungrouped); - if (filterList && filterList.length) { - const filterExpression = filterList.join(' | '); - const filterAST = fromExpression(filterExpression); - return interpretAst(filterAST); - } else { - const filterType = registries.types.get('filter'); - return filterType.from(null); - } - }, + if (filterList && filterList.length) { + const filterExpression = filterList.join(' | '); + const filterAST = fromExpression(filterExpression); + return interpretAst(filterAST); + } else { + const filterType = initialize.typesRegistry.get('filter'); + return filterType?.from(null, {}); + } + }, + }; }; } diff --git a/x-pack/legacy/plugins/canvas/public/functions/index.ts b/x-pack/legacy/plugins/canvas/public/functions/index.ts index 63d87a673f820..27fb7d83274a4 100644 --- a/x-pack/legacy/plugins/canvas/public/functions/index.ts +++ b/x-pack/legacy/plugins/canvas/public/functions/index.ts @@ -4,9 +4,16 @@ * you may not use this file except in compliance with the Elastic License. */ +import { ExpressionsSetup } from 'src/plugins/expressions/public'; import { asset } from './asset'; -import { filters } from './filters'; +import { filtersFunctionFactory } from './filters'; import { timelion } from './timelion'; -import { to } from './to'; +import { toFunctionFactory } from './to'; -export const clientFunctions = [asset, filters, timelion, to]; +export interface InitializeArguments { + typesRegistry: ExpressionsSetup['__LEGACY']['types']; +} + +export function initFunctions(initialize: InitializeArguments) { + return [asset, filtersFunctionFactory(initialize), timelion, toFunctionFactory(initialize)]; +} diff --git a/x-pack/legacy/plugins/canvas/public/functions/to.ts b/x-pack/legacy/plugins/canvas/public/functions/to.ts index 7c24926b5aa6a..64d25b28a8aa0 100644 --- a/x-pack/legacy/plugins/canvas/public/functions/to.ts +++ b/x-pack/legacy/plugins/canvas/public/functions/to.ts @@ -7,35 +7,39 @@ // @ts-ignore untyped Elastic library import { castProvider } from '@kbn/interpreter/common'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/public'; -import { npStart } from 'ui/new_platform'; import { getFunctionHelp, getFunctionErrors } from '../../i18n'; +import { InitializeArguments } from '.'; interface Arguments { type: string[]; } -export function to(): ExpressionFunctionDefinition<'to', any, Arguments, any> { - const { help, args: argHelp } = getFunctionHelp().to; - const errors = getFunctionErrors().to; +type ToFunction = ExpressionFunctionDefinition<'to', any, Arguments, any>; - return { - name: 'to', - aliases: [], - help, - args: { - type: { - types: ['string'], - help: argHelp.type, - aliases: ['_'], - multi: true, +export function toFunctionFactory(initialize: InitializeArguments): () => ToFunction { + return function to(): ToFunction { + const { help, args: argHelp } = getFunctionHelp().to; + const errors = getFunctionErrors().to; + + return { + name: 'to', + aliases: [], + help, + args: { + type: { + types: ['string'], + help: argHelp.type, + aliases: ['_'], + multi: true, + }, }, - }, - fn: (input, args) => { - if (!args.type) { - throw errors.missingType(); - } + fn: (input, args) => { + if (!args.type) { + throw errors.missingType(); + } - return castProvider(npStart.plugins.expressions.getTypes())(input, args.type); - }, + return castProvider(initialize.typesRegistry.toJS())(input, args.type); + }, + }; }; } diff --git a/x-pack/legacy/plugins/canvas/public/interpreter_expression_types.ts b/x-pack/legacy/plugins/canvas/public/interpreter_expression_types.ts deleted file mode 100644 index e443f7e40879f..0000000000000 --- a/x-pack/legacy/plugins/canvas/public/interpreter_expression_types.ts +++ /dev/null @@ -1,12 +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 { typesRegistry } from '../../../../../src/legacy/core_plugins/interpreter/public/registries'; -import { typeFunctions } from '../canvas_plugin_src/expression_types'; - -typeFunctions.forEach(r => { - typesRegistry.register(r); -}); diff --git a/x-pack/legacy/plugins/canvas/public/legacy.ts b/x-pack/legacy/plugins/canvas/public/legacy.ts index 0d2e77637f19d..9bccc958f7263 100644 --- a/x-pack/legacy/plugins/canvas/public/legacy.ts +++ b/x-pack/legacy/plugins/canvas/public/legacy.ts @@ -5,7 +5,7 @@ */ import { npSetup, npStart } from 'ui/new_platform'; -import { CanvasStartDeps } from './plugin'; // eslint-disable-line import/order +import { CanvasStartDeps, CanvasSetupDeps } from './plugin'; // eslint-disable-line import/order // @ts-ignore Untyped Kibana Lib import chrome, { loadingCount } from 'ui/chrome'; // eslint-disable-line import/order @@ -19,12 +19,14 @@ const shimCoreSetup = { const shimCoreStart = { ...npStart.core, }; -const shimSetupPlugins = { + +const shimSetupPlugins: CanvasSetupDeps = { + expressions: npSetup.plugins.expressions, home: npSetup.plugins.home, }; - const shimStartPlugins: CanvasStartDeps = { ...npStart.plugins, + expressions: npStart.plugins.expressions, __LEGACY: { // ToDo: Copy directly into canvas absoluteToParsedUrl, diff --git a/x-pack/legacy/plugins/canvas/public/legacy_plugin_support.ts b/x-pack/legacy/plugins/canvas/public/legacy_plugin_support.ts new file mode 100644 index 0000000000000..cfc3de8f6d54c --- /dev/null +++ b/x-pack/legacy/plugins/canvas/public/legacy_plugin_support.ts @@ -0,0 +1,47 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +// @ts-ignore +import { Registry, registryFactory } from '@kbn/interpreter/common'; + +type specFn = (...args: any[]) => { name: string }; + +const fnWrapper = (fn: specFn) => { + const obj = fn(); + return () => ({ + name: obj.name, + fn, + }); +}; + +class LegacyRegistry extends Registry { + register(fn: specFn) { + super.register(fnWrapper(fn)); + } + + getOriginalFns() { + return this.toArray().map(entry => entry.fn); + } +} + +export const legacyRegistries = { + browserFunctions: new LegacyRegistry(), + renderers: new LegacyRegistry(), + types: new LegacyRegistry(), + elements: new LegacyRegistry(), + transformUIs: new LegacyRegistry(), + datasourceUIs: new LegacyRegistry(), + modelUIs: new LegacyRegistry(), + viewUIs: new LegacyRegistry(), + argumentUIs: new LegacyRegistry(), + templates: new LegacyRegistry(), + tagUIs: new LegacyRegistry(), +}; + +(global as any).kbnInterpreter = Object.assign( + (global as any).kbnInterpreter || {}, + registryFactory(legacyRegistries) +); diff --git a/x-pack/legacy/plugins/canvas/public/browser_functions.ts b/x-pack/legacy/plugins/canvas/public/legacy_register_interpreter.ts similarity index 62% rename from x-pack/legacy/plugins/canvas/public/browser_functions.ts rename to x-pack/legacy/plugins/canvas/public/legacy_register_interpreter.ts index 011fe8b4504bc..274a9875d123d 100644 --- a/x-pack/legacy/plugins/canvas/public/browser_functions.ts +++ b/x-pack/legacy/plugins/canvas/public/legacy_register_interpreter.ts @@ -6,8 +6,13 @@ import { npSetup } from 'ui/new_platform'; import { functions } from '../canvas_plugin_src/functions/browser'; +import { typeFunctions } from '../canvas_plugin_src/expression_types'; +// @ts-ignore untyped local +import { renderFunctions } from '../canvas_plugin_src/renderers'; functions.forEach(npSetup.plugins.expressions.registerFunction); +typeFunctions.forEach(npSetup.plugins.expressions.registerType); +renderFunctions.forEach(npSetup.plugins.expressions.registerRenderer); // eslint-disable-next-line import/no-default-export export default functions; diff --git a/x-pack/legacy/plugins/canvas/public/legacy_start.ts b/x-pack/legacy/plugins/canvas/public/legacy_start.ts index d7d1a940d3b43..ac647fe8a5a93 100644 --- a/x-pack/legacy/plugins/canvas/public/legacy_start.ts +++ b/x-pack/legacy/plugins/canvas/public/legacy_start.ts @@ -13,12 +13,7 @@ import 'uiExports/spyModes'; import 'uiExports/embeddableFactories'; import 'uiExports/interpreter'; -// TODO: These dependencies should be moved into plugin startup methods -// Load the interpreter so that the kbnInterpreter global will be available when plugins load -import 'plugins/interpreter/interpreter'; -// Load our app component to initialize registries -import './components/app'; - +import './legacy_plugin_support'; // load application code import 'uiExports/canvas'; diff --git a/x-pack/legacy/plugins/canvas/public/lib/monaco_language_def.ts b/x-pack/legacy/plugins/canvas/public/lib/monaco_language_def.ts index cd054bff3b7d2..5dac7fcc9bc50 100644 --- a/x-pack/legacy/plugins/canvas/public/lib/monaco_language_def.ts +++ b/x-pack/legacy/plugins/canvas/public/lib/monaco_language_def.ts @@ -5,7 +5,7 @@ */ import { monaco } from '@kbn/ui-shared-deps/monaco'; -import { npSetup } from 'ui/new_platform'; +import { ExpressionFunction } from '../../types'; export const LANGUAGE_ID = 'canvas-expression'; @@ -94,9 +94,8 @@ export const language: Language = { }, }; -export function registerLanguage() { - const functions = Object.values(npSetup.plugins.expressions.getFunctions()); - language.keywords = functions.map(({ name }) => name); +export function registerLanguage(functions: ExpressionFunction[]) { + language.keywords = functions.map(fn => fn.name); monaco.languages.register({ id: LANGUAGE_ID }); monaco.languages.setMonarchTokensProvider(LANGUAGE_ID, language); diff --git a/x-pack/legacy/plugins/canvas/public/lib/run_interpreter.js b/x-pack/legacy/plugins/canvas/public/lib/run_interpreter.js deleted file mode 100644 index 7fc33c9add8f9..0000000000000 --- a/x-pack/legacy/plugins/canvas/public/lib/run_interpreter.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { fromExpression, getType } from '@kbn/interpreter/common'; -import { interpretAst } from 'plugins/interpreter/interpreter'; -import { loadLegacyServerFunctionWrappers } from 'plugins/interpreter/canvas/load_legacy_server_function_wrappers'; -import { notify } from './notify'; - -/** - * Runs interpreter, usually in the browser - * - * @param {object} ast - Executable AST - * @param {any} context - Initial context for AST execution - * @param {object} options - * @param {boolean} options.castToRender - try to cast to a type: render object? - * @param {boolean} options.retryRenderCasting - - * @returns {promise} - */ -export function runInterpreter(ast, context = null, options = {}) { - return loadLegacyServerFunctionWrappers() - .then(() => interpretAst(ast, context)) - .then(renderable => { - if (getType(renderable) === 'render') { - return renderable; - } - - if (options.castToRender) { - return runInterpreter(fromExpression('render'), renderable, { - castToRender: false, - }); - } - - return new Error(`Ack! I don't know how to render a '${getType(renderable)}'`); - }) - .catch(err => { - notify.error(err); - throw err; - }); -} diff --git a/x-pack/legacy/plugins/canvas/public/lib/run_interpreter.ts b/x-pack/legacy/plugins/canvas/public/lib/run_interpreter.ts new file mode 100644 index 0000000000000..d2f4cca8fe97d --- /dev/null +++ b/x-pack/legacy/plugins/canvas/public/lib/run_interpreter.ts @@ -0,0 +1,87 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { fromExpression, getType } from '@kbn/interpreter/common'; +import { ExpressionValue, ExpressionAstExpression } from 'src/plugins/expressions/public'; +// @ts-ignore Untyped Local +import { notify } from './notify'; + +import { CanvasStartDeps, CanvasSetupDeps } from '../plugin'; + +let expressionsStarting: Promise; + +export const initInterpreter = function( + expressionsStart: CanvasStartDeps['expressions'], + expressionsSetup: CanvasSetupDeps['expressions'] +) { + expressionsStarting = startExpressions(expressionsStart, expressionsSetup); + + return expressionsStarting; +}; + +async function startExpressions( + expressionsStart: CanvasStartDeps['expressions'], + expressionsSetup: CanvasSetupDeps['expressions'] +) { + await expressionsSetup.__LEGACY.loadLegacyServerFunctionWrappers(); + return expressionsStart; +} + +interface Options { + castToRender?: boolean; +} + +/** + * Meant to be a replacement for plugins/interpreter/interpretAST + */ +export async function interpretAst(ast: ExpressionAstExpression): Promise { + if (!expressionsStarting) { + throw new Error('Interpreter has not been initialized'); + } + + const expressions = await expressionsStarting; + return await expressions.execute(ast).getData(); +} + +/** + * Runs interpreter, usually in the browser + * + * @param {object} ast - Executable AST + * @param {any} input - Initial input for AST execution + * @param {object} options + * @param {boolean} options.castToRender - try to cast to a type: render object? + * @returns {promise} + */ +export async function runInterpreter( + ast: ExpressionAstExpression, + input: ExpressionValue, + options: Options = {} +): Promise { + if (!expressionsStarting) { + throw new Error('Interpreter has not been initialized'); + } + + const expressions = await expressionsStarting; + + try { + const renderable = await expressions.execute(ast, input).getData(); + + if (getType(renderable) === 'render') { + return renderable; + } + + if (options.castToRender) { + return runInterpreter(fromExpression('render'), renderable, { + castToRender: false, + }); + } + + throw new Error(`Ack! I don't know how to render a '${getType(renderable)}'`); + } catch (err) { + notify.error(err); + throw err; + } +} diff --git a/x-pack/legacy/plugins/canvas/public/plugin.tsx b/x-pack/legacy/plugins/canvas/public/plugin.tsx index a5fbbccb4299f..6644b927dd884 100644 --- a/x-pack/legacy/plugins/canvas/public/plugin.tsx +++ b/x-pack/legacy/plugins/canvas/public/plugin.tsx @@ -28,6 +28,33 @@ import { getDocumentationLinks } from './lib/documentation_links'; // @ts-ignore: untyped local import { initClipboard } from './lib/clipboard'; import { featureCatalogueEntry } from './feature_catalogue_entry'; +import { ExpressionsSetup, ExpressionsStart } from '../../../../../src/plugins/expressions/public'; +// @ts-ignore untyped local +import { datasourceSpecs } from './expression_types/datasources'; +// @ts-ignore untyped local +import { argTypeSpecs } from './expression_types/arg_types'; +import { transitions } from './transitions'; +import { registerLanguage } from './lib/monaco_language_def'; + +import { initInterpreter } from './lib/run_interpreter'; +import { legacyRegistries } from './legacy_plugin_support'; +import { getPluginApi, CanvasApi, SetupRegistries } from './plugin_api'; +import { + initRegistries, + addElements, + addTransformUIs, + addDatasourceUIs, + addModelUIs, + addViewUIs, + addArgumentUIs, + addTagUIs, + addTemplates, + addTransitions, +} from './registries'; + +import { initFunctions } from './functions'; + +import { CanvasSrcPlugin } from '../canvas_plugin_src/plugin'; export { CoreStart }; /** @@ -36,9 +63,12 @@ export { CoreStart }; */ // This interface will be built out as we require other plugins for setup export interface CanvasSetupDeps { + expressions: ExpressionsSetup; home: HomePublicPluginSetup; } + export interface CanvasStartDeps { + expressions: ExpressionsStart; __LEGACY: { absoluteToParsedUrl: (url: string, basePath: string) => any; formatMsg: any; @@ -53,16 +83,18 @@ export interface CanvasStartDeps { */ // These interfaces are empty for now but will be populate as we need to export // things for other plugins to use at startup or runtime -export interface CanvasSetup {} // eslint-disable-line @typescript-eslint/no-empty-interface +export type CanvasSetup = CanvasApi; export interface CanvasStart {} // eslint-disable-line @typescript-eslint/no-empty-interface /** @internal */ export class CanvasPlugin implements Plugin { - public setup(core: CoreSetup, plugins: CanvasSetupDeps) { - // This is where any setup actions need to occur. - // Things like registering functions to the interpreter that need - // to be available everywhere, not just in Canvas + private expressionSetup: CanvasSetupDeps['expressions'] | undefined; + private registries: SetupRegistries | undefined; + + public setup(core: CoreSetup, plugins: CanvasSetupDeps) { + const { api: canvasApi, registries } = getPluginApi(plugins.expressions); + this.registries = registries; core.application.register({ id: 'canvas', @@ -82,15 +114,51 @@ export class CanvasPlugin }); plugins.home.featureCatalogue.register(featureCatalogueEntry); + this.expressionSetup = plugins.expressions; - return {}; + // Register Legacy plugin stuff + canvasApi.addFunctions(legacyRegistries.browserFunctions.getOriginalFns()); + canvasApi.addElements(legacyRegistries.elements.getOriginalFns()); + + // TODO: Do we want to completely move canvas_plugin_src into it's own plugin? + const srcPlugin = new CanvasSrcPlugin(); + srcPlugin.setup(core, { canvas: canvasApi }); + + // Register core canvas stuff + canvasApi.addFunctions(initFunctions({ typesRegistry: plugins.expressions.__LEGACY.types })); + canvasApi.addDatasourceUIs(datasourceSpecs); + canvasApi.addArgumentUIs(argTypeSpecs); + canvasApi.addTransitions(transitions); + + return { + ...canvasApi, + }; } public start(core: CoreStart, plugins: CanvasStartDeps) { - loadExpressionTypes(); - loadTransitions(); - initLoadingIndicator(core.http.addLoadingCountSource); + initRegistries(); + + if (this.expressionSetup) { + const expressionSetup = this.expressionSetup; + initInterpreter(plugins.expressions, expressionSetup).then(() => { + registerLanguage(Object.values(plugins.expressions.getFunctions())); + }); + } + + if (this.registries) { + addElements(this.registries.elements); + addTransformUIs(this.registries.transformUIs); + addDatasourceUIs(this.registries.datasourceUIs); + addModelUIs(this.registries.modelUIs); + addViewUIs(this.registries.viewUIs); + addArgumentUIs(this.registries.argumentUIs); + addTemplates(this.registries.templates); + addTagUIs(this.registries.tagUIs); + addTransitions(this.registries.transitions); + } else { + throw new Error('Unable to initialize Canvas registries'); + } core.chrome.setBadge( core.application.capabilities.canvas && core.application.capabilities.canvas.save diff --git a/x-pack/legacy/plugins/canvas/public/plugin_api.ts b/x-pack/legacy/plugins/canvas/public/plugin_api.ts new file mode 100644 index 0000000000000..a7346c0b4376e --- /dev/null +++ b/x-pack/legacy/plugins/canvas/public/plugin_api.ts @@ -0,0 +1,89 @@ +/* + * 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 { + AnyExpressionFunctionDefinition, + AnyExpressionTypeDefinition, + RendererFactory, +} from '../types'; +import { ElementFactory } from '../types'; +import { ExpressionsSetup } from '../../../../../src/plugins/expressions/public'; + +type AddToRegistry = (add: T[]) => void; + +export interface CanvasApi { + addArgumentUIs: AddToRegistry; + addDatasourceUIs: AddToRegistry; + addElements: AddToRegistry; + addFunctions: AddToRegistry<() => AnyExpressionFunctionDefinition>; + addModelUIs: AddToRegistry; + addRenderers: AddToRegistry; + addTagUIs: AddToRegistry; + addTemplates: AddToRegistry; + addTransformUIs: AddToRegistry; + addTransitions: AddToRegistry; + addTypes: AddToRegistry<() => AnyExpressionTypeDefinition>; + addViewUIs: AddToRegistry; +} + +export interface SetupRegistries { + elements: ElementFactory[]; + transformUIs: any[]; + datasourceUIs: any[]; + modelUIs: any[]; + viewUIs: any[]; + argumentUIs: any[]; + templates: any[]; + tagUIs: any[]; + transitions: any[]; +} + +export function getPluginApi( + expressionsPluginSetup: ExpressionsSetup +): { api: CanvasApi; registries: SetupRegistries } { + const registries: SetupRegistries = { + elements: [], + transformUIs: [], + datasourceUIs: [], + modelUIs: [], + viewUIs: [], + argumentUIs: [], + templates: [], + tagUIs: [], + transitions: [], + }; + + const api: CanvasApi = { + // Functions, types and renderers are registered directly to expression plugin + addFunctions: fns => { + fns.forEach(fn => { + expressionsPluginSetup.registerFunction(fn); + }); + }, + addTypes: types => { + types.forEach(type => { + expressionsPluginSetup.registerType(type as any); + }); + }, + addRenderers: renderers => { + renderers.forEach((r: any) => { + expressionsPluginSetup.registerRenderer(r); + }); + }, + + // All these others are local to canvas, and they will only register on start + addElements: elements => registries.elements.push(...elements), + addTransformUIs: transforms => registries.transformUIs.push(...transforms), + addDatasourceUIs: datasources => registries.datasourceUIs.push(...datasources), + addModelUIs: models => registries.modelUIs.push(...models), + addViewUIs: views => registries.viewUIs.push(...views), + addArgumentUIs: args => registries.argumentUIs.push(...args), + addTemplates: templates => registries.templates.push(...templates), + addTagUIs: tags => registries.tagUIs.push(...tags), + addTransitions: transitions => registries.transitions.push(...transitions), + }; + + return { api, registries }; +} diff --git a/x-pack/legacy/plugins/canvas/public/registries.ts b/x-pack/legacy/plugins/canvas/public/registries.ts new file mode 100644 index 0000000000000..d175ab3934eed --- /dev/null +++ b/x-pack/legacy/plugins/canvas/public/registries.ts @@ -0,0 +1,81 @@ +/* + * 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. + */ + +// @ts-ignore untyped module +import { addRegistries, register } from '@kbn/interpreter/common'; +// @ts-ignore untyped local +import { elementsRegistry } from './lib/elements_registry'; +// @ts-ignore untyped local +import { templatesRegistry } from './lib/templates_registry'; +import { tagsRegistry } from './lib/tags_registry'; +import { ElementFactory } from '../types'; +// @ts-ignore untyped local +import { transitionsRegistry } from './lib/transitions_registry'; + +import { + argTypeRegistry, + datasourceRegistry, + modelRegistry, + transformRegistry, + viewRegistry, + // @ts-ignore untyped local +} from './expression_types'; + +export const registries = {}; + +export function initRegistries() { + addRegistries(registries, { + elements: elementsRegistry, + transformUIs: transformRegistry, + datasourceUIs: datasourceRegistry, + modelUIs: modelRegistry, + viewUIs: viewRegistry, + argumentUIs: argTypeRegistry, + templates: templatesRegistry, + tagUIs: tagsRegistry, + transitions: transitionsRegistry, + }); +} + +export function addElements(elements: ElementFactory[]) { + register(registries, { elements }); +} + +export function addTransformUIs(transformUIs: any[]) { + register(registries, { transformUIs }); +} + +export function addDatasourceUIs(datasourceUIs: any[]) { + register(registries, { datasourceUIs }); +} + +export function addModelUIs(modelUIs: any[]) { + register(registries, { modelUIs }); +} + +export function addViewUIs(viewUIs: any[]) { + register(registries, { viewUIs }); +} + +export function addArgumentUIs(argumentUIs: any[]) { + register(registries, { argumentUIs }); +} + +export function addTemplates(templates: any[]) { + register(registries, { templates }); +} + +export function addTagUIs(tagUIs: any[]) { + register(registries, { tagUIs }); +} + +export function addTransitions(transitions: any[]) { + register(registries, { transitions }); +} + +export function addBrowserFunctions(browserFunctions: any[]) { + register(registries, { browserFunctions }); +} diff --git a/x-pack/legacy/plugins/canvas/public/renderers.js b/x-pack/legacy/plugins/canvas/public/renderers.js deleted file mode 100644 index 0c278789bc1aa..0000000000000 --- a/x-pack/legacy/plugins/canvas/public/renderers.js +++ /dev/null @@ -1,12 +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 { npSetup } from 'ui/new_platform'; -import { renderFunctions } from '../canvas_plugin_src/renderers'; - -renderFunctions.forEach(npSetup.plugins.expressions.registerRenderer); - -export default renderFunctions; diff --git a/x-pack/legacy/plugins/canvas/public/state/actions/elements.js b/x-pack/legacy/plugins/canvas/public/state/actions/elements.js index 8b49d16e87b21..1798aaab22f06 100644 --- a/x-pack/legacy/plugins/canvas/public/state/actions/elements.js +++ b/x-pack/legacy/plugins/canvas/public/state/actions/elements.js @@ -9,13 +9,12 @@ import { createThunk } from 'redux-thunks'; import immutable from 'object-path-immutable'; import { get, pick, cloneDeep, without } from 'lodash'; import { toExpression, safeElementFromExpression } from '@kbn/interpreter/common'; -import { interpretAst } from 'plugins/interpreter/interpreter'; import { getPages, getNodeById, getNodes, getSelectedPageIndex } from '../selectors/workpad'; import { getValue as getResolvedArgsValue } from '../selectors/resolved_args'; import { getDefaultElement } from '../defaults'; import { ErrorStrings } from '../../../i18n'; import { notify } from '../../lib/notify'; -import { runInterpreter } from '../../lib/run_interpreter'; +import { runInterpreter, interpretAst } from '../../lib/run_interpreter'; import { subMultitree } from '../../lib/aeroelastic/functional'; import { selectToplevelNodes } from './transient'; import * as args from './resolved_args'; diff --git a/x-pack/legacy/plugins/canvas/server/plugin.ts b/x-pack/legacy/plugins/canvas/server/plugin.ts index 014ff244e6e0c..61cb81c91279a 100644 --- a/x-pack/legacy/plugins/canvas/server/plugin.ts +++ b/x-pack/legacy/plugins/canvas/server/plugin.ts @@ -5,10 +5,7 @@ */ import { CoreSetup, PluginsSetup } from './shim'; -import { functions } from '../canvas_plugin_src/functions/server'; export class Plugin { - public setup(core: CoreSetup, plugins: PluginsSetup) { - plugins.interpreter.register({ serverFunctions: functions }); - } + public setup(core: CoreSetup, plugins: PluginsSetup) {} } diff --git a/x-pack/legacy/plugins/canvas/types/functions.ts b/x-pack/legacy/plugins/canvas/types/functions.ts index 3344f9b3ae9f2..afe5614ac6e5a 100644 --- a/x-pack/legacy/plugins/canvas/types/functions.ts +++ b/x-pack/legacy/plugins/canvas/types/functions.ts @@ -8,7 +8,7 @@ import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { functions as commonFunctions } from '../canvas_plugin_src/functions/common'; import { functions as browserFunctions } from '../canvas_plugin_src/functions/browser'; import { functions as serverFunctions } from '../canvas_plugin_src/functions/server'; -import { clientFunctions } from '../public/functions'; +import { initFunctions } from '../public/functions'; /** * A `ExpressionFunctionFactory` is a powerful type used for any function that produces @@ -87,7 +87,9 @@ export type FunctionFactory = type CommonFunction = FunctionFactory; type BrowserFunction = FunctionFactory; type ServerFunction = FunctionFactory; -type ClientFunctions = FunctionFactory; +type ClientFunctions = FunctionFactory< + ReturnType extends Array ? U : never +>; /** * A collection of all Canvas Functions. diff --git a/x-pack/plugins/canvas/kibana.json b/x-pack/plugins/canvas/kibana.json index 6e12164b61c5e..3cc442d591f3f 100644 --- a/x-pack/plugins/canvas/kibana.json +++ b/x-pack/plugins/canvas/kibana.json @@ -5,6 +5,6 @@ "configPath": ["xpack", "canvas"], "server": true, "ui": false, - "requiredPlugins": ["features", "home"], + "requiredPlugins": ["expressions", "features", "home"], "optionalPlugins": ["usageCollection"] } diff --git a/x-pack/plugins/canvas/server/plugin.ts b/x-pack/plugins/canvas/server/plugin.ts index a94c711b56e05..bfda7ef5885bc 100644 --- a/x-pack/plugins/canvas/server/plugin.ts +++ b/x-pack/plugins/canvas/server/plugin.ts @@ -6,17 +6,20 @@ import { first } from 'rxjs/operators'; import { CoreSetup, PluginInitializerContext, Plugin, Logger } from 'src/core/server'; +import { ExpressionsServerSetup } from 'src/plugins/expressions/server'; import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import { HomeServerPluginSetup } from 'src/plugins/home/server'; import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server'; import { initRoutes } from './routes'; import { registerCanvasUsageCollector } from './collectors'; import { loadSampleData } from './sample_data'; +import { setupInterpreter } from './setup_interpreter'; interface PluginsSetup { - usageCollection?: UsageCollectionSetup; + expressions: ExpressionsServerSetup; features: FeaturesPluginSetup; home: HomeServerPluginSetup; + usageCollection?: UsageCollectionSetup; } export class CanvasPlugin implements Plugin { @@ -65,6 +68,8 @@ export class CanvasPlugin implements Plugin { .pipe(first()) .toPromise(); registerCanvasUsageCollector(plugins.usageCollection, globalConfig.kibana.index); + + setupInterpreter(plugins.expressions); } public start() {} diff --git a/x-pack/plugins/canvas/server/setup_interpreter.ts b/x-pack/plugins/canvas/server/setup_interpreter.ts new file mode 100644 index 0000000000000..74dd8decbea69 --- /dev/null +++ b/x-pack/plugins/canvas/server/setup_interpreter.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 { ExpressionsServerSetup } from 'src/plugins/expressions/server'; +import { functions } from '../../../legacy/plugins/canvas/canvas_plugin_src/functions/server'; + +export function setupInterpreter(expressions: ExpressionsServerSetup) { + expressions.__LEGACY.register({ types: [], serverFunctions: functions }); +} From 848188e5178cc4913ddaf9561554910391536d19 Mon Sep 17 00:00:00 2001 From: Robert Oskamp Date: Tue, 10 Mar 2020 14:15:20 +0100 Subject: [PATCH 10/23] [ML] Functional tests - re-activate date_nanos test (#59649) This PR re-activates the date_nanos functional UI test. --- .../apps/machine_learning/anomaly_detection/date_nanos_job.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/test/functional/apps/machine_learning/anomaly_detection/date_nanos_job.ts b/x-pack/test/functional/apps/machine_learning/anomaly_detection/date_nanos_job.ts index 6af27d558432d..2a9824f46778d 100644 --- a/x-pack/test/functional/apps/machine_learning/anomaly_detection/date_nanos_job.ts +++ b/x-pack/test/functional/apps/machine_learning/anomaly_detection/date_nanos_job.ts @@ -165,8 +165,7 @@ export default function({ getService }: FtrProviderContext) { }, ]; - // test failures, see #59419 - describe.skip('job on data set with date_nanos time field', function() { + describe('job on data set with date_nanos time field', function() { this.tags(['smoke', 'mlqa']); before(async () => { await esArchiver.load('ml/event_rate_nanos'); From eb533c82116efe458bd9bc2ae9eb15ea1d363473 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 10 Mar 2020 07:33:20 -0600 Subject: [PATCH 11/23] [Maps] convert tooltip classes to typescript (#59589) * getting started * fix ts lint errors * TS es_tooltip_property * convert ESAggTooltipProperty to TS * final clean up * ts lint cleanup * review feedback * remove unused import Co-authored-by: Elastic Machine --- .../maps/public/layers/fields/es_agg_field.ts | 15 ++-- .../maps/public/layers/fields/es_doc_field.js | 4 +- .../maps/public/layers/fields/field.ts | 4 +- .../fields/top_term_percentage_field.ts | 4 +- .../plugins/maps/public/layers/joins/join.ts | 11 +++ .../public/layers/sources/es_term_source.d.ts | 12 +++ .../tooltips/es_agg_tooltip_property.ts | 12 +++ .../tooltips/es_aggmetric_tooltip_property.js | 40 ---------- .../layers/tooltips/es_tooltip_property.js | 49 ------------ .../layers/tooltips/es_tooltip_property.ts | 75 +++++++++++++++++++ ...p_property.js => join_tooltip_property.ts} | 27 ++++--- .../layers/tooltips/tooltip_property.js | 39 ---------- .../layers/tooltips/tooltip_property.ts | 53 +++++++++++++ 13 files changed, 194 insertions(+), 151 deletions(-) create mode 100644 x-pack/legacy/plugins/maps/public/layers/joins/join.ts create mode 100644 x-pack/legacy/plugins/maps/public/layers/sources/es_term_source.d.ts create mode 100644 x-pack/legacy/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts delete mode 100644 x-pack/legacy/plugins/maps/public/layers/tooltips/es_aggmetric_tooltip_property.js delete mode 100644 x-pack/legacy/plugins/maps/public/layers/tooltips/es_tooltip_property.js create mode 100644 x-pack/legacy/plugins/maps/public/layers/tooltips/es_tooltip_property.ts rename x-pack/legacy/plugins/maps/public/layers/tooltips/{join_tooltip_property.js => join_tooltip_property.ts} (63%) delete mode 100644 x-pack/legacy/plugins/maps/public/layers/tooltips/tooltip_property.js create mode 100644 x-pack/legacy/plugins/maps/public/layers/tooltips/tooltip_property.ts diff --git a/x-pack/legacy/plugins/maps/public/layers/fields/es_agg_field.ts b/x-pack/legacy/plugins/maps/public/layers/fields/es_agg_field.ts index 9f08200442fea..5aa214772259a 100644 --- a/x-pack/legacy/plugins/maps/public/layers/fields/es_agg_field.ts +++ b/x-pack/legacy/plugins/maps/public/layers/fields/es_agg_field.ts @@ -13,10 +13,10 @@ import { IVectorSource } from '../sources/vector_source'; import { ESDocField } from './es_doc_field'; import { AGG_TYPE, FIELD_ORIGIN } from '../../../common/constants'; import { isMetricCountable } from '../util/is_metric_countable'; -// @ts-ignore -import { ESAggMetricTooltipProperty } from '../tooltips/es_aggmetric_tooltip_property'; import { getField, addFieldToDSL } from '../util/es_agg_utils'; import { TopTermPercentageField } from './top_term_percentage_field'; +import { ITooltipProperty, TooltipProperty } from '../tooltips/tooltip_property'; +import { ESAggTooltipProperty } from '../tooltips/es_agg_tooltip_property'; export interface IESAggField extends IField { getValueAggDsl(indexPattern: IndexPattern): unknown | null; @@ -92,15 +92,10 @@ export class ESAggField implements IESAggField { return this._esDocField ? this._esDocField.getName() : ''; } - async createTooltipProperty(value: number | string): Promise { + async createTooltipProperty(value: string | undefined): Promise { const indexPattern = await this._source.getIndexPattern(); - return new ESAggMetricTooltipProperty( - this.getName(), - await this.getLabel(), - value, - indexPattern, - this - ); + const tooltipProperty = new TooltipProperty(this.getName(), await this.getLabel(), value); + return new ESAggTooltipProperty(tooltipProperty, indexPattern, this); } getValueAggDsl(indexPattern: IndexPattern): unknown | null { diff --git a/x-pack/legacy/plugins/maps/public/layers/fields/es_doc_field.js b/x-pack/legacy/plugins/maps/public/layers/fields/es_doc_field.js index ea7641ed5e8dd..4bd33a8a769f8 100644 --- a/x-pack/legacy/plugins/maps/public/layers/fields/es_doc_field.js +++ b/x-pack/legacy/plugins/maps/public/layers/fields/es_doc_field.js @@ -6,6 +6,7 @@ import { AbstractField } from './field'; import { ESTooltipProperty } from '../tooltips/es_tooltip_property'; +import { TooltipProperty } from '../tooltips/tooltip_property'; import { COLOR_PALETTE_MAX_SIZE } from '../../../common/constants'; import { indexPatterns } from '../../../../../../../src/plugins/data/public'; @@ -20,7 +21,8 @@ export class ESDocField extends AbstractField { async createTooltipProperty(value) { const indexPattern = await this._source.getIndexPattern(); - return new ESTooltipProperty(this.getName(), this.getName(), value, indexPattern); + const tooltipProperty = new TooltipProperty(this.getName(), this.getName(), value); + return new ESTooltipProperty(tooltipProperty, indexPattern, this); } async getDataType() { diff --git a/x-pack/legacy/plugins/maps/public/layers/fields/field.ts b/x-pack/legacy/plugins/maps/public/layers/fields/field.ts index f7c27fec1c6c7..2c665dd9a0b73 100644 --- a/x-pack/legacy/plugins/maps/public/layers/fields/field.ts +++ b/x-pack/legacy/plugins/maps/public/layers/fields/field.ts @@ -6,6 +6,7 @@ import { FIELD_ORIGIN } from '../../../common/constants'; import { IVectorSource } from '../sources/vector_source'; +import { ITooltipProperty } from '../tooltips/tooltip_property'; export interface IField { getName(): string; @@ -13,6 +14,7 @@ export interface IField { canValueBeFormatted(): boolean; getLabel(): Promise; getDataType(): Promise; + createTooltipProperty(value: string | undefined): Promise; getSource(): IVectorSource; getOrigin(): FIELD_ORIGIN; isValid(): boolean; @@ -65,7 +67,7 @@ export class AbstractField implements IField { return this._fieldName; } - async createTooltipProperty(): Promise { + async createTooltipProperty(value: string | undefined): Promise { throw new Error('must implement Field#createTooltipProperty'); } diff --git a/x-pack/legacy/plugins/maps/public/layers/fields/top_term_percentage_field.ts b/x-pack/legacy/plugins/maps/public/layers/fields/top_term_percentage_field.ts index cadf325652370..bdc01f3323a9c 100644 --- a/x-pack/legacy/plugins/maps/public/layers/fields/top_term_percentage_field.ts +++ b/x-pack/legacy/plugins/maps/public/layers/fields/top_term_percentage_field.ts @@ -7,7 +7,7 @@ import { IESAggField } from './es_agg_field'; import { IVectorSource } from '../sources/vector_source'; // @ts-ignore -import { TooltipProperty } from '../tooltips/tooltip_property'; +import { ITooltipProperty, TooltipProperty } from '../tooltips/tooltip_property'; import { TOP_TERM_PERCENTAGE_SUFFIX } from '../../../common/constants'; import { FIELD_ORIGIN } from '../../../common/constants'; @@ -48,7 +48,7 @@ export class TopTermPercentageField implements IESAggField { return 'number'; } - async createTooltipProperty(value: unknown): Promise { + async createTooltipProperty(value: string | undefined): Promise { return new TooltipProperty(this.getName(), await this.getLabel(), value); } diff --git a/x-pack/legacy/plugins/maps/public/layers/joins/join.ts b/x-pack/legacy/plugins/maps/public/layers/joins/join.ts new file mode 100644 index 0000000000000..7d402dc777fdc --- /dev/null +++ b/x-pack/legacy/plugins/maps/public/layers/joins/join.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { IESTermSource } from '../sources/es_term_source'; + +export interface IJoin { + getRightJoinSource(): IESTermSource; +} diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_term_source.d.ts b/x-pack/legacy/plugins/maps/public/layers/sources/es_term_source.d.ts new file mode 100644 index 0000000000000..44cdc851b4fc7 --- /dev/null +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_term_source.d.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 { IField } from '../fields/field'; +import { IESAggSource } from './es_agg_source'; + +export interface IESTermSource extends IESAggSource { + getTermField(): IField; +} diff --git a/x-pack/legacy/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts b/x-pack/legacy/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts new file mode 100644 index 0000000000000..24011c51ddbaa --- /dev/null +++ b/x-pack/legacy/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.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 { ESTooltipProperty } from './es_tooltip_property'; + +export class ESAggTooltipProperty extends ESTooltipProperty { + isFilterable(): boolean { + return false; + } +} diff --git a/x-pack/legacy/plugins/maps/public/layers/tooltips/es_aggmetric_tooltip_property.js b/x-pack/legacy/plugins/maps/public/layers/tooltips/es_aggmetric_tooltip_property.js deleted file mode 100644 index ea000a78331eb..0000000000000 --- a/x-pack/legacy/plugins/maps/public/layers/tooltips/es_aggmetric_tooltip_property.js +++ /dev/null @@ -1,40 +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 { ESTooltipProperty } from './es_tooltip_property'; -import { AGG_TYPE } from '../../../common/constants'; - -export class ESAggMetricTooltipProperty extends ESTooltipProperty { - constructor(propertyKey, propertyName, rawValue, indexPattern, metricField) { - super(propertyKey, propertyName, rawValue, indexPattern); - this._metricField = metricField; - } - - isFilterable() { - return false; - } - - getHtmlDisplayValue() { - if (typeof this._rawValue === 'undefined') { - return '-'; - } - if ( - this._metricField.getAggType() === AGG_TYPE.COUNT || - this._metricField.getAggType() === AGG_TYPE.UNIQUE_COUNT - ) { - return this._rawValue; - } - const indexPatternField = this._indexPattern.fields.getByName(this._metricField.getRootName()); - if (!indexPatternField) { - return this._rawValue; - } - const htmlConverter = indexPatternField.format.getConverterFor('html'); - - return htmlConverter - ? htmlConverter(this._rawValue) - : indexPatternField.format.convert(this._rawValue); - } -} diff --git a/x-pack/legacy/plugins/maps/public/layers/tooltips/es_tooltip_property.js b/x-pack/legacy/plugins/maps/public/layers/tooltips/es_tooltip_property.js deleted file mode 100644 index f66960263c31d..0000000000000 --- a/x-pack/legacy/plugins/maps/public/layers/tooltips/es_tooltip_property.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { TooltipProperty } from './tooltip_property'; -import _ from 'lodash'; -import { esFilters } from '../../../../../../../src/plugins/data/public'; -export class ESTooltipProperty extends TooltipProperty { - constructor(propertyKey, propertyName, rawValue, indexPattern) { - super(propertyKey, propertyName, rawValue); - this._indexPattern = indexPattern; - } - - getHtmlDisplayValue() { - if (typeof this._rawValue === 'undefined') { - return '-'; - } - - const field = this._indexPattern.fields.getByName(this._propertyName); - if (!field) { - return _.escape(this._rawValue); - } - const htmlConverter = field.format.getConverterFor('html'); - return htmlConverter ? htmlConverter(this._rawValue) : field.format.convert(this._rawValue); - } - - isFilterable() { - const field = this._indexPattern.fields.getByName(this._propertyName); - return ( - field && - (field.type === 'string' || - field.type === 'date' || - field.type === 'ip' || - field.type === 'number') - ); - } - - async getESFilters() { - return [ - esFilters.buildPhraseFilter( - this._indexPattern.fields.getByName(this._propertyName), - this._rawValue, - this._indexPattern - ), - ]; - } -} diff --git a/x-pack/legacy/plugins/maps/public/layers/tooltips/es_tooltip_property.ts b/x-pack/legacy/plugins/maps/public/layers/tooltips/es_tooltip_property.ts new file mode 100644 index 0000000000000..8fd7e173435ce --- /dev/null +++ b/x-pack/legacy/plugins/maps/public/layers/tooltips/es_tooltip_property.ts @@ -0,0 +1,75 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import _ from 'lodash'; +import { ITooltipProperty } from './tooltip_property'; +import { IField } from '../fields/field'; +import { esFilters, IFieldType, IndexPattern } from '../../../../../../../src/plugins/data/public'; +import { PhraseFilter } from '../../../../../../../src/plugins/data/public'; + +export class ESTooltipProperty implements ITooltipProperty { + private readonly _tooltipProperty: ITooltipProperty; + private readonly _indexPattern: IndexPattern; + private readonly _field: IField; + + constructor(tooltipProperty: ITooltipProperty, indexPattern: IndexPattern, field: IField) { + this._tooltipProperty = tooltipProperty; + this._indexPattern = indexPattern; + this._field = field; + } + + getPropertyKey(): string { + return this._tooltipProperty.getPropertyKey(); + } + + getPropertyName(): string { + return this._tooltipProperty.getPropertyName(); + } + + getRawValue(): string | undefined { + return this._tooltipProperty.getRawValue(); + } + + _getIndexPatternField(): IFieldType | undefined { + return this._indexPattern.fields.getByName(this._field.getRootName()); + } + + getHtmlDisplayValue(): string { + if (typeof this.getRawValue() === 'undefined') { + return '-'; + } + + const indexPatternField = this._getIndexPatternField(); + if (!indexPatternField || !this._field.canValueBeFormatted()) { + return _.escape(this.getRawValue()); + } + + const htmlConverter = indexPatternField.format.getConverterFor('html'); + return htmlConverter + ? htmlConverter(this.getRawValue()) + : indexPatternField.format.convert(this.getRawValue()); + } + + isFilterable(): boolean { + const indexPatternField = this._getIndexPatternField(); + return ( + !!indexPatternField && + (indexPatternField.type === 'string' || + indexPatternField.type === 'date' || + indexPatternField.type === 'ip' || + indexPatternField.type === 'number') + ); + } + + async getESFilters(): Promise { + const indexPatternField = this._getIndexPatternField(); + if (!indexPatternField) { + return []; + } + + return [esFilters.buildPhraseFilter(indexPatternField, this.getRawValue(), this._indexPattern)]; + } +} diff --git a/x-pack/legacy/plugins/maps/public/layers/tooltips/join_tooltip_property.js b/x-pack/legacy/plugins/maps/public/layers/tooltips/join_tooltip_property.ts similarity index 63% rename from x-pack/legacy/plugins/maps/public/layers/tooltips/join_tooltip_property.js rename to x-pack/legacy/plugins/maps/public/layers/tooltips/join_tooltip_property.ts index e62f93c959faa..02f0920ce3c61 100644 --- a/x-pack/legacy/plugins/maps/public/layers/tooltips/join_tooltip_property.js +++ b/x-pack/legacy/plugins/maps/public/layers/tooltips/join_tooltip_property.ts @@ -4,32 +4,40 @@ * you may not use this file except in compliance with the Elastic License. */ -import { TooltipProperty } from './tooltip_property'; +import { ITooltipProperty } from './tooltip_property'; +import { IJoin } from '../joins/join'; +import { PhraseFilter } from '../../../../../../../src/plugins/data/public'; -export class JoinTooltipProperty extends TooltipProperty { - constructor(tooltipProperty, leftInnerJoins) { - super(); +export class JoinTooltipProperty implements ITooltipProperty { + private readonly _tooltipProperty: ITooltipProperty; + private readonly _leftInnerJoins: IJoin[]; + + constructor(tooltipProperty: ITooltipProperty, leftInnerJoins: IJoin[]) { this._tooltipProperty = tooltipProperty; this._leftInnerJoins = leftInnerJoins; } - isFilterable() { + isFilterable(): boolean { return true; } - getPropertyKey() { + getPropertyKey(): string { return this._tooltipProperty.getPropertyKey(); } - getPropertyName() { + getPropertyName(): string { return this._tooltipProperty.getPropertyName(); } - getHtmlDisplayValue() { + getRawValue(): string | undefined { + return this._tooltipProperty.getRawValue(); + } + + getHtmlDisplayValue(): string { return this._tooltipProperty.getHtmlDisplayValue(); } - async getESFilters() { + async getESFilters(): Promise { const esFilters = []; if (this._tooltipProperty.isFilterable()) { esFilters.push(...(await this._tooltipProperty.getESFilters())); @@ -46,6 +54,7 @@ export class JoinTooltipProperty extends TooltipProperty { esFilters.push(...(await esTooltipProperty.getESFilters())); } } catch (e) { + // eslint-disable-next-line no-console console.error('Cannot create joined filter', e); } } diff --git a/x-pack/legacy/plugins/maps/public/layers/tooltips/tooltip_property.js b/x-pack/legacy/plugins/maps/public/layers/tooltips/tooltip_property.js deleted file mode 100644 index e063913abf433..0000000000000 --- a/x-pack/legacy/plugins/maps/public/layers/tooltips/tooltip_property.js +++ /dev/null @@ -1,39 +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 _ from 'lodash'; - -export class TooltipProperty { - constructor(propertyKey, propertyName, rawValue) { - this._propertyKey = propertyKey; - this._propertyName = propertyName; - this._rawValue = rawValue; - } - - getPropertyKey() { - return this._propertyKey; - } - - getPropertyName() { - return this._propertyName; - } - - getHtmlDisplayValue() { - return _.escape(this._rawValue); - } - - getRawValue() { - return this._rawValue; - } - - isFilterable() { - return false; - } - - async getESFilters() { - return []; - } -} diff --git a/x-pack/legacy/plugins/maps/public/layers/tooltips/tooltip_property.ts b/x-pack/legacy/plugins/maps/public/layers/tooltips/tooltip_property.ts new file mode 100644 index 0000000000000..3428cb9589267 --- /dev/null +++ b/x-pack/legacy/plugins/maps/public/layers/tooltips/tooltip_property.ts @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import _ from 'lodash'; +import { PhraseFilter } from '../../../../../../../src/plugins/data/public'; + +export interface ITooltipProperty { + getPropertyKey(): string; + getPropertyName(): string; + getHtmlDisplayValue(): string; + getRawValue(): string | undefined; + isFilterable(): boolean; + getESFilters(): Promise; +} + +export class TooltipProperty implements ITooltipProperty { + private readonly _propertyKey: string; + private readonly _propertyName: string; + private readonly _rawValue: string | undefined; + + constructor(propertyKey: string, propertyName: string, rawValue: string | undefined) { + this._propertyKey = propertyKey; + this._propertyName = propertyName; + this._rawValue = rawValue; + } + + getPropertyKey(): string { + return this._propertyKey; + } + + getPropertyName(): string { + return this._propertyName; + } + + getHtmlDisplayValue(): string { + return _.escape(this._rawValue); + } + + getRawValue(): string | undefined { + return this._rawValue; + } + + isFilterable(): boolean { + return false; + } + + async getESFilters(): Promise { + return []; + } +} From b56cd414127382b9d8928ec328d83df462ee2575 Mon Sep 17 00:00:00 2001 From: Ryland Herrick Date: Tue, 10 Mar 2020 09:11:17 -0500 Subject: [PATCH 12/23] [SIEM] Fix and consolidate handling of error responses in the client (#59438) * Convert our manual throwing of TypeError to a custom Error Throwing a TypeError meant that our manual errors were indistinguishable from, say, trying to invoke a method on undefined. This adds a custom error, BadRequestError, that disambiguates that situation. * Present API Error messages to the user With Core's new HTTP client, an unsuccessful API call will raise an error containing the body of the response it received. In the case of SIEM endpoints, this will include a useful error message with potentially more specificity than e.g. 'Internal Server Error'. This adds a type predicate to check for such errors, and adds a handling case in our errorToToaster handler. If the error does not contain our SIEM-specific message, it will fall through as normal and the general error.message will be displayed in the toaster. * Remove unnecessary use of throwIfNotOk in our client API calls The new HTTP client raises an error on a 4xx or 5xx response, so there should not be a case where throwIfNotOk is actually going to throw an error. The established pattern on the frontend is to catch errors at the call site and handle them appropriately, so I'm mainly just verifying that these are caught where they're used, now. * Move errorToToaster and ToasterError to general location These were living in ML since that's where they originated. However, we have need of it (and already use it) elsewhere. The basic pattern for error handling on the frontend is: 1) API call throws error 2) caller catches error and dispatches a toast throwIfNotOk is meant to convert the error into a useful message in 1). We currently use both errorToToaster and displayErrorToast to display that in a toaster in 2) Now that errorToToaster handles a few different types of errors, and throwIfNotOk is going to be bypassed due to the new client behavior of throwing on error, we're going to start consolidating on: 1) Api call throws error 2) caller catches error and passes it to errorToToaster * Refactor Rules API functions to not use throwIfNotOk * Ensures that all callers of these methods properly catch errors * Updates error toasterification to use errorToToaster * Simplifies tests now that we mainly just invoke the http client and return the result. throwIfNotOk is not being used in the majority of cases, as the client raises an error and bypasses that call. The few cases this might break are where we return a 200 but have errors within the response. Whether throwIfNotOk handled this or not, I'll need a simpler helper to accomplish the same behavior. * Define a type for our BulkRule responses These can be an array of errors OR rules; typing it as such forces downstream to deal with both. enableRules was being handled correctly with the bucketing helper, and TS has confirmed the rest are as well. This obviates the need to raise from our API calls, as bulk errors are recoverable and we want to both a) continue on with any successful rules and b) handle the errors as necessary. This is highly dependent on the caller and so we can't/shouldn't handle it here. * Address case where bulk rules errors were not handled I'm not sure that we're ever using this non-dispatch version, but it was throwing a type error. Will bring it up in review. * Remove more throwIfNotOk uses from API calls These are unneeded as an error response will already throw an error to be handled at the call site. * Display an error toaster on newsfeed fetch failure * Remove dead code This was left over as a result of #56261 * Remove throwIfNotOk from case API calls Again, not needed because the client already throws. * Update use_get_tags for NP * Gets rid of throwIfNotOK usage * uses core http fetch * Remove throwIfNotOk from signals API * Remove throwIfNotOk This served the same purpose as errorToToaster, but in a less robust way. All usages have been replaced, so now we say goodbye. * Remove custom errors in favor of KibanaApiError and isApiError type predicate There was no functional difference between these two code paths, and removing these custom errors allowed us to delete a bunch of associated code as well.. * Fix test failures These were mainly related to my swapping any remaining fetch calls with the core router as good kibana denizens should :salute: * Replace use of core mocks with our simpler local ones This is enough to get our tests to pass. We can't use the core mocks for now since there are circular dependencies there, which breaks our build. * add signal api unit tests * privilege unit test api * Add unit tests on the signals container * Refactor signals API tests to use core mocks * Simplifies our mocking verbosity by leveraging core mocks * Simplifies test setup by isolating a reference to our fetch mock * Abstracts response structure to pure helper functions The try/catch tests had some false positives in that nothing would be asserted if the code did not throw an error. These proved to be masking a gap in coverage for our get/create signal index requests, which do not leverage `throwIfNotOk` but instead rely on the fetch to throw an error; once that behavior is verified we can update those tests to have our fetchMock throw errors, and we should be all set. * Simplify signals API tests now that the subjects do less We no longer re-throw errors, or parse the response, we just return the result of the client call. Simple! * Simplify API functions to use implict returns When possible. Also adds missing error-throwing documentation where necessary. * Revert "Display an error toaster on newsfeed fetch failure" This reverts commit 64213221f54af5195075f5885fca00c11ad61fc9. * Error property is readonly * Pull uuid generation into default argument value * Fix type predicate isApiError Uses has to properly inspect our errorish object. Turns out we have a 'message' property, not an 'error' property. * Fix test setup following modification of type predicate We need a message (via new Error), a body.message, and a body.status_code to satisfy isApiError. Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Co-authored-by: Elastic Machine --- .../ml/anomaly/use_anomalies_table_data.ts | 3 +- .../components/ml/api/anomalies_table_data.ts | 20 +- .../components/ml/api/error_to_toaster.ts | 67 -- .../siem/public/components/ml/api/errors.ts | 20 + .../components/ml/api/get_ml_capabilities.ts | 18 +- .../ml}/api/throw_if_not_ok.test.ts | 37 +- .../ml}/api/throw_if_not_ok.ts | 40 +- .../permissions/ml_capabilities_provider.tsx | 3 +- .../siem/public/components/ml_popover/api.tsx | 90 +- .../ml_popover/hooks/use_siem_jobs.tsx | 3 +- .../components/ml_popover/ml_popover.tsx | 3 +- .../components/news_feed/helpers.test.ts | 35 +- .../public/components/news_feed/helpers.ts | 10 +- .../components/recent_timelines/helpers.ts | 20 - .../components/recent_timelines/index.tsx | 4 - .../recent_timelines/recent_timelines.tsx | 4 - .../siem/public/components/toasters/errors.ts | 18 + .../siem/public/components/toasters/index.tsx | 51 +- .../utils.test.ts} | 95 +- .../siem/public/components/toasters/utils.ts | 123 ++ .../siem/public/containers/case/api.ts | 29 +- .../public/containers/case/use_get_case.tsx | 3 +- .../public/containers/case/use_get_cases.tsx | 3 +- .../public/containers/case/use_get_tags.tsx | 3 +- .../public/containers/case/use_post_case.tsx | 4 +- .../containers/case/use_post_comment.tsx | 3 +- .../containers/case/use_update_case.tsx | 3 +- .../containers/case/use_update_comment.tsx | 3 +- .../siem/public/containers/case/utils.ts | 4 +- .../detection_engine/rules/api.test.ts | 439 ++----- .../containers/detection_engine/rules/api.ts | 210 ++-- .../rules/fetch_index_patterns.tsx | 3 +- .../detection_engine/rules/persist_rule.tsx | 3 +- .../detection_engine/rules/types.ts | 5 +- .../rules/use_pre_packaged_rules.tsx | 3 +- .../detection_engine/rules/use_rule.tsx | 3 +- .../rules/use_rule_status.tsx | 3 +- .../detection_engine/rules/use_rules.tsx | 3 +- .../detection_engine/rules/use_tags.test.tsx | 4 +- .../detection_engine/rules/use_tags.tsx | 3 +- .../detection_engine/signals/__mocks__/api.ts | 29 + .../detection_engine/signals/api.test.ts | 165 +++ .../detection_engine/signals/api.ts | 86 +- .../signals/errors_types/get_index_error.ts | 24 - .../signals/errors_types/post_index_error.ts | 24 - .../errors_types/privilege_user_error.ts | 24 - .../detection_engine/signals/mock.ts | 1037 +++++++++++++++++ .../detection_engine/signals/types.ts | 2 - .../signals/use_privilege_user.test.tsx | 70 ++ .../signals/use_privilege_user.tsx | 9 +- .../signals/use_query.test.tsx | 130 +++ .../detection_engine/signals/use_query.tsx | 6 +- .../signals/use_signal_index.test.tsx | 127 ++ .../signals/use_signal_index.tsx | 15 +- .../matrix_histogram/index.test.tsx | 7 +- .../containers/matrix_histogram/index.ts | 3 +- .../plugins/siem/public/hooks/api/api.test.ts | 44 - .../plugins/siem/public/hooks/api/api.tsx | 23 - .../siem/public/hooks/use_index_patterns.tsx | 3 +- .../detection_engine/rules/all/actions.tsx | 17 +- .../detection_engine/rules/all/helpers.ts | 7 +- .../components/import_rule_modal/index.tsx | 5 +- .../components/rule_downloader/index.tsx | 4 +- .../rules/components/rule_switch/index.tsx | 30 +- .../plugins/siem/public/utils/api/index.ts | 23 +- .../errors/bad_request_error.ts} | 4 +- .../lib/detection_engine/routes/utils.test.ts | 17 +- .../lib/detection_engine/routes/utils.ts | 10 +- .../create_rules_stream_from_ndjson.test.ts | 9 +- .../rules/create_rules_stream_from_ndjson.ts | 3 +- .../rules/get_prepackaged_rules.ts | 3 +- .../detection_engine/signals/get_filter.ts | 5 +- 72 files changed, 2142 insertions(+), 1221 deletions(-) delete mode 100644 x-pack/legacy/plugins/siem/public/components/ml/api/error_to_toaster.ts create mode 100644 x-pack/legacy/plugins/siem/public/components/ml/api/errors.ts rename x-pack/legacy/plugins/siem/public/{hooks => components/ml}/api/throw_if_not_ok.test.ts (96%) rename x-pack/legacy/plugins/siem/public/{hooks => components/ml}/api/throw_if_not_ok.ts (63%) delete mode 100644 x-pack/legacy/plugins/siem/public/components/recent_timelines/helpers.ts create mode 100644 x-pack/legacy/plugins/siem/public/components/toasters/errors.ts rename x-pack/legacy/plugins/siem/public/components/{ml/api/error_to_toaster.test.ts => toasters/utils.test.ts} (57%) create mode 100644 x-pack/legacy/plugins/siem/public/components/toasters/utils.ts create mode 100644 x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/__mocks__/api.ts create mode 100644 x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/api.test.ts delete mode 100644 x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/get_index_error.ts delete mode 100644 x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/post_index_error.ts delete mode 100644 x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/privilege_user_error.ts create mode 100644 x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/mock.ts create mode 100644 x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_privilege_user.test.tsx create mode 100644 x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_query.test.tsx create mode 100644 x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_signal_index.test.tsx delete mode 100644 x-pack/legacy/plugins/siem/public/hooks/api/api.test.ts rename x-pack/legacy/plugins/siem/{public/containers/detection_engine/signals/errors_types/index.ts => server/lib/detection_engine/errors/bad_request_error.ts} (68%) diff --git a/x-pack/legacy/plugins/siem/public/components/ml/anomaly/use_anomalies_table_data.ts b/x-pack/legacy/plugins/siem/public/components/ml/anomaly/use_anomalies_table_data.ts index 0baa1ef7cdd05..ad59d3dc436a7 100644 --- a/x-pack/legacy/plugins/siem/public/components/ml/anomaly/use_anomalies_table_data.ts +++ b/x-pack/legacy/plugins/siem/public/components/ml/anomaly/use_anomalies_table_data.ts @@ -10,8 +10,7 @@ import { InfluencerInput, Anomalies, CriteriaFields } from '../types'; import { hasMlUserPermissions } from '../permissions/has_ml_user_permissions'; import { MlCapabilitiesContext } from '../permissions/ml_capabilities_provider'; import { useSiemJobs } from '../../ml_popover/hooks/use_siem_jobs'; -import { useStateToaster } from '../../toasters'; -import { errorToToaster } from '../api/error_to_toaster'; +import { useStateToaster, errorToToaster } from '../../toasters'; import * as i18n from './translations'; import { useTimeZone, useUiSetting$ } from '../../../lib/kibana'; diff --git a/x-pack/legacy/plugins/siem/public/components/ml/api/anomalies_table_data.ts b/x-pack/legacy/plugins/siem/public/components/ml/api/anomalies_table_data.ts index 35dbbf012272e..b3876b28655b3 100644 --- a/x-pack/legacy/plugins/siem/public/components/ml/api/anomalies_table_data.ts +++ b/x-pack/legacy/plugins/siem/public/components/ml/api/anomalies_table_data.ts @@ -5,7 +5,6 @@ */ import { Anomalies, InfluencerInput, CriteriaFields } from '../types'; -import { throwIfNotOk } from '../../../hooks/api/api'; import { KibanaServices } from '../../../lib/kibana'; export interface Body { @@ -22,17 +21,10 @@ export interface Body { } export const anomaliesTableData = async (body: Body, signal: AbortSignal): Promise => { - const response = await KibanaServices.get().http.fetch( - '/api/ml/results/anomalies_table_data', - { - method: 'POST', - body: JSON.stringify(body), - asResponse: true, - asSystemRequest: true, - signal, - } - ); - - await throwIfNotOk(response.response); - return response.body!; + return KibanaServices.get().http.fetch('/api/ml/results/anomalies_table_data', { + method: 'POST', + body: JSON.stringify(body), + asSystemRequest: true, + signal, + }); }; diff --git a/x-pack/legacy/plugins/siem/public/components/ml/api/error_to_toaster.ts b/x-pack/legacy/plugins/siem/public/components/ml/api/error_to_toaster.ts deleted file mode 100644 index b341016fff6ef..0000000000000 --- a/x-pack/legacy/plugins/siem/public/components/ml/api/error_to_toaster.ts +++ /dev/null @@ -1,67 +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 { isError } from 'lodash/fp'; -import uuid from 'uuid'; -import { ActionToaster, AppToast } from '../../toasters'; -import { ToasterErrorsType, ToasterErrors } from '../../../hooks/api/throw_if_not_ok'; - -export type ErrorToToasterArgs = Partial & { - error: unknown; - dispatchToaster: React.Dispatch; -}; - -export const errorToToaster = ({ - id = uuid.v4(), - title, - error, - color = 'danger', - iconType = 'alert', - dispatchToaster, -}: ErrorToToasterArgs) => { - if (isToasterError(error)) { - const toast: AppToast = { - id, - title, - color, - iconType, - errors: error.messages, - }; - dispatchToaster({ - type: 'addToaster', - toast, - }); - } else if (isAnError(error)) { - const toast: AppToast = { - id, - title, - color, - iconType, - errors: [error.message], - }; - dispatchToaster({ - type: 'addToaster', - toast, - }); - } else { - const toast: AppToast = { - id, - title, - color, - iconType, - errors: ['Network Error'], - }; - dispatchToaster({ - type: 'addToaster', - toast, - }); - } -}; - -export const isAnError = (error: unknown): error is Error => isError(error); - -export const isToasterError = (error: unknown): error is ToasterErrorsType => - error instanceof ToasterErrors; diff --git a/x-pack/legacy/plugins/siem/public/components/ml/api/errors.ts b/x-pack/legacy/plugins/siem/public/components/ml/api/errors.ts new file mode 100644 index 0000000000000..f117b92c7106e --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/components/ml/api/errors.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { has } from 'lodash/fp'; + +import { MlError } from '../types'; + +export interface MlStartJobError { + error: MlError; + started: boolean; +} + +// use the "in operator" and regular type guards to do a narrow once this issue is fixed below: +// https://github.com/microsoft/TypeScript/issues/21732 +// Otherwise for now, has will work ok even though it casts 'unknown' to 'any' +export const isMlStartJobError = (value: unknown): value is MlStartJobError => + has('error.msg', value) && has('error.response', value) && has('error.statusCode', value); diff --git a/x-pack/legacy/plugins/siem/public/components/ml/api/get_ml_capabilities.ts b/x-pack/legacy/plugins/siem/public/components/ml/api/get_ml_capabilities.ts index feafbba2024dc..e69abc1a86e0e 100644 --- a/x-pack/legacy/plugins/siem/public/components/ml/api/get_ml_capabilities.ts +++ b/x-pack/legacy/plugins/siem/public/components/ml/api/get_ml_capabilities.ts @@ -5,7 +5,6 @@ */ import { InfluencerInput, MlCapabilities } from '../types'; -import { throwIfNotOk } from '../../../hooks/api/api'; import { KibanaServices } from '../../../lib/kibana'; export interface Body { @@ -22,16 +21,9 @@ export interface Body { } export const getMlCapabilities = async (signal: AbortSignal): Promise => { - const response = await KibanaServices.get().http.fetch( - '/api/ml/ml_capabilities', - { - method: 'GET', - asResponse: true, - asSystemRequest: true, - signal, - } - ); - - await throwIfNotOk(response.response); - return response.body!; + return KibanaServices.get().http.fetch('/api/ml/ml_capabilities', { + method: 'GET', + asSystemRequest: true, + signal, + }); }; diff --git a/x-pack/legacy/plugins/siem/public/hooks/api/throw_if_not_ok.test.ts b/x-pack/legacy/plugins/siem/public/components/ml/api/throw_if_not_ok.test.ts similarity index 96% rename from x-pack/legacy/plugins/siem/public/hooks/api/throw_if_not_ok.test.ts rename to x-pack/legacy/plugins/siem/public/components/ml/api/throw_if_not_ok.test.ts index bc0c765d6f2df..486b0f7e77412 100644 --- a/x-pack/legacy/plugins/siem/public/hooks/api/throw_if_not_ok.test.ts +++ b/x-pack/legacy/plugins/siem/public/components/ml/api/throw_if_not_ok.test.ts @@ -5,48 +5,21 @@ */ import fetchMock from 'fetch-mock'; + +import { ToasterError } from '../../toasters'; +import { SetupMlResponse } from '../../ml_popover/types'; +import { isMlStartJobError } from './errors'; import { - isMlStartJobError, - MessageBody, - parseJsonFromBody, throwIfErrorAttached, throwIfErrorAttachedToSetup, - ToasterErrors, tryParseResponse, } from './throw_if_not_ok'; -import { SetupMlResponse } from '../../components/ml_popover/types'; describe('throw_if_not_ok', () => { afterEach(() => { fetchMock.reset(); }); - describe('#parseJsonFromBody', () => { - test('parses a json from the body correctly', async () => { - fetchMock.mock('http://example.com', { - status: 500, - body: { - error: 'some error', - statusCode: 500, - message: 'I am a custom message', - }, - }); - const response = await fetch('http://example.com'); - const expected: MessageBody = { - error: 'some error', - statusCode: 500, - message: 'I am a custom message', - }; - await expect(parseJsonFromBody(response)).resolves.toEqual(expected); - }); - - test('returns null if the body does not exist', async () => { - fetchMock.mock('http://example.com', { status: 500, body: 'some text' }); - const response = await fetch('http://example.com'); - await expect(parseJsonFromBody(response)).resolves.toEqual(null); - }); - }); - describe('#tryParseResponse', () => { test('It formats a JSON object', () => { const parsed = tryParseResponse(JSON.stringify({ hello: 'how are you?' })); @@ -119,7 +92,7 @@ describe('throw_if_not_ok', () => { }, }; expect(() => throwIfErrorAttached(json, ['some-id'])).toThrow( - new ToasterErrors(['some message']) + new ToasterError(['some message']) ); }); diff --git a/x-pack/legacy/plugins/siem/public/hooks/api/throw_if_not_ok.ts b/x-pack/legacy/plugins/siem/public/components/ml/api/throw_if_not_ok.ts similarity index 63% rename from x-pack/legacy/plugins/siem/public/hooks/api/throw_if_not_ok.ts rename to x-pack/legacy/plugins/siem/public/components/ml/api/throw_if_not_ok.ts index 7d70106b0e562..4e92cbc76c933 100644 --- a/x-pack/legacy/plugins/siem/public/hooks/api/throw_if_not_ok.ts +++ b/x-pack/legacy/plugins/siem/public/components/ml/api/throw_if_not_ok.ts @@ -4,32 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { has } from 'lodash/fp'; - -import * as i18n from '../../components/ml/api/translations'; -import { MlError } from '../../components/ml/types'; -import { SetupMlResponse } from '../../components/ml_popover/types'; - -export { MessageBody, parseJsonFromBody } from '../../utils/api'; - -export interface MlStartJobError { - error: MlError; - started: boolean; -} - -export type ToasterErrorsType = Error & { - messages: string[]; -}; - -export class ToasterErrors extends Error implements ToasterErrorsType { - public messages: string[]; - - constructor(messages: string[]) { - super(messages[0]); - this.name = 'ToasterErrors'; - this.messages = messages; - } -} +import * as i18n from './translations'; +import { ToasterError } from '../../toasters'; +import { SetupMlResponse } from '../../ml_popover/types'; +import { isMlStartJobError } from './errors'; export const tryParseResponse = (response: string): string => { try { @@ -71,7 +49,7 @@ export const throwIfErrorAttachedToSetup = ( const errors = [...jobErrors, ...dataFeedErrors]; if (errors.length > 0) { - throw new ToasterErrors(errors); + throw new ToasterError(errors); } }; @@ -93,12 +71,6 @@ export const throwIfErrorAttached = ( } }, []); if (errors.length > 0) { - throw new ToasterErrors(errors); + throw new ToasterError(errors); } }; - -// use the "in operator" and regular type guards to do a narrow once this issue is fixed below: -// https://github.com/microsoft/TypeScript/issues/21732 -// Otherwise for now, has will work ok even though it casts 'unknown' to 'any' -export const isMlStartJobError = (value: unknown): value is MlStartJobError => - has('error.msg', value) && has('error.response', value) && has('error.statusCode', value); diff --git a/x-pack/legacy/plugins/siem/public/components/ml/permissions/ml_capabilities_provider.tsx b/x-pack/legacy/plugins/siem/public/components/ml/permissions/ml_capabilities_provider.tsx index cae05e26b115b..eee44abb44204 100644 --- a/x-pack/legacy/plugins/siem/public/components/ml/permissions/ml_capabilities_provider.tsx +++ b/x-pack/legacy/plugins/siem/public/components/ml/permissions/ml_capabilities_provider.tsx @@ -9,8 +9,7 @@ import React, { useState, useEffect } from 'react'; import { MlCapabilities } from '../types'; import { getMlCapabilities } from '../api/get_ml_capabilities'; import { emptyMlCapabilities } from '../empty_ml_capabilities'; -import { errorToToaster } from '../api/error_to_toaster'; -import { useStateToaster } from '../../toasters'; +import { errorToToaster, useStateToaster } from '../../toasters'; import * as i18n from './translations'; diff --git a/x-pack/legacy/plugins/siem/public/components/ml_popover/api.tsx b/x-pack/legacy/plugins/siem/public/components/ml_popover/api.tsx index 1ab996f88515b..f2bc7ca64565b 100644 --- a/x-pack/legacy/plugins/siem/public/components/ml_popover/api.tsx +++ b/x-pack/legacy/plugins/siem/public/components/ml_popover/api.tsx @@ -17,8 +17,7 @@ import { StartDatafeedResponse, StopDatafeedResponse, } from './types'; -import { throwIfErrorAttached, throwIfErrorAttachedToSetup } from '../../hooks/api/throw_if_not_ok'; -import { throwIfNotOk } from '../../hooks/api/api'; +import { throwIfErrorAttached, throwIfErrorAttachedToSetup } from '../ml/api/throw_if_not_ok'; import { KibanaServices } from '../../lib/kibana'; /** @@ -26,45 +25,36 @@ import { KibanaServices } from '../../lib/kibana'; * * @param indexPatternName ES index pattern to check for compatible modules * @param signal to cancel request + * + * @throws An error if response is not OK */ export const checkRecognizer = async ({ indexPatternName, signal, -}: CheckRecognizerProps): Promise => { - const response = await KibanaServices.get().http.fetch( +}: CheckRecognizerProps): Promise => + KibanaServices.get().http.fetch( `/api/ml/modules/recognize/${indexPatternName}`, { method: 'GET', - asResponse: true, asSystemRequest: true, signal, } ); - await throwIfNotOk(response.response); - return response.body!; -}; - /** * Returns ML Module for given moduleId. Returns all modules if no moduleId specified * * @param moduleId id of the module to retrieve * @param signal to cancel request + * + * @throws An error if response is not OK */ -export const getModules = async ({ moduleId = '', signal }: GetModulesProps): Promise => { - const response = await KibanaServices.get().http.fetch( - `/api/ml/modules/get_module/${moduleId}`, - { - method: 'GET', - asResponse: true, - asSystemRequest: true, - signal, - } - ); - - await throwIfNotOk(response.response); - return response.body!; -}; +export const getModules = async ({ moduleId = '', signal }: GetModulesProps): Promise => + KibanaServices.get().http.fetch(`/api/ml/modules/get_module/${moduleId}`, { + method: 'GET', + asSystemRequest: true, + signal, + }); /** * Creates ML Jobs + Datafeeds for the given configTemplate + indexPatternName @@ -74,6 +64,8 @@ export const getModules = async ({ moduleId = '', signal }: GetModulesProps): Pr * @param jobIdErrorFilter - if provided, filters all errors except for given jobIds * @param groups - list of groups to add to jobs being installed * @param prefix - prefix to be added to job name + * + * @throws An error if response is not OK */ export const setupMlJob = async ({ configTemplate, @@ -93,16 +85,12 @@ export const setupMlJob = async ({ startDatafeed: false, useDedicatedIndex: true, }), - asResponse: true, asSystemRequest: true, } ); - await throwIfNotOk(response.response); - const json = response.body!; - throwIfErrorAttachedToSetup(json, jobIdErrorFilter); - - return json; + throwIfErrorAttachedToSetup(response, jobIdErrorFilter); + return response; }; /** @@ -110,6 +98,8 @@ export const setupMlJob = async ({ * * @param datafeedIds * @param start + * + * @throws An error if response is not OK */ export const startDatafeeds = async ({ datafeedIds, @@ -126,22 +116,20 @@ export const startDatafeeds = async ({ datafeedIds, ...(start !== 0 && { start }), }), - asResponse: true, asSystemRequest: true, } ); - await throwIfNotOk(response.response); - const json = response.body!; - throwIfErrorAttached(json, datafeedIds); - - return json; + throwIfErrorAttached(response, datafeedIds); + return response; }; /** * Stops the given dataFeedIds and sets the corresponding Job's jobState to closed * * @param datafeedIds + * + * @throws An error if response is not OK */ export const stopDatafeeds = async ({ datafeedIds, @@ -155,14 +143,10 @@ export const stopDatafeeds = async ({ body: JSON.stringify({ datafeedIds, }), - asResponse: true, asSystemRequest: true, } ); - await throwIfNotOk(stopDatafeedsResponse.response); - const stopDatafeedsResponseJson = stopDatafeedsResponse.body!; - const datafeedPrefix = 'datafeed-'; const closeJobsResponse = await KibanaServices.get().http.fetch( '/api/ml/jobs/close_jobs', @@ -175,13 +159,11 @@ export const stopDatafeeds = async ({ : dataFeedId ), }), - asResponse: true, asSystemRequest: true, } ); - await throwIfNotOk(closeJobsResponse.response); - return [stopDatafeedsResponseJson, closeJobsResponse.body!]; + return [stopDatafeedsResponse, closeJobsResponse]; }; /** @@ -191,19 +173,13 @@ export const stopDatafeeds = async ({ * return a 500 * * @param signal to cancel request + * + * @throws An error if response is not OK */ -export const getJobsSummary = async (signal: AbortSignal): Promise => { - const response = await KibanaServices.get().http.fetch( - '/api/ml/jobs/jobs_summary', - { - method: 'POST', - body: JSON.stringify({}), - asResponse: true, - asSystemRequest: true, - signal, - } - ); - - await throwIfNotOk(response.response); - return response.body!; -}; +export const getJobsSummary = async (signal: AbortSignal): Promise => + KibanaServices.get().http.fetch('/api/ml/jobs/jobs_summary', { + method: 'POST', + body: JSON.stringify({}), + asSystemRequest: true, + signal, + }); diff --git a/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_siem_jobs.tsx b/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_siem_jobs.tsx index 9df93d087e166..4e4cdbfc109a9 100644 --- a/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_siem_jobs.tsx +++ b/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_siem_jobs.tsx @@ -10,8 +10,7 @@ import { checkRecognizer, getJobsSummary, getModules } from '../api'; import { SiemJob } from '../types'; import { hasMlUserPermissions } from '../../ml/permissions/has_ml_user_permissions'; import { MlCapabilitiesContext } from '../../ml/permissions/ml_capabilities_provider'; -import { useStateToaster } from '../../toasters'; -import { errorToToaster } from '../../ml/api/error_to_toaster'; +import { errorToToaster, useStateToaster } from '../../toasters'; import { useUiSetting$ } from '../../../lib/kibana'; import { DEFAULT_INDEX_KEY } from '../../../../common/constants'; diff --git a/x-pack/legacy/plugins/siem/public/components/ml_popover/ml_popover.tsx b/x-pack/legacy/plugins/siem/public/components/ml_popover/ml_popover.tsx index a41e84c163663..ec924889f93f1 100644 --- a/x-pack/legacy/plugins/siem/public/components/ml_popover/ml_popover.tsx +++ b/x-pack/legacy/plugins/siem/public/components/ml_popover/ml_popover.tsx @@ -12,10 +12,9 @@ import styled from 'styled-components'; import { useKibana } from '../../lib/kibana'; import { METRIC_TYPE, TELEMETRY_EVENT, track } from '../../lib/telemetry'; -import { errorToToaster } from '../ml/api/error_to_toaster'; import { hasMlAdminPermissions } from '../ml/permissions/has_ml_admin_permissions'; import { MlCapabilitiesContext } from '../ml/permissions/ml_capabilities_provider'; -import { useStateToaster } from '../toasters'; +import { errorToToaster, useStateToaster } from '../toasters'; import { setupMlJob, startDatafeeds, stopDatafeeds } from './api'; import { filterJobs } from './helpers'; import { useSiemJobs } from './hooks/use_siem_jobs'; diff --git a/x-pack/legacy/plugins/siem/public/components/news_feed/helpers.test.ts b/x-pack/legacy/plugins/siem/public/components/news_feed/helpers.test.ts index 0b0e0298a0c66..e7cd03d098da8 100644 --- a/x-pack/legacy/plugins/siem/public/components/news_feed/helpers.test.ts +++ b/x-pack/legacy/plugins/siem/public/components/news_feed/helpers.test.ts @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ +import { KibanaServices } from '../../lib/kibana'; import { NEWS_FEED_URL_SETTING_DEFAULT } from '../../../common/constants'; import { rawNewsApiResponse } from '../../mock/news'; import { rawNewsJSON } from '../../mock/raw_news'; @@ -18,7 +19,7 @@ import { } from './helpers'; import { NewsItem, RawNewsApiResponse } from './types'; -type GlobalWithFetch = NodeJS.Global & { fetch: jest.Mock }; +jest.mock('../../lib/kibana'); describe('helpers', () => { describe('removeSnapshotFromVersion', () => { @@ -390,37 +391,19 @@ describe('helpers', () => { }); describe('fetchNews', () => { - const newsFeedUrl = 'https://feeds.elastic.co/security-solution/v8.0.0.json'; + const mockKibanaServices = KibanaServices.get as jest.Mock; + const fetchMock = jest.fn(); + mockKibanaServices.mockReturnValue({ http: { fetch: fetchMock } }); - afterAll(() => { - delete (global as GlobalWithFetch).fetch; + beforeEach(() => { + fetchMock.mockClear(); + fetchMock.mockResolvedValue(rawNewsApiResponse); }); test('it returns the raw API response from the news feed', async () => { - (global as GlobalWithFetch).fetch = jest.fn().mockImplementationOnce(() => - Promise.resolve({ - ok: true, - json: () => { - return rawNewsApiResponse; - }, - }) - ); - + const newsFeedUrl = 'https://feeds.elastic.co/security-solution/v8.0.0.json'; expect(await fetchNews({ newsFeedUrl })).toEqual(rawNewsApiResponse); }); - - test('it throws if the response from the news feed is not ok', async () => { - (global as GlobalWithFetch).fetch = jest.fn().mockImplementationOnce(() => - Promise.resolve({ - ok: false, - json: () => { - return rawNewsApiResponse; - }, - }) - ); - - await expect(fetchNews({ newsFeedUrl })).rejects.toThrow('Network Error: undefined'); - }); }); describe('showNewsItem', () => { diff --git a/x-pack/legacy/plugins/siem/public/components/news_feed/helpers.ts b/x-pack/legacy/plugins/siem/public/components/news_feed/helpers.ts index 0cb5015872dec..838a8a8c41262 100644 --- a/x-pack/legacy/plugins/siem/public/components/news_feed/helpers.ts +++ b/x-pack/legacy/plugins/siem/public/components/news_feed/helpers.ts @@ -9,7 +9,7 @@ import moment from 'moment'; import uuid from 'uuid'; import { NewsItem, RawNewsApiItem, RawNewsApiResponse } from './types'; -import { throwIfNotOk } from '../../hooks/api/api'; +import { KibanaServices } from '../../lib/kibana'; /** * Removes the `-SNAPSHOT` that is sometimes appended to the Kibana version, @@ -90,15 +90,11 @@ export const fetchNews = async ({ }: { newsFeedUrl: string; }): Promise => { - const response = await fetch(newsFeedUrl, { - credentials: 'omit', + return KibanaServices.get().http.fetch(newsFeedUrl, { method: 'GET', + credentials: 'omit', mode: 'cors', }); - - await throwIfNotOk(response); - - return response.json(); }; /** diff --git a/x-pack/legacy/plugins/siem/public/components/recent_timelines/helpers.ts b/x-pack/legacy/plugins/siem/public/components/recent_timelines/helpers.ts deleted file mode 100644 index 41fa90f1776e6..0000000000000 --- a/x-pack/legacy/plugins/siem/public/components/recent_timelines/helpers.ts +++ /dev/null @@ -1,20 +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 { throwIfNotOk } from '../../hooks/api/api'; -import { KibanaServices } from '../../lib/kibana'; -import { MeApiResponse } from './recent_timelines'; - -export const fetchUsername = async () => { - const response = await KibanaServices.get().http.fetch('/internal/security/me', { - method: 'GET', - credentials: 'same-origin', - asResponse: true, - }); - - await throwIfNotOk(response.response); - return response.body!.username; -}; diff --git a/x-pack/legacy/plugins/siem/public/components/recent_timelines/index.tsx b/x-pack/legacy/plugins/siem/public/components/recent_timelines/index.tsx index 41eb137742963..6f22287774d7e 100644 --- a/x-pack/legacy/plugins/siem/public/components/recent_timelines/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/recent_timelines/index.tsx @@ -22,10 +22,6 @@ import { RecentTimelines } from './recent_timelines'; import * as i18n from './translations'; import { FilterMode } from './types'; -export interface MeApiResponse { - username: string; -} - interface OwnProps { apolloClient: ApolloClient<{}>; filterBy: FilterMode; diff --git a/x-pack/legacy/plugins/siem/public/components/recent_timelines/recent_timelines.tsx b/x-pack/legacy/plugins/siem/public/components/recent_timelines/recent_timelines.tsx index a01cc0fe277aa..fdd206a33ff7e 100644 --- a/x-pack/legacy/plugins/siem/public/components/recent_timelines/recent_timelines.tsx +++ b/x-pack/legacy/plugins/siem/public/components/recent_timelines/recent_timelines.tsx @@ -21,10 +21,6 @@ import { WithHoverActions } from '../with_hover_actions'; import { RecentTimelineCounts } from './counts'; import * as i18n from './translations'; -export interface MeApiResponse { - username: string; -} - export const RecentTimelines = React.memo<{ noTimelinesMessage: string; onOpenTimeline: OnOpenTimeline; diff --git a/x-pack/legacy/plugins/siem/public/components/toasters/errors.ts b/x-pack/legacy/plugins/siem/public/components/toasters/errors.ts new file mode 100644 index 0000000000000..7633d289c1f1d --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/components/toasters/errors.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. + */ + +export class ToasterError extends Error { + public readonly messages: string[]; + + constructor(messages: string[]) { + super(messages[0]); + this.name = 'ToasterError'; + this.messages = messages; + } +} + +export const isToasterError = (error: unknown): error is ToasterError => + error instanceof ToasterError; diff --git a/x-pack/legacy/plugins/siem/public/components/toasters/index.tsx b/x-pack/legacy/plugins/siem/public/components/toasters/index.tsx index 6d13bbd778f53..a24b52d8eef4d 100644 --- a/x-pack/legacy/plugins/siem/public/components/toasters/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/toasters/index.tsx @@ -8,11 +8,13 @@ import { EuiButton, EuiGlobalToastList, EuiGlobalToastListToast as Toast } from import { noop } from 'lodash/fp'; import React, { createContext, Dispatch, useContext, useReducer, useState } from 'react'; import styled from 'styled-components'; -import uuid from 'uuid'; import { ModalAllErrors } from './modal_all_errors'; import * as i18n from './translations'; +export * from './utils'; +export * from './errors'; + export interface AppToast extends Toast { errors?: string[]; } @@ -131,50 +133,3 @@ const ErrorToastContainer = styled.div` `; ErrorToastContainer.displayName = 'ErrorToastContainer'; - -/** - * Displays an error toast for the provided title and message - * - * @param errorTitle Title of error to display in toaster and modal - * @param errorMessages Message to display in error modal when clicked - * @param dispatchToaster provided by useStateToaster() - */ -export const displayErrorToast = ( - errorTitle: string, - errorMessages: string[], - dispatchToaster: React.Dispatch -): void => { - const toast: AppToast = { - id: uuid.v4(), - title: errorTitle, - color: 'danger', - iconType: 'alert', - errors: errorMessages, - }; - dispatchToaster({ - type: 'addToaster', - toast, - }); -}; - -/** - * Displays a success toast for the provided title and message - * - * @param title success message to display in toaster and modal - * @param dispatchToaster provided by useStateToaster() - */ -export const displaySuccessToast = ( - title: string, - dispatchToaster: React.Dispatch -): void => { - const toast: AppToast = { - id: uuid.v4(), - title, - color: 'success', - iconType: 'check', - }; - dispatchToaster({ - type: 'addToaster', - toast, - }); -}; diff --git a/x-pack/legacy/plugins/siem/public/components/ml/api/error_to_toaster.test.ts b/x-pack/legacy/plugins/siem/public/components/toasters/utils.test.ts similarity index 57% rename from x-pack/legacy/plugins/siem/public/components/ml/api/error_to_toaster.test.ts rename to x-pack/legacy/plugins/siem/public/components/toasters/utils.test.ts index d4f38d817bd6b..26cfc4bc1fca1 100644 --- a/x-pack/legacy/plugins/siem/public/components/ml/api/error_to_toaster.test.ts +++ b/x-pack/legacy/plugins/siem/public/components/toasters/utils.test.ts @@ -4,8 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { isAnError, isToasterError, errorToToaster } from './error_to_toaster'; -import { ToasterErrors } from '../../../hooks/api/throw_if_not_ok'; +import { errorToToaster } from './utils'; +import { ToasterError } from './errors'; + +const ApiError = class extends Error { + public body: {} = {}; +}; describe('error_to_toaster', () => { let dispatchToaster = jest.fn(); @@ -15,8 +19,8 @@ describe('error_to_toaster', () => { }); describe('#errorToToaster', () => { - test('adds a ToastError given multiple toaster errors', () => { - const error = new ToasterErrors(['some error 1', 'some error 2']); + test('dispatches an error toast given a ToasterError with multiple error messages', () => { + const error = new ToasterError(['some error 1', 'some error 2']); errorToToaster({ id: 'some-made-up-id', title: 'some title', error, dispatchToaster }); expect(dispatchToaster.mock.calls[0]).toEqual([ { @@ -32,8 +36,8 @@ describe('error_to_toaster', () => { ]); }); - test('adds a ToastError given a single toaster errors', () => { - const error = new ToasterErrors(['some error 1']); + test('dispatches an error toast given a ToasterError with a single error message', () => { + const error = new ToasterError(['some error 1']); errorToToaster({ id: 'some-made-up-id', title: 'some title', error, dispatchToaster }); expect(dispatchToaster.mock.calls[0]).toEqual([ { @@ -49,7 +53,44 @@ describe('error_to_toaster', () => { ]); }); - test('adds a regular Error given a single error', () => { + test('dispatches an error toast given an ApiError with a message', () => { + const error = new ApiError('Internal Server Error'); + error.body = { message: 'something bad happened', status_code: 500 }; + + errorToToaster({ id: 'some-made-up-id', title: 'some title', error, dispatchToaster }); + expect(dispatchToaster.mock.calls[0]).toEqual([ + { + toast: { + color: 'danger', + errors: ['something bad happened'], + iconType: 'alert', + id: 'some-made-up-id', + title: 'some title', + }, + type: 'addToaster', + }, + ]); + }); + + test('dispatches an error toast given an ApiError with no message', () => { + const error = new ApiError('Internal Server Error'); + + errorToToaster({ id: 'some-made-up-id', title: 'some title', error, dispatchToaster }); + expect(dispatchToaster.mock.calls[0]).toEqual([ + { + toast: { + color: 'danger', + errors: ['Internal Server Error'], + iconType: 'alert', + id: 'some-made-up-id', + title: 'some title', + }, + type: 'addToaster', + }, + ]); + }); + + test('dispatches an error toast given a standard Error', () => { const error = new Error('some error 1'); errorToToaster({ id: 'some-made-up-id', title: 'some title', error, dispatchToaster }); expect(dispatchToaster.mock.calls[0]).toEqual([ @@ -83,44 +124,4 @@ describe('error_to_toaster', () => { ]); }); }); - - describe('#isAnError', () => { - test('returns true if given an error object', () => { - const error = new Error('some error'); - expect(isAnError(error)).toEqual(true); - }); - - test('returns false if given a regular object', () => { - expect(isAnError({})).toEqual(false); - }); - - test('returns false if given a string', () => { - expect(isAnError('som string')).toEqual(false); - }); - - test('returns true if given a toaster error', () => { - const error = new ToasterErrors(['some error']); - expect(isAnError(error)).toEqual(true); - }); - }); - - describe('#isToasterError', () => { - test('returns true if given a ToasterErrors object', () => { - const error = new ToasterErrors(['some error']); - expect(isToasterError(error)).toEqual(true); - }); - - test('returns false if given a regular object', () => { - expect(isToasterError({})).toEqual(false); - }); - - test('returns false if given a string', () => { - expect(isToasterError('som string')).toEqual(false); - }); - - test('returns false if given a regular error', () => { - const error = new Error('some error'); - expect(isToasterError(error)).toEqual(false); - }); - }); }); diff --git a/x-pack/legacy/plugins/siem/public/components/toasters/utils.ts b/x-pack/legacy/plugins/siem/public/components/toasters/utils.ts new file mode 100644 index 0000000000000..e624144c9826f --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/components/toasters/utils.ts @@ -0,0 +1,123 @@ +/* + * 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 uuid from 'uuid'; +import { isError } from 'lodash/fp'; + +import { AppToast, ActionToaster } from './'; +import { isToasterError } from './errors'; +import { isApiError } from '../../utils/api'; + +/** + * Displays an error toast for the provided title and message + * + * @param errorTitle Title of error to display in toaster and modal + * @param errorMessages Message to display in error modal when clicked + * @param dispatchToaster provided by useStateToaster() + */ +export const displayErrorToast = ( + errorTitle: string, + errorMessages: string[], + dispatchToaster: React.Dispatch, + id: string = uuid.v4() +): void => { + const toast: AppToast = { + id, + title: errorTitle, + color: 'danger', + iconType: 'alert', + errors: errorMessages, + }; + dispatchToaster({ + type: 'addToaster', + toast, + }); +}; + +/** + * Displays a success toast for the provided title and message + * + * @param title success message to display in toaster and modal + * @param dispatchToaster provided by useStateToaster() + */ +export const displaySuccessToast = ( + title: string, + dispatchToaster: React.Dispatch, + id: string = uuid.v4() +): void => { + const toast: AppToast = { + id, + title, + color: 'success', + iconType: 'check', + }; + dispatchToaster({ + type: 'addToaster', + toast, + }); +}; + +export type ErrorToToasterArgs = Partial & { + error: unknown; + dispatchToaster: React.Dispatch; +}; + +/** + * Displays an error toast with messages parsed from the error + * + * @param title error message to display in toaster and modal + * @param error the error from which messages will be parsed + * @param dispatchToaster provided by useStateToaster() + */ +export const errorToToaster = ({ + id = uuid.v4(), + title, + error, + color = 'danger', + iconType = 'alert', + dispatchToaster, +}: ErrorToToasterArgs) => { + let toast: AppToast; + + if (isToasterError(error)) { + toast = { + id, + title, + color, + iconType, + errors: error.messages, + }; + } else if (isApiError(error)) { + toast = { + id, + title, + color, + iconType, + errors: [error.body.message], + }; + } else if (isError(error)) { + toast = { + id, + title, + color, + iconType, + errors: [error.message], + }; + } else { + toast = { + id, + title, + color, + iconType, + errors: ['Network Error'], + }; + } + + dispatchToaster({ + type: 'addToaster', + toast, + }); +}; diff --git a/x-pack/legacy/plugins/siem/public/containers/case/api.ts b/x-pack/legacy/plugins/siem/public/containers/case/api.ts index 81f8f83217e11..98bb1b470d561 100644 --- a/x-pack/legacy/plugins/siem/public/containers/case/api.ts +++ b/x-pack/legacy/plugins/siem/public/containers/case/api.ts @@ -13,7 +13,6 @@ import { } from '../../../../../../plugins/case/common/api'; import { KibanaServices } from '../../lib/kibana'; import { AllCases, Case, Comment, FetchCasesProps, SortFieldCase } from './types'; -import { throwIfNotOk } from '../../hooks/api/api'; import { CASES_URL } from './constants'; import { convertToCamelCase, @@ -28,22 +27,18 @@ const CaseSavedObjectType = 'cases'; export const getCase = async (caseId: string, includeComments: boolean = true): Promise => { const response = await KibanaServices.get().http.fetch(`${CASES_URL}/${caseId}`, { method: 'GET', - asResponse: true, query: { includeComments, }, }); - await throwIfNotOk(response.response); - return convertToCamelCase(decodeCaseResponse(response.body)); + return convertToCamelCase(decodeCaseResponse(response)); }; export const getTags = async (): Promise => { const response = await KibanaServices.get().http.fetch(`${CASES_URL}/tags`, { method: 'GET', - asResponse: true, }); - await throwIfNotOk(response.response); - return response.body ?? []; + return response ?? []; }; export const getCases = async ({ @@ -74,20 +69,16 @@ export const getCases = async ({ const response = await KibanaServices.get().http.fetch(`${CASES_URL}/_find`, { method: 'GET', query, - asResponse: true, }); - await throwIfNotOk(response.response); - return convertAllCasesToCamel(decodeCasesResponse(response.body)); + return convertAllCasesToCamel(decodeCasesResponse(response)); }; export const postCase = async (newCase: CaseRequest): Promise => { const response = await KibanaServices.get().http.fetch(`${CASES_URL}`, { method: 'POST', - asResponse: true, body: JSON.stringify(newCase), }); - await throwIfNotOk(response.response); - return convertToCamelCase(decodeCaseResponse(response.body)); + return convertToCamelCase(decodeCaseResponse(response)); }; export const patchCase = async ( @@ -97,11 +88,9 @@ export const patchCase = async ( ): Promise => { const response = await KibanaServices.get().http.fetch(`${CASES_URL}`, { method: 'PATCH', - asResponse: true, body: JSON.stringify({ ...updatedCase, id: caseId, version }), }); - await throwIfNotOk(response.response); - return convertToCamelCase(decodeCaseResponse(response.body)); + return convertToCamelCase(decodeCaseResponse(response)); }; export const postComment = async (newComment: CommentRequest, caseId: string): Promise => { @@ -109,12 +98,10 @@ export const postComment = async (newComment: CommentRequest, caseId: string): P `${CASES_URL}/${caseId}/comments`, { method: 'POST', - asResponse: true, body: JSON.stringify(newComment), } ); - await throwIfNotOk(response.response); - return convertToCamelCase(decodeCommentResponse(response.body)); + return convertToCamelCase(decodeCommentResponse(response)); }; export const patchComment = async ( @@ -124,9 +111,7 @@ export const patchComment = async ( ): Promise> => { const response = await KibanaServices.get().http.fetch(`${CASES_URL}/comments`, { method: 'PATCH', - asResponse: true, body: JSON.stringify({ comment: commentUpdate, id: commentId, version }), }); - await throwIfNotOk(response.response); - return convertToCamelCase(decodeCommentResponse(response.body)); + return convertToCamelCase(decodeCommentResponse(response)); }; diff --git a/x-pack/legacy/plugins/siem/public/containers/case/use_get_case.tsx b/x-pack/legacy/plugins/siem/public/containers/case/use_get_case.tsx index 5f1dc96735d32..b758f914c991e 100644 --- a/x-pack/legacy/plugins/siem/public/containers/case/use_get_case.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/case/use_get_case.tsx @@ -9,9 +9,8 @@ import { useEffect, useReducer } from 'react'; import { Case } from './types'; import { FETCH_INIT, FETCH_FAILURE, FETCH_SUCCESS } from './constants'; import { getTypedPayload } from './utils'; -import { errorToToaster } from '../../components/ml/api/error_to_toaster'; import * as i18n from './translations'; -import { useStateToaster } from '../../components/toasters'; +import { errorToToaster, useStateToaster } from '../../components/toasters'; import { getCase } from './api'; interface CaseState { diff --git a/x-pack/legacy/plugins/siem/public/containers/case/use_get_cases.tsx b/x-pack/legacy/plugins/siem/public/containers/case/use_get_cases.tsx index 76e9b5c138269..99c7ef0c757c7 100644 --- a/x-pack/legacy/plugins/siem/public/containers/case/use_get_cases.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/case/use_get_cases.tsx @@ -7,8 +7,7 @@ import { useCallback, useEffect, useReducer } from 'react'; import { DEFAULT_TABLE_ACTIVE_PAGE, DEFAULT_TABLE_LIMIT } from './constants'; import { AllCases, SortFieldCase, FilterOptions, QueryParams, Case } from './types'; -import { errorToToaster } from '../../components/ml/api/error_to_toaster'; -import { useStateToaster } from '../../components/toasters'; +import { errorToToaster, useStateToaster } from '../../components/toasters'; import * as i18n from './translations'; import { UpdateByKey } from './use_update_case'; import { getCases, patchCase } from './api'; diff --git a/x-pack/legacy/plugins/siem/public/containers/case/use_get_tags.tsx b/x-pack/legacy/plugins/siem/public/containers/case/use_get_tags.tsx index 7d3e00a4f2be4..5e6df9b92f462 100644 --- a/x-pack/legacy/plugins/siem/public/containers/case/use_get_tags.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/case/use_get_tags.tsx @@ -5,9 +5,8 @@ */ import { useEffect, useReducer } from 'react'; -import { useStateToaster } from '../../components/toasters'; -import { errorToToaster } from '../../components/ml/api/error_to_toaster'; +import { errorToToaster, useStateToaster } from '../../components/toasters'; import { getTags } from './api'; import { FETCH_FAILURE, FETCH_INIT, FETCH_SUCCESS } from './constants'; import * as i18n from './translations'; diff --git a/x-pack/legacy/plugins/siem/public/containers/case/use_post_case.tsx b/x-pack/legacy/plugins/siem/public/containers/case/use_post_case.tsx index 7497b30395155..5cd0911fae81a 100644 --- a/x-pack/legacy/plugins/siem/public/containers/case/use_post_case.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/case/use_post_case.tsx @@ -7,9 +7,7 @@ import { useReducer, useCallback } from 'react'; import { CaseRequest } from '../../../../../../plugins/case/common/api'; -import { useStateToaster } from '../../components/toasters'; -import { errorToToaster } from '../../components/ml/api/error_to_toaster'; - +import { errorToToaster, useStateToaster } from '../../components/toasters'; import { postCase } from './api'; import { FETCH_FAILURE, FETCH_INIT, FETCH_SUCCESS } from './constants'; import * as i18n from './translations'; diff --git a/x-pack/legacy/plugins/siem/public/containers/case/use_post_comment.tsx b/x-pack/legacy/plugins/siem/public/containers/case/use_post_comment.tsx index 63d24e2935c2a..1467c691f547e 100644 --- a/x-pack/legacy/plugins/siem/public/containers/case/use_post_comment.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/case/use_post_comment.tsx @@ -7,8 +7,7 @@ import { useReducer, useCallback } from 'react'; import { CommentRequest } from '../../../../../../plugins/case/common/api'; -import { useStateToaster } from '../../components/toasters'; -import { errorToToaster } from '../../components/ml/api/error_to_toaster'; +import { errorToToaster, useStateToaster } from '../../components/toasters'; import { postComment } from './api'; import { FETCH_FAILURE, FETCH_INIT, FETCH_SUCCESS } from './constants'; diff --git a/x-pack/legacy/plugins/siem/public/containers/case/use_update_case.tsx b/x-pack/legacy/plugins/siem/public/containers/case/use_update_case.tsx index 21c8fb5dc7032..594677aefe245 100644 --- a/x-pack/legacy/plugins/siem/public/containers/case/use_update_case.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/case/use_update_case.tsx @@ -7,8 +7,7 @@ import { useReducer, useCallback } from 'react'; import { CaseRequest } from '../../../../../../plugins/case/common/api'; -import { useStateToaster } from '../../components/toasters'; -import { errorToToaster } from '../../components/ml/api/error_to_toaster'; +import { errorToToaster, useStateToaster } from '../../components/toasters'; import { patchCase } from './api'; import { FETCH_FAILURE, FETCH_INIT, FETCH_SUCCESS } from './constants'; diff --git a/x-pack/legacy/plugins/siem/public/containers/case/use_update_comment.tsx b/x-pack/legacy/plugins/siem/public/containers/case/use_update_comment.tsx index d7649cb7d8fdb..bd9ce9bd37500 100644 --- a/x-pack/legacy/plugins/siem/public/containers/case/use_update_comment.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/case/use_update_comment.tsx @@ -6,8 +6,7 @@ import { useReducer, useCallback } from 'react'; -import { useStateToaster } from '../../components/toasters'; -import { errorToToaster } from '../../components/ml/api/error_to_toaster'; +import { errorToToaster, useStateToaster } from '../../components/toasters'; import { patchComment } from './api'; import { FETCH_FAILURE, FETCH_INIT, FETCH_SUCCESS } from './constants'; diff --git a/x-pack/legacy/plugins/siem/public/containers/case/utils.ts b/x-pack/legacy/plugins/siem/public/containers/case/utils.ts index a377c496fe726..6a0da7618c383 100644 --- a/x-pack/legacy/plugins/siem/public/containers/case/utils.ts +++ b/x-pack/legacy/plugins/siem/public/containers/case/utils.ts @@ -18,7 +18,7 @@ import { CommentResponse, CommentResponseRt, } from '../../../../../../plugins/case/common/api'; -import { ToasterErrors } from '../../hooks/api/throw_if_not_ok'; +import { ToasterError } from '../../components/toasters'; import { AllCases, Case } from './types'; export const getTypedPayload = (a: unknown): T => a as T; @@ -53,7 +53,7 @@ export const convertAllCasesToCamel = (snakeCases: CasesResponse): AllCases => ( total: snakeCases.total, }); -export const createToasterPlainError = (message: string) => new ToasterErrors([message]); +export const createToasterPlainError = (message: string) => new ToasterError([message]); export const decodeCaseResponse = (respCase?: CaseResponse) => pipe(CaseResponseRt.decode(respCase), fold(throwErrors(createToasterPlainError), identity)); diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.test.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.test.ts index 05446577a0fa0..3048fc3dc5a02 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.test.ts +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.test.ts @@ -20,115 +20,46 @@ import { getPrePackagedRulesStatus, } from './api'; import { ruleMock, rulesMock } from './mock'; -import { ToasterErrors } from '../../../hooks/api/throw_if_not_ok'; const abortCtrl = new AbortController(); const mockKibanaServices = KibanaServices.get as jest.Mock; jest.mock('../../../lib/kibana'); -const mockfetchSuccess = (body: unknown, fetchMock?: jest.Mock) => { - if (fetchMock) { - mockKibanaServices.mockImplementation(() => ({ - http: { - fetch: fetchMock, - }, - })); - } else { - mockKibanaServices.mockImplementation(() => ({ - http: { - fetch: () => ({ - response: { - ok: true, - message: 'success', - text: 'success', - }, - body, - }), - }, - })); - } -}; - -const mockfetchError = () => { - mockKibanaServices.mockImplementation(() => ({ - http: { - fetch: () => ({ - response: { - ok: false, - text: () => - JSON.stringify({ - message: 'super mega error, it is not that bad', - }), - }, - body: null, - }), - }, - })); -}; +const fetchMock = jest.fn(); +mockKibanaServices.mockReturnValue({ http: { fetch: fetchMock } }); describe('Detections Rules API', () => { - const fetchMock = jest.fn(); describe('addRule', () => { beforeEach(() => { - mockKibanaServices.mockClear(); fetchMock.mockClear(); - fetchMock.mockImplementation(() => ({ - response: { - ok: true, - message: 'success', - text: 'success', - }, - body: ruleMock, - })); + fetchMock.mockResolvedValue(ruleMock); }); - test('check parameter url, body', async () => { - mockfetchSuccess(null, fetchMock); + test('check parameter url, body', async () => { await addRule({ rule: ruleMock, signal: abortCtrl.signal }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules', { - asResponse: true, body: '{"description":"some desc","enabled":true,"false_positives":[],"filters":[],"from":"now-360s","index":["apm-*-transaction*","auditbeat-*","endgame-*","filebeat-*","packetbeat-*","winlogbeat-*"],"interval":"5m","rule_id":"bbd3106e-b4b5-4d7c-a1a2-47531d6a2baf","language":"kuery","risk_score":75,"name":"Test rule","query":"user.email: \'root@elastic.co\'","references":[],"severity":"high","tags":["APM"],"to":"now","type":"query","threat":[]}', method: 'POST', signal: abortCtrl.signal, }); }); + test('happy path', async () => { - mockfetchSuccess(ruleMock); const ruleResp = await addRule({ rule: ruleMock, signal: abortCtrl.signal }); expect(ruleResp).toEqual(ruleMock); }); - test('unhappy path', async () => { - mockfetchError(); - try { - await addRule({ rule: ruleMock, signal: abortCtrl.signal }); - } catch (exp) { - expect(exp).toBeInstanceOf(ToasterErrors); - expect(exp.message).toEqual('super mega error, it is not that bad'); - } - }); }); describe('fetchRules', () => { beforeEach(() => { - mockKibanaServices.mockClear(); fetchMock.mockClear(); - fetchMock.mockImplementation(() => ({ - response: { - ok: true, - message: 'success', - text: 'success', - }, - body: rulesMock, - })); + fetchMock.mockResolvedValue(rulesMock); }); test('check parameter url, query without any options', async () => { - mockfetchSuccess(null, fetchMock); - await fetchRules({ signal: abortCtrl.signal }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_find', { - asResponse: true, method: 'GET', query: { page: 1, @@ -141,8 +72,6 @@ describe('Detections Rules API', () => { }); test('check parameter url, query with a filter', async () => { - mockfetchSuccess(null, fetchMock); - await fetchRules({ filterOptions: { filter: 'hello world', @@ -154,8 +83,8 @@ describe('Detections Rules API', () => { }, signal: abortCtrl.signal, }); + expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_find', { - asResponse: true, method: 'GET', query: { filter: 'alert.attributes.name: hello world', @@ -169,8 +98,6 @@ describe('Detections Rules API', () => { }); test('check parameter url, query with showCustomRules', async () => { - mockfetchSuccess(null, fetchMock); - await fetchRules({ filterOptions: { filter: '', @@ -182,8 +109,8 @@ describe('Detections Rules API', () => { }, signal: abortCtrl.signal, }); + expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_find', { - asResponse: true, method: 'GET', query: { filter: 'alert.attributes.tags: "__internal_immutable:false"', @@ -197,8 +124,6 @@ describe('Detections Rules API', () => { }); test('check parameter url, query with showElasticRules', async () => { - mockfetchSuccess(null, fetchMock); - await fetchRules({ filterOptions: { filter: '', @@ -210,8 +135,8 @@ describe('Detections Rules API', () => { }, signal: abortCtrl.signal, }); + expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_find', { - asResponse: true, method: 'GET', query: { filter: 'alert.attributes.tags: "__internal_immutable:true"', @@ -225,8 +150,6 @@ describe('Detections Rules API', () => { }); test('check parameter url, query with tags', async () => { - mockfetchSuccess(null, fetchMock); - await fetchRules({ filterOptions: { filter: '', @@ -238,8 +161,8 @@ describe('Detections Rules API', () => { }, signal: abortCtrl.signal, }); + expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_find', { - asResponse: true, method: 'GET', query: { filter: 'alert.attributes.tags: hello AND alert.attributes.tags: world', @@ -253,8 +176,6 @@ describe('Detections Rules API', () => { }); test('check parameter url, query with all options', async () => { - mockfetchSuccess(null, fetchMock); - await fetchRules({ filterOptions: { filter: 'ruleName', @@ -267,7 +188,6 @@ describe('Detections Rules API', () => { signal: abortCtrl.signal, }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_find', { - asResponse: true, method: 'GET', query: { filter: @@ -282,41 +202,20 @@ describe('Detections Rules API', () => { }); test('happy path', async () => { - mockfetchSuccess(rulesMock); - const rulesResp = await fetchRules({ signal: abortCtrl.signal }); expect(rulesResp).toEqual(rulesMock); }); - test('unhappy path', async () => { - mockfetchError(); - try { - await fetchRules({ signal: abortCtrl.signal }); - } catch (exp) { - expect(exp).toBeInstanceOf(ToasterErrors); - expect(exp.message).toEqual('super mega error, it is not that bad'); - } - }); }); describe('fetchRuleById', () => { beforeEach(() => { - mockKibanaServices.mockClear(); fetchMock.mockClear(); - fetchMock.mockImplementation(() => ({ - response: { - ok: true, - message: 'success', - text: 'success', - }, - body: ruleMock, - })); + fetchMock.mockResolvedValue(ruleMock); }); - test('check parameter url, query', async () => { - mockfetchSuccess(null, fetchMock); + test('check parameter url, query', async () => { await fetchRuleById({ id: 'mySuperRuleId', signal: abortCtrl.signal }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules', { - asResponse: true, query: { id: 'mySuperRuleId', }, @@ -324,192 +223,102 @@ describe('Detections Rules API', () => { signal: abortCtrl.signal, }); }); + test('happy path', async () => { - mockfetchSuccess(ruleMock); const ruleResp = await fetchRuleById({ id: 'mySuperRuleId', signal: abortCtrl.signal }); expect(ruleResp).toEqual(ruleMock); }); - test('unhappy path', async () => { - mockfetchError(); - try { - await fetchRuleById({ id: 'mySuperRuleId', signal: abortCtrl.signal }); - } catch (exp) { - expect(exp).toBeInstanceOf(ToasterErrors); - expect(exp.message).toEqual('super mega error, it is not that bad'); - } - }); }); describe('enableRules', () => { beforeEach(() => { - mockKibanaServices.mockClear(); fetchMock.mockClear(); - fetchMock.mockImplementation(() => ({ - response: { - ok: true, - message: 'success', - text: 'success', - }, - body: ruleMock, - })); + fetchMock.mockResolvedValue(rulesMock); }); - test('check parameter url, body when enabling rules', async () => { - mockfetchSuccess(null, fetchMock); + test('check parameter url, body when enabling rules', async () => { await enableRules({ ids: ['mySuperRuleId', 'mySuperRuleId_II'], enabled: true }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_bulk_update', { - asResponse: true, body: '[{"id":"mySuperRuleId","enabled":true},{"id":"mySuperRuleId_II","enabled":true}]', method: 'PATCH', }); }); test('check parameter url, body when disabling rules', async () => { - mockfetchSuccess(null, fetchMock); - await enableRules({ ids: ['mySuperRuleId', 'mySuperRuleId_II'], enabled: false }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_bulk_update', { - asResponse: true, body: '[{"id":"mySuperRuleId","enabled":false},{"id":"mySuperRuleId_II","enabled":false}]', method: 'PATCH', }); }); test('happy path', async () => { - mockfetchSuccess(rulesMock.data); const ruleResp = await enableRules({ ids: ['mySuperRuleId', 'mySuperRuleId_II'], enabled: true, }); - expect(ruleResp).toEqual(rulesMock.data); - }); - test('unhappy path', async () => { - mockfetchError(); - try { - await enableRules({ ids: ['mySuperRuleId', 'mySuperRuleId_II'], enabled: true }); - } catch (exp) { - expect(exp).toBeInstanceOf(ToasterErrors); - expect(exp.message).toEqual('super mega error, it is not that bad'); - } + expect(ruleResp).toEqual(rulesMock); }); }); describe('deleteRules', () => { beforeEach(() => { - mockKibanaServices.mockClear(); fetchMock.mockClear(); - fetchMock.mockImplementation(() => ({ - response: { - ok: true, - message: 'success', - text: 'success', - }, - body: ruleMock, - })); + fetchMock.mockResolvedValue(rulesMock); }); - test('check parameter url, body when deleting rules', async () => { - mockfetchSuccess(null, fetchMock); + test('check parameter url, body when deleting rules', async () => { await deleteRules({ ids: ['mySuperRuleId', 'mySuperRuleId_II'] }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_bulk_delete', { - asResponse: true, body: '[{"id":"mySuperRuleId"},{"id":"mySuperRuleId_II"}]', method: 'DELETE', }); }); + test('happy path', async () => { - mockfetchSuccess(ruleMock); const ruleResp = await deleteRules({ ids: ['mySuperRuleId', 'mySuperRuleId_II'], }); - expect(ruleResp).toEqual(ruleMock); - }); - test('unhappy path', async () => { - mockfetchError(); - try { - await deleteRules({ ids: ['mySuperRuleId', 'mySuperRuleId_II'] }); - } catch (exp) { - expect(exp).toBeInstanceOf(ToasterErrors); - expect(exp.message).toEqual('super mega error, it is not that bad'); - } + expect(ruleResp).toEqual(rulesMock); }); }); describe('duplicateRules', () => { beforeEach(() => { - mockKibanaServices.mockClear(); fetchMock.mockClear(); - fetchMock.mockImplementation(() => ({ - response: { - ok: true, - message: 'success', - text: 'success', - }, - body: ruleMock, - })); + fetchMock.mockResolvedValue(rulesMock); }); - test('check parameter url, body when duplicating rules', async () => { - mockfetchSuccess(null, fetchMock); + test('check parameter url, body when duplicating rules', async () => { await duplicateRules({ rules: rulesMock.data }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_bulk_create', { - asResponse: true, body: '[{"description":"Elastic Endpoint detected Credential Dumping. Click the Elastic Endpoint icon in the event.module column or the link in the rule.reference column in the External Alerts tab of the SIEM Detections page for additional information.","enabled":false,"false_positives":[],"from":"now-660s","index":["endgame-*"],"interval":"10m","language":"kuery","output_index":".siem-signals-default","max_signals":100,"risk_score":73,"name":"Credential Dumping - Detected - Elastic Endpoint [Duplicate]","query":"event.kind:alert and event.module:endgame and event.action:cred_theft_event and endgame.metadata.type:detection","filters":[],"references":[],"severity":"high","tags":["Elastic","Endpoint"],"to":"now","type":"query","threat":[],"version":1},{"description":"Elastic Endpoint detected an Adversary Behavior. Click the Elastic Endpoint icon in the event.module column or the link in the rule.reference column in the External Alerts tab of the SIEM Detections page for additional information.","enabled":false,"false_positives":[],"from":"now-660s","index":["endgame-*"],"interval":"10m","language":"kuery","output_index":".siem-signals-default","max_signals":100,"risk_score":47,"name":"Adversary Behavior - Detected - Elastic Endpoint [Duplicate]","query":"event.kind:alert and event.module:endgame and event.action:rules_engine_event","filters":[],"references":[],"severity":"medium","tags":["Elastic","Endpoint"],"to":"now","type":"query","threat":[],"version":1}]', method: 'POST', }); }); + test('happy path', async () => { - mockfetchSuccess(rulesMock.data); const ruleResp = await duplicateRules({ rules: rulesMock.data }); - expect(ruleResp).toEqual(rulesMock.data); - }); - test('unhappy path', async () => { - mockfetchError(); - try { - await duplicateRules({ rules: rulesMock.data }); - } catch (exp) { - expect(exp).toBeInstanceOf(ToasterErrors); - expect(exp.message).toEqual('super mega error, it is not that bad'); - } + expect(ruleResp).toEqual(rulesMock); }); }); describe('createPrepackagedRules', () => { beforeEach(() => { - mockKibanaServices.mockClear(); fetchMock.mockClear(); - fetchMock.mockImplementation(() => ({ - response: { - ok: true, - message: 'success', - text: 'success', - }, - body: ruleMock, - })); + fetchMock.mockResolvedValue('unknown'); }); - test('check parameter url when creating pre-packaged rules', async () => { - mockfetchSuccess(null, fetchMock); + test('check parameter url when creating pre-packaged rules', async () => { await createPrepackagedRules({ signal: abortCtrl.signal }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/prepackaged', { - asResponse: true, signal: abortCtrl.signal, method: 'PUT', }); }); test('happy path', async () => { - mockfetchSuccess(true); const resp = await createPrepackagedRules({ signal: abortCtrl.signal }); expect(resp).toEqual(true); }); - test('unhappy path', async () => { - mockfetchError(); - try { - await createPrepackagedRules({ signal: abortCtrl.signal }); - } catch (exp) { - expect(exp).toBeInstanceOf(ToasterErrors); - expect(exp.message).toEqual('super mega error, it is not that bad'); - } - }); }); describe('importRules', () => { @@ -525,23 +334,15 @@ describe('Detections Rules API', () => { } as File; const formData = new FormData(); formData.append('file', fileToImport); + beforeEach(() => { - mockKibanaServices.mockClear(); fetchMock.mockClear(); - fetchMock.mockImplementation(() => ({ - response: { - ok: true, - message: 'success', - text: 'success', - }, - body: ruleMock, - })); + fetchMock.mockResolvedValue('unknown'); }); + test('check parameter url, body and query when importing rules', async () => { - mockfetchSuccess(null, fetchMock); await importRules({ fileToImport, signal: abortCtrl.signal }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_import', { - asResponse: true, signal: abortCtrl.signal, method: 'POST', body: formData, @@ -555,11 +356,8 @@ describe('Detections Rules API', () => { }); test('check parameter url, body and query when importing rules with overwrite', async () => { - mockfetchSuccess(null, fetchMock); - await importRules({ fileToImport, overwrite: true, signal: abortCtrl.signal }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_import', { - asResponse: true, signal: abortCtrl.signal, method: 'POST', body: formData, @@ -573,7 +371,7 @@ describe('Detections Rules API', () => { }); test('happy path', async () => { - mockfetchSuccess({ + fetchMock.mockResolvedValue({ success: true, success_count: 33, errors: [], @@ -585,40 +383,29 @@ describe('Detections Rules API', () => { errors: [], }); }); - - test('unhappy path', async () => { - mockfetchError(); - try { - await importRules({ fileToImport, signal: abortCtrl.signal }); - } catch (exp) { - expect(exp).toBeInstanceOf(ToasterErrors); - expect(exp.message).toEqual('super mega error, it is not that bad'); - } - }); }); describe('exportRules', () => { + const blob: Blob = { + size: 89, + type: 'json', + arrayBuffer: jest.fn(), + slice: jest.fn(), + stream: jest.fn(), + text: jest.fn(), + } as Blob; + beforeEach(() => { - mockKibanaServices.mockClear(); fetchMock.mockClear(); - fetchMock.mockImplementation(() => ({ - response: { - ok: true, - message: 'success', - text: 'success', - }, - body: ruleMock, - })); + fetchMock.mockResolvedValue(blob); }); test('check parameter url, body and query when exporting rules', async () => { - mockfetchSuccess(null, fetchMock); await exportRules({ ruleIds: ['mySuperRuleId', 'mySuperRuleId_II'], signal: abortCtrl.signal, }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_export', { - asResponse: true, signal: abortCtrl.signal, method: 'POST', body: '{"objects":[{"rule_id":"mySuperRuleId"},{"rule_id":"mySuperRuleId_II"}]}', @@ -630,14 +417,12 @@ describe('Detections Rules API', () => { }); test('check parameter url, body and query when exporting rules with excludeExportDetails', async () => { - mockfetchSuccess(null, fetchMock); await exportRules({ excludeExportDetails: true, ruleIds: ['mySuperRuleId', 'mySuperRuleId_II'], signal: abortCtrl.signal, }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_export', { - asResponse: true, signal: abortCtrl.signal, method: 'POST', body: '{"objects":[{"rule_id":"mySuperRuleId"},{"rule_id":"mySuperRuleId_II"}]}', @@ -649,14 +434,12 @@ describe('Detections Rules API', () => { }); test('check parameter url, body and query when exporting rules with fileName', async () => { - mockfetchSuccess(null, fetchMock); await exportRules({ filename: 'myFileName.ndjson', ruleIds: ['mySuperRuleId', 'mySuperRuleId_II'], signal: abortCtrl.signal, }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_export', { - asResponse: true, signal: abortCtrl.signal, method: 'POST', body: '{"objects":[{"rule_id":"mySuperRuleId"},{"rule_id":"mySuperRuleId_II"}]}', @@ -668,7 +451,6 @@ describe('Detections Rules API', () => { }); test('check parameter url, body and query when exporting rules with all options', async () => { - mockfetchSuccess(null, fetchMock); await exportRules({ excludeExportDetails: true, filename: 'myFileName.ndjson', @@ -676,7 +458,6 @@ describe('Detections Rules API', () => { signal: abortCtrl.signal, }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_export', { - asResponse: true, signal: abortCtrl.signal, method: 'POST', body: '{"objects":[{"rule_id":"mySuperRuleId"},{"rule_id":"mySuperRuleId_II"}]}', @@ -688,55 +469,38 @@ describe('Detections Rules API', () => { }); test('happy path', async () => { - const blob: Blob = { - size: 89, - type: 'json', - arrayBuffer: jest.fn(), - slice: jest.fn(), - stream: jest.fn(), - text: jest.fn(), - } as Blob; - mockfetchSuccess(blob); const resp = await exportRules({ ruleIds: ['mySuperRuleId', 'mySuperRuleId_II'], signal: abortCtrl.signal, }); expect(resp).toEqual(blob); }); - - test('unhappy path', async () => { - mockfetchError(); - try { - await exportRules({ - ruleIds: ['mySuperRuleId', 'mySuperRuleId_II'], - signal: abortCtrl.signal, - }); - } catch (exp) { - expect(exp).toBeInstanceOf(ToasterErrors); - expect(exp.message).toEqual('super mega error, it is not that bad'); - } - }); }); describe('getRuleStatusById', () => { + const statusMock = { + myRule: { + current_status: { + alert_id: 'alertId', + status_date: 'mm/dd/yyyyTHH:MM:sssz', + status: 'succeeded', + last_failure_at: null, + last_success_at: 'mm/dd/yyyyTHH:MM:sssz', + last_failure_message: null, + last_success_message: 'it is a success', + }, + failures: [], + }, + }; + beforeEach(() => { - mockKibanaServices.mockClear(); fetchMock.mockClear(); - fetchMock.mockImplementation(() => ({ - response: { - ok: true, - message: 'success', - text: 'success', - }, - body: ruleMock, - })); + fetchMock.mockResolvedValue(statusMock); }); - test('check parameter url, query', async () => { - mockfetchSuccess(null, fetchMock); + test('check parameter url, query', async () => { await getRuleStatusById({ id: 'mySuperRuleId', signal: abortCtrl.signal }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/_find_statuses', { - asResponse: true, query: { ids: '["mySuperRuleId"]', }, @@ -744,117 +508,54 @@ describe('Detections Rules API', () => { signal: abortCtrl.signal, }); }); + test('happy path', async () => { - const statusMock = { - myRule: { - current_status: { - alert_id: 'alertId', - status_date: 'mm/dd/yyyyTHH:MM:sssz', - status: 'succeeded', - last_failure_at: null, - last_success_at: 'mm/dd/yyyyTHH:MM:sssz', - last_failure_message: null, - last_success_message: 'it is a success', - }, - failures: [], - }, - }; - mockfetchSuccess(statusMock); const ruleResp = await getRuleStatusById({ id: 'mySuperRuleId', signal: abortCtrl.signal }); expect(ruleResp).toEqual(statusMock); }); - test('unhappy path', async () => { - mockfetchError(); - try { - await getRuleStatusById({ id: 'mySuperRuleId', signal: abortCtrl.signal }); - } catch (exp) { - expect(exp).toBeInstanceOf(ToasterErrors); - expect(exp.message).toEqual('super mega error, it is not that bad'); - } - }); }); describe('fetchTags', () => { beforeEach(() => { - mockKibanaServices.mockClear(); fetchMock.mockClear(); - fetchMock.mockImplementation(() => ({ - response: { - ok: true, - message: 'success', - text: 'success', - }, - body: ruleMock, - })); + fetchMock.mockResolvedValue(['some', 'tags']); }); - test('check parameter url when fetching tags', async () => { - mockfetchSuccess(null, fetchMock); + test('check parameter url when fetching tags', async () => { await fetchTags({ signal: abortCtrl.signal }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/tags', { - asResponse: true, signal: abortCtrl.signal, method: 'GET', }); }); + test('happy path', async () => { - mockfetchSuccess(['hello', 'tags']); const resp = await fetchTags({ signal: abortCtrl.signal }); - expect(resp).toEqual(['hello', 'tags']); - }); - test('unhappy path', async () => { - mockfetchError(); - try { - await fetchTags({ signal: abortCtrl.signal }); - } catch (exp) { - expect(exp).toBeInstanceOf(ToasterErrors); - expect(exp.message).toEqual('super mega error, it is not that bad'); - } + expect(resp).toEqual(['some', 'tags']); }); }); describe('getPrePackagedRulesStatus', () => { + const prePackagedRulesStatus = { + rules_custom_installed: 33, + rules_installed: 12, + rules_not_installed: 0, + rules_not_updated: 2, + }; beforeEach(() => { - mockKibanaServices.mockClear(); fetchMock.mockClear(); - fetchMock.mockImplementation(() => ({ - response: { - ok: true, - message: 'success', - text: 'success', - }, - body: ruleMock, - })); + fetchMock.mockResolvedValue(prePackagedRulesStatus); }); test('check parameter url when fetching tags', async () => { - mockfetchSuccess(null, fetchMock); - await getPrePackagedRulesStatus({ signal: abortCtrl.signal }); expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/rules/prepackaged/_status', { - asResponse: true, signal: abortCtrl.signal, method: 'GET', }); }); test('happy path', async () => { - const prePackagesRulesStatus = { - rules_custom_installed: 33, - rules_installed: 12, - rules_not_installed: 0, - rules_not_updated: 2, - }; - mockfetchSuccess(prePackagesRulesStatus); const resp = await getPrePackagedRulesStatus({ signal: abortCtrl.signal }); - expect(resp).toEqual(prePackagesRulesStatus); - }); - test('unhappy path', async () => { - mockfetchError(); - try { - await getPrePackagedRulesStatus({ signal: abortCtrl.signal }); - } catch (exp) { - expect(exp).toBeInstanceOf(ToasterErrors); - expect(exp.message).toEqual('super mega error, it is not that bad'); - } + expect(resp).toEqual(prePackagedRulesStatus); }); }); }); diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.ts index dfd812251e3d6..b52c4964c6695 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.ts +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.ts @@ -17,13 +17,12 @@ import { BasicFetchProps, ImportRulesProps, ExportRulesProps, - RuleError, RuleStatusResponse, ImportRulesResponse, PrePackagedRulesStatusResponse, + BulkRuleResponse, } from './types'; import { KibanaServices } from '../../../lib/kibana'; -import { throwIfNotOk } from '../../../hooks/api/api'; import { DETECTION_ENGINE_RULES_URL, DETECTION_ENGINE_PREPACKAGED_URL, @@ -38,19 +37,16 @@ import * as i18n from '../../../pages/detection_engine/rules/translations'; * * @param rule to add * @param signal to cancel request + * + * @throws An error if response is not OK */ -export const addRule = async ({ rule, signal }: AddRulesProps): Promise => { - const response = await KibanaServices.get().http.fetch(DETECTION_ENGINE_RULES_URL, { +export const addRule = async ({ rule, signal }: AddRulesProps): Promise => + KibanaServices.get().http.fetch(DETECTION_ENGINE_RULES_URL, { method: rule.id != null ? 'PUT' : 'POST', body: JSON.stringify(rule), - asResponse: true, signal, }); - await throwIfNotOk(response.response); - return response.body!; -}; - /** * Fetches all rules from the Detection Engine API * @@ -58,6 +54,7 @@ export const addRule = async ({ rule, signal }: AddRulesProps): Promise * @param pagination desired pagination options (e.g. page/perPage) * @param signal to cancel request * + * @throws An error if response is not OK */ export const fetchRules = async ({ filterOptions = { @@ -94,18 +91,14 @@ export const fetchRules = async ({ ...(filters.length ? { filter: filters.join(' AND ') } : {}), }; - const response = await KibanaServices.get().http.fetch( + return KibanaServices.get().http.fetch( `${DETECTION_ENGINE_RULES_URL}/_find`, { method: 'GET', query, signal, - asResponse: true, } ); - - await throwIfNotOk(response.response); - return response.body!; }; /** @@ -114,19 +107,15 @@ export const fetchRules = async ({ * @param id Rule ID's (not rule_id) * @param signal to cancel request * + * @throws An error if response is not OK */ -export const fetchRuleById = async ({ id, signal }: FetchRuleProps): Promise => { - const response = await KibanaServices.get().http.fetch(DETECTION_ENGINE_RULES_URL, { +export const fetchRuleById = async ({ id, signal }: FetchRuleProps): Promise => + KibanaServices.get().http.fetch(DETECTION_ENGINE_RULES_URL, { method: 'GET', query: { id }, - asResponse: true, signal, }); - await throwIfNotOk(response.response); - return response.body!; -}; - /** * Enables/Disables provided Rule ID's * @@ -135,19 +124,11 @@ export const fetchRuleById = async ({ id, signal }: FetchRuleProps): Promise => { - const response = await KibanaServices.get().http.fetch( - `${DETECTION_ENGINE_RULES_URL}/_bulk_update`, - { - method: 'PATCH', - body: JSON.stringify(ids.map(id => ({ id, enabled }))), - asResponse: true, - } - ); - - await throwIfNotOk(response.response); - return response.body!; -}; +export const enableRules = async ({ ids, enabled }: EnableRulesProps): Promise => + KibanaServices.get().http.fetch(`${DETECTION_ENGINE_RULES_URL}/_bulk_update`, { + method: 'PATCH', + body: JSON.stringify(ids.map(id => ({ id, enabled }))), + }); /** * Deletes provided Rule ID's @@ -156,74 +137,57 @@ export const enableRules = async ({ ids, enabled }: EnableRulesProps): Promise> => { - const response = await KibanaServices.get().http.fetch( - `${DETECTION_ENGINE_RULES_URL}/_bulk_delete`, - { - method: 'DELETE', - body: JSON.stringify(ids.map(id => ({ id }))), - asResponse: true, - } - ); - - await throwIfNotOk(response.response); - return response.body!; -}; +export const deleteRules = async ({ ids }: DeleteRulesProps): Promise => + KibanaServices.get().http.fetch(`${DETECTION_ENGINE_RULES_URL}/_bulk_delete`, { + method: 'DELETE', + body: JSON.stringify(ids.map(id => ({ id }))), + }); /** * Duplicates provided Rules * * @param rules to duplicate + * + * @throws An error if response is not OK */ -export const duplicateRules = async ({ rules }: DuplicateRulesProps): Promise => { - const response = await KibanaServices.get().http.fetch( - `${DETECTION_ENGINE_RULES_URL}/_bulk_create`, - { - method: 'POST', - body: JSON.stringify( - rules.map(rule => ({ - ...rule, - name: `${rule.name} [${i18n.DUPLICATE}]`, - created_at: undefined, - created_by: undefined, - id: undefined, - rule_id: undefined, - updated_at: undefined, - updated_by: undefined, - enabled: rule.enabled, - immutable: undefined, - last_success_at: undefined, - last_success_message: undefined, - last_failure_at: undefined, - last_failure_message: undefined, - status: undefined, - status_date: undefined, - })) - ), - asResponse: true, - } - ); - - await throwIfNotOk(response.response); - return response.body!; -}; +export const duplicateRules = async ({ rules }: DuplicateRulesProps): Promise => + KibanaServices.get().http.fetch(`${DETECTION_ENGINE_RULES_URL}/_bulk_create`, { + method: 'POST', + body: JSON.stringify( + rules.map(rule => ({ + ...rule, + name: `${rule.name} [${i18n.DUPLICATE}]`, + created_at: undefined, + created_by: undefined, + id: undefined, + rule_id: undefined, + updated_at: undefined, + updated_by: undefined, + enabled: rule.enabled, + immutable: undefined, + last_success_at: undefined, + last_success_message: undefined, + last_failure_at: undefined, + last_failure_message: undefined, + status: undefined, + status_date: undefined, + })) + ), + }); /** * Create Prepackaged Rules * * @param signal AbortSignal for cancelling request + * + * @throws An error if response is not OK */ export const createPrepackagedRules = async ({ signal }: BasicFetchProps): Promise => { - const response = await KibanaServices.get().http.fetch( - DETECTION_ENGINE_PREPACKAGED_URL, - { - method: 'PUT', - signal, - asResponse: true, - } - ); + await KibanaServices.get().http.fetch(DETECTION_ENGINE_PREPACKAGED_URL, { + method: 'PUT', + signal, + }); - await throwIfNotOk(response.response); return true; }; @@ -244,20 +208,16 @@ export const importRules = async ({ const formData = new FormData(); formData.append('file', fileToImport); - const response = await KibanaServices.get().http.fetch( + return KibanaServices.get().http.fetch( `${DETECTION_ENGINE_RULES_URL}/_import`, { method: 'POST', headers: { 'Content-Type': undefined }, query: { overwrite }, body: formData, - asResponse: true, signal, } ); - - await throwIfNotOk(response.response); - return response.body!; }; /** @@ -281,22 +241,15 @@ export const exportRules = async ({ ? JSON.stringify({ objects: ruleIds.map(rule => ({ rule_id: rule })) }) : undefined; - const response = await KibanaServices.get().http.fetch( - `${DETECTION_ENGINE_RULES_URL}/_export`, - { - method: 'POST', - body, - query: { - exclude_export_details: excludeExportDetails, - file_name: filename, - }, - signal, - asResponse: true, - } - ); - - await throwIfNotOk(response.response); - return response.body!; + return KibanaServices.get().http.fetch(`${DETECTION_ENGINE_RULES_URL}/_export`, { + method: 'POST', + body, + query: { + exclude_export_details: excludeExportDetails, + file_name: filename, + }, + signal, + }); }; /** @@ -313,38 +266,26 @@ export const getRuleStatusById = async ({ }: { id: string; signal: AbortSignal; -}): Promise => { - const response = await KibanaServices.get().http.fetch( - DETECTION_ENGINE_RULES_STATUS_URL, - { - method: 'GET', - query: { ids: JSON.stringify([id]) }, - signal, - asResponse: true, - } - ); - - await throwIfNotOk(response.response); - return response.body!; -}; +}): Promise => + KibanaServices.get().http.fetch(DETECTION_ENGINE_RULES_STATUS_URL, { + method: 'GET', + query: { ids: JSON.stringify([id]) }, + signal, + }); /** * Fetch all unique Tags used by Rules * * @param signal to cancel request * + * @throws An error if response is not OK */ -export const fetchTags = async ({ signal }: { signal: AbortSignal }): Promise => { - const response = await KibanaServices.get().http.fetch(DETECTION_ENGINE_TAGS_URL, { +export const fetchTags = async ({ signal }: { signal: AbortSignal }): Promise => + KibanaServices.get().http.fetch(DETECTION_ENGINE_TAGS_URL, { method: 'GET', signal, - asResponse: true, }); - await throwIfNotOk(response.response); - return response.body!; -}; - /** * Get pre packaged rules Status * @@ -356,16 +297,11 @@ export const getPrePackagedRulesStatus = async ({ signal, }: { signal: AbortSignal; -}): Promise => { - const response = await KibanaServices.get().http.fetch( +}): Promise => + KibanaServices.get().http.fetch( DETECTION_ENGINE_PREPACKAGED_RULES_STATUS_URL, { method: 'GET', signal, - asResponse: true, } ); - - await throwIfNotOk(response.response); - return response.body!; -}; diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx index 06c4d1054bca4..c5aefac15f48e 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx @@ -15,8 +15,7 @@ import { getIndexFields, sourceQuery, } from '../../../containers/source'; -import { useStateToaster } from '../../../components/toasters'; -import { errorToToaster } from '../../../components/ml/api/error_to_toaster'; +import { errorToToaster, useStateToaster } from '../../../components/toasters'; import { SourceQuery } from '../../../graphql/types'; import { useApolloClient } from '../../../utils/apollo_context'; diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/persist_rule.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/persist_rule.tsx index e720a1e70f153..4d4f6c9d8f63a 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/persist_rule.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/persist_rule.tsx @@ -6,8 +6,7 @@ import { useEffect, useState, Dispatch } from 'react'; -import { useStateToaster } from '../../../components/toasters'; -import { errorToToaster } from '../../../components/ml/api/error_to_toaster'; +import { errorToToaster, useStateToaster } from '../../../components/toasters'; import { addRule as persistRule } from './api'; import * as i18n from './translations'; diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/types.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/types.ts index ff49bb8a8c3a2..4d2aec4ee8740 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/types.ts +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/types.ts @@ -96,10 +96,13 @@ export type Rule = t.TypeOf; export type Rules = t.TypeOf; export interface RuleError { - rule_id: string; + id?: string; + rule_id?: string; error: { status_code: number; message: string }; } +export type BulkRuleResponse = Array; + export interface RuleResponseBuckets { rules: Rule[]; errors: RuleError[]; diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_pre_packaged_rules.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_pre_packaged_rules.tsx index 04d7e3ef67da4..0dd95bea8a0b2 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_pre_packaged_rules.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_pre_packaged_rules.tsx @@ -6,8 +6,7 @@ import { useEffect, useState } from 'react'; -import { useStateToaster, displaySuccessToast } from '../../../components/toasters'; -import { errorToToaster } from '../../../components/ml/api/error_to_toaster'; +import { errorToToaster, useStateToaster, displaySuccessToast } from '../../../components/toasters'; import { getPrePackagedRulesStatus, createPrepackagedRules } from './api'; import * as i18n from './translations'; diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_rule.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_rule.tsx index ab08bd39688ce..d6a49e006e1b8 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_rule.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_rule.tsx @@ -6,8 +6,7 @@ import { useEffect, useState } from 'react'; -import { useStateToaster } from '../../../components/toasters'; -import { errorToToaster } from '../../../components/ml/api/error_to_toaster'; +import { errorToToaster, useStateToaster } from '../../../components/toasters'; import { fetchRuleById } from './api'; import * as i18n from './translations'; import { Rule } from './types'; diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_rule_status.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_rule_status.tsx index fcf95ac061ba3..8d06e037e0979 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_rule_status.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_rule_status.tsx @@ -6,8 +6,7 @@ import { useEffect, useRef, useState } from 'react'; -import { useStateToaster } from '../../../components/toasters'; -import { errorToToaster } from '../../../components/ml/api/error_to_toaster'; +import { errorToToaster, useStateToaster } from '../../../components/toasters'; import { getRuleStatusById } from './api'; import * as i18n from './translations'; import { RuleStatus } from './types'; diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_rules.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_rules.tsx index 81b8b04ed6648..6e41e229c2490 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_rules.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_rules.tsx @@ -8,9 +8,8 @@ import { noop } from 'lodash/fp'; import { useEffect, useState, useRef } from 'react'; import { FetchRulesResponse, FilterOptions, PaginationOptions, Rule } from './types'; -import { useStateToaster } from '../../../components/toasters'; +import { errorToToaster, useStateToaster } from '../../../components/toasters'; import { fetchRules } from './api'; -import { errorToToaster } from '../../../components/ml/api/error_to_toaster'; import * as i18n from './translations'; export type ReturnRules = [ diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_tags.test.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_tags.test.tsx index 68f54b35754f6..222ff3d1ede2e 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_tags.test.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_tags.test.tsx @@ -12,7 +12,7 @@ jest.mock('./api'); describe('useTags', () => { test('init', async () => { await act(async () => { - const { result, waitForNextUpdate } = renderHook(() => useTags()); + const { result, waitForNextUpdate } = renderHook(() => useTags()); await waitForNextUpdate(); expect(result.current).toEqual([true, [], result.current[2]]); }); @@ -20,7 +20,7 @@ describe('useTags', () => { test('fetch tags', async () => { await act(async () => { - const { result, waitForNextUpdate } = renderHook(() => useTags()); + const { result, waitForNextUpdate } = renderHook(() => useTags()); await waitForNextUpdate(); await waitForNextUpdate(); expect(result.current).toEqual([ diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_tags.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_tags.tsx index 5985200fa16ec..669efedc619bb 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_tags.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/use_tags.tsx @@ -6,9 +6,8 @@ import { noop } from 'lodash/fp'; import { useEffect, useState, useRef } from 'react'; -import { useStateToaster } from '../../../components/toasters'; +import { errorToToaster, useStateToaster } from '../../../components/toasters'; import { fetchTags } from './api'; -import { errorToToaster } from '../../../components/ml/api/error_to_toaster'; import * as i18n from './translations'; export type ReturnTags = [boolean, string[], () => void]; diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/__mocks__/api.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/__mocks__/api.ts new file mode 100644 index 0000000000000..7cb1d7d574cf8 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/__mocks__/api.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { + QuerySignals, + SignalSearchResponse, + BasicSignals, + SignalsIndex, + Privilege, +} from '../types'; +import { signalsMock, mockSignalIndex, mockUserPrivilege } from '../mock'; + +export const fetchQuerySignals = async ({ + query, + signal, +}: QuerySignals): Promise> => + Promise.resolve(signalsMock as SignalSearchResponse); + +export const getSignalIndex = async ({ signal }: BasicSignals): Promise => + Promise.resolve(mockSignalIndex); + +export const getUserPrivilege = async ({ signal }: BasicSignals): Promise => + Promise.resolve(mockUserPrivilege); + +export const createSignalIndex = async ({ signal }: BasicSignals): Promise => + Promise.resolve(mockSignalIndex); diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/api.test.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/api.test.ts new file mode 100644 index 0000000000000..c011ecffb35bc --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/api.test.ts @@ -0,0 +1,165 @@ +/* + * 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 { KibanaServices } from '../../../lib/kibana'; +import { + signalsMock, + mockSignalsQuery, + mockStatusSignalQuery, + mockSignalIndex, + mockUserPrivilege, +} from './mock'; +import { + fetchQuerySignals, + updateSignalStatus, + getSignalIndex, + getUserPrivilege, + createSignalIndex, +} from './api'; + +const abortCtrl = new AbortController(); +const mockKibanaServices = KibanaServices.get as jest.Mock; +jest.mock('../../../lib/kibana'); + +const fetchMock = jest.fn(); +mockKibanaServices.mockReturnValue({ http: { fetch: fetchMock } }); + +describe('Detections Signals API', () => { + describe('fetchQuerySignals', () => { + beforeEach(() => { + fetchMock.mockClear(); + fetchMock.mockResolvedValue(signalsMock); + }); + + test('check parameter url, body', async () => { + await fetchQuerySignals({ query: mockSignalsQuery, signal: abortCtrl.signal }); + expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/signals/search', { + body: + '{"aggs":{"signalsByGrouping":{"terms":{"field":"signal.rule.risk_score","missing":"All others","order":{"_count":"desc"},"size":10},"aggs":{"signals":{"date_histogram":{"field":"@timestamp","fixed_interval":"81000000ms","min_doc_count":0,"extended_bounds":{"min":1579644343954,"max":1582236343955}}}}}},"query":{"bool":{"filter":[{"bool":{"must":[],"filter":[{"match_all":{}}],"should":[],"must_not":[]}},{"range":{"@timestamp":{"gte":1579644343954,"lte":1582236343955}}}]}}}', + method: 'POST', + signal: abortCtrl.signal, + }); + }); + + test('happy path', async () => { + const signalsResp = await fetchQuerySignals({ + query: mockSignalsQuery, + signal: abortCtrl.signal, + }); + expect(signalsResp).toEqual(signalsMock); + }); + }); + + describe('updateSignalStatus', () => { + beforeEach(() => { + fetchMock.mockClear(); + fetchMock.mockResolvedValue({}); + }); + + test('check parameter url, body when closing a signal', async () => { + await updateSignalStatus({ + query: mockStatusSignalQuery, + signal: abortCtrl.signal, + status: 'closed', + }); + expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/signals/status', { + body: + '{"status":"closed","bool":{"filter":{"terms":{"_id":["b4ee5c32e3a321057edcc953ca17228c6fdfe5ba43fdbbdaffa8cefa11605cc5"]}}}}', + method: 'POST', + signal: abortCtrl.signal, + }); + }); + + test('check parameter url, body when opening a signal', async () => { + await updateSignalStatus({ + query: mockStatusSignalQuery, + signal: abortCtrl.signal, + status: 'open', + }); + expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/signals/status', { + body: + '{"status":"open","bool":{"filter":{"terms":{"_id":["b4ee5c32e3a321057edcc953ca17228c6fdfe5ba43fdbbdaffa8cefa11605cc5"]}}}}', + method: 'POST', + signal: abortCtrl.signal, + }); + }); + + test('happy path', async () => { + const signalsResp = await updateSignalStatus({ + query: mockStatusSignalQuery, + signal: abortCtrl.signal, + status: 'open', + }); + expect(signalsResp).toEqual({}); + }); + }); + + describe('getSignalIndex', () => { + beforeEach(() => { + fetchMock.mockClear(); + fetchMock.mockResolvedValue(mockSignalIndex); + }); + + test('check parameter url', async () => { + await getSignalIndex({ signal: abortCtrl.signal }); + expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/index', { + method: 'GET', + signal: abortCtrl.signal, + }); + }); + + test('happy path', async () => { + const signalsResp = await getSignalIndex({ + signal: abortCtrl.signal, + }); + expect(signalsResp).toEqual(mockSignalIndex); + }); + }); + + describe('getUserPrivilege', () => { + beforeEach(() => { + fetchMock.mockClear(); + fetchMock.mockResolvedValue(mockUserPrivilege); + }); + + test('check parameter url', async () => { + await getUserPrivilege({ signal: abortCtrl.signal }); + expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/privileges', { + method: 'GET', + signal: abortCtrl.signal, + }); + }); + + test('happy path', async () => { + const signalsResp = await getUserPrivilege({ + signal: abortCtrl.signal, + }); + expect(signalsResp).toEqual(mockUserPrivilege); + }); + }); + + describe('createSignalIndex', () => { + beforeEach(() => { + fetchMock.mockClear(); + fetchMock.mockResolvedValue(mockSignalIndex); + }); + + test('check parameter url', async () => { + await createSignalIndex({ signal: abortCtrl.signal }); + expect(fetchMock).toHaveBeenCalledWith('/api/detection_engine/index', { + method: 'POST', + signal: abortCtrl.signal, + }); + }); + + test('happy path', async () => { + const signalsResp = await createSignalIndex({ + signal: abortCtrl.signal, + }); + expect(signalsResp).toEqual(mockSignalIndex); + }); + }); +}); diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/api.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/api.ts index 085bde3e54ef1..25263c2d32735 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/api.ts +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/api.ts @@ -5,7 +5,6 @@ */ import { KibanaServices } from '../../../lib/kibana'; -import { throwIfNotOk } from '../../../hooks/api/api'; import { DETECTION_ENGINE_QUERY_SIGNALS_URL, DETECTION_ENGINE_SIGNALS_STATUS_URL, @@ -14,10 +13,8 @@ import { } from '../../../../common/constants'; import { BasicSignals, - PostSignalError, Privilege, QuerySignals, - SignalIndexError, SignalSearchResponse, SignalsIndex, UpdateSignalStatusProps, @@ -27,101 +24,78 @@ import { * Fetch Signals by providing a query * * @param query String to match a dsl + * @param signal to cancel request + * + * @throws An error if response is not OK */ export const fetchQuerySignals = async ({ query, signal, -}: QuerySignals): Promise> => { - const response = await KibanaServices.get().http.fetch>( +}: QuerySignals): Promise> => + KibanaServices.get().http.fetch>( DETECTION_ENGINE_QUERY_SIGNALS_URL, { method: 'POST', body: JSON.stringify(query), - asResponse: true, signal, } ); - await throwIfNotOk(response.response); - return response.body!; -}; - /** * Update signal status by query * * @param query of signals to update * @param status to update to('open' / 'closed') * @param signal AbortSignal for cancelling request + * + * @throws An error if response is not OK */ export const updateSignalStatus = async ({ query, status, signal, -}: UpdateSignalStatusProps): Promise => { - const response = await KibanaServices.get().http.fetch(DETECTION_ENGINE_SIGNALS_STATUS_URL, { +}: UpdateSignalStatusProps): Promise => + KibanaServices.get().http.fetch(DETECTION_ENGINE_SIGNALS_STATUS_URL, { method: 'POST', body: JSON.stringify({ status, ...query }), - asResponse: true, signal, }); - await throwIfNotOk(response.response); - return response.body!; -}; - /** * Fetch Signal Index * * @param signal AbortSignal for cancelling request + * + * @throws An error if response is not OK */ -export const getSignalIndex = async ({ signal }: BasicSignals): Promise => { - try { - return await KibanaServices.get().http.fetch(DETECTION_ENGINE_INDEX_URL, { - method: 'GET', - signal, - }); - } catch (e) { - if (e.body) { - throw new SignalIndexError(e.body); - } - throw e; - } -}; +export const getSignalIndex = async ({ signal }: BasicSignals): Promise => + KibanaServices.get().http.fetch(DETECTION_ENGINE_INDEX_URL, { + method: 'GET', + signal, + }); /** * Get User Privileges * * @param signal AbortSignal for cancelling request + * + * @throws An error if response is not OK */ -export const getUserPrivilege = async ({ signal }: BasicSignals): Promise => { - const response = await KibanaServices.get().http.fetch( - DETECTION_ENGINE_PRIVILEGES_URL, - { - method: 'GET', - signal, - asResponse: true, - } - ); - - await throwIfNotOk(response.response); - return response.body!; -}; +export const getUserPrivilege = async ({ signal }: BasicSignals): Promise => + KibanaServices.get().http.fetch(DETECTION_ENGINE_PRIVILEGES_URL, { + method: 'GET', + signal, + }); /** * Create Signal Index if needed it * * @param signal AbortSignal for cancelling request + * + * @throws An error if response is not OK */ -export const createSignalIndex = async ({ signal }: BasicSignals): Promise => { - try { - return await KibanaServices.get().http.fetch(DETECTION_ENGINE_INDEX_URL, { - method: 'POST', - signal, - }); - } catch (e) { - if (e.body) { - throw new PostSignalError(e.body); - } - throw e; - } -}; +export const createSignalIndex = async ({ signal }: BasicSignals): Promise => + KibanaServices.get().http.fetch(DETECTION_ENGINE_INDEX_URL, { + method: 'POST', + signal, + }); diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/get_index_error.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/get_index_error.ts deleted file mode 100644 index 79dae5b8acb87..0000000000000 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/get_index_error.ts +++ /dev/null @@ -1,24 +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 { MessageBody } from '../../../../hooks/api/throw_if_not_ok'; - -export class SignalIndexError extends Error { - message: string = ''; - status_code: number = -1; - error: string = ''; - - constructor(errObj: MessageBody) { - super(errObj.message); - this.message = errObj.message ?? ''; - this.status_code = errObj.status_code ?? -1; - this.error = errObj.error ?? ''; - this.name = 'SignalIndexError'; - - // Set the prototype explicitly. - Object.setPrototypeOf(this, SignalIndexError.prototype); - } -} diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/post_index_error.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/post_index_error.ts deleted file mode 100644 index 227699af71b42..0000000000000 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/post_index_error.ts +++ /dev/null @@ -1,24 +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 { MessageBody } from '../../../../hooks/api/throw_if_not_ok'; - -export class PostSignalError extends Error { - message: string = ''; - statusCode: number = -1; - error: string = ''; - - constructor(errObj: MessageBody) { - super(errObj.message); - this.message = errObj.message ?? ''; - this.statusCode = errObj.statusCode ?? -1; - this.error = errObj.error ?? ''; - this.name = 'PostSignalError'; - - // Set the prototype explicitly. - Object.setPrototypeOf(this, PostSignalError.prototype); - } -} diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/privilege_user_error.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/privilege_user_error.ts deleted file mode 100644 index 19915e898bbeb..0000000000000 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/privilege_user_error.ts +++ /dev/null @@ -1,24 +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 { MessageBody } from '../../../../hooks/api/throw_if_not_ok'; - -export class PrivilegeUserError extends Error { - message: string = ''; - statusCode: number = -1; - error: string = ''; - - constructor(errObj: MessageBody) { - super(errObj.message); - this.message = errObj.message ?? ''; - this.statusCode = errObj.statusCode ?? -1; - this.error = errObj.error ?? ''; - this.name = 'PrivilegeUserError'; - - // Set the prototype explicitly. - Object.setPrototypeOf(this, PrivilegeUserError.prototype); - } -} diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/mock.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/mock.ts new file mode 100644 index 0000000000000..37e93b1481e15 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/mock.ts @@ -0,0 +1,1037 @@ +/* + * 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 { SignalSearchResponse, SignalsIndex, Privilege } from './types'; + +export const signalsMock: SignalSearchResponse = { + took: 7, + timeout: false, + _shards: { + total: 1, + successful: 1, + skipped: 0, + failed: 0, + }, + hits: { + total: { + value: 10000, + relation: 'gte', + }, + hits: [ + { + _index: '.siem-signals-default-000001', + _id: '820e05ab0a10a2110d6f0ab2e1864402724a88680d5b49840ecc17dd069d7646', + _score: 0, + _source: { + '@timestamp': '2020-02-15T00:15:19.231Z', + event: { + kind: 'signal', + code: 4625, + created: '2020-02-15T00:09:19.454Z', + module: 'security', + type: 'authentication_failure', + outcome: 'failure', + provider: 'Microsoft-Windows-Security-Auditing', + action: 'logon-failed', + category: 'authentication', + }, + winlog: { + record_id: 4864460, + task: 'Logon', + logon: { + failure: { + reason: 'Unknown user name or bad password.', + status: 'This is either due to a bad username or authentication information', + sub_status: 'User logon with misspelled or bad user account', + }, + type: 'Network', + }, + channel: 'Security', + event_id: 4625, + process: { + pid: 548, + thread: { + id: 292, + }, + }, + api: 'wineventlog', + opcode: 'Info', + computer_name: 'siem-windows', + keywords: ['Audit Failure'], + activity_id: '{96816605-032c-0000-eaad-4c5f58e1d501}', + provider_guid: '{54849625-5478-4994-a5ba-3e3b0328c30d}', + event_data: { + Status: '0xc000006d', + LmPackageName: '-', + SubjectUserSid: 'S-1-0-0', + SubjectLogonId: '0x0', + TransmittedServices: '-', + SubjectDomainName: '-', + LogonProcessName: 'NtLmSsp ', + AuthenticationPackageName: 'NTLM', + KeyLength: '0', + SubjectUserName: '-', + TargetUserSid: 'S-1-0-0', + FailureReason: '%%2313', + SubStatus: '0xc0000064', + LogonType: '3', + TargetUserName: 'ADMIN', + }, + provider_name: 'Microsoft-Windows-Security-Auditing', + }, + process: { + pid: 0, + executable: '-', + name: '-', + }, + agent: { + type: 'winlogbeat', + ephemeral_id: 'cbee8ae0-2c75-4999-ba16-71d482247f52', + hostname: 'siem-windows', + id: '19b2de73-7b9a-4e92-b3e7-82383ac5f389', + version: '7.5.1', + }, + cloud: { + availability_zone: 'us-east1-b', + project: { + id: 'elastic-beats', + }, + provider: 'gcp', + instance: { + id: '3849238371046563697', + name: 'siem-windows', + }, + machine: { + type: 'g1-small', + }, + }, + log: { + level: 'information', + }, + message: + 'An account failed to log on.\n\nSubject:\n\tSecurity ID:\t\tS-1-0-0\n\tAccount Name:\t\t-\n\tAccount Domain:\t\t-\n\tLogon ID:\t\t0x0\n\nLogon Type:\t\t\t3\n\nAccount For Which Logon Failed:\n\tSecurity ID:\t\tS-1-0-0\n\tAccount Name:\t\tADMIN\n\tAccount Domain:\t\t\n\nFailure Information:\n\tFailure Reason:\t\tUnknown user name or bad password.\n\tStatus:\t\t\t0xC000006D\n\tSub Status:\t\t0xC0000064\n\nProcess Information:\n\tCaller Process ID:\t0x0\n\tCaller Process Name:\t-\n\nNetwork Information:\n\tWorkstation Name:\t-\n\tSource Network Address:\t185.209.0.96\n\tSource Port:\t\t0\n\nDetailed Authentication Information:\n\tLogon Process:\t\tNtLmSsp \n\tAuthentication Package:\tNTLM\n\tTransited Services:\t-\n\tPackage Name (NTLM only):\t-\n\tKey Length:\t\t0\n\nThis event is generated when a logon request fails. It is generated on the computer where access was attempted.\n\nThe Subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.\n\nThe Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network).\n\nThe Process Information fields indicate which account and process on the system requested the logon.\n\nThe Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.\n\nThe authentication information fields provide detailed information about this specific logon request.\n\t- Transited services indicate which intermediate services have participated in this logon request.\n\t- Package name indicates which sub-protocol was used among the NTLM protocols.\n\t- Key length indicates the length of the generated session key. This will be 0 if no session key was requested.', + user: { + name: 'ADMIN', + id: 'S-1-0-0', + }, + source: { + ip: '185.209.0.96', + port: 0, + domain: '-', + }, + ecs: { + version: '1.1.0', + }, + host: { + name: 'siem-windows', + os: { + name: 'Windows Server 2019 Datacenter', + kernel: '10.0.17763.1039 (WinBuild.160101.0800)', + build: '17763.1039', + platform: 'windows', + version: '10.0', + family: 'windows', + }, + id: 'ae32054e-0d4a-4c4d-88ec-b840f992e1c2', + hostname: 'siem-windows', + architecture: 'x86_64', + }, + signal: { + parent: { + rule: '2df3a613-f5a8-4b55-bf6a-487fc820b842', + id: 'AdctRnABMQha2n6boR1M', + type: 'event', + index: 'winlogbeat-7.5.1-2020.01.15-000001', + depth: 1, + }, + ancestors: [ + { + rule: '2df3a613-f5a8-4b55-bf6a-487fc820b842', + id: 'AdctRnABMQha2n6boR1M', + type: 'event', + index: 'winlogbeat-7.5.1-2020.01.15-000001', + depth: 1, + }, + ], + original_time: '2020-02-15T00:09:18.714Z', + status: 'open', + rule: { + id: '2df3a613-f5a8-4b55-bf6a-487fc820b842', + rule_id: '82b2b065-a2ee-49fc-9d6d-781a75c3d280', + false_positives: [], + meta: { + from: '1m', + }, + max_signals: 100, + risk_score: 79, + output_index: '.siem-signals-default', + description: 'matches most events', + from: 'now-360s', + immutable: false, + index: [ + 'apm-*-transaction*', + 'auditbeat-*', + 'endgame-*', + 'filebeat-*', + 'packetbeat-*', + 'winlogbeat-*', + ], + interval: '5m', + language: 'kuery', + name: 'matches host.name exists', + query: 'host.name : *', + references: ['https://google.com'], + severity: 'high', + tags: [ + 'host.name exists', + 'for testing', + '__internal_rule_id:82b2b065-a2ee-49fc-9d6d-781a75c3d280', + '__internal_immutable:false', + ], + type: 'query', + to: 'now', + enabled: true, + filters: [], + created_by: 'elastic', + updated_by: 'elastic', + threat: [ + { + framework: 'MITRE ATT&CK', + technique: [ + { + reference: 'https://attack.mitre.org/techniques/T1110', + name: 'Brute Force', + id: 'T1110', + }, + { + reference: 'https://attack.mitre.org/techniques/T1098', + name: 'Account Manipulation', + id: 'T1098', + }, + { + reference: 'https://attack.mitre.org/techniques/T1081', + name: 'Credentials in Files', + id: 'T1081', + }, + ], + tactic: { + reference: 'https://attack.mitre.org/tactics/TA0006', + name: 'Credential Access', + id: 'TA0006', + }, + }, + { + framework: 'MITRE ATT&CK', + technique: [ + { + reference: 'https://attack.mitre.org/techniques/T1530', + name: 'Data from Cloud Storage Object', + id: 'T1530', + }, + ], + tactic: { + reference: 'https://attack.mitre.org/tactics/TA0009', + name: 'Collection', + id: 'TA0009', + }, + }, + ], + version: 1, + created_at: '2020-02-12T19:49:29.417Z', + updated_at: '2020-02-14T23:15:06.186Z', + }, + original_event: { + kind: 'event', + code: 4625, + created: '2020-02-15T00:09:19.454Z', + module: 'security', + type: 'authentication_failure', + outcome: 'failure', + provider: 'Microsoft-Windows-Security-Auditing', + action: 'logon-failed', + category: 'authentication', + }, + }, + }, + }, + { + _index: '.siem-signals-default-000001', + _id: 'f461e2132bdf3926ef1fe10c83e671707ff3f12348ce600b8490c97a0c704086', + _score: 0, + _source: { + '@timestamp': '2020-02-15T00:15:19.231Z', + source: { + ip: '10.142.0.7', + port: 42774, + packets: 2, + bytes: 80, + }, + server: { + bytes: 10661, + ip: '169.254.169.254', + port: 80, + packets: 3, + }, + service: { + type: 'system', + }, + system: { + audit: { + socket: { + egid: 0, + kernel_sock_address: '0xffff8dd0103d2000', + uid: 0, + gid: 0, + euid: 0, + }, + }, + }, + destination: { + bytes: 10661, + ip: '169.254.169.254', + port: 80, + packets: 3, + }, + host: { + architecture: 'x86_64', + os: { + name: 'Debian GNU/Linux', + kernel: '4.9.0-8-amd64', + codename: 'stretch', + platform: 'debian', + version: '9 (stretch)', + family: 'debian', + }, + id: 'aa7ca589f1b8220002f2fc61c64cfbf1', + containerized: false, + hostname: 'siem-kibana', + name: 'siem-kibana', + }, + agent: { + type: 'auditbeat', + ephemeral_id: '60adc2c2-ab48-4e5c-b557-e73549400a79', + hostname: 'siem-kibana', + id: '03ccb0ce-f65c-4279-a619-05f1d5bb000b', + version: '7.5.0', + }, + client: { + ip: '10.142.0.7', + port: 42774, + packets: 2, + bytes: 80, + }, + cloud: { + machine: { + type: 'n1-standard-2', + }, + availability_zone: 'us-east1-b', + instance: { + name: 'siem-kibana', + id: '5412578377715150143', + }, + project: { + id: 'elastic-beats', + }, + provider: 'gcp', + }, + network: { + type: 'ipv4', + transport: 'tcp', + packets: 5, + bytes: 10741, + community_id: '1:qTY0+fxFYZvNHSUM4xTnCKjq8hM=', + direction: 'outbound', + }, + group: { + name: 'root', + id: '0', + }, + tags: ['7.5.0-bc2'], + ecs: { + version: '1.1.0', + }, + user: { + id: '0', + name: 'root', + }, + event: { + dataset: 'socket', + kind: 'signal', + action: 'network_flow', + category: 'network_traffic', + start: '2020-02-15T00:09:18.360Z', + end: '2020-02-15T00:09:18.361Z', + duration: 746181, + module: 'system', + }, + process: { + pid: 746, + name: 'google_accounts', + args: ['/usr/bin/python3', '/usr/bin/google_accounts_daemon'], + executable: '/usr/bin/python3.5', + created: '2020-02-14T18:31:08.280Z', + }, + flow: { + final: true, + complete: false, + }, + signal: { + parent: { + rule: '2df3a613-f5a8-4b55-bf6a-487fc820b842', + id: '59ctRnABMQha2n6bmhzN', + type: 'event', + index: 'auditbeat-7.5.0-2020.01.14-000002', + depth: 1, + }, + ancestors: [ + { + rule: '2df3a613-f5a8-4b55-bf6a-487fc820b842', + id: '59ctRnABMQha2n6bmhzN', + type: 'event', + index: 'auditbeat-7.5.0-2020.01.14-000002', + depth: 1, + }, + ], + original_time: '2020-02-15T00:09:18.795Z', + status: 'open', + rule: { + id: '2df3a613-f5a8-4b55-bf6a-487fc820b842', + rule_id: '82b2b065-a2ee-49fc-9d6d-781a75c3d280', + false_positives: [], + meta: { + from: '1m', + }, + max_signals: 100, + risk_score: 79, + output_index: '.siem-signals-default', + description: 'matches most events', + from: 'now-360s', + immutable: false, + index: [ + 'apm-*-transaction*', + 'auditbeat-*', + 'endgame-*', + 'filebeat-*', + 'packetbeat-*', + 'winlogbeat-*', + ], + interval: '5m', + language: 'kuery', + name: 'matches host.name exists', + query: 'host.name : *', + references: ['https://google.com'], + severity: 'high', + tags: [ + 'host.name exists', + 'for testing', + '__internal_rule_id:82b2b065-a2ee-49fc-9d6d-781a75c3d280', + '__internal_immutable:false', + ], + type: 'query', + to: 'now', + enabled: true, + filters: [], + created_by: 'elastic', + updated_by: 'elastic', + threat: [ + { + framework: 'MITRE ATT&CK', + technique: [ + { + reference: 'https://attack.mitre.org/techniques/T1110', + name: 'Brute Force', + id: 'T1110', + }, + { + reference: 'https://attack.mitre.org/techniques/T1098', + name: 'Account Manipulation', + id: 'T1098', + }, + { + reference: 'https://attack.mitre.org/techniques/T1081', + name: 'Credentials in Files', + id: 'T1081', + }, + ], + tactic: { + reference: 'https://attack.mitre.org/tactics/TA0006', + name: 'Credential Access', + id: 'TA0006', + }, + }, + { + framework: 'MITRE ATT&CK', + technique: [ + { + reference: 'https://attack.mitre.org/techniques/T1530', + name: 'Data from Cloud Storage Object', + id: 'T1530', + }, + ], + tactic: { + reference: 'https://attack.mitre.org/tactics/TA0009', + name: 'Collection', + id: 'TA0009', + }, + }, + ], + version: 1, + created_at: '2020-02-12T19:49:29.417Z', + updated_at: '2020-02-14T23:15:06.186Z', + }, + original_event: { + dataset: 'socket', + kind: 'event', + action: 'network_flow', + category: 'network_traffic', + start: '2020-02-15T00:09:18.360Z', + end: '2020-02-15T00:09:18.361Z', + duration: 746181, + module: 'system', + }, + }, + }, + }, + { + _index: '.siem-signals-default-000001', + _id: '428551fed9382740e808f27ea64ce53b4d3b8cc82401d83afd47969339a0f6e3', + _score: 0, + _source: { + '@timestamp': '2020-02-15T00:15:19.231Z', + service: { + type: 'system', + }, + message: 'Process sleep (PID: 317535) by user root STARTED', + ecs: { + version: '1.0.0', + }, + host: { + name: 'beats-ci-immutable-ubuntu-1604-1581723302100990071', + hostname: 'beats-ci-immutable-ubuntu-1604-1581723302100990071', + architecture: 'x86_64', + os: { + platform: 'ubuntu', + version: '16.04.6 LTS (Xenial Xerus)', + family: 'debian', + name: 'Ubuntu', + kernel: '4.15.0-1052-gcp', + codename: 'xenial', + }, + id: 'c428794c81ade2eb0633d2bbea7ecf51', + containerized: false, + }, + cloud: { + machine: { + type: 'n1-highmem-4', + }, + availability_zone: 'us-central1-b', + project: { + id: 'elastic-ci-prod', + }, + provider: 'gcp', + instance: { + id: '5167639562480685129', + name: 'beats-ci-immutable-ubuntu-1604-1581723302100990071', + }, + }, + event: { + kind: 'signal', + action: 'process_started', + module: 'system', + dataset: 'process', + }, + process: { + executable: '/bin/sleep', + start: '2020-02-15T00:09:17.850Z', + args: ['sleep', '1'], + working_directory: '/', + name: 'sleep', + ppid: 239348, + pid: 317535, + hash: { + sha1: '9dc3644a028d1a4c853924c427f5e7d668c38ef7', + }, + entity_id: 'vtgDN10edfL0mX5p', + }, + user: { + id: '0', + group: { + id: '0', + name: 'root', + }, + effective: { + id: '0', + group: { + id: '0', + }, + }, + saved: { + id: '0', + group: { + id: '0', + }, + }, + name: 'root', + }, + agent: { + id: '4ae34f08-4770-4e5b-bd5b-c8b13741eafa', + version: '7.2.0', + type: 'auditbeat', + ephemeral_id: '3b3939af-dc90-4be8-b20b-a3d9f555d379', + hostname: 'beats-ci-immutable-ubuntu-1604-1581723302100990071', + }, + signal: { + parent: { + rule: '2df3a613-f5a8-4b55-bf6a-487fc820b842', + id: '7tctRnABMQha2n6bnxxQ', + type: 'event', + index: 'auditbeat-7.2.0', + depth: 1, + }, + ancestors: [ + { + rule: '2df3a613-f5a8-4b55-bf6a-487fc820b842', + id: '7tctRnABMQha2n6bnxxQ', + type: 'event', + index: 'auditbeat-7.2.0', + depth: 1, + }, + ], + original_time: '2020-02-15T00:09:18.860Z', + status: 'open', + rule: { + id: '2df3a613-f5a8-4b55-bf6a-487fc820b842', + rule_id: '82b2b065-a2ee-49fc-9d6d-781a75c3d280', + false_positives: [], + meta: { + from: '1m', + }, + max_signals: 100, + risk_score: 79, + output_index: '.siem-signals-default', + description: 'matches most events', + from: 'now-360s', + immutable: false, + index: [ + 'apm-*-transaction*', + 'auditbeat-*', + 'endgame-*', + 'filebeat-*', + 'packetbeat-*', + 'winlogbeat-*', + ], + interval: '5m', + language: 'kuery', + name: 'matches host.name exists', + query: 'host.name : *', + references: ['https://google.com'], + severity: 'high', + tags: [ + 'host.name exists', + 'for testing', + '__internal_rule_id:82b2b065-a2ee-49fc-9d6d-781a75c3d280', + '__internal_immutable:false', + ], + type: 'query', + to: 'now', + enabled: true, + filters: [], + created_by: 'elastic', + updated_by: 'elastic', + threat: [ + { + framework: 'MITRE ATT&CK', + technique: [ + { + reference: 'https://attack.mitre.org/techniques/T1110', + name: 'Brute Force', + id: 'T1110', + }, + { + reference: 'https://attack.mitre.org/techniques/T1098', + name: 'Account Manipulation', + id: 'T1098', + }, + { + reference: 'https://attack.mitre.org/techniques/T1081', + name: 'Credentials in Files', + id: 'T1081', + }, + ], + tactic: { + reference: 'https://attack.mitre.org/tactics/TA0006', + name: 'Credential Access', + id: 'TA0006', + }, + }, + { + framework: 'MITRE ATT&CK', + technique: [ + { + reference: 'https://attack.mitre.org/techniques/T1530', + name: 'Data from Cloud Storage Object', + id: 'T1530', + }, + ], + tactic: { + reference: 'https://attack.mitre.org/tactics/TA0009', + name: 'Collection', + id: 'TA0009', + }, + }, + ], + version: 1, + created_at: '2020-02-12T19:49:29.417Z', + updated_at: '2020-02-14T23:15:06.186Z', + }, + original_event: { + kind: 'event', + action: 'process_started', + module: 'system', + dataset: 'process', + }, + }, + }, + }, + { + _index: '.siem-signals-default-000001', + _id: '9f6d771532d8f2b314c65b5007b1b9e2fcd206dca352b9b244c971341a09f5ce', + _score: 0, + _source: { + '@timestamp': '2020-02-15T00:15:19.231Z', + service: { + type: 'system', + }, + event: { + dataset: 'process', + kind: 'signal', + action: 'process_error', + module: 'system', + }, + message: + 'ERROR for PID 317759: failed to hash executable / for PID 317759: failed to calculate file hashes: read /: is a directory', + cloud: { + instance: { + id: '5167639562480685129', + name: 'beats-ci-immutable-ubuntu-1604-1581723302100990071', + }, + machine: { + type: 'n1-highmem-4', + }, + availability_zone: 'us-central1-b', + project: { + id: 'elastic-ci-prod', + }, + provider: 'gcp', + }, + host: { + architecture: 'x86_64', + os: { + platform: 'ubuntu', + version: '16.04.6 LTS (Xenial Xerus)', + family: 'debian', + name: 'Ubuntu', + kernel: '4.15.0-1052-gcp', + codename: 'xenial', + }, + name: 'beats-ci-immutable-ubuntu-1604-1581723302100990071', + id: 'c428794c81ade2eb0633d2bbea7ecf51', + containerized: false, + hostname: 'beats-ci-immutable-ubuntu-1604-1581723302100990071', + }, + agent: { + ephemeral_id: '3b3939af-dc90-4be8-b20b-a3d9f555d379', + hostname: 'beats-ci-immutable-ubuntu-1604-1581723302100990071', + id: '4ae34f08-4770-4e5b-bd5b-c8b13741eafa', + version: '7.2.0', + type: 'auditbeat', + }, + error: { + message: + 'failed to hash executable / for PID 317759: failed to calculate file hashes: read /: is a directory', + }, + process: { + entity_id: 'ahsj04Ppla09U8Q2', + name: 'runc:[2:INIT]', + args: ['runc', 'init'], + pid: 317759, + ppid: 317706, + working_directory: '/', + executable: '/', + start: '2020-02-15T00:09:18.360Z', + }, + user: { + name: 'root', + id: '0', + group: { + id: '0', + name: 'root', + }, + effective: { + id: '0', + group: { + id: '0', + }, + }, + saved: { + id: '0', + group: { + id: '0', + }, + }, + }, + ecs: { + version: '1.0.0', + }, + signal: { + parent: { + rule: '2df3a613-f5a8-4b55-bf6a-487fc820b842', + id: '79ctRnABMQha2n6bnxxQ', + type: 'event', + index: 'auditbeat-7.2.0', + depth: 1, + }, + ancestors: [ + { + rule: '2df3a613-f5a8-4b55-bf6a-487fc820b842', + id: '79ctRnABMQha2n6bnxxQ', + type: 'event', + index: 'auditbeat-7.2.0', + depth: 1, + }, + ], + original_time: '2020-02-15T00:09:18.860Z', + status: 'open', + rule: { + id: '2df3a613-f5a8-4b55-bf6a-487fc820b842', + rule_id: '82b2b065-a2ee-49fc-9d6d-781a75c3d280', + false_positives: [], + meta: { + from: '1m', + }, + max_signals: 100, + risk_score: 79, + output_index: '.siem-signals-default', + description: 'matches most events', + from: 'now-360s', + immutable: false, + index: [ + 'apm-*-transaction*', + 'auditbeat-*', + 'endgame-*', + 'filebeat-*', + 'packetbeat-*', + 'winlogbeat-*', + ], + interval: '5m', + language: 'kuery', + name: 'matches host.name exists', + query: 'host.name : *', + references: ['https://google.com'], + severity: 'high', + tags: [ + 'host.name exists', + 'for testing', + '__internal_rule_id:82b2b065-a2ee-49fc-9d6d-781a75c3d280', + '__internal_immutable:false', + ], + type: 'query', + to: 'now', + enabled: true, + filters: [], + created_by: 'elastic', + updated_by: 'elastic', + threat: [ + { + framework: 'MITRE ATT&CK', + technique: [ + { + reference: 'https://attack.mitre.org/techniques/T1110', + name: 'Brute Force', + id: 'T1110', + }, + { + reference: 'https://attack.mitre.org/techniques/T1098', + name: 'Account Manipulation', + id: 'T1098', + }, + { + reference: 'https://attack.mitre.org/techniques/T1081', + name: 'Credentials in Files', + id: 'T1081', + }, + ], + tactic: { + reference: 'https://attack.mitre.org/tactics/TA0006', + name: 'Credential Access', + id: 'TA0006', + }, + }, + { + framework: 'MITRE ATT&CK', + technique: [ + { + reference: 'https://attack.mitre.org/techniques/T1530', + name: 'Data from Cloud Storage Object', + id: 'T1530', + }, + ], + tactic: { + reference: 'https://attack.mitre.org/tactics/TA0009', + name: 'Collection', + id: 'TA0009', + }, + }, + ], + version: 1, + created_at: '2020-02-12T19:49:29.417Z', + updated_at: '2020-02-14T23:15:06.186Z', + }, + original_event: { + dataset: 'process', + kind: 'error', + action: 'process_error', + module: 'system', + }, + }, + }, + }, + ], + }, + aggregations: { + signalsByGrouping: { + doc_count_error_upper_bound: 0, + sum_other_doc_count: 0, + buckets: [ + { + key: '4', + doc_count: 12600, + signals: { + buckets: [ + { + key_as_string: '2020-01-21T04:30:00.000Z', + key: 1579581000000, + doc_count: 0, + }, + { + key_as_string: '2020-01-22T03:00:00.000Z', + key: 1579662000000, + doc_count: 0, + }, + { + key_as_string: '2020-01-23T01:30:00.000Z', + key: 1579743000000, + doc_count: 0, + }, + { + key_as_string: '2020-01-24T00:00:00.000Z', + key: 1579824000000, + doc_count: 0, + }, + ], + }, + }, + ], + }, + }, +}; + +export const mockSignalsQuery: object = { + aggs: { + signalsByGrouping: { + terms: { + field: 'signal.rule.risk_score', + missing: 'All others', + order: { _count: 'desc' }, + size: 10, + }, + aggs: { + signals: { + date_histogram: { + field: '@timestamp', + fixed_interval: '81000000ms', + min_doc_count: 0, + extended_bounds: { min: 1579644343954, max: 1582236343955 }, + }, + }, + }, + }, + }, + query: { + bool: { + filter: [ + { bool: { must: [], filter: [{ match_all: {} }], should: [], must_not: [] } }, + { range: { '@timestamp': { gte: 1579644343954, lte: 1582236343955 } } }, + ], + }, + }, +}; + +export const mockStatusSignalQuery: object = { + bool: { + filter: { + terms: { _id: ['b4ee5c32e3a321057edcc953ca17228c6fdfe5ba43fdbbdaffa8cefa11605cc5'] }, + }, + }, +}; + +export const mockSignalIndex: SignalsIndex = { + name: 'mock-signal-index', +}; + +export const mockUserPrivilege: Privilege = { + username: 'elastic', + has_all_requested: false, + cluster: { + monitor_ml: true, + manage_ccr: true, + manage_index_templates: true, + monitor_watcher: true, + monitor_transform: true, + read_ilm: true, + manage_api_key: true, + manage_security: true, + manage_own_api_key: false, + manage_saml: true, + all: true, + manage_ilm: true, + manage_ingest_pipelines: true, + read_ccr: true, + manage_rollup: true, + monitor: true, + manage_watcher: true, + manage: true, + manage_transform: true, + manage_token: true, + manage_ml: true, + manage_pipeline: true, + monitor_rollup: true, + transport_client: true, + create_snapshot: true, + }, + index: { + '.siem-signals-default': { + all: true, + manage_ilm: true, + read: true, + create_index: true, + read_cross_cluster: true, + index: true, + monitor: true, + delete: true, + manage: true, + delete_index: true, + create_doc: true, + view_index_metadata: true, + create: true, + manage_follow_index: true, + manage_leader_index: true, + write: true, + }, + }, + is_authenticated: true, + has_encryption_key: true, +}; diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/types.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/types.ts index 752de13567e5c..d90f94d32001d 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/types.ts +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/types.ts @@ -4,8 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -export * from './errors_types'; - export interface BasicSignals { signal: AbortSignal; } diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_privilege_user.test.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_privilege_user.test.tsx new file mode 100644 index 0000000000000..2682742960442 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_privilege_user.test.tsx @@ -0,0 +1,70 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { renderHook, act } from '@testing-library/react-hooks'; +import { usePrivilegeUser, ReturnPrivilegeUser } from './use_privilege_user'; +import * as api from './api'; + +jest.mock('./api'); + +describe('usePrivilegeUser', () => { + test('init', async () => { + await act(async () => { + const { result, waitForNextUpdate } = renderHook(() => + usePrivilegeUser() + ); + await waitForNextUpdate(); + expect(result.current).toEqual({ + hasEncryptionKey: null, + hasIndexManage: null, + hasIndexWrite: null, + hasManageApiKey: null, + isAuthenticated: null, + loading: true, + }); + }); + }); + + test('fetch user privilege', async () => { + await act(async () => { + const { result, waitForNextUpdate } = renderHook(() => + usePrivilegeUser() + ); + await waitForNextUpdate(); + await waitForNextUpdate(); + expect(result.current).toEqual({ + hasEncryptionKey: true, + hasIndexManage: true, + hasIndexWrite: true, + hasManageApiKey: true, + isAuthenticated: true, + loading: false, + }); + }); + }); + + test('if there is an error when fetching user privilege, we should get back false for every properties', async () => { + const spyOnGetUserPrivilege = jest.spyOn(api, 'getUserPrivilege'); + spyOnGetUserPrivilege.mockImplementation(() => { + throw new Error('Something went wrong, let see what happen'); + }); + await act(async () => { + const { result, waitForNextUpdate } = renderHook(() => + usePrivilegeUser() + ); + await waitForNextUpdate(); + await waitForNextUpdate(); + expect(result.current).toEqual({ + hasEncryptionKey: false, + hasIndexManage: false, + hasIndexWrite: false, + hasManageApiKey: false, + isAuthenticated: false, + loading: false, + }); + }); + }); +}); diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_privilege_user.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_privilege_user.tsx index 55f3386b503d8..c58e62c062fae 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_privilege_user.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_privilege_user.tsx @@ -6,12 +6,11 @@ import { useEffect, useState } from 'react'; -import { errorToToaster } from '../../../components/ml/api/error_to_toaster'; -import { useStateToaster } from '../../../components/toasters'; +import { errorToToaster, useStateToaster } from '../../../components/toasters'; import { getUserPrivilege } from './api'; import * as i18n from './translations'; -interface Return { +export interface ReturnPrivilegeUser { loading: boolean; isAuthenticated: boolean | null; hasEncryptionKey: boolean | null; @@ -23,11 +22,11 @@ interface Return { * Hook to get user privilege from * */ -export const usePrivilegeUser = (): Return => { +export const usePrivilegeUser = (): ReturnPrivilegeUser => { const [loading, setLoading] = useState(true); const [privilegeUser, setPrivilegeUser] = useState< Pick< - Return, + ReturnPrivilegeUser, | 'isAuthenticated' | 'hasEncryptionKey' | 'hasIndexManage' diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_query.test.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_query.test.tsx new file mode 100644 index 0000000000000..b0440cfb8373f --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_query.test.tsx @@ -0,0 +1,130 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { renderHook, act } from '@testing-library/react-hooks'; +import { useQuerySignals, ReturnQuerySignals } from './use_query'; +import * as api from './api'; +import { mockSignalsQuery, signalsMock } from './mock'; + +jest.mock('./api'); + +describe('useQuerySignals', () => { + const indexName = 'mock-index-name'; + beforeEach(() => { + jest.resetAllMocks(); + }); + test('init', async () => { + await act(async () => { + const { result, waitForNextUpdate } = renderHook< + [object, string], + ReturnQuerySignals + >(() => useQuerySignals(mockSignalsQuery, indexName)); + await waitForNextUpdate(); + expect(result.current).toEqual({ + loading: true, + data: null, + response: '', + request: '', + setQuery: result.current.setQuery, + refetch: null, + }); + }); + }); + + test('fetch signals data', async () => { + await act(async () => { + const { result, waitForNextUpdate } = renderHook< + [object, string], + ReturnQuerySignals + >(() => useQuerySignals(mockSignalsQuery, indexName)); + await waitForNextUpdate(); + await waitForNextUpdate(); + expect(result.current).toEqual({ + loading: false, + data: signalsMock, + response: JSON.stringify(signalsMock, null, 2), + request: JSON.stringify({ index: [indexName] ?? [''], body: mockSignalsQuery }, null, 2), + setQuery: result.current.setQuery, + refetch: result.current.refetch, + }); + }); + }); + + test('re-fetch signals data', async () => { + const spyOnfetchQuerySignals = jest.spyOn(api, 'fetchQuerySignals'); + await act(async () => { + const { result, waitForNextUpdate } = renderHook< + [object, string], + ReturnQuerySignals + >(() => useQuerySignals(mockSignalsQuery, indexName)); + await waitForNextUpdate(); + await waitForNextUpdate(); + if (result.current.refetch) { + result.current.refetch(); + } + await waitForNextUpdate(); + expect(spyOnfetchQuerySignals).toHaveBeenCalledTimes(2); + }); + }); + + test('fetch signal when index name changed', async () => { + const spyOnfetchRules = jest.spyOn(api, 'fetchQuerySignals'); + await act(async () => { + const { rerender, waitForNextUpdate } = renderHook< + [object, string], + ReturnQuerySignals + >(args => useQuerySignals(args[0], args[1]), { + initialProps: [mockSignalsQuery, indexName], + }); + await waitForNextUpdate(); + await waitForNextUpdate(); + rerender([mockSignalsQuery, 'new-mock-index-name']); + await waitForNextUpdate(); + expect(spyOnfetchRules).toHaveBeenCalledTimes(2); + }); + }); + + test('fetch signal when query object changed', async () => { + const spyOnfetchRules = jest.spyOn(api, 'fetchQuerySignals'); + await act(async () => { + const { result, waitForNextUpdate } = renderHook< + [object, string], + ReturnQuerySignals + >(args => useQuerySignals(args[0], args[1]), { + initialProps: [mockSignalsQuery, indexName], + }); + await waitForNextUpdate(); + await waitForNextUpdate(); + if (result.current.setQuery) { + result.current.setQuery({ ...mockSignalsQuery }); + } + await waitForNextUpdate(); + expect(spyOnfetchRules).toHaveBeenCalledTimes(2); + }); + }); + + test('if there is an error when fetching data, we should get back the init value for every properties', async () => { + const spyOnGetUserPrivilege = jest.spyOn(api, 'fetchQuerySignals'); + spyOnGetUserPrivilege.mockImplementation(() => { + throw new Error('Something went wrong, let see what happen'); + }); + await act(async () => { + const { result, waitForNextUpdate } = renderHook>( + () => useQuerySignals(mockSignalsQuery, 'mock-index-name') + ); + await waitForNextUpdate(); + await waitForNextUpdate(); + expect(result.current).toEqual({ + loading: false, + data: null, + response: '', + request: '', + setQuery: result.current.setQuery, + refetch: result.current.refetch, + }); + }); + }); +}); diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_query.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_query.tsx index 45f191f4a6fe5..531e080ed7d1f 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_query.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_query.tsx @@ -11,7 +11,7 @@ import { SignalSearchResponse } from './types'; type Func = () => void; -interface Return { +export interface ReturnQuerySignals { loading: boolean; data: SignalSearchResponse | null; setQuery: React.Dispatch>; @@ -29,10 +29,10 @@ interface Return { export const useQuerySignals = ( initialQuery: object, indexName?: string | null -): Return => { +): ReturnQuerySignals => { const [query, setQuery] = useState(initialQuery); const [signals, setSignals] = useState< - Pick, 'data' | 'setQuery' | 'response' | 'request' | 'refetch'> + Pick, 'data' | 'setQuery' | 'response' | 'request' | 'refetch'> >({ data: null, response: '', diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_signal_index.test.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_signal_index.test.tsx new file mode 100644 index 0000000000000..c834e4ab14be2 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_signal_index.test.tsx @@ -0,0 +1,127 @@ +/* + * 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 { renderHook, act } from '@testing-library/react-hooks'; +import { useSignalIndex, ReturnSignalIndex } from './use_signal_index'; +import * as api from './api'; + +jest.mock('./api'); + +describe('useSignalIndex', () => { + beforeEach(() => { + jest.clearAllMocks(); + jest.resetAllMocks(); + }); + test('init', async () => { + await act(async () => { + const { result, waitForNextUpdate } = renderHook(() => + useSignalIndex() + ); + await waitForNextUpdate(); + expect(result.current).toEqual({ + createDeSignalIndex: null, + loading: true, + signalIndexExists: null, + signalIndexName: null, + }); + }); + }); + + test('fetch signals info', async () => { + await act(async () => { + const { result, waitForNextUpdate } = renderHook(() => + useSignalIndex() + ); + await waitForNextUpdate(); + await waitForNextUpdate(); + expect(result.current).toEqual({ + createDeSignalIndex: result.current.createDeSignalIndex, + loading: false, + signalIndexExists: true, + signalIndexName: 'mock-signal-index', + }); + }); + }); + + test('make sure that createSignalIndex is giving back the signal info', async () => { + await act(async () => { + const { result, waitForNextUpdate } = renderHook(() => + useSignalIndex() + ); + await waitForNextUpdate(); + await waitForNextUpdate(); + if (result.current.createDeSignalIndex != null) { + await result.current.createDeSignalIndex(); + } + await waitForNextUpdate(); + expect(result.current).toEqual({ + createDeSignalIndex: result.current.createDeSignalIndex, + loading: false, + signalIndexExists: true, + signalIndexName: 'mock-signal-index', + }); + }); + }); + + test('make sure that createSignalIndex have been called when trying to create signal index', async () => { + const spyOnCreateSignalIndex = jest.spyOn(api, 'createSignalIndex'); + await act(async () => { + const { result, waitForNextUpdate } = renderHook(() => + useSignalIndex() + ); + await waitForNextUpdate(); + await waitForNextUpdate(); + if (result.current.createDeSignalIndex != null) { + await result.current.createDeSignalIndex(); + } + await waitForNextUpdate(); + expect(spyOnCreateSignalIndex).toHaveBeenCalledTimes(1); + }); + }); + + test('if there is an error during createSignalIndex, we should get back signalIndexExists === false && signalIndexName == null', async () => { + const spyOnCreateSignalIndex = jest.spyOn(api, 'createSignalIndex'); + spyOnCreateSignalIndex.mockImplementation(() => { + throw new Error('Something went wrong, let see what happen'); + }); + await act(async () => { + const { result, waitForNextUpdate } = renderHook(() => + useSignalIndex() + ); + await waitForNextUpdate(); + await waitForNextUpdate(); + if (result.current.createDeSignalIndex != null) { + await result.current.createDeSignalIndex(); + } + expect(result.current).toEqual({ + createDeSignalIndex: result.current.createDeSignalIndex, + loading: false, + signalIndexExists: false, + signalIndexName: null, + }); + }); + }); + + test('if there is an error when fetching signals info, signalIndexExists === false && signalIndexName == null', async () => { + const spyOnGetSignalIndex = jest.spyOn(api, 'getSignalIndex'); + spyOnGetSignalIndex.mockImplementation(() => { + throw new Error('Something went wrong, let see what happen'); + }); + await act(async () => { + const { result, waitForNextUpdate } = renderHook(() => + useSignalIndex() + ); + await waitForNextUpdate(); + await waitForNextUpdate(); + expect(result.current).toEqual({ + createDeSignalIndex: result.current.createDeSignalIndex, + loading: false, + signalIndexExists: false, + signalIndexName: null, + }); + }); + }); +}); diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_signal_index.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_signal_index.tsx index 813bd2483689c..a7f5c9731320e 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_signal_index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/use_signal_index.tsx @@ -6,15 +6,14 @@ import { useEffect, useState } from 'react'; -import { errorToToaster } from '../../../components/ml/api/error_to_toaster'; -import { useStateToaster } from '../../../components/toasters'; +import { errorToToaster, useStateToaster } from '../../../components/toasters'; import { createSignalIndex, getSignalIndex } from './api'; import * as i18n from './translations'; -import { PostSignalError, SignalIndexError } from './types'; +import { isApiError } from '../../../utils/api'; type Func = () => void; -interface Return { +export interface ReturnSignalIndex { loading: boolean; signalIndexExists: boolean | null; signalIndexName: string | null; @@ -26,10 +25,10 @@ interface Return { * * */ -export const useSignalIndex = (): Return => { +export const useSignalIndex = (): ReturnSignalIndex => { const [loading, setLoading] = useState(true); const [signalIndex, setSignalIndex] = useState< - Pick + Pick >({ signalIndexExists: null, signalIndexName: null, @@ -60,7 +59,7 @@ export const useSignalIndex = (): Return => { signalIndexName: null, createDeSignalIndex: createIndex, }); - if (error instanceof SignalIndexError && error.status_code !== 404) { + if (isApiError(error) && error.body.status_code !== 404) { errorToToaster({ title: i18n.SIGNAL_GET_NAME_FAILURE, error, dispatchToaster }); } } @@ -82,7 +81,7 @@ export const useSignalIndex = (): Return => { } } catch (error) { if (isSubscribed) { - if (error instanceof PostSignalError && error.statusCode === 409) { + if (isApiError(error) && error.body.status_code === 409) { fetchData(); } else { setSignalIndex({ diff --git a/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.test.tsx b/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.test.tsx index 06367ab8657a8..80899a061e7c1 100644 --- a/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.test.tsx @@ -8,7 +8,7 @@ import { useQuery } from '.'; import { mount } from 'enzyme'; import React from 'react'; import { useApolloClient } from '../../utils/apollo_context'; -import { errorToToaster } from '../../components/ml/api/error_to_toaster'; +import { errorToToaster } from '../../components/toasters'; import { MatrixOverTimeHistogramData, HistogramType } from '../../graphql/types'; import { InspectQuery, Refetch } from '../../store/inputs/model'; @@ -41,7 +41,10 @@ jest.mock('./index.gql_query', () => { }; }); -jest.mock('../../components/ml/api/error_to_toaster'); +jest.mock('../../components/toasters/', () => ({ + useStateToaster: () => [jest.fn(), jest.fn()], + errorToToaster: jest.fn(), +})); describe('useQuery', () => { let result: { diff --git a/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.ts b/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.ts index 683d5b68c305b..0b369b4180fb8 100644 --- a/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.ts +++ b/x-pack/legacy/plugins/siem/public/containers/matrix_histogram/index.ts @@ -6,8 +6,7 @@ import { useEffect, useState, useRef } from 'react'; import { MatrixHistogramQueryProps } from '../../components/matrix_histogram/types'; import { DEFAULT_INDEX_KEY } from '../../../common/constants'; -import { useStateToaster } from '../../components/toasters'; -import { errorToToaster } from '../../components/ml/api/error_to_toaster'; +import { errorToToaster, useStateToaster } from '../../components/toasters'; import { useUiSetting$ } from '../../lib/kibana'; import { createFilter } from '../helpers'; import { useApolloClient } from '../../utils/apollo_context'; diff --git a/x-pack/legacy/plugins/siem/public/hooks/api/api.test.ts b/x-pack/legacy/plugins/siem/public/hooks/api/api.test.ts deleted file mode 100644 index 208a3b14ca283..0000000000000 --- a/x-pack/legacy/plugins/siem/public/hooks/api/api.test.ts +++ /dev/null @@ -1,44 +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 fetchMock from 'fetch-mock'; -import { throwIfNotOk } from './api'; - -describe('api', () => { - afterEach(() => { - fetchMock.reset(); - }); - - describe('#throwIfNotOk', () => { - test('throws a network error if there is no response', async () => { - await expect(throwIfNotOk()).rejects.toThrow('Network Error'); - }); - - test('does a throw if it is given response that is not ok and the body is not parsable', async () => { - fetchMock.mock('http://example.com', 500); - const response = await fetch('http://example.com'); - await expect(throwIfNotOk(response)).rejects.toThrow('Network Error: Internal Server Error'); - }); - - test('does a throw and returns a body if it is parsable', async () => { - fetchMock.mock('http://example.com', { - status: 500, - body: { - statusCode: 500, - message: 'I am a custom message', - }, - }); - const response = await fetch('http://example.com'); - await expect(throwIfNotOk(response)).rejects.toThrow('I am a custom message'); - }); - - test('does NOT do a throw if it is given response is not ok', async () => { - fetchMock.mock('http://example.com', 200); - const response = await fetch('http://example.com'); - await expect(throwIfNotOk(response)).resolves.toEqual(undefined); - }); - }); -}); diff --git a/x-pack/legacy/plugins/siem/public/hooks/api/api.tsx b/x-pack/legacy/plugins/siem/public/hooks/api/api.tsx index 1dfd6416531ee..8120e3819d9a8 100644 --- a/x-pack/legacy/plugins/siem/public/hooks/api/api.tsx +++ b/x-pack/legacy/plugins/siem/public/hooks/api/api.tsx @@ -4,9 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import * as i18n from '../translations'; import { StartServices } from '../../plugin'; -import { parseJsonFromBody, ToasterErrors } from './throw_if_not_ok'; import { IndexPatternSavedObject, IndexPatternSavedObjectAttributes } from '../types'; /** @@ -25,24 +23,3 @@ export const getIndexPatterns = async ( return response.savedObjects; }; - -export const throwIfNotOk = async (response?: Response): Promise => { - if (!response) { - throw new ToasterErrors([i18n.NETWORK_ERROR]); - } - - if (!response.ok) { - const body = await parseJsonFromBody(response); - if (body != null && body.message) { - if (body.statusCode != null) { - throw new ToasterErrors([body.message, `${i18n.STATUS_CODE} ${body.statusCode}`]); - } else if (body.status_code != null) { - throw new ToasterErrors([body.message, `${i18n.STATUS_CODE} ${body.status_code}`]); - } else { - throw new ToasterErrors([body.message]); - } - } else { - throw new ToasterErrors([`${i18n.NETWORK_ERROR} ${response.statusText}`]); - } - } -}; diff --git a/x-pack/legacy/plugins/siem/public/hooks/use_index_patterns.tsx b/x-pack/legacy/plugins/siem/public/hooks/use_index_patterns.tsx index e10d4873f1b6e..05b0521e35217 100644 --- a/x-pack/legacy/plugins/siem/public/hooks/use_index_patterns.tsx +++ b/x-pack/legacy/plugins/siem/public/hooks/use_index_patterns.tsx @@ -7,8 +7,7 @@ import { useEffect, useState } from 'react'; import { useKibana } from '../lib/kibana'; -import { useStateToaster } from '../components/toasters'; -import { errorToToaster } from '../components/ml/api/error_to_toaster'; +import { errorToToaster, useStateToaster } from '../components/toasters'; import * as i18n from './translations'; import { IndexPatternSavedObject } from './types'; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/all/actions.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/all/actions.tsx index a17fd34d1c344..bc5d0c32bb9c6 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/all/actions.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/all/actions.tsx @@ -20,6 +20,7 @@ import { ActionToaster, displayErrorToast, displaySuccessToast, + errorToToaster, } from '../../../../components/toasters'; import { track, METRIC_TYPE, TELEMETRY_EVENT } from '../../../../lib/telemetry'; @@ -50,9 +51,9 @@ export const duplicateRulesAction = async ( displaySuccessToast(i18n.SUCCESSFULLY_DUPLICATED_RULES(ruleIds.length), dispatchToaster); } dispatch({ type: 'loadingRuleIds', ids: [], actionType: null }); - } catch (e) { + } catch (error) { dispatch({ type: 'loadingRuleIds', ids: [], actionType: null }); - displayErrorToast(i18n.DUPLICATE_RULE_ERROR, [e.message], dispatchToaster); + errorToToaster({ title: i18n.DUPLICATE_RULE_ERROR, error, dispatchToaster }); } }; @@ -80,13 +81,13 @@ export const deleteRulesAction = async ( } else if (onRuleDeleted) { onRuleDeleted(); } - } catch (e) { + } catch (error) { dispatch({ type: 'loadingRuleIds', ids: [], actionType: null }); - displayErrorToast( - i18n.BATCH_ACTION_DELETE_SELECTED_ERROR(ruleIds.length), - [e.message], - dispatchToaster - ); + errorToToaster({ + title: i18n.BATCH_ACTION_DELETE_SELECTED_ERROR(ruleIds.length), + error, + dispatchToaster, + }); } }; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/all/helpers.ts b/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/all/helpers.ts index 5ce26144a4d9c..0ebeb84d57468 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/all/helpers.ts +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/all/helpers.ts @@ -5,17 +5,16 @@ */ import { - Rule, - RuleError, + BulkRuleResponse, RuleResponseBuckets, } from '../../../../containers/detection_engine/rules'; /** * Separates rules/errors from bulk rules API response (create/update/delete) * - * @param response Array from bulk rules API + * @param response BulkRuleResponse from bulk rules API */ -export const bucketRulesResponse = (response: Array) => +export const bucketRulesResponse = (response: BulkRuleResponse) => response.reduce( (acc, cv): RuleResponseBuckets => { return 'error' in cv diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/components/import_rule_modal/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/components/import_rule_modal/index.tsx index 97649fb03dac0..ef42b5097e364 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/components/import_rule_modal/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/components/import_rule_modal/index.tsx @@ -26,6 +26,7 @@ import { displayErrorToast, displaySuccessToast, useStateToaster, + errorToToaster, } from '../../../../../components/toasters'; import * as i18n from './translations'; @@ -83,9 +84,9 @@ export const ImportRuleModalComponent = ({ importComplete(); cleanupAndCloseModal(); - } catch (e) { + } catch (error) { cleanupAndCloseModal(); - displayErrorToast(i18n.IMPORT_FAILED, [e.message], dispatchToaster); + errorToToaster({ title: i18n.IMPORT_FAILED, error, dispatchToaster }); } } }, [selectedFiles, overwrite]); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/components/rule_downloader/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/components/rule_downloader/index.tsx index 5d3086051a6e2..959864d50747f 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/components/rule_downloader/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/components/rule_downloader/index.tsx @@ -8,7 +8,7 @@ import React, { useEffect, useRef } from 'react'; import styled from 'styled-components'; import { isFunction } from 'lodash/fp'; import { exportRules } from '../../../../../containers/detection_engine/rules'; -import { displayErrorToast, useStateToaster } from '../../../../../components/toasters'; +import { useStateToaster, errorToToaster } from '../../../../../components/toasters'; import * as i18n from './translations'; const InvisibleAnchor = styled.a` @@ -65,7 +65,7 @@ export const RuleDownloaderComponent = ({ } } catch (error) { if (isSubscribed) { - displayErrorToast(i18n.EXPORT_FAILURE, [error.message], dispatchToaster); + errorToToaster({ title: i18n.EXPORT_FAILURE, error, dispatchToaster }); } } } diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/components/rule_switch/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/components/rule_switch/index.tsx index 09b7ecc9df982..44845ea68d954 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/components/rule_switch/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/components/rule_switch/index.tsx @@ -15,10 +15,12 @@ import { isEmpty } from 'lodash/fp'; import styled from 'styled-components'; import React, { useCallback, useState, useEffect } from 'react'; +import * as i18n from '../../translations'; import { enableRules } from '../../../../../containers/detection_engine/rules'; import { enableRulesAction } from '../../all/actions'; import { Action } from '../../all/reducer'; -import { useStateToaster } from '../../../../../components/toasters'; +import { useStateToaster, displayErrorToast } from '../../../../../components/toasters'; +import { bucketRulesResponse } from '../../all/helpers'; const StaticSwitch = styled(EuiSwitch)` .euiSwitch__thumb, @@ -62,13 +64,29 @@ export const RuleSwitchComponent = ({ await enableRulesAction([id], event.target.checked!, dispatch, dispatchToaster); } else { try { - const updatedRules = await enableRules({ + const enabling = event.target.checked!; + const response = await enableRules({ ids: [id], - enabled: event.target.checked!, + enabled: enabling, }); - setMyEnabled(updatedRules[0].enabled); - if (onChange != null) { - onChange(updatedRules[0].enabled); + const { rules, errors } = bucketRulesResponse(response); + + if (errors.length > 0) { + setMyIsLoading(false); + const title = enabling + ? i18n.BATCH_ACTION_ACTIVATE_SELECTED_ERROR(1) + : i18n.BATCH_ACTION_DEACTIVATE_SELECTED_ERROR(1); + displayErrorToast( + title, + errors.map(e => e.error.message), + dispatchToaster + ); + } else { + const [rule] = rules; + setMyEnabled(rule.enabled); + if (onChange != null) { + onChange(rule.enabled); + } } } catch { setMyIsLoading(false); diff --git a/x-pack/legacy/plugins/siem/public/utils/api/index.ts b/x-pack/legacy/plugins/siem/public/utils/api/index.ts index 3c70083136505..e47e03ce4e627 100644 --- a/x-pack/legacy/plugins/siem/public/utils/api/index.ts +++ b/x-pack/legacy/plugins/siem/public/utils/api/index.ts @@ -4,18 +4,15 @@ * you may not use this file except in compliance with the Elastic License. */ -export interface MessageBody { - error?: string; - message?: string; - statusCode?: number; - status_code?: number; +import { has } from 'lodash/fp'; + +export interface KibanaApiError { + message: string; + body: { + message: string; + status_code: number; + }; } -export const parseJsonFromBody = async (response: Response): Promise => { - try { - const text = await response.text(); - return JSON.parse(text); - } catch (error) { - return null; - } -}; +export const isApiError = (error: unknown): error is KibanaApiError => + has('message', error) && has('body.message', error) && has('body.status_code', error); diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/index.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/errors/bad_request_error.ts similarity index 68% rename from x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/index.ts rename to x-pack/legacy/plugins/siem/server/lib/detection_engine/errors/bad_request_error.ts index 4ce8e6ba89183..2ad3bbf759ad7 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/signals/errors_types/index.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/errors/bad_request_error.ts @@ -4,6 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -export * from './get_index_error'; -export * from './post_index_error'; -export * from './privilege_user_error'; +export class BadRequestError extends Error {} diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.test.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.test.ts index f18e158db4269..6768e9534a87e 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.test.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.test.ts @@ -8,6 +8,7 @@ import Boom from 'boom'; import { SavedObjectsFindResponse } from 'kibana/server'; import { IRuleSavedAttributesSavedObjectAttributes, IRuleStatusAttributes } from '../rules/types'; +import { BadRequestError } from '../errors/bad_request_error'; import { transformError, transformBulkError, @@ -70,8 +71,8 @@ describe('utils', () => { }); }); - test('it detects a TypeError and returns a status code of 400 from that particular error type', () => { - const error: TypeError = new TypeError('I have a type error'); + test('it detects a BadRequestError and returns a status code of 400 from that particular error type', () => { + const error: BadRequestError = new BadRequestError('I have a type error'); const transformed = transformError(error); expect(transformed).toEqual({ message: 'I have a type error', @@ -79,8 +80,8 @@ describe('utils', () => { }); }); - test('it detects a TypeError and returns a Boom status of 400', () => { - const error: TypeError = new TypeError('I have a type error'); + test('it detects a BadRequestError and returns a Boom status of 400', () => { + const error: BadRequestError = new BadRequestError('I have a type error'); const transformed = transformError(error); expect(transformed).toEqual({ message: 'I have a type error', @@ -127,8 +128,8 @@ describe('utils', () => { expect(transformed).toEqual(expected); }); - test('it detects a TypeError and returns a Boom status of 400', () => { - const error: TypeError = new TypeError('I have a type error'); + test('it detects a BadRequestError and returns a Boom status of 400', () => { + const error: BadRequestError = new BadRequestError('I have a type error'); const transformed = transformBulkError('rule-1', error); const expected: BulkError = { rule_id: 'rule-1', @@ -279,8 +280,8 @@ describe('utils', () => { expect(transformed).toEqual(expected); }); - test('it detects a TypeError and returns a Boom status of 400', () => { - const error: TypeError = new TypeError('I have a type error'); + test('it detects a BadRequestError and returns a Boom status of 400', () => { + const error: BadRequestError = new BadRequestError('I have a type error'); const transformed = transformImportError('rule-1', error, { success_count: 1, success: false, diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.ts index 6c98517c4dc0c..79c2f47658f7e 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.ts @@ -13,6 +13,7 @@ import { KibanaResponseFactory, CustomHttpResponseOptions, } from '../../../../../../../../src/core/server'; +import { BadRequestError } from '../errors/bad_request_error'; export interface OutputError { message: string; @@ -31,9 +32,8 @@ export const transformError = (err: Error & { statusCode?: number }): OutputErro message: err.message, statusCode: err.statusCode, }; - } else if (err instanceof TypeError) { - // allows us to throw type errors instead of booms in some conditions - // where we don't want to mingle Boom with the rest of the code + } else if (err instanceof BadRequestError) { + // allows us to throw request validation errors in the absence of Boom return { message: err.message, statusCode: 400, @@ -178,7 +178,7 @@ export const transformImportError = ( message: err.message, existingImportSuccessError, }); - } else if (err instanceof TypeError) { + } else if (err instanceof BadRequestError) { return createImportErrorObject({ ruleId, statusCode: 400, @@ -205,7 +205,7 @@ export const transformBulkError = ( statusCode: err.output.statusCode, message: err.message, }); - } else if (err instanceof TypeError) { + } else if (err instanceof BadRequestError) { return createBulkErrorObject({ ruleId, statusCode: 400, diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.test.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.test.ts index b1dc62f6fc90f..8705682f61bcc 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.test.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.test.ts @@ -7,6 +7,7 @@ import { Readable } from 'stream'; import { createRulesStreamFromNdJson } from './create_rules_stream_from_ndjson'; import { createPromiseFromStreams } from 'src/legacy/utils/streams'; import { ImportRuleAlertRest } from '../types'; +import { BadRequestError } from '../errors/bad_request_error'; type PromiseFromStreams = ImportRuleAlertRest | Error; @@ -331,7 +332,7 @@ describe('create_rules_stream_from_ndjson', () => { ndJsonStream, ...rulesObjectsStream, ]); - const resultOrError = result as TypeError[]; + const resultOrError = result as BadRequestError[]; expect(resultOrError[0]).toEqual({ rule_id: 'rule-1', output_index: '.siem-signals', @@ -383,7 +384,7 @@ describe('create_rules_stream_from_ndjson', () => { }); }); - test('non validated data is an instanceof TypeError', async () => { + test('non validated data is an instanceof BadRequestError', async () => { const sample1 = getOutputSample(); const sample2 = getOutputSample(); sample2.rule_id = 'rule-2'; @@ -400,8 +401,8 @@ describe('create_rules_stream_from_ndjson', () => { ndJsonStream, ...rulesObjectsStream, ]); - const resultOrError = result as TypeError[]; - expect(resultOrError[1] instanceof TypeError).toEqual(true); + const resultOrError = result as BadRequestError[]; + expect(resultOrError[1] instanceof BadRequestError).toEqual(true); }); }); }); diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.ts index ae0dfa20852aa..3e22999528101 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/create_rules_stream_from_ndjson.ts @@ -13,6 +13,7 @@ import { createConcatStream, } from '../../../../../../../../src/legacy/utils/streams'; import { importRulesSchema } from '../routes/schemas/import_rules_schema'; +import { BadRequestError } from '../errors/bad_request_error'; export interface RulesObjectsExportResultDetails { /** number of successfully exported objects */ @@ -42,7 +43,7 @@ export const validateRules = (): Transform => { if (!(obj instanceof Error)) { const validated = importRulesSchema.validate(obj); if (validated.error != null) { - return new TypeError(validated.error.message); + return new BadRequestError(validated.error.message); } else { return validated.value; } diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/get_prepackaged_rules.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/get_prepackaged_rules.ts index bcfe6ee203ecd..e81200fe94376 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/get_prepackaged_rules.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/get_prepackaged_rules.ts @@ -6,6 +6,7 @@ import { PrepackagedRules } from '../types'; import { addPrepackagedRulesSchema } from '../routes/schemas/add_prepackaged_rules_schema'; +import { BadRequestError } from '../errors/bad_request_error'; import { rawRules } from './prepackaged_rules'; /** @@ -19,7 +20,7 @@ export const validateAllPrepackagedRules = (rules: PrepackagedRules[]): Prepacka if (validatedRule.error != null) { const ruleName = rule.name ? rule.name : '(rule name unknown)'; const ruleId = rule.rule_id ? rule.rule_id : '(rule rule_id unknown)'; - throw new TypeError( + throw new BadRequestError( `name: "${ruleName}", rule_id: "${ruleId}" within the folder rules/prepackaged_rules ` + `is not a valid detection engine rule. Expect the system ` + `to not work with pre-packaged rules until this rule is fixed ` + diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/signals/get_filter.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/signals/get_filter.ts index d1f41efdddd14..9c3e15de7ce90 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/signals/get_filter.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/signals/get_filter.ts @@ -14,6 +14,7 @@ import { IIndexPattern, } from '../../../../../../../../src/plugins/data/server'; import { PartialFilter, RuleAlertParams } from '../types'; +import { BadRequestError } from '../errors/bad_request_error'; export const getQueryFilter = ( query: string, @@ -74,7 +75,7 @@ export const getFilter = async ({ if (query != null && language != null && index != null) { return getQueryFilter(query, language, filters || [], index); } else { - throw new TypeError('query, filters, and index parameter should be defined'); + throw new BadRequestError('query, filters, and index parameter should be defined'); } } case 'saved_query': { @@ -103,7 +104,7 @@ export const getFilter = async ({ } } } else { - throw new TypeError('savedId parameter should be defined'); + throw new BadRequestError('savedId parameter should be defined'); } } } From ec1f46bdbd4ab3379fe7a1433ee934cf0b1c4a34 Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Tue, 10 Mar 2020 15:52:17 +0100 Subject: [PATCH 13/23] [ML] Transforms: Data grid fixes. (#59538) - Fixes data grid schemas to avoid crashing the page. - Fixes date formatting. - Uses data grid for preview table in transform list. --- .../common/utils/object_utils.test.ts | 70 ++++++ .../transform/common/utils/object_utils.ts | 6 +- .../components/pivot_preview/common.test.ts | 117 +++++++++ .../app/components/pivot_preview/common.ts | 60 +++++ .../app/components/pivot_preview/index.ts | 7 + .../pivot_preview}/pivot_preview.test.tsx | 12 +- .../pivot_preview}/pivot_preview.tsx | 82 +++++-- .../use_pivot_preview_data.test.tsx | 20 +- .../pivot_preview}/use_pivot_preview_data.ts | 16 +- .../source_index_preview.tsx | 182 ++++++++------ .../use_source_index_data.test.tsx | 5 +- .../use_source_index_data.ts | 89 ++++--- .../components/step_define/common.test.ts | 114 +-------- .../components/step_define/common.ts | 54 +---- .../step_define/step_define_form.tsx | 4 +- .../step_define/step_define_summary.tsx | 4 +- .../expanded_row_preview_pane.tsx | 223 ++---------------- .../translations/translations/ja-JP.json | 1 - .../translations/translations/zh-CN.json | 1 - .../services/transform_ui/transform_table.ts | 18 +- 20 files changed, 547 insertions(+), 538 deletions(-) create mode 100644 x-pack/plugins/transform/common/utils/object_utils.test.ts create mode 100644 x-pack/plugins/transform/public/app/components/pivot_preview/common.test.ts create mode 100644 x-pack/plugins/transform/public/app/components/pivot_preview/common.ts create mode 100644 x-pack/plugins/transform/public/app/components/pivot_preview/index.ts rename x-pack/plugins/transform/public/app/{sections/create_transform/components/step_define => components/pivot_preview}/pivot_preview.test.tsx (82%) rename x-pack/plugins/transform/public/app/{sections/create_transform/components/step_define => components/pivot_preview}/pivot_preview.tsx (75%) rename x-pack/plugins/transform/public/app/{sections/create_transform/components/step_define => components/pivot_preview}/use_pivot_preview_data.test.tsx (77%) rename x-pack/plugins/transform/public/app/{sections/create_transform/components/step_define => components/pivot_preview}/use_pivot_preview_data.ts (86%) diff --git a/x-pack/plugins/transform/common/utils/object_utils.test.ts b/x-pack/plugins/transform/common/utils/object_utils.test.ts new file mode 100644 index 0000000000000..7ac68b41b625c --- /dev/null +++ b/x-pack/plugins/transform/common/utils/object_utils.test.ts @@ -0,0 +1,70 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { getNestedProperty } from './object_utils'; + +describe('object_utils', () => { + test('getNestedProperty()', () => { + const testObj = { + the: { + nested: { + value: 'the-nested-value', + }, + }, + }; + + const falseyObj = { + the: { + nested: { + value: false, + }, + other_nested: { + value: 0, + }, + }, + }; + + const test1 = getNestedProperty(testObj, 'the'); + expect(typeof test1).toBe('object'); + expect(Object.keys(test1)).toStrictEqual(['nested']); + + const test2 = getNestedProperty(testObj, 'the$'); + expect(typeof test2).toBe('undefined'); + + const test3 = getNestedProperty(testObj, 'the$', 'the-default-value'); + expect(typeof test3).toBe('string'); + expect(test3).toBe('the-default-value'); + + const test4 = getNestedProperty(testObj, 'the.neSted'); + expect(typeof test4).toBe('undefined'); + + const test5 = getNestedProperty(testObj, 'the.nested'); + expect(typeof test5).toBe('object'); + expect(Object.keys(test5)).toStrictEqual(['value']); + + const test6 = getNestedProperty(testObj, 'the.nested.vaLue'); + expect(typeof test6).toBe('undefined'); + + const test7 = getNestedProperty(testObj, 'the.nested.value'); + expect(typeof test7).toBe('string'); + expect(test7).toBe('the-nested-value'); + + const test8 = getNestedProperty(testObj, 'the.nested.value.doesntExist'); + expect(typeof test8).toBe('undefined'); + + const test9 = getNestedProperty(testObj, 'the.nested.value.doesntExist', 'the-default-value'); + expect(typeof test9).toBe('string'); + expect(test9).toBe('the-default-value'); + + const test10 = getNestedProperty(falseyObj, 'the.nested.value'); + expect(typeof test10).toBe('boolean'); + expect(test10).toBe(false); + + const test11 = getNestedProperty(falseyObj, 'the.other_nested.value'); + expect(typeof test11).toBe('number'); + expect(test11).toBe(0); + }); +}); diff --git a/x-pack/plugins/transform/common/utils/object_utils.ts b/x-pack/plugins/transform/common/utils/object_utils.ts index 589803b33e11c..dfdcd0959260d 100644 --- a/x-pack/plugins/transform/common/utils/object_utils.ts +++ b/x-pack/plugins/transform/common/utils/object_utils.ts @@ -11,5 +11,9 @@ export const getNestedProperty = ( accessor: string, defaultValue?: any ) => { - return accessor.split('.').reduce((o, i) => o?.[i], obj) || defaultValue; + const value = accessor.split('.').reduce((o, i) => o?.[i], obj); + + if (value === undefined) return defaultValue; + + return value; }; diff --git a/x-pack/plugins/transform/public/app/components/pivot_preview/common.test.ts b/x-pack/plugins/transform/public/app/components/pivot_preview/common.test.ts new file mode 100644 index 0000000000000..172256ddb5cee --- /dev/null +++ b/x-pack/plugins/transform/public/app/components/pivot_preview/common.test.ts @@ -0,0 +1,117 @@ +/* + * 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 { EuiDataGridSorting } from '@elastic/eui'; + +import { + getPreviewRequestBody, + PivotAggsConfig, + PivotGroupByConfig, + PIVOT_SUPPORTED_AGGS, + PIVOT_SUPPORTED_GROUP_BY_AGGS, + SimpleQuery, +} from '../../common'; + +import { multiColumnSortFactory, getPivotPreviewDevConsoleStatement } from './common'; + +describe('Transform: Define Pivot Common', () => { + test('multiColumnSortFactory()', () => { + const data = [ + { s: 'a', n: 1 }, + { s: 'a', n: 2 }, + { s: 'b', n: 3 }, + { s: 'b', n: 4 }, + ]; + + const sortingColumns1: EuiDataGridSorting['columns'] = [{ id: 's', direction: 'desc' }]; + const multiColumnSort1 = multiColumnSortFactory(sortingColumns1); + data.sort(multiColumnSort1); + + expect(data).toStrictEqual([ + { s: 'b', n: 3 }, + { s: 'b', n: 4 }, + { s: 'a', n: 1 }, + { s: 'a', n: 2 }, + ]); + + const sortingColumns2: EuiDataGridSorting['columns'] = [ + { id: 's', direction: 'asc' }, + { id: 'n', direction: 'desc' }, + ]; + const multiColumnSort2 = multiColumnSortFactory(sortingColumns2); + data.sort(multiColumnSort2); + + expect(data).toStrictEqual([ + { s: 'a', n: 2 }, + { s: 'a', n: 1 }, + { s: 'b', n: 4 }, + { s: 'b', n: 3 }, + ]); + + const sortingColumns3: EuiDataGridSorting['columns'] = [ + { id: 'n', direction: 'desc' }, + { id: 's', direction: 'desc' }, + ]; + const multiColumnSort3 = multiColumnSortFactory(sortingColumns3); + data.sort(multiColumnSort3); + + expect(data).toStrictEqual([ + { s: 'b', n: 4 }, + { s: 'b', n: 3 }, + { s: 'a', n: 2 }, + { s: 'a', n: 1 }, + ]); + }); + + test('getPivotPreviewDevConsoleStatement()', () => { + const query: SimpleQuery = { + query_string: { + query: '*', + default_operator: 'AND', + }, + }; + const groupBy: PivotGroupByConfig = { + agg: PIVOT_SUPPORTED_GROUP_BY_AGGS.TERMS, + field: 'the-group-by-field', + aggName: 'the-group-by-agg-name', + dropDownName: 'the-group-by-drop-down-name', + }; + const agg: PivotAggsConfig = { + agg: PIVOT_SUPPORTED_AGGS.AVG, + field: 'the-agg-field', + aggName: 'the-agg-agg-name', + dropDownName: 'the-agg-drop-down-name', + }; + const request = getPreviewRequestBody('the-index-pattern-title', query, [groupBy], [agg]); + const pivotPreviewDevConsoleStatement = getPivotPreviewDevConsoleStatement(request); + + expect(pivotPreviewDevConsoleStatement).toBe(`POST _transform/_preview +{ + "source": { + "index": [ + "the-index-pattern-title" + ] + }, + "pivot": { + "group_by": { + "the-group-by-agg-name": { + "terms": { + "field": "the-group-by-field" + } + } + }, + "aggregations": { + "the-agg-agg-name": { + "avg": { + "field": "the-agg-field" + } + } + } + } +} +`); + }); +}); diff --git a/x-pack/plugins/transform/public/app/components/pivot_preview/common.ts b/x-pack/plugins/transform/public/app/components/pivot_preview/common.ts new file mode 100644 index 0000000000000..498c3a3ac60af --- /dev/null +++ b/x-pack/plugins/transform/public/app/components/pivot_preview/common.ts @@ -0,0 +1,60 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiDataGridSorting } from '@elastic/eui'; + +import { getNestedProperty } from '../../../../common/utils/object_utils'; + +import { PreviewRequestBody } from '../../common'; + +/** + * Helper to sort an array of objects based on an EuiDataGrid sorting configuration. + * `sortFn()` is recursive to support sorting on multiple columns. + * + * @param sortingColumns - The EUI data grid sorting configuration + * @returns The sorting function which can be used with an array's sort() function. + */ +export const multiColumnSortFactory = (sortingColumns: EuiDataGridSorting['columns']) => { + const isString = (arg: any): arg is string => { + return typeof arg === 'string'; + }; + + const sortFn = (a: any, b: any, sortingColumnIndex = 0): number => { + const sort = sortingColumns[sortingColumnIndex]; + const aValue = getNestedProperty(a, sort.id, null); + const bValue = getNestedProperty(b, sort.id, null); + + if (typeof aValue === 'number' && typeof bValue === 'number') { + if (aValue < bValue) { + return sort.direction === 'asc' ? -1 : 1; + } + if (aValue > bValue) { + return sort.direction === 'asc' ? 1 : -1; + } + } + + if (isString(aValue) && isString(bValue)) { + if (aValue.localeCompare(bValue) === -1) { + return sort.direction === 'asc' ? -1 : 1; + } + if (aValue.localeCompare(bValue) === 1) { + return sort.direction === 'asc' ? 1 : -1; + } + } + + if (sortingColumnIndex + 1 < sortingColumns.length) { + return sortFn(a, b, sortingColumnIndex + 1); + } + + return 0; + }; + + return sortFn; +}; + +export const getPivotPreviewDevConsoleStatement = (request: PreviewRequestBody) => { + return `POST _transform/_preview\n${JSON.stringify(request, null, 2)}\n`; +}; diff --git a/x-pack/plugins/transform/public/app/components/pivot_preview/index.ts b/x-pack/plugins/transform/public/app/components/pivot_preview/index.ts new file mode 100644 index 0000000000000..049e73d6309fc --- /dev/null +++ b/x-pack/plugins/transform/public/app/components/pivot_preview/index.ts @@ -0,0 +1,7 @@ +/* + * 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. + */ + +export { PivotPreview } from './pivot_preview'; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.test.tsx b/x-pack/plugins/transform/public/app/components/pivot_preview/pivot_preview.test.tsx similarity index 82% rename from x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.test.tsx rename to x-pack/plugins/transform/public/app/components/pivot_preview/pivot_preview.test.tsx index f39885f520995..b37cdbb132bab 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.test.tsx +++ b/x-pack/plugins/transform/public/app/components/pivot_preview/pivot_preview.test.tsx @@ -8,20 +8,19 @@ import React from 'react'; import { render, wait } from '@testing-library/react'; import '@testing-library/jest-dom/extend-expect'; -import { Providers } from '../../../../app_dependencies.mock'; +import { Providers } from '../../app_dependencies.mock'; import { getPivotQuery, PivotAggsConfig, PivotGroupByConfig, PIVOT_SUPPORTED_AGGS, PIVOT_SUPPORTED_GROUP_BY_AGGS, -} from '../../../../common'; -import { SearchItems } from '../../../../hooks/use_search_items'; +} from '../../common'; import { PivotPreview } from './pivot_preview'; jest.mock('ui/new_platform'); -jest.mock('../../../../../shared_imports'); +jest.mock('../../../shared_imports'); describe('Transform: ', () => { // Using the async/await wait()/done() pattern to avoid act() errors. @@ -42,10 +41,7 @@ describe('Transform: ', () => { const props = { aggs: { 'the-agg-name': agg }, groupBy: { 'the-group-by-name': groupBy }, - indexPattern: { - title: 'the-index-pattern-title', - fields: [] as any[], - } as SearchItems['indexPattern'], + indexPatternTitle: 'the-index-pattern-title', query: getPivotQuery('the-query'), }; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.tsx b/x-pack/plugins/transform/public/app/components/pivot_preview/pivot_preview.tsx similarity index 75% rename from x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.tsx rename to x-pack/plugins/transform/public/app/components/pivot_preview/pivot_preview.tsx index 9b32bbbae839e..51ca9f38a3d10 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.tsx +++ b/x-pack/plugins/transform/public/app/components/pivot_preview/pivot_preview.tsx @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ +import moment from 'moment-timezone'; import React, { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { i18n } from '@kbn/i18n'; @@ -21,8 +22,11 @@ import { EuiTitle, } from '@elastic/eui'; -import { dictionaryToArray } from '../../../../../../common/types/common'; -import { getNestedProperty } from '../../../../../../common/utils/object_utils'; +import { ES_FIELD_TYPES } from '../../../../../../../src/plugins/data/common'; + +import { dictionaryToArray } from '../../../../common/types/common'; +import { formatHumanReadableDateTimeSeconds } from '../../../../common/utils/date_utils'; +import { getNestedProperty } from '../../../../common/utils/object_utils'; import { euiDataGridStyle, @@ -33,8 +37,8 @@ import { PivotGroupByConfig, PivotGroupByConfigDict, PivotQuery, -} from '../../../../common'; -import { SearchItems } from '../../../../hooks/use_search_items'; +} from '../../common'; +import { SearchItems } from '../../hooks/use_search_items'; import { getPivotPreviewDevConsoleStatement, multiColumnSortFactory } from './common'; import { PIVOT_PREVIEW_STATUS, usePivotPreviewData } from './use_pivot_preview_data'; @@ -102,21 +106,22 @@ const ErrorMessage: FC = ({ message }) => ( interface PivotPreviewProps { aggs: PivotAggsConfigDict; groupBy: PivotGroupByConfigDict; - indexPattern: SearchItems['indexPattern']; + indexPatternTitle: SearchItems['indexPattern']['title']; query: PivotQuery; + showHeader?: boolean; } const defaultPagination = { pageIndex: 0, pageSize: 5 }; export const PivotPreview: FC = React.memo( - ({ aggs, groupBy, indexPattern, query }) => { + ({ aggs, groupBy, indexPatternTitle, query, showHeader = true }) => { const { previewData: data, previewMappings, errorMessage, previewRequest, status, - } = usePivotPreviewData(indexPattern, query, aggs, groupBy); + } = usePivotPreviewData(indexPatternTitle, query, aggs, groupBy); const groupByArr = dictionaryToArray(groupBy); // Filters mapping properties of type `object`, which get returned for nested field parents. @@ -142,7 +147,42 @@ export const PivotPreview: FC = React.memo( }, [data.length]); // EuiDataGrid State - const dataGridColumns = columnKeys.map(id => ({ id })); + const dataGridColumns = columnKeys.map(id => { + const field = previewMappings.properties[id]; + + // Built-in values are ['boolean', 'currency', 'datetime', 'numeric', 'json'] + // To fall back to the default string schema it needs to be undefined. + let schema; + + switch (field?.type) { + case ES_FIELD_TYPES.GEO_POINT: + case ES_FIELD_TYPES.GEO_SHAPE: + schema = 'json'; + break; + case ES_FIELD_TYPES.BOOLEAN: + schema = 'boolean'; + break; + case ES_FIELD_TYPES.DATE: + schema = 'datetime'; + break; + case ES_FIELD_TYPES.BYTE: + case ES_FIELD_TYPES.DOUBLE: + case ES_FIELD_TYPES.FLOAT: + case ES_FIELD_TYPES.HALF_FLOAT: + case ES_FIELD_TYPES.INTEGER: + case ES_FIELD_TYPES.LONG: + case ES_FIELD_TYPES.SCALED_FLOAT: + case ES_FIELD_TYPES.SHORT: + schema = 'numeric'; + break; + // keep schema undefined for text based columns + case ES_FIELD_TYPES.KEYWORD: + case ES_FIELD_TYPES.TEXT: + break; + } + + return { id, schema }; + }); const onChangeItemsPerPage = useCallback( pageSize => { @@ -191,13 +231,17 @@ export const PivotPreview: FC = React.memo( return JSON.stringify(cellValue); } - if (cellValue === undefined) { + if (cellValue === undefined || cellValue === null) { return null; } + if (previewMappings.properties[columnId].type === ES_FIELD_TYPES.DATE) { + return formatHumanReadableDateTimeSeconds(moment(cellValue).unix() * 1000); + } + return cellValue; }; - }, [pageData, pagination.pageIndex, pagination.pageSize]); + }, [pageData, pagination.pageIndex, pagination.pageSize, previewMappings.properties]); if (status === PIVOT_PREVIEW_STATUS.ERROR) { return ( @@ -256,13 +300,17 @@ export const PivotPreview: FC = React.memo( return (
- -
- {status === PIVOT_PREVIEW_STATUS.LOADING && } - {status !== PIVOT_PREVIEW_STATUS.LOADING && ( - - )} -
+ {showHeader && ( + <> + +
+ {status === PIVOT_PREVIEW_STATUS.LOADING && } + {status !== PIVOT_PREVIEW_STATUS.LOADING && ( + + )} +
+ + )} {dataGridColumns.length > 0 && data.length > 0 && ( void; interface TestHookProps { @@ -46,12 +44,7 @@ let pivotPreviewObj: UsePivotPreviewDataReturnType; describe('usePivotPreviewData', () => { test('indexPattern not defined', () => { testHook(() => { - pivotPreviewObj = usePivotPreviewData( - ({ id: 'the-id', title: 'the-title', fields: [] } as unknown) as IndexPattern, - query, - {}, - {} - ); + pivotPreviewObj = usePivotPreviewData('the-title', query, {}, {}); }); expect(pivotPreviewObj.errorMessage).toBe(''); @@ -61,12 +54,7 @@ describe('usePivotPreviewData', () => { test('indexPattern set triggers loading', () => { testHook(() => { - pivotPreviewObj = usePivotPreviewData( - ({ id: 'the-id', title: 'the-title', fields: [] } as unknown) as IndexPattern, - query, - {}, - {} - ); + pivotPreviewObj = usePivotPreviewData('the-title', query, {}, {}); }); expect(pivotPreviewObj.errorMessage).toBe(''); diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.ts b/x-pack/plugins/transform/public/app/components/pivot_preview/use_pivot_preview_data.ts similarity index 86% rename from x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.ts rename to x-pack/plugins/transform/public/app/components/pivot_preview/use_pivot_preview_data.ts index 215435027d5b8..c3ccddbfc2906 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.ts +++ b/x-pack/plugins/transform/public/app/components/pivot_preview/use_pivot_preview_data.ts @@ -6,11 +6,11 @@ import { useEffect, useState } from 'react'; -import { dictionaryToArray } from '../../../../../../common/types/common'; -import { useApi } from '../../../../hooks/use_api'; +import { dictionaryToArray } from '../../../../common/types/common'; +import { useApi } from '../../hooks/use_api'; -import { Dictionary } from '../../../../../../common/types/common'; -import { IndexPattern, ES_FIELD_TYPES } from '../../../../../../../../../src/plugins/data/public'; +import { Dictionary } from '../../../../common/types/common'; +import { IndexPattern, ES_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; import { getPreviewRequestBody, @@ -18,7 +18,7 @@ import { PivotAggsConfigDict, PivotGroupByConfigDict, PivotQuery, -} from '../../../../common'; +} from '../../common'; export enum PIVOT_PREVIEW_STATUS { UNUSED, @@ -51,7 +51,7 @@ export interface GetTransformsResponse { } export const usePivotPreviewData = ( - indexPattern: IndexPattern, + indexPatternTitle: IndexPattern['title'], query: PivotQuery, aggs: PivotAggsConfigDict, groupBy: PivotGroupByConfigDict @@ -65,7 +65,7 @@ export const usePivotPreviewData = ( const aggsArr = dictionaryToArray(aggs); const groupByArr = dictionaryToArray(groupBy); - const previewRequest = getPreviewRequestBody(indexPattern.title, query, groupByArr, aggsArr); + const previewRequest = getPreviewRequestBody(indexPatternTitle, query, groupByArr, aggsArr); const getPreviewData = async () => { if (aggsArr.length === 0 || groupByArr.length === 0) { @@ -94,7 +94,7 @@ export const usePivotPreviewData = ( // custom comparison /* eslint-disable react-hooks/exhaustive-deps */ }, [ - indexPattern.title, + indexPatternTitle, JSON.stringify(aggsArr), JSON.stringify(groupByArr), JSON.stringify(query), diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/source_index_preview/source_index_preview.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/source_index_preview/source_index_preview.tsx index 76ed12ff772f5..2a467ba4a5772 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/source_index_preview/source_index_preview.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/source_index_preview/source_index_preview.tsx @@ -4,7 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import moment from 'moment-timezone'; +import React, { useCallback, useMemo, useState } from 'react'; import { i18n } from '@kbn/i18n'; @@ -17,9 +18,11 @@ import { EuiFlexGroup, EuiFlexItem, EuiProgress, + EuiSpacer, EuiTitle, } from '@elastic/eui'; +import { formatHumanReadableDateTimeSeconds } from '../../../../../../common/utils/date_utils'; import { getNestedProperty } from '../../../../../../common/utils/object_utils'; import { @@ -29,6 +32,7 @@ import { PivotQuery, } from '../../../../common'; import { SearchItems } from '../../../../hooks/use_search_items'; +import { useToastNotifications } from '../../../../app_dependencies'; import { getSourceIndexDevConsoleStatement } from './common'; import { SOURCE_INDEX_STATUS, useSourceIndexData } from './use_source_index_data'; @@ -52,9 +56,8 @@ interface Props { query: PivotQuery; } -const defaultPagination = { pageIndex: 0, pageSize: 5 }; - export const SourceIndexPreview: React.FC = React.memo(({ indexPattern, query }) => { + const toastNotifications = useToastNotifications(); const allFields = indexPattern.fields.map(f => f.name); const indexPatternFields: string[] = allFields.filter(f => { if (indexPattern.metaFields.includes(f)) { @@ -73,38 +76,67 @@ export const SourceIndexPreview: React.FC = React.memo(({ indexPattern, q // Column visibility const [visibleColumns, setVisibleColumns] = useState(indexPatternFields); - const [pagination, setPagination] = useState(defaultPagination); - - useEffect(() => { - setPagination(defaultPagination); - }, [query]); - - const { errorMessage, status, rowCount, tableItems: data } = useSourceIndexData( - indexPattern, - query, - pagination - ); + const { + errorMessage, + pagination, + setPagination, + setSortingColumns, + rowCount, + sortingColumns, + status, + tableItems: data, + } = useSourceIndexData(indexPattern, query); // EuiDataGrid State - const dataGridColumns = indexPatternFields.map(id => { - const field = indexPattern.fields.getByName(id); - - let schema = 'string'; - - switch (field?.type) { - case 'date': - schema = 'datetime'; - break; - case 'geo_point': - schema = 'json'; - break; - case 'number': - schema = 'numeric'; - break; - } + const dataGridColumns = [ + ...indexPatternFields.map(id => { + const field = indexPattern.fields.getByName(id); + + // Built-in values are ['boolean', 'currency', 'datetime', 'numeric', 'json'] + // To fall back to the default string schema it needs to be undefined. + let schema; + + switch (field?.type) { + case 'date': + schema = 'datetime'; + break; + case 'geo_point': + schema = 'json'; + break; + case 'number': + schema = 'numeric'; + break; + } - return { id, schema }; - }); + return { id, schema }; + }), + ]; + + const onSort = useCallback( + (sc: Array<{ id: string; direction: 'asc' | 'desc' }>) => { + // Check if an unsupported column type for sorting was selected. + const invalidSortingColumnns = sc.reduce((arr, current) => { + const columnType = dataGridColumns.find(dgc => dgc.id === current.id); + if (columnType?.schema === 'json') { + arr.push(current.id); + } + return arr; + }, []); + if (invalidSortingColumnns.length === 0) { + setSortingColumns(sc); + } else { + invalidSortingColumnns.forEach(columnId => { + toastNotifications.addDanger( + i18n.translate('xpack.transform.sourceIndexPreview.invalidSortingColumnError', { + defaultMessage: `The column '{columnId}' cannot be used for sorting.`, + values: { columnId }, + }) + ); + }); + } + }, + [dataGridColumns, setSortingColumns, toastNotifications] + ); const onChangeItemsPerPage = useCallback( pageSize => { @@ -120,10 +152,6 @@ export const SourceIndexPreview: React.FC = React.memo(({ indexPattern, q setPagination, ]); - // ** Sorting config - const [sortingColumns, setSortingColumns] = useState([]); - const onSort = useCallback(sc => setSortingColumns(sc), [setSortingColumns]); - const renderCellValue = useMemo(() => { return ({ rowIndex, @@ -144,32 +172,18 @@ export const SourceIndexPreview: React.FC = React.memo(({ indexPattern, q return JSON.stringify(cellValue); } - if (cellValue === undefined) { + if (cellValue === undefined || cellValue === null) { return null; } + const field = indexPattern.fields.getByName(columnId); + if (field?.type === 'date') { + return formatHumanReadableDateTimeSeconds(moment(cellValue).unix() * 1000); + } + return cellValue; }; - }, [data, pagination.pageIndex, pagination.pageSize]); - - if (status === SOURCE_INDEX_STATUS.ERROR) { - return ( -
- - - - {errorMessage} - - -
- ); - } + }, [data, indexPattern.fields, pagination.pageIndex, pagination.pageSize]); if (status === SOURCE_INDEX_STATUS.LOADED && data.length === 0) { return ( @@ -200,7 +214,11 @@ export const SourceIndexPreview: React.FC = React.memo(({ indexPattern, q }); return ( -
+
@@ -222,24 +240,38 @@ export const SourceIndexPreview: React.FC = React.memo(({ indexPattern, q )}
- {dataGridColumns.length > 0 && data.length > 0 && ( - + {status === SOURCE_INDEX_STATUS.ERROR && ( +
+ + + {errorMessage} + + + +
)} +
); }); diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/source_index_preview/use_source_index_data.test.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/source_index_preview/use_source_index_data.test.tsx index 9992f153f3b86..5a1d8a8db5b42 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/source_index_preview/use_source_index_data.test.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/source_index_preview/use_source_index_data.test.tsx @@ -26,10 +26,7 @@ const query: SimpleQuery = { describe('useSourceIndexData', () => { test('indexPattern set triggers loading', async done => { const { result, waitForNextUpdate } = renderHook(() => - useSourceIndexData({ id: 'the-id', title: 'the-title', fields: [] }, query, { - pageIndex: 0, - pageSize: 10, - }) + useSourceIndexData({ id: 'the-id', title: 'the-title', fields: [] }, query) ); const sourceIndexObj: UseSourceIndexDataReturnType = result.current; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/source_index_preview/use_source_index_data.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/source_index_preview/use_source_index_data.ts index ae5bd9040baca..5301a3c168a51 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/source_index_preview/use_source_index_data.ts +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/source_index_preview/use_source_index_data.ts @@ -4,15 +4,18 @@ * you may not use this file except in compliance with the Elastic License. */ -import { useEffect, useState } from 'react'; +import { useEffect, useState, Dispatch, SetStateAction } from 'react'; import { SearchResponse } from 'elasticsearch'; +import { EuiDataGridPaginationProps, EuiDataGridSorting } from '@elastic/eui'; + import { IIndexPattern } from 'src/plugins/data/public'; -import { useApi } from '../../../../hooks/use_api'; +import { Dictionary } from '../../../../../../common/types/common'; import { isDefaultQuery, matchAllQuery, EsDocSource, PivotQuery } from '../../../../common'; +import { useApi } from '../../../../hooks/use_api'; export enum SOURCE_INDEX_STATUS { UNUSED, @@ -21,19 +24,25 @@ export enum SOURCE_INDEX_STATUS { ERROR, } +type EsSorting = Dictionary<{ + order: 'asc' | 'desc'; +}>; + interface ErrorResponse { - error: { - body: string; - msg: string; - path: string; - query: any; - response: string; + request: Dictionary; + response: Dictionary; + body: { statusCode: number; + error: string; + message: string; }; + name: string; + req: Dictionary; + res: Dictionary; } const isErrorResponse = (arg: any): arg is ErrorResponse => { - return arg.error !== undefined; + return arg?.body?.error !== undefined && arg?.body?.message !== undefined; }; // The types specified in `@types/elasticsearch` are out of date and still have `total: number`. @@ -46,42 +55,60 @@ interface SearchResponse7 extends SearchResponse { }; } -type SourceIndexSearchResponse = ErrorResponse | SearchResponse7; +type SourceIndexSearchResponse = SearchResponse7; + +type SourceIndexPagination = Pick; +const defaultPagination: SourceIndexPagination = { pageIndex: 0, pageSize: 5 }; export interface UseSourceIndexDataReturnType { errorMessage: string; - status: SOURCE_INDEX_STATUS; + pagination: SourceIndexPagination; + setPagination: Dispatch>; + setSortingColumns: Dispatch>; rowCount: number; + sortingColumns: EuiDataGridSorting['columns']; + status: SOURCE_INDEX_STATUS; tableItems: EsDocSource[]; } export const useSourceIndexData = ( indexPattern: IIndexPattern, - query: PivotQuery, - pagination: { pageIndex: number; pageSize: number } + query: PivotQuery ): UseSourceIndexDataReturnType => { const [errorMessage, setErrorMessage] = useState(''); const [status, setStatus] = useState(SOURCE_INDEX_STATUS.UNUSED); + const [pagination, setPagination] = useState(defaultPagination); + const [sortingColumns, setSortingColumns] = useState([]); const [rowCount, setRowCount] = useState(0); const [tableItems, setTableItems] = useState([]); const api = useApi(); + useEffect(() => { + setPagination(defaultPagination); + }, [query]); + const getSourceIndexData = async function() { setErrorMessage(''); setStatus(SOURCE_INDEX_STATUS.LOADING); - try { - const resp: SourceIndexSearchResponse = await api.esSearch({ - index: indexPattern.title, + const sort: EsSorting = sortingColumns.reduce((s, column) => { + s[column.id] = { order: column.direction }; + return s; + }, {} as EsSorting); + + const esSearchRequest = { + index: indexPattern.title, + body: { + // Instead of using the default query (`*`), fall back to a more efficient `match_all` query. + query: isDefaultQuery(query) ? matchAllQuery : query, from: pagination.pageIndex * pagination.pageSize, size: pagination.pageSize, - // Instead of using the default query (`*`), fall back to a more efficient `match_all` query. - body: { query: isDefaultQuery(query) ? matchAllQuery : query }, - }); + ...(Object.keys(sort).length > 0 ? { sort } : {}), + }, + }; - if (isErrorResponse(resp)) { - throw resp.error; - } + try { + const resp: SourceIndexSearchResponse = await api.esSearch(esSearchRequest); const docs = resp.hits.hits.map(d => d._source); @@ -89,12 +116,11 @@ export const useSourceIndexData = ( setTableItems(docs); setStatus(SOURCE_INDEX_STATUS.LOADED); } catch (e) { - if (e.message !== undefined) { - setErrorMessage(e.message); + if (isErrorResponse(e)) { + setErrorMessage(`${e.body.error}: ${e.body.message}`); } else { setErrorMessage(JSON.stringify(e, null, 2)); } - setTableItems([]); setStatus(SOURCE_INDEX_STATUS.ERROR); } }; @@ -103,6 +129,15 @@ export const useSourceIndexData = ( getSourceIndexData(); // custom comparison // eslint-disable-next-line react-hooks/exhaustive-deps - }, [indexPattern.title, JSON.stringify(query), JSON.stringify(pagination)]); - return { errorMessage, status, rowCount, tableItems }; + }, [indexPattern.title, JSON.stringify([query, pagination, sortingColumns])]); + return { + errorMessage, + pagination, + setPagination, + setSortingColumns, + rowCount, + sortingColumns, + status, + tableItems, + }; }; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common.test.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common.test.ts index c9a52304578ee..5db6a233c9134 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common.test.ts +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common.test.ts @@ -4,73 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiDataGridSorting } from '@elastic/eui'; - -import { - getPreviewRequestBody, - PivotAggsConfig, - PivotGroupByConfig, - PIVOT_SUPPORTED_AGGS, - PIVOT_SUPPORTED_GROUP_BY_AGGS, - SimpleQuery, -} from '../../../../common'; - -import { - multiColumnSortFactory, - getPivotPreviewDevConsoleStatement, - getPivotDropdownOptions, -} from './common'; +import { getPivotDropdownOptions } from './common'; import { IndexPattern } from '../../../../../../../../../src/plugins/data/public'; describe('Transform: Define Pivot Common', () => { - test('customSortFactory()', () => { - const data = [ - { s: 'a', n: 1 }, - { s: 'a', n: 2 }, - { s: 'b', n: 3 }, - { s: 'b', n: 4 }, - ]; - - const sortingColumns1: EuiDataGridSorting['columns'] = [{ id: 's', direction: 'desc' }]; - const multiColumnSort1 = multiColumnSortFactory(sortingColumns1); - data.sort(multiColumnSort1); - - expect(data).toStrictEqual([ - { s: 'b', n: 3 }, - { s: 'b', n: 4 }, - { s: 'a', n: 1 }, - { s: 'a', n: 2 }, - ]); - - const sortingColumns2: EuiDataGridSorting['columns'] = [ - { id: 's', direction: 'asc' }, - { id: 'n', direction: 'desc' }, - ]; - const multiColumnSort2 = multiColumnSortFactory(sortingColumns2); - data.sort(multiColumnSort2); - - expect(data).toStrictEqual([ - { s: 'a', n: 2 }, - { s: 'a', n: 1 }, - { s: 'b', n: 4 }, - { s: 'b', n: 3 }, - ]); - - const sortingColumns3: EuiDataGridSorting['columns'] = [ - { id: 'n', direction: 'desc' }, - { id: 's', direction: 'desc' }, - ]; - const multiColumnSort3 = multiColumnSortFactory(sortingColumns3); - data.sort(multiColumnSort3); - - expect(data).toStrictEqual([ - { s: 'b', n: 4 }, - { s: 'b', n: 3 }, - { s: 'a', n: 2 }, - { s: 'a', n: 1 }, - ]); - }); - test('getPivotDropdownOptions()', () => { // The field name includes the characters []> as well as a leading and ending space charcter // which cannot be used for aggregation names. The test results verifies that the characters @@ -155,53 +92,4 @@ describe('Transform: Define Pivot Common', () => { }, }); }); - - test('getPivotPreviewDevConsoleStatement()', () => { - const query: SimpleQuery = { - query_string: { - query: '*', - default_operator: 'AND', - }, - }; - const groupBy: PivotGroupByConfig = { - agg: PIVOT_SUPPORTED_GROUP_BY_AGGS.TERMS, - field: 'the-group-by-field', - aggName: 'the-group-by-agg-name', - dropDownName: 'the-group-by-drop-down-name', - }; - const agg: PivotAggsConfig = { - agg: PIVOT_SUPPORTED_AGGS.AVG, - field: 'the-agg-field', - aggName: 'the-agg-agg-name', - dropDownName: 'the-agg-drop-down-name', - }; - const request = getPreviewRequestBody('the-index-pattern-title', query, [groupBy], [agg]); - const pivotPreviewDevConsoleStatement = getPivotPreviewDevConsoleStatement(request); - - expect(pivotPreviewDevConsoleStatement).toBe(`POST _transform/_preview -{ - "source": { - "index": [ - "the-index-pattern-title" - ] - }, - "pivot": { - "group_by": { - "the-group-by-agg-name": { - "terms": { - "field": "the-group-by-field" - } - } - }, - "aggregations": { - "the-agg-agg-name": { - "avg": { - "field": "the-agg-field" - } - } - } - } -} -`); - }); }); diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common.ts index 0779cb1339af6..a9413afb6243e 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common.ts +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common.ts @@ -4,13 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ import { get } from 'lodash'; -import { EuiComboBoxOptionOption, EuiDataGridSorting } from '@elastic/eui'; +import { EuiComboBoxOptionOption } from '@elastic/eui'; import { IndexPattern, KBN_FIELD_TYPES } from '../../../../../../../../../src/plugins/data/public'; -import { getNestedProperty } from '../../../../../../common/utils/object_utils'; - import { - PreviewRequestBody, DropDownLabel, DropDownOption, EsFieldName, @@ -27,51 +24,6 @@ export interface Field { type: KBN_FIELD_TYPES; } -/** - * Helper to sort an array of objects based on an EuiDataGrid sorting configuration. - * `sortFn()` is recursive to support sorting on multiple columns. - * - * @param sortingColumns - The EUI data grid sorting configuration - * @returns The sorting function which can be used with an array's sort() function. - */ -export const multiColumnSortFactory = (sortingColumns: EuiDataGridSorting['columns']) => { - const isString = (arg: any): arg is string => { - return typeof arg === 'string'; - }; - - const sortFn = (a: any, b: any, sortingColumnIndex = 0): number => { - const sort = sortingColumns[sortingColumnIndex]; - const aValue = getNestedProperty(a, sort.id, null); - const bValue = getNestedProperty(b, sort.id, null); - - if (typeof aValue === 'number' && typeof bValue === 'number') { - if (aValue < bValue) { - return sort.direction === 'asc' ? -1 : 1; - } - if (aValue > bValue) { - return sort.direction === 'asc' ? 1 : -1; - } - } - - if (isString(aValue) && isString(bValue)) { - if (aValue.localeCompare(bValue) === -1) { - return sort.direction === 'asc' ? -1 : 1; - } - if (aValue.localeCompare(bValue) === 1) { - return sort.direction === 'asc' ? 1 : -1; - } - } - - if (sortingColumnIndex + 1 < sortingColumns.length) { - return sortFn(a, b, sortingColumnIndex + 1); - } - - return 0; - }; - - return sortFn; -}; - function getDefaultGroupByConfig( aggName: string, dropDownName: string, @@ -166,7 +118,3 @@ export function getPivotDropdownOptions(indexPattern: IndexPattern) { aggOptionsData, }; } - -export const getPivotPreviewDevConsoleStatement = (request: PreviewRequestBody) => { - return `POST _transform/_preview\n${JSON.stringify(request, null, 2)}\n`; -}; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.tsx index 254d867165ae6..5b6283fc4777d 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.tsx @@ -26,6 +26,7 @@ import { EuiSwitch, } from '@elastic/eui'; +import { PivotPreview } from '../../../../components/pivot_preview'; import { useDocumentationLinks } from '../../../../hooks/use_documentation_links'; import { SavedSearchQuery, SearchItems } from '../../../../hooks/use_search_items'; import { useXJsonMode, xJsonMode } from '../../../../hooks/use_x_json_mode'; @@ -36,7 +37,6 @@ import { DropDown } from '../aggregation_dropdown'; import { AggListForm } from '../aggregation_list'; import { GroupByListForm } from '../group_by_list'; import { SourceIndexPreview } from '../source_index_preview'; -import { PivotPreview } from './pivot_preview'; import { KqlFilterBar } from '../../../../../shared_imports'; import { SwitchModal } from './switch_modal'; @@ -899,7 +899,7 @@ export const StepDefineForm: FC = React.memo(({ overrides = {}, onChange, diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_summary.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_summary.tsx index f8fb9db9bd686..00948109c811d 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_summary.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_summary.tsx @@ -18,12 +18,12 @@ import { } from '@elastic/eui'; import { getPivotQuery } from '../../../../common'; +import { PivotPreview } from '../../../../components/pivot_preview'; import { SearchItems } from '../../../../hooks/use_search_items'; import { AggListSummary } from '../aggregation_list'; import { GroupByListSummary } from '../group_by_list'; -import { PivotPreview } from './pivot_preview'; import { StepDefineExposedState } from './step_define_form'; const defaultSearch = '*'; @@ -134,7 +134,7 @@ export const StepDefineSummary: FC = ({ diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_preview_pane.tsx b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_preview_pane.tsx index 0e9b531e1feaf..eaaedc2eb77ce 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_preview_pane.tsx +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_preview_pane.tsx @@ -4,218 +4,39 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { FC, useState } from 'react'; -import { i18n } from '@kbn/i18n'; -import moment from 'moment-timezone'; -import { Direction } from '@elastic/eui'; -import { SortDirection, SORT_DIRECTION, FieldDataColumnType } from '../../../../../shared_imports'; +import React, { FC } from 'react'; -import { useApi } from '../../../../hooks/use_api'; +import { SearchItems } from '../../../../hooks/use_search_items'; -import { - getFlattenedFields, - useRefreshTransformList, - EsDoc, - PreviewRequestBody, - TransformPivotConfig, -} from '../../../../common'; -import { ES_FIELD_TYPES } from '../../../../../../../../../src/plugins/data/public'; -import { formatHumanReadableDateTimeSeconds } from '../../../../../../common/utils/date_utils'; -import { transformTableFactory } from './transform_table'; +import { getPivotQuery, TransformPivotConfig } from '../../../../common'; -const TransformTable = transformTableFactory(); +import { + applyTransformConfigToDefineState, + getDefaultStepDefineState, +} from '../../../create_transform/components/step_define/'; +import { PivotPreview } from '../../../../components/pivot_preview'; interface Props { transformConfig: TransformPivotConfig; } -export function sortColumns(groupByArr: string[]) { - return (a: string, b: string) => { - // make sure groupBy fields are always most left columns - if (groupByArr.some(aggName => aggName === a) && groupByArr.some(aggName => aggName === b)) { - return a.localeCompare(b); - } - if (groupByArr.some(aggName => aggName === a)) { - return -1; - } - if (groupByArr.some(aggName => aggName === b)) { - return 1; - } - return a.localeCompare(b); - }; -} - -function getDataFromTransform( - transformConfig: TransformPivotConfig -): { previewRequest: PreviewRequestBody; groupByArr: string[] | [] } { - const index = transformConfig.source.index; - const query = transformConfig.source.query; - const pivot = transformConfig.pivot; - const groupByArr = []; - - const previewRequest: PreviewRequestBody = { - source: { - index, - query, - }, - pivot, - }; - // hasOwnProperty check to ensure only properties on object itself, and not its prototypes - if (pivot.group_by !== undefined) { - for (const key in pivot.group_by) { - if (pivot.group_by.hasOwnProperty(key)) { - groupByArr.push(key); - } - } - } - - return { groupByArr, previewRequest }; -} - export const ExpandedRowPreviewPane: FC = ({ transformConfig }) => { - const [previewData, setPreviewData] = useState([]); - const [columns, setColumns] = useState> | []>([]); - const [pageIndex, setPageIndex] = useState(0); - const [pageSize, setPageSize] = useState(10); - const [sortDirection, setSortDirection] = useState(SORT_DIRECTION.ASC); - const [sortField, setSortField] = useState(''); - const [isLoading, setIsLoading] = useState(false); - const [errorMessage, setErrorMessage] = useState(''); - const api = useApi(); - - const getPreviewFactory = () => { - let concurrentLoads = 0; - - return async function getPreview() { - try { - concurrentLoads++; - - if (concurrentLoads > 1) { - return; - } - - const { previewRequest, groupByArr } = getDataFromTransform(transformConfig); - setIsLoading(true); - const resp: any = await api.getTransformsPreview(previewRequest); - setIsLoading(false); - - if (resp.preview.length > 0) { - const columnKeys = getFlattenedFields(resp.preview[0]); - columnKeys.sort(sortColumns(groupByArr)); - - const tableColumns: Array> = columnKeys.map(k => { - const column: FieldDataColumnType = { - field: k, - name: k, - sortable: true, - truncateText: true, - }; - - if (typeof resp.mappings.properties[k] !== 'undefined') { - const esFieldType = resp.mappings.properties[k].type; - switch (esFieldType) { - case ES_FIELD_TYPES.BOOLEAN: - column.dataType = 'boolean'; - break; - case ES_FIELD_TYPES.DATE: - column.align = 'right'; - column.render = (d: any) => - formatHumanReadableDateTimeSeconds(moment(d).unix() * 1000); - break; - case ES_FIELD_TYPES.BYTE: - case ES_FIELD_TYPES.DOUBLE: - case ES_FIELD_TYPES.FLOAT: - case ES_FIELD_TYPES.HALF_FLOAT: - case ES_FIELD_TYPES.INTEGER: - case ES_FIELD_TYPES.LONG: - case ES_FIELD_TYPES.SCALED_FLOAT: - case ES_FIELD_TYPES.SHORT: - column.dataType = 'number'; - break; - case ES_FIELD_TYPES.KEYWORD: - case ES_FIELD_TYPES.TEXT: - column.dataType = 'string'; - break; - } - } - - return column; - }); - - setPreviewData(resp.preview); - setColumns(tableColumns); - setSortField(sortField); - setSortDirection(sortDirection); - } - concurrentLoads--; - - if (concurrentLoads > 0) { - concurrentLoads = 0; - getPreview(); - } - } catch (error) { - setIsLoading(false); - setErrorMessage( - i18n.translate('xpack.transform.transformList.stepDetails.previewPane.errorMessage', { - defaultMessage: 'Preview could not be loaded', - }) - ); - } - }; - }; - - useRefreshTransformList({ onRefresh: getPreviewFactory() }); - - const pagination = { - initialPageIndex: pageIndex, - initialPageSize: pageSize, - totalItemCount: previewData.length, - pageSizeOptions: [10, 20], - hidePerPageOptions: false, - }; - - const sorting = { - sort: { - field: sortField as string, - direction: sortDirection, - }, - }; - - const onTableChange = ({ - page = { index: 0, size: 10 }, - sort = { field: columns[0].field, direction: SORT_DIRECTION.ASC }, - }: { - page?: { index: number; size: number }; - sort?: { field: keyof typeof previewData[number]; direction: SortDirection | Direction }; - }) => { - const { index, size } = page; - setPageIndex(index); - setPageSize(size); - - const { field, direction } = sort; - setSortField(field); - setSortDirection(direction); - }; + const previewConfig = applyTransformConfigToDefineState( + getDefaultStepDefineState({} as SearchItems), + transformConfig + ); - const transformTableLoading = previewData.length === 0 && isLoading === true; - const dataTestSubj = `transformPreviewTabContent${!transformTableLoading ? ' loaded' : ''}`; + const indexPatternTitle = Array.isArray(transformConfig.source.index) + ? transformConfig.source.index.join(',') + : transformConfig.source.index; return ( -
- ({ - 'data-test-subj': 'transformPreviewTabContentRow', - })} - sorting={sorting} - error={errorMessage} - /> -
+ ); }; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 5635bb19b7e83..b64caea05dbe4 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -12500,7 +12500,6 @@ "xpack.transform.transformList.startModalTitle": "{transformId} を開始", "xpack.transform.transformList.startTransformErrorMessage": "変換 {transformId} の開始中にエラーが発生しました", "xpack.transform.transformList.startTransformSuccessMessage": "変換 {transformId} の開始リクエストが受け付けられました。", - "xpack.transform.transformList.stepDetails.previewPane.errorMessage": "プレビューを読み込めませんでした", "xpack.transform.transformList.stopActionName": "停止", "xpack.transform.transformList.stoppedTransformBulkToolTip": "1 つまたは複数の変換が既に開始済みです。", "xpack.transform.transformList.stoppedTransformToolTip": "{transformId} は既に停止済みです。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 0523021046167..872ec3b71ec10 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -12500,7 +12500,6 @@ "xpack.transform.transformList.startModalTitle": "启动 {transformId}", "xpack.transform.transformList.startTransformErrorMessage": "启动转换 {transformId} 时发生错误", "xpack.transform.transformList.startTransformSuccessMessage": "启动转换 {transformId} 的请求已确认。", - "xpack.transform.transformList.stepDetails.previewPane.errorMessage": "无法加载预览", "xpack.transform.transformList.stopActionName": "停止", "xpack.transform.transformList.stoppedTransformBulkToolTip": "一个或多个选定数据帧转换已停止。", "xpack.transform.transformList.stoppedTransformToolTip": "{transformId} 已停止。", diff --git a/x-pack/test/functional/services/transform_ui/transform_table.ts b/x-pack/test/functional/services/transform_ui/transform_table.ts index ebd7fe527b45f..858524eb2e1fd 100644 --- a/x-pack/test/functional/services/transform_ui/transform_table.ts +++ b/x-pack/test/functional/services/transform_ui/transform_table.ts @@ -61,17 +61,17 @@ export function TransformTableProvider({ getService }: FtrProviderContext) { return rows; } - async parseEuiInMemoryTable(tableSubj: string) { + async parseEuiDataGrid(tableSubj: string) { const table = await testSubjects.find(`~${tableSubj}`); const $ = await table.parseDomContent(); const rows = []; // For each row, get the content of each cell and // add its values as an array to each row. - for (const tr of $.findTestSubjects(`~${tableSubj}Row`).toArray()) { + for (const tr of $.findTestSubjects(`~dataGridRow`).toArray()) { rows.push( $(tr) - .find('.euiTableCellContent') + .find('.euiDataGridRowCell__truncate') .toArray() .map(cell => $(cell) @@ -84,14 +84,14 @@ export function TransformTableProvider({ getService }: FtrProviderContext) { return rows; } - async assertEuiInMemoryTableColumnValues( + async assertEuiDataGridColumnValues( tableSubj: string, column: number, expectedColumnValues: string[] ) { await retry.tryForTime(2000, async () => { // get a 2D array of rows and cell values - const rows = await this.parseEuiInMemoryTable(tableSubj); + const rows = await this.parseEuiDataGrid(tableSubj); // reduce the rows data to an array of unique values in the specified column const uniqueColumnValues = rows @@ -148,17 +148,17 @@ export function TransformTableProvider({ getService }: FtrProviderContext) { await testSubjects.existOrFail('transformPreviewTab'); await testSubjects.click('transformPreviewTab'); - await testSubjects.existOrFail('~transformPreviewTabContent'); + await testSubjects.existOrFail('~transformPivotPreview'); } public async waitForTransformsExpandedRowPreviewTabToLoad() { - await testSubjects.existOrFail('~transformPreviewTabContent', { timeout: 60 * 1000 }); - await testSubjects.existOrFail('transformPreviewTabContent loaded', { timeout: 30 * 1000 }); + await testSubjects.existOrFail('~transformPivotPreview', { timeout: 60 * 1000 }); + await testSubjects.existOrFail('transformPivotPreview loaded', { timeout: 30 * 1000 }); } async assertTransformsExpandedRowPreviewColumnValues(column: number, values: string[]) { await this.waitForTransformsExpandedRowPreviewTabToLoad(); - await this.assertEuiInMemoryTableColumnValues('transformPreviewTabContent', column, values); + await this.assertEuiDataGridColumnValues('transformPivotPreview', column, values); } })(); } From 06999ecfb31f223f75bd93f36b6f3293390204c7 Mon Sep 17 00:00:00 2001 From: Devon Thomson Date: Tue, 10 Mar 2020 11:31:03 -0400 Subject: [PATCH 14/23] Enhancement - EUICodeEditor for Visualize JSON (#58679) Switched out the textfield in the advanced JSON editor for the EUI code editor component. removed legacy import isValidJson in favor of using Ace Editor's default json validation. --- src/legacy/core_plugins/data/public/index.ts | 1 - .../data/public/search/aggs/index.ts | 2 +- .../data/public/search/aggs/utils.test.tsx | 49 --------- .../data/public/search/aggs/utils.ts | 29 ----- .../public/components/controls/raw_json.tsx | 100 +++++++++++------- .../public/legacy_imports.ts | 2 +- src/legacy/ui/public/agg_types/index.ts | 1 - 7 files changed, 65 insertions(+), 119 deletions(-) delete mode 100644 src/legacy/core_plugins/data/public/search/aggs/utils.test.tsx diff --git a/src/legacy/core_plugins/data/public/index.ts b/src/legacy/core_plugins/data/public/index.ts index 424e5ab0bf4d5..9187e207ed0d6 100644 --- a/src/legacy/core_plugins/data/public/index.ts +++ b/src/legacy/core_plugins/data/public/index.ts @@ -69,7 +69,6 @@ export { isStringType, isType, isValidInterval, - isValidJson, METRIC_TYPES, OptionedParamType, parentPipelineType, diff --git a/src/legacy/core_plugins/data/public/search/aggs/index.ts b/src/legacy/core_plugins/data/public/search/aggs/index.ts index 8d6fbeacd606a..75d632a0f931f 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/index.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/index.ts @@ -53,7 +53,7 @@ export { toAbsoluteDates } from './buckets/lib/date_utils'; export { convertIPRangeToString } from './buckets/ip_range'; export { aggTypeFilters, propFilter } from './filter'; export { OptionedParamType } from './param_types/optioned'; -export { isValidJson, isValidInterval } from './utils'; +export { isValidInterval } from './utils'; export { BUCKET_TYPES } from './buckets/bucket_agg_types'; export { METRIC_TYPES } from './metrics/metric_agg_types'; diff --git a/src/legacy/core_plugins/data/public/search/aggs/utils.test.tsx b/src/legacy/core_plugins/data/public/search/aggs/utils.test.tsx deleted file mode 100644 index c0662c98755a3..0000000000000 --- a/src/legacy/core_plugins/data/public/search/aggs/utils.test.tsx +++ /dev/null @@ -1,49 +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 { isValidJson } from './utils'; - -const input = { - valid: '{ "test": "json input" }', - invalid: 'strings are not json', -}; - -describe('AggType utils', () => { - describe('isValidJson', () => { - it('should return true when empty string', () => { - expect(isValidJson('')).toBeTruthy(); - }); - - it('should return true when undefine', () => { - expect(isValidJson(undefined as any)).toBeTruthy(); - }); - - it('should return false when invalid string', () => { - expect(isValidJson(input.invalid)).toBeFalsy(); - }); - - it('should return true when valid string', () => { - expect(isValidJson(input.valid)).toBeTruthy(); - }); - - it('should return false if a number', () => { - expect(isValidJson('0')).toBeFalsy(); - }); - }); -}); diff --git a/src/legacy/core_plugins/data/public/search/aggs/utils.ts b/src/legacy/core_plugins/data/public/search/aggs/utils.ts index 67ea373f438fb..9fcd3f7930b06 100644 --- a/src/legacy/core_plugins/data/public/search/aggs/utils.ts +++ b/src/legacy/core_plugins/data/public/search/aggs/utils.ts @@ -20,35 +20,6 @@ import { leastCommonInterval } from 'ui/vis/lib/least_common_interval'; import { isValidEsInterval } from '../../../common'; -/** - * Check a string if it's a valid JSON. - * - * @param {string} value a string that should be validated - * @returns {boolean} true if value is a valid JSON or if value is an empty string, or a string with whitespaces, otherwise false - */ -export function isValidJson(value: string): boolean { - if (!value || value.length === 0) { - return true; - } - - const trimmedValue = value.trim(); - - if (trimmedValue.length === 0) { - return true; - } - - if (trimmedValue[0] === '{' || trimmedValue[0] === '[') { - try { - JSON.parse(trimmedValue); - return true; - } catch (e) { - return false; - } - } else { - return false; - } -} - export function isValidInterval(value: string, baseInterval?: string) { if (baseInterval) { return _parseWithBase(value, baseInterval); diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/raw_json.tsx b/src/legacy/core_plugins/vis_default_editor/public/components/controls/raw_json.tsx index 32939c420155f..b6a6da09fb20e 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/controls/raw_json.tsx +++ b/src/legacy/core_plugins/vis_default_editor/public/components/controls/raw_json.tsx @@ -17,65 +17,91 @@ * under the License. */ -import React, { useEffect } from 'react'; +import React, { useState, useMemo, useCallback } from 'react'; -import { EuiFormRow, EuiIconTip, EuiTextArea } from '@elastic/eui'; +import { EuiFormRow, EuiIconTip, EuiCodeEditor, EuiScreenReaderOnly } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { isValidJson } from '../../legacy_imports'; import { AggParamEditorProps } from '../agg_param_props'; function RawJsonParamEditor({ - agg, showValidation, value = '', setValidity, setValue, setTouched, }: AggParamEditorProps) { - const label = ( - <> - {' '} - - + const [isFieldValid, setFieldValidity] = useState(true); + const [editorReady, setEditorReady] = useState(false); + + const editorTooltipText = useMemo( + () => + i18n.translate('visDefaultEditor.controls.jsonInputTooltip', { + defaultMessage: + "Any JSON formatted properties you add here will be merged with the elasticsearch aggregation definition for this section. For example 'shard_size' on a terms aggregation.", + }), + [] ); - const isValid = isValidJson(value); - const onChange = (ev: React.ChangeEvent) => { - const textValue = ev.target.value; - setValue(textValue); - setValidity(isValidJson(textValue)); - }; + const jsonEditorLabelText = useMemo( + () => + i18n.translate('visDefaultEditor.controls.jsonInputLabel', { + defaultMessage: 'JSON input', + }), + [] + ); - useEffect(() => { - setValidity(isValid); - }, [isValid]); + const label = useMemo( + () => ( + <> + {jsonEditorLabelText}{' '} + + + ), + [jsonEditorLabelText, editorTooltipText] + ); + + const onEditorValidate = useCallback( + (annotations: unknown[]) => { + // The first onValidate returned from EuiCodeEditor is a false negative + if (editorReady) { + const validity = annotations.length === 0; + setFieldValidity(validity); + setValidity(validity); + } else { + setEditorReady(true); + } + }, + [setValidity, editorReady] + ); return ( - + <> + + +

{editorTooltipText}

+
+
); } diff --git a/src/legacy/core_plugins/vis_default_editor/public/legacy_imports.ts b/src/legacy/core_plugins/vis_default_editor/public/legacy_imports.ts index 5c02b50286a95..33a5c0fe660c4 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/legacy_imports.ts +++ b/src/legacy/core_plugins/vis_default_editor/public/legacy_imports.ts @@ -42,7 +42,7 @@ export { parentPipelineType } from 'ui/agg_types'; export { siblingPipelineType } from 'ui/agg_types'; export { isType, isStringType } from 'ui/agg_types'; export { OptionedValueProp, OptionedParamEditorProps, OptionedParamType } from 'ui/agg_types'; -export { isValidJson, isValidInterval } from 'ui/agg_types'; +export { isValidInterval } from 'ui/agg_types'; export { AggParamOption } from 'ui/agg_types'; export { CidrMask } from 'ui/agg_types'; diff --git a/src/legacy/ui/public/agg_types/index.ts b/src/legacy/ui/public/agg_types/index.ts index db64bd025b8cb..d066e61df18e9 100644 --- a/src/legacy/ui/public/agg_types/index.ts +++ b/src/legacy/ui/public/agg_types/index.ts @@ -73,7 +73,6 @@ export { isStringType, isType, isValidInterval, - isValidJson, OptionedParamType, parentPipelineType, propFilter, From 5ad8337634bf06ade6ddbdc3025236c09ba32509 Mon Sep 17 00:00:00 2001 From: Zacqary Adam Xeper Date: Tue, 10 Mar 2020 10:45:57 -0500 Subject: [PATCH 15/23] [Metrics Alerts] Add support for search query and groupBy on alerts (#59388) * Add filterQuery to metric alert params * Add groupBy alert support * Fix typings * Fix malformed query * Fix filterQuery merge * Fix groupBy afterkey insertion, add group name to alert action * Convert iife to getter * Fix type check * Fix type check again * Remove unnecessary order param --- .../register_metric_threshold_alert_type.ts | 172 ++++++++++++++---- .../lib/alerting/metric_threshold/types.ts | 1 + .../infra/server/lib/snapshot/snapshot.ts | 9 +- .../server/utils/get_all_composite_data.ts | 14 +- 4 files changed, 150 insertions(+), 46 deletions(-) diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts index 8785957dbd98e..399f09bd3e776 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts @@ -4,8 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ import uuid from 'uuid'; +import { mapValues } from 'lodash'; import { i18n } from '@kbn/i18n'; import { schema } from '@kbn/config-schema'; +import { InfraDatabaseSearchResponse } from '../../adapters/framework/adapter_types'; +import { createAfterKeyHandler } from '../../../utils/create_afterkey_handler'; +import { getAllCompositeData } from '../../../utils/get_all_composite_data'; import { networkTraffic } from '../../../../common/inventory_models/shared/metrics/snapshot/network_traffic'; import { MetricExpressionParams, @@ -15,6 +19,16 @@ import { } from './types'; import { AlertServices, PluginSetupContract } from '../../../../../alerting/server'; +interface Aggregation { + aggregatedIntervals: { buckets: Array<{ aggregatedValue: { value: number } }> }; +} + +interface CompositeAggregationsResponse { + groupings: { + buckets: Aggregation[]; + }; +} + const FIRED_ACTIONS = { id: 'metrics.threshold.fired', name: i18n.translate('xpack.infra.metrics.alerting.threshold.fired', { @@ -22,11 +36,41 @@ const FIRED_ACTIONS = { }), }; -async function getMetric( - { callCluster }: AlertServices, - { metric, aggType, timeUnit, timeSize, indexPattern }: MetricExpressionParams +const getCurrentValueFromAggregations = (aggregations: Aggregation) => { + const { buckets } = aggregations.aggregatedIntervals; + const { value } = buckets[buckets.length - 1].aggregatedValue; + return value; +}; + +const getParsedFilterQuery: ( + filterQuery: string | undefined +) => Record = filterQuery => { + if (!filterQuery) return {}; + try { + return JSON.parse(filterQuery).bool; + } catch (e) { + return { + query_string: { + query: filterQuery, + analyze_wildcard: true, + }, + }; + } +}; + +const getMetric: ( + services: AlertServices, + params: MetricExpressionParams, + groupBy: string | undefined, + filterQuery: string | undefined +) => Promise> = async function( + { callCluster }, + { metric, aggType, timeUnit, timeSize, indexPattern }, + groupBy, + filterQuery ) { const interval = `${timeSize}${timeUnit}`; + const aggregations = aggType === 'rate' ? networkTraffic('aggregatedValue', metric) @@ -38,6 +82,38 @@ async function getMetric( }, }; + const baseAggs = { + aggregatedIntervals: { + date_histogram: { + field: '@timestamp', + fixed_interval: interval, + }, + aggregations, + }, + }; + + const aggs = groupBy + ? { + groupings: { + composite: { + size: 10, + sources: [ + { + groupBy: { + terms: { + field: groupBy, + }, + }, + }, + ], + }, + aggs: baseAggs, + }, + } + : baseAggs; + + const parsedFilterQuery = getParsedFilterQuery(filterQuery); + const searchBody = { query: { bool: { @@ -48,34 +124,49 @@ async function getMetric( gte: `now-${interval}`, }, }, + }, + { exists: { field: metric, }, }, ], + ...parsedFilterQuery, }, }, size: 0, - aggs: { - aggregatedIntervals: { - date_histogram: { - field: '@timestamp', - fixed_interval: interval, - }, - aggregations, - }, - }, + aggs, }; + if (groupBy) { + const bucketSelector = ( + response: InfraDatabaseSearchResponse<{}, CompositeAggregationsResponse> + ) => response.aggregations?.groupings?.buckets || []; + const afterKeyHandler = createAfterKeyHandler( + 'aggs.groupings.composite.after', + response => response.aggregations?.groupings?.after_key + ); + const compositeBuckets = (await getAllCompositeData( + body => callCluster('search', { body, index: indexPattern }), + searchBody, + bucketSelector, + afterKeyHandler + )) as Array; + return compositeBuckets.reduce( + (result, bucket) => ({ + ...result, + [bucket.key.groupBy]: getCurrentValueFromAggregations(bucket), + }), + {} + ); + } + const result = await callCluster('search', { body: searchBody, index: indexPattern, }); - - const { buckets } = result.aggregations.aggregatedIntervals; - const { value } = buckets[buckets.length - 1].aggregatedValue; - return value; -} + return { '*': getCurrentValueFromAggregations(result.aggregations) }; +}; const comparatorMap = { [Comparator.BETWEEN]: (value: number, [a, b]: number[]) => @@ -112,39 +203,54 @@ export async function registerMetricThresholdAlertType(alertingPlugin: PluginSet indexPattern: schema.string(), }) ), + groupBy: schema.maybe(schema.string()), + filterQuery: schema.maybe(schema.string()), }), }, defaultActionGroupId: FIRED_ACTIONS.id, actionGroups: [FIRED_ACTIONS], async executor({ services, params }) { - const { criteria } = params as { criteria: MetricExpressionParams[] }; - const alertInstance = services.alertInstanceFactory(alertUUID); + const { criteria, groupBy, filterQuery } = params as { + criteria: MetricExpressionParams[]; + groupBy: string | undefined; + filterQuery: string | undefined; + }; const alertResults = await Promise.all( - criteria.map(({ threshold, comparator }) => + criteria.map(criterion => (async () => { - const currentValue = await getMetric(services, params as MetricExpressionParams); - if (typeof currentValue === 'undefined') + const currentValues = await getMetric(services, criterion, groupBy, filterQuery); + if (typeof currentValues === 'undefined') throw new Error('Could not get current value of metric'); - + const { threshold, comparator } = criterion; const comparisonFunction = comparatorMap[comparator]; - return { shouldFire: comparisonFunction(currentValue, threshold), currentValue }; + + return mapValues(currentValues, value => ({ + shouldFire: comparisonFunction(value, threshold), + currentValue: value, + })); })() ) ); - const shouldAlertFire = alertResults.every(({ shouldFire }) => shouldFire); + const groups = Object.keys(alertResults[0]); + for (const group of groups) { + const alertInstance = services.alertInstanceFactory(`${alertUUID}-${group}`); + + const shouldAlertFire = alertResults.every(result => result[group].shouldFire); - if (shouldAlertFire) { - alertInstance.scheduleActions(FIRED_ACTIONS.id, { - value: alertResults.map(({ currentValue }) => currentValue), + if (shouldAlertFire) { + alertInstance.scheduleActions(FIRED_ACTIONS.id, { + group, + value: alertResults.map(result => result[group].currentValue), + }); + } + + // Future use: ability to fetch display current alert state + alertInstance.replaceState({ + alertState: shouldAlertFire ? AlertStates.ALERT : AlertStates.OK, }); } - - // Future use: ability to fetch display current alert state - alertInstance.replaceState({ - alertState: shouldAlertFire ? AlertStates.ALERT : AlertStates.OK, - }); }, }); } diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/types.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/types.ts index 9bb0d8963ac66..1c3d0cea3dc84 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/types.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/types.ts @@ -31,4 +31,5 @@ export interface MetricExpressionParams { indexPattern: string; threshold: number[]; comparator: Comparator; + filterQuery: string; } diff --git a/x-pack/plugins/infra/server/lib/snapshot/snapshot.ts b/x-pack/plugins/infra/server/lib/snapshot/snapshot.ts index ef453be76d8d7..8e5f8e6716f3c 100644 --- a/x-pack/plugins/infra/server/lib/snapshot/snapshot.ts +++ b/x-pack/plugins/infra/server/lib/snapshot/snapshot.ts @@ -77,6 +77,11 @@ const handleAfterKey = createAfterKeyHandler( input => input?.aggregations?.nodes?.after_key ); +const callClusterFactory = (framework: KibanaFramework, requestContext: RequestHandlerContext) => ( + opts: any +) => + framework.callWithRequest<{}, InfraSnapshotAggregationResponse>(requestContext, 'search', opts); + const requestGroupedNodes = async ( requestContext: RequestHandlerContext, options: InfraSnapshotRequestOptions, @@ -119,7 +124,7 @@ const requestGroupedNodes = async ( return await getAllCompositeData< InfraSnapshotAggregationResponse, InfraSnapshotNodeGroupByBucket - >(framework, requestContext, query, bucketSelector, handleAfterKey); + >(callClusterFactory(framework, requestContext), query, bucketSelector, handleAfterKey); }; const requestNodeMetrics = async ( @@ -170,7 +175,7 @@ const requestNodeMetrics = async ( return await getAllCompositeData< InfraSnapshotAggregationResponse, InfraSnapshotNodeMetricsBucket - >(framework, requestContext, query, bucketSelector, handleAfterKey); + >(callClusterFactory(framework, requestContext), query, bucketSelector, handleAfterKey); }; // buckets can be InfraSnapshotNodeGroupByBucket[] or InfraSnapshotNodeMetricsBucket[] diff --git a/x-pack/plugins/infra/server/utils/get_all_composite_data.ts b/x-pack/plugins/infra/server/utils/get_all_composite_data.ts index c7ff1b077f685..093dd266ea915 100644 --- a/x-pack/plugins/infra/server/utils/get_all_composite_data.ts +++ b/x-pack/plugins/infra/server/utils/get_all_composite_data.ts @@ -4,8 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { RequestHandlerContext } from 'src/core/server'; -import { KibanaFramework } from '../lib/adapters/framework/kibana_framework_adapter'; import { InfraDatabaseSearchResponse } from '../lib/adapters/framework'; export const getAllCompositeData = async < @@ -13,18 +11,13 @@ export const getAllCompositeData = async < Bucket = {}, Options extends object = {} >( - framework: KibanaFramework, - requestContext: RequestHandlerContext, + callCluster: (options: Options) => Promise>, options: Options, bucketSelector: (response: InfraDatabaseSearchResponse<{}, Aggregation>) => Bucket[], onAfterKey: (options: Options, response: InfraDatabaseSearchResponse<{}, Aggregation>) => Options, previousBuckets: Bucket[] = [] ): Promise => { - const response = await framework.callWithRequest<{}, Aggregation>( - requestContext, - 'search', - options - ); + const response = await callCluster(options); // Nothing available, return the previous buckets. if (response.hits.total.value === 0) { @@ -46,8 +39,7 @@ export const getAllCompositeData = async < // There is possibly more data, concat previous and current buckets and call ourselves recursively. const newOptions = onAfterKey(options, response); return getAllCompositeData( - framework, - requestContext, + callCluster, newOptions, bucketSelector, onAfterKey, From 5dcba2a566c4894aa94e4dd8e94436194172fa31 Mon Sep 17 00:00:00 2001 From: Kaarina Tungseth Date: Tue, 10 Mar 2020 10:51:53 -0500 Subject: [PATCH 16/23] [DOCS] Changed Discover app to Discover (#59769) --- docs/apm/advanced-queries.asciidoc | 14 +++++++------- docs/getting-started/tutorial-discovering.asciidoc | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/apm/advanced-queries.asciidoc b/docs/apm/advanced-queries.asciidoc index 971d543bbb445..ed77ebb4c4930 100644 --- a/docs/apm/advanced-queries.asciidoc +++ b/docs/apm/advanced-queries.asciidoc @@ -21,22 +21,22 @@ TIP: Read the {kibana-ref}/kuery-query.html[Kibana Query Language Enhancements] [float] [[discover-advanced-queries]] -=== Querying in the Discover app +=== Querying in Discover -It may also be helpful to view your APM data in the {kibana-ref}/discover.html[Discover app]. -Querying documents in Discover works the same way as querying in the APM app, -and all of the example APM app queries can also be used in the Discover app. +It may also be helpful to view your APM data in {kibana-ref}/discover.html[*Discover*]. +Querying documents in *Discover* works the same way as querying in the APM app, +and all of the example APM app queries can also be used in *Discover*. [float] -==== Example Discover app query +==== Example Discover query -One example where you may want to make use of the Discover app, +One example where you may want to make use of *Discover*, is for viewing _all_ transactions for an endpoint, instead of just a sample. TIP: Starting in v7.6, you can view 10 samples per bucket in the APM app, instead of just one. Use the APM app to find a transaction name and time bucket that you're interested in learning more about. -Then, switch to the Discover app and make a search: +Then, switch to *Discover* and make a search: ["source","sh"] ----- diff --git a/docs/getting-started/tutorial-discovering.asciidoc b/docs/getting-started/tutorial-discovering.asciidoc index 48e5bed6a4ba7..bbffb2187f0cf 100644 --- a/docs/getting-started/tutorial-discovering.asciidoc +++ b/docs/getting-started/tutorial-discovering.asciidoc @@ -1,7 +1,7 @@ [[tutorial-discovering]] === Discover your data -Using the Discover application, you can enter +Using *Discover*, you can enter an {ref}/query-dsl-query-string-query.html#query-string-syntax[Elasticsearch query] to search your data and filter the results. @@ -12,7 +12,7 @@ You might need to click *New* in the menu bar to refresh the data. . Click the caret to the right of the current index pattern, and select `ba*`. + -By default, all fields are shown for each matching document. +By default, all fields are shown for each matching document. . In the search field, enter the following string: + From 0ed7176e4daaf840fd03851fb7e9f9cd06fc2c97 Mon Sep 17 00:00:00 2001 From: Daniil Suleiman <31325372+sulemanof@users.noreply.github.com> Date: Tue, 10 Mar 2020 18:55:45 +0300 Subject: [PATCH 17/23] [Vis Editor] Refactoring metrics axes (#59135) * Fix TS for vislib * Fix TS * Revert table changes * Update unit test * Refactor code in metrics_axes Co-authored-by: maryia-lapata Co-authored-by: Elastic Machine --- .../category_axis_panel.test.tsx.snap | 55 +-- .../__snapshots__/chart_options.test.tsx.snap | 28 -- .../__snapshots__/index.test.tsx.snap | 329 +++++------------- .../__snapshots__/label_options.test.tsx.snap | 8 +- .../value_axes_panel.test.tsx.snap | 246 ++++--------- .../value_axis_options.test.tsx.snap | 294 +--------------- .../metrics_axes/category_axis_panel.test.tsx | 16 +- .../metrics_axes/category_axis_panel.tsx | 37 +- .../metrics_axes/chart_options.test.tsx | 28 +- .../options/metrics_axes/chart_options.tsx | 14 +- .../custom_extents_options.test.tsx | 22 +- .../metrics_axes/custom_extents_options.tsx | 26 +- .../components/options/metrics_axes/index.tsx | 15 +- .../metrics_axes/label_options.test.tsx | 33 +- .../options/metrics_axes/label_options.tsx | 50 +-- .../metrics_axes/line_options.test.tsx | 14 +- .../components/options/metrics_axes/mocks.ts | 20 +- .../options/metrics_axes/series_panel.tsx | 17 +- .../metrics_axes/value_axes_panel.test.tsx | 30 +- .../options/metrics_axes/value_axes_panel.tsx | 33 +- .../metrics_axes/value_axis_options.test.tsx | 32 +- .../metrics_axes/value_axis_options.tsx | 67 ++-- 22 files changed, 402 insertions(+), 1012 deletions(-) diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap index 037989a86af01..2b7c03084ec65 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap @@ -52,59 +52,16 @@ exports[`CategoryAxisPanel component should init with the default set of props 1 value={true} /> `; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap index 56f35ae021173..e9cd2b737b879 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap @@ -31,22 +31,6 @@ exports[`ChartOptions component should init with the default set of props 1`] = diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap index f589a69eecbc3..0b673a819f666 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap @@ -89,7 +89,6 @@ exports[`ValueAxesPanel component should init with the default set of props 1`] size="m" /> diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.test.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.test.tsx index 69622bb3666a6..91cdcd0f456b1 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.test.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.test.tsx @@ -21,14 +21,12 @@ import React from 'react'; import { shallow } from 'enzyme'; import { CategoryAxisPanel, CategoryAxisPanelProps } from './category_axis_panel'; import { Axis } from '../../../types'; -import { Positions, getPositions } from '../../../utils/collections'; +import { Positions } from '../../../utils/collections'; import { LabelOptions } from './label_options'; -import { categoryAxis } from './mocks'; +import { categoryAxis, vis } from './mocks'; jest.mock('ui/new_platform'); -const positions = getPositions(); - describe('CategoryAxisPanel component', () => { let setCategoryAxis: jest.Mock; let onPositionChanged: jest.Mock; @@ -42,16 +40,10 @@ describe('CategoryAxisPanel component', () => { defaultProps = { axis, - vis: { - type: { - editorConfig: { - collections: { positions }, - }, - }, - }, + vis, onPositionChanged, setCategoryAxis, - } as any; + }; }); it('should init with the default set of props', () => { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx index c1da70f5c17c2..049df0cdd77be 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx @@ -23,21 +23,25 @@ import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { VisOptionsProps } from '../../../../../vis_default_editor/public'; -import { BasicVislibParams, Axis } from '../../../types'; +import { VisOptionsProps } from 'src/legacy/core_plugins/vis_default_editor/public'; +import { Axis } from '../../../types'; import { SelectOption, SwitchOption } from '../../common'; -import { LabelOptions } from './label_options'; +import { LabelOptions, SetAxisLabel } from './label_options'; import { Positions } from '../../../utils/collections'; -export interface CategoryAxisPanelProps extends VisOptionsProps { +export interface CategoryAxisPanelProps { axis: Axis; onPositionChanged: (position: Positions) => void; setCategoryAxis: (value: Axis) => void; + vis: VisOptionsProps['vis']; } -function CategoryAxisPanel(props: CategoryAxisPanelProps) { - const { axis, onPositionChanged, vis, setCategoryAxis } = props; - +function CategoryAxisPanel({ + axis, + onPositionChanged, + vis, + setCategoryAxis, +}: CategoryAxisPanelProps) { const setAxis = useCallback( (paramName: T, value: Axis[T]) => { const updatedAxis = { @@ -57,6 +61,17 @@ function CategoryAxisPanel(props: CategoryAxisPanelProps) { [setAxis, onPositionChanged] ); + const setAxisLabel: SetAxisLabel = useCallback( + (paramName, value) => { + const labels = { + ...axis.labels, + [paramName]: value, + }; + setAxis('labels', labels); + }, + [axis.labels, setAxis] + ); + return ( @@ -89,7 +104,13 @@ function CategoryAxisPanel(props: CategoryAxisPanelProps) { setValue={setAxis} /> - {axis.show && } + {axis.show && ( + + )} ); } diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.test.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.test.tsx index 9679728a2a3d1..c913fd4f35713 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.test.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.test.tsx @@ -22,21 +22,11 @@ import { shallow } from 'enzyme'; import { ChartOptions, ChartOptionsParams } from './chart_options'; import { SeriesParam } from '../../../types'; import { LineOptions } from './line_options'; -import { - ChartTypes, - ChartModes, - getInterpolationModes, - getChartTypes, - getChartModes, -} from '../../../utils/collections'; -import { valueAxis, seriesParam } from './mocks'; +import { ChartTypes, ChartModes } from '../../../utils/collections'; +import { valueAxis, seriesParam, vis } from './mocks'; jest.mock('ui/new_platform'); -const interpolationModes = getInterpolationModes(); -const chartTypes = getChartTypes(); -const chartModes = getChartModes(); - describe('ChartOptions component', () => { let setParamByIndex: jest.Mock; let changeValueAxis: jest.Mock; @@ -51,19 +41,11 @@ describe('ChartOptions component', () => { defaultProps = { index: 0, chart, - vis: { - type: { - editorConfig: { - collections: { interpolationModes, chartTypes, chartModes }, - }, - }, - }, - stateParams: { - valueAxes: [valueAxis], - }, + vis, + valueAxes: [valueAxis], setParamByIndex, changeValueAxis, - } as any; + }; }); it('should init with the default set of props', () => { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx index 399028a1128a9..bc12e04e29468 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx @@ -22,8 +22,8 @@ import React, { useMemo, useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; -import { VisOptionsProps } from '../../../../../vis_default_editor/public'; -import { BasicVislibParams, SeriesParam, ValueAxis } from '../../../types'; +import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { SeriesParam, ValueAxis } from '../../../types'; import { ChartTypes } from '../../../utils/collections'; import { SelectOption } from '../../common'; import { LineOptions } from './line_options'; @@ -31,17 +31,19 @@ import { SetParamByIndex, ChangeValueAxis } from './'; export type SetChart = (paramName: T, value: SeriesParam[T]) => void; -export interface ChartOptionsParams extends VisOptionsProps { +export interface ChartOptionsParams { chart: SeriesParam; index: number; changeValueAxis: ChangeValueAxis; setParamByIndex: SetParamByIndex; + valueAxes: ValueAxis[]; + vis: Vis; } function ChartOptions({ chart, index, - stateParams, + valueAxes, vis, changeValueAxis, setParamByIndex, @@ -62,7 +64,7 @@ function ChartOptions({ const valueAxesOptions = useMemo( () => [ - ...stateParams.valueAxes.map(({ id, name }: ValueAxis) => ({ + ...valueAxes.map(({ id, name }: ValueAxis) => ({ text: name, value: id, })), @@ -73,7 +75,7 @@ function ChartOptions({ value: 'new', }, ], - [stateParams.valueAxes] + [valueAxes] ); return ( diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.test.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.test.tsx index a112b9a3db708..a93ee454a7afd 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.test.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.test.tsx @@ -42,7 +42,7 @@ describe('CustomExtentsOptions component', () => { setMultipleValidity = jest.fn(); defaultProps = { - axis: { ...valueAxis }, + axisScale: { ...valueAxis.scale }, setValueAxis, setValueAxisScale, setMultipleValidity, @@ -57,7 +57,7 @@ describe('CustomExtentsOptions component', () => { describe('boundsMargin', () => { it('should set validity as true when value is positive', () => { - defaultProps.axis.scale.boundsMargin = 5; + defaultProps.axisScale.boundsMargin = 5; mount(); expect(setMultipleValidity).toBeCalledWith(BOUNDS_MARGIN, true); @@ -66,17 +66,17 @@ describe('CustomExtentsOptions component', () => { it('should set validity as true when value is empty', () => { const comp = mount(); comp.setProps({ - axis: { ...valueAxis, scale: { ...valueAxis.scale, boundsMargin: undefined } }, + axisScale: { ...valueAxis.scale, boundsMargin: undefined }, }); expect(setMultipleValidity).toBeCalledWith(BOUNDS_MARGIN, true); }); it('should set validity as false when value is negative', () => { - defaultProps.axis.scale.defaultYExtents = true; + defaultProps.axisScale.defaultYExtents = true; const comp = mount(); comp.setProps({ - axis: { ...valueAxis, scale: { ...valueAxis.scale, boundsMargin: -1 } }, + axisScale: { ...valueAxis.scale, boundsMargin: -1 }, }); expect(setMultipleValidity).toBeCalledWith(BOUNDS_MARGIN, false); @@ -91,7 +91,7 @@ describe('CustomExtentsOptions component', () => { }); it('should hide bounds margin input when defaultYExtents is false', () => { - defaultProps.axis.scale = { ...defaultProps.axis.scale, defaultYExtents: false }; + defaultProps.axisScale = { ...defaultProps.axisScale, defaultYExtents: false }; const comp = shallow(); expect(comp.find({ paramName: BOUNDS_MARGIN }).exists()).toBeFalsy(); @@ -102,7 +102,7 @@ describe('CustomExtentsOptions component', () => { comp.find({ paramName: DEFAULT_Y_EXTENTS }).prop('setValue')(DEFAULT_Y_EXTENTS, true); expect(setMultipleValidity).not.toBeCalled(); - expect(setValueAxis).toBeCalledWith(SCALE, defaultProps.axis.scale); + expect(setValueAxis).toBeCalledWith(SCALE, defaultProps.axisScale); }); it('should reset boundsMargin when value is false', () => { @@ -110,7 +110,7 @@ describe('CustomExtentsOptions component', () => { comp.find({ paramName: DEFAULT_Y_EXTENTS }).prop('setValue')(DEFAULT_Y_EXTENTS, false); const newScale = { - ...defaultProps.axis.scale, + ...defaultProps.axisScale, boundsMargin: undefined, defaultYExtents: false, }; @@ -126,7 +126,7 @@ describe('CustomExtentsOptions component', () => { }); it('should hide YExtents when value is false', () => { - defaultProps.axis.scale = { ...defaultProps.axis.scale, setYExtents: false }; + defaultProps.axisScale = { ...defaultProps.axisScale, setYExtents: false }; const comp = shallow(); expect(comp.find(YExtents).exists()).toBeFalsy(); @@ -136,7 +136,7 @@ describe('CustomExtentsOptions component', () => { const comp = shallow(); comp.find({ paramName: SET_Y_EXTENTS }).prop('setValue')(SET_Y_EXTENTS, true); - expect(setValueAxis).toBeCalledWith(SCALE, defaultProps.axis.scale); + expect(setValueAxis).toBeCalledWith(SCALE, defaultProps.axisScale); }); it('should reset min and max when value is false', () => { @@ -144,7 +144,7 @@ describe('CustomExtentsOptions component', () => { comp.find({ paramName: SET_Y_EXTENTS }).prop('setValue')(SET_Y_EXTENTS, false); const newScale = { - ...defaultProps.axis.scale, + ...defaultProps.axisScale, min: undefined, max: undefined, setYExtents: false, diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.tsx index e322e2863a186..53b2ffa55a941 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.tsx @@ -26,14 +26,14 @@ import { YExtents } from './y_extents'; import { SetScale } from './value_axis_options'; export interface CustomExtentsOptionsProps { - axis: ValueAxis; + axisScale: ValueAxis['scale']; setMultipleValidity(paramName: string, isValid: boolean): void; setValueAxis(paramName: T, value: ValueAxis[T]): void; setValueAxisScale: SetScale; } function CustomExtentsOptions({ - axis, + axisScale, setMultipleValidity, setValueAxis, setValueAxisScale, @@ -44,7 +44,7 @@ function CustomExtentsOptions({ ); const isBoundsMarginValid = - !axis.scale.defaultYExtents || !axis.scale.boundsMargin || axis.scale.boundsMargin >= 0; + !axisScale.defaultYExtents || !axisScale.boundsMargin || axisScale.boundsMargin >= 0; const setBoundsMargin = useCallback( (paramName: 'boundsMargin', value: number | '') => @@ -54,25 +54,25 @@ function CustomExtentsOptions({ const onDefaultYExtentsChange = useCallback( (paramName: 'defaultYExtents', value: boolean) => { - const scale = { ...axis.scale, [paramName]: value }; + const scale = { ...axisScale, [paramName]: value }; if (!scale.defaultYExtents) { delete scale.boundsMargin; } setValueAxis('scale', scale); }, - [setValueAxis, axis.scale] + [axisScale, setValueAxis] ); const onSetYExtentsChange = useCallback( (paramName: 'setYExtents', value: boolean) => { - const scale = { ...axis.scale, [paramName]: value }; + const scale = { ...axisScale, [paramName]: value }; if (!scale.setYExtents) { delete scale.min; delete scale.max; } setValueAxis('scale', scale); }, - [setValueAxis, axis.scale] + [axisScale, setValueAxis] ); useEffect(() => { @@ -91,11 +91,11 @@ function CustomExtentsOptions({ } )} paramName="defaultYExtents" - value={axis.scale.defaultYExtents} + value={axisScale.defaultYExtents} setValue={onDefaultYExtentsChange} /> - {axis.scale.defaultYExtents && ( + {axisScale.defaultYExtents && ( <> @@ -121,13 +121,13 @@ function CustomExtentsOptions({ defaultMessage: 'Set axis extents', })} paramName="setYExtents" - value={axis.scale.setYExtents} + value={axisScale.setYExtents} setValue={onSetYExtentsChange} /> - {axis.scale.setYExtents && ( + {axisScale.setYExtents && ( diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/index.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/index.tsx index 32c21008c2a3a..82b64e4185ed2 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/index.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/index.tsx @@ -304,7 +304,13 @@ function MetricsAxisOptions(props: ValidationVisOptionsProps) return isTabSelected ? ( <> - + ) removeValueAxis={removeValueAxis} onValueAxisPositionChanged={onValueAxisPositionChanged} setParamByIndex={setParamByIndex} - {...props} + setMultipleValidity={props.setMultipleValidity} + seriesParams={stateParams.seriesParams} + valueAxes={stateParams.valueAxes} + vis={vis} /> ) : null; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.test.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.test.tsx index 91d9987c77f3b..48fcbdf8f9082 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.test.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.test.tsx @@ -21,32 +21,26 @@ import React from 'react'; import { shallow } from 'enzyme'; import { LabelOptions, LabelOptionsProps } from './label_options'; import { TruncateLabelsOption } from '../../common'; -import { valueAxis, categoryAxis } from './mocks'; +import { valueAxis } from './mocks'; jest.mock('ui/new_platform'); const FILTER = 'filter'; const ROTATE = 'rotate'; const DISABLED = 'disabled'; -const CATEGORY_AXES = 'categoryAxes'; describe('LabelOptions component', () => { - let setValue: jest.Mock; + let setAxisLabel: jest.Mock; let defaultProps: LabelOptionsProps; beforeEach(() => { - setValue = jest.fn(); + setAxisLabel = jest.fn(); defaultProps = { - axis: { ...valueAxis }, - axesName: CATEGORY_AXES, - index: 0, - stateParams: { - categoryAxes: [{ ...categoryAxis }], - valueAxes: [{ ...valueAxis }], - } as any, - setValue, - } as any; + axisLabels: { ...valueAxis.labels }, + axisFilterCheckboxName: '', + setAxisLabel, + }; }); it('should init with the default set of props', () => { @@ -64,7 +58,7 @@ describe('LabelOptions component', () => { }); it('should disable other fields when axis.labels.show is false', () => { - defaultProps.axis.labels.show = false; + defaultProps.axisLabels.show = false; const comp = shallow(); expect(comp.find({ paramName: FILTER }).prop(DISABLED)).toBeTruthy(); @@ -76,25 +70,20 @@ describe('LabelOptions component', () => { const comp = shallow(); comp.find({ paramName: ROTATE }).prop('setValue')(ROTATE, '5'); - const newAxes = [{ ...categoryAxis, labels: { ...categoryAxis.labels, rotate: 5 } }]; - expect(setValue).toBeCalledWith(CATEGORY_AXES, newAxes); + expect(setAxisLabel).toBeCalledWith('rotate', 5); }); it('should set filter value', () => { const comp = shallow(); - expect(defaultProps.stateParams.categoryAxes[0].labels.filter).toBeTruthy(); comp.find({ paramName: FILTER }).prop('setValue')(FILTER, false); - const newAxes = [{ ...categoryAxis, labels: { ...categoryAxis.labels, filter: false } }]; - expect(setValue).toBeCalledWith(CATEGORY_AXES, newAxes); + expect(setAxisLabel).toBeCalledWith(FILTER, false); }); it('should set value for valueAxes', () => { - defaultProps.axesName = 'valueAxes'; const comp = shallow(); comp.find(TruncateLabelsOption).prop('setValue')('truncate', 10); - const newAxes = [{ ...valueAxis, labels: { ...valueAxis.labels, truncate: 10 } }]; - expect(setValue).toBeCalledWith('valueAxes', newAxes); + expect(setAxisLabel).toBeCalledWith('truncate', 10); }); }); diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.tsx index 2dc5889090dca..b6b54193e9f4a 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.tsx @@ -23,33 +23,21 @@ import { EuiTitle, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { VisOptionsProps } from '../../../../../vis_default_editor/public'; -import { BasicVislibParams, Axis } from '../../../types'; +import { Axis } from '../../../types'; import { SelectOption, SwitchOption, TruncateLabelsOption } from '../../common'; import { getRotateOptions } from '../../../utils/collections'; -export interface LabelOptionsProps extends VisOptionsProps { - axis: Axis; - axesName: 'categoryAxes' | 'valueAxes'; - index: number; +export type SetAxisLabel = ( + paramName: T, + value: Axis['labels'][T] +) => void; +export interface LabelOptionsProps { + axisLabels: Axis['labels']; + axisFilterCheckboxName: string; + setAxisLabel: SetAxisLabel; } -function LabelOptions({ stateParams, setValue, axis, axesName, index }: LabelOptionsProps) { - const setAxisLabel = useCallback( - (paramName: T, value: Axis['labels'][T]) => { - const axes = [...stateParams[axesName]]; - axes[index] = { - ...axes[index], - labels: { - ...axes[index].labels, - [paramName]: value, - }, - }; - setValue(axesName, axes); - }, - [axesName, index, setValue, stateParams] - ); - +function LabelOptions({ axisLabels, axisFilterCheckboxName, setAxisLabel }: LabelOptionsProps) { const setAxisLabelRotate = useCallback( (paramName: 'rotate', value: Axis['labels']['rotate']) => { setAxisLabel(paramName, Number(value)); @@ -77,20 +65,18 @@ function LabelOptions({ stateParams, setValue, axis, axesName, index }: LabelOpt defaultMessage: 'Show labels', })} paramName="show" - value={axis.labels.show} + value={axisLabels.show} setValue={setAxisLabel} /> @@ -99,20 +85,20 @@ function LabelOptions({ stateParams, setValue, axis, axesName, index }: LabelOpt diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.test.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.test.tsx index 98ef8a094a260..1d29d39bfcb7f 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.test.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.test.tsx @@ -21,14 +21,12 @@ import React from 'react'; import { shallow } from 'enzyme'; import { LineOptions, LineOptionsParams } from './line_options'; import { NumberInputOption } from '../../common'; -import { getInterpolationModes } from '../../../utils/collections'; -import { seriesParam } from './mocks'; +import { seriesParam, vis } from './mocks'; jest.mock('ui/new_platform'); const LINE_WIDTH = 'lineWidth'; const DRAW_LINES = 'drawLinesBetweenPoints'; -const interpolationModes = getInterpolationModes(); describe('LineOptions component', () => { let setChart: jest.Mock; @@ -39,15 +37,9 @@ describe('LineOptions component', () => { defaultProps = { chart: { ...seriesParam }, - vis: { - type: { - editorConfig: { - collections: { interpolationModes }, - }, - }, - }, + vis, setChart, - } as any; + }; }); it('should init with the default set of props', () => { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts index 7955bf79c24eb..58c75629f1fa1 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts @@ -17,6 +17,7 @@ * under the License. */ +import { Vis } from 'src/legacy/core_plugins/visualizations/public'; import { Axis, ValueAxis, SeriesParam, Style } from '../../../types'; import { ChartTypes, @@ -25,6 +26,10 @@ import { ScaleTypes, Positions, AxisTypes, + getScaleTypes, + getAxisModes, + getPositions, + getInterpolationModes, } from '../../../utils/collections'; const defaultValueAxisId = 'ValueAxis-1'; @@ -84,4 +89,17 @@ const seriesParam: SeriesParam = { valueAxis: defaultValueAxisId, }; -export { defaultValueAxisId, categoryAxis, valueAxis, seriesParam }; +const positions = getPositions(); +const axisModes = getAxisModes(); +const scaleTypes = getScaleTypes(); +const interpolationModes = getInterpolationModes(); + +const vis = ({ + type: { + editorConfig: { + collections: { scaleTypes, axisModes, positions, interpolationModes }, + }, + }, +} as any) as Vis; + +export { defaultValueAxisId, categoryAxis, valueAxis, seriesParam, vis }; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx index db28256816f8d..44e7a4cfb0088 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx @@ -23,19 +23,20 @@ import { EuiPanel, EuiTitle, EuiSpacer, EuiAccordion } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { VisOptionsProps } from '../../../../../vis_default_editor/public'; -import { BasicVislibParams } from '../../../types'; +import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { ValueAxis, SeriesParam } from '../../../types'; import { ChartOptions } from './chart_options'; import { SetParamByIndex, ChangeValueAxis } from './'; -export interface SeriesPanelProps extends VisOptionsProps { +export interface SeriesPanelProps { changeValueAxis: ChangeValueAxis; setParamByIndex: SetParamByIndex; + seriesParams: SeriesParam[]; + valueAxes: ValueAxis[]; + vis: Vis; } -function SeriesPanel(props: SeriesPanelProps) { - const { stateParams } = props; - +function SeriesPanel({ seriesParams, ...chartProps }: SeriesPanelProps) { return ( @@ -48,7 +49,7 @@ function SeriesPanel(props: SeriesPanelProps) { - {stateParams.seriesParams.map((chart, index) => ( + {seriesParams.map((chart, index) => ( - + ))} diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx index 7524c7a13435b..141273fa6bc3f 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx @@ -21,16 +21,12 @@ import React from 'react'; import { shallow } from 'enzyme'; import { ValueAxesPanel, ValueAxesPanelProps } from './value_axes_panel'; import { ValueAxis, SeriesParam } from '../../../types'; -import { Positions, getScaleTypes, getAxisModes, getPositions } from '../../../utils/collections'; +import { Positions } from '../../../utils/collections'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; -import { valueAxis, seriesParam } from './mocks'; +import { valueAxis, seriesParam, vis } from './mocks'; jest.mock('ui/new_platform'); -const positions = getPositions(); -const axisModes = getAxisModes(); -const scaleTypes = getScaleTypes(); - describe('ValueAxesPanel component', () => { let setParamByIndex: jest.Mock; let onValueAxisPositionChanged: jest.Mock; @@ -66,24 +62,16 @@ describe('ValueAxesPanel component', () => { }; defaultProps = { - stateParams: { - seriesParams: [seriesParamCount, seriesParamAverage], - valueAxes: [axisLeft, axisRight], - }, - vis: { - type: { - editorConfig: { - collections: { scaleTypes, axisModes, positions }, - }, - }, - }, + seriesParams: [seriesParamCount, seriesParamAverage], + valueAxes: [axisLeft, axisRight], + vis, isCategoryAxisHorizontal: false, setParamByIndex, onValueAxisPositionChanged, addValueAxis, removeValueAxis, setMultipleValidity, - } as any; + }; }); it('should init with the default set of props', () => { @@ -93,7 +81,7 @@ describe('ValueAxesPanel component', () => { }); it('should not allow to remove the last value axis', () => { - defaultProps.stateParams.valueAxes = [axisLeft]; + defaultProps.valueAxes = [axisLeft]; const comp = mountWithIntl(); expect(comp.find('[data-test-subj="removeValueAxisBtn"] button').exists()).toBeFalsy(); }); @@ -133,7 +121,7 @@ describe('ValueAxesPanel component', () => { }); it('should show when multiple series match value axis', () => { - defaultProps.stateParams.seriesParams[1].valueAxis = 'ValueAxis-1'; + defaultProps.seriesParams[1].valueAxis = 'ValueAxis-1'; const comp = mountWithIntl(); expect( comp @@ -144,7 +132,7 @@ describe('ValueAxesPanel component', () => { }); it('should not show when no series match value axis', () => { - defaultProps.stateParams.seriesParams[0].valueAxis = 'ValueAxis-2'; + defaultProps.seriesParams[0].valueAxis = 'ValueAxis-2'; const comp = mountWithIntl(); expect( comp diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx index 4aa2aee083a67..30d80ed595fe7 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx @@ -31,31 +31,35 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { BasicVislibParams, ValueAxis } from '../../../types'; +import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { SeriesParam, ValueAxis } from '../../../types'; import { ValueAxisOptions } from './value_axis_options'; import { SetParamByIndex } from './'; -import { ValidationVisOptionsProps } from '../../common'; -export interface ValueAxesPanelProps extends ValidationVisOptionsProps { +export interface ValueAxesPanelProps { isCategoryAxisHorizontal: boolean; addValueAxis: () => ValueAxis; removeValueAxis: (axis: ValueAxis) => void; onValueAxisPositionChanged: (index: number, value: ValueAxis['position']) => void; setParamByIndex: SetParamByIndex; + seriesParams: SeriesParam[]; + valueAxes: ValueAxis[]; + vis: Vis; + setMultipleValidity: (paramName: string, isValid: boolean) => void; } function ValueAxesPanel(props: ValueAxesPanelProps) { - const { stateParams, addValueAxis, removeValueAxis } = props; + const { addValueAxis, removeValueAxis, seriesParams, valueAxes } = props; const getSeries = useCallback( (axis: ValueAxis) => { - const isFirst = stateParams.valueAxes[0].id === axis.id; - const series = stateParams.seriesParams.filter( + const isFirst = valueAxes[0].id === axis.id; + const series = seriesParams.filter( serie => serie.valueAxis === axis.id || (isFirst && !serie.valueAxis) ); return series.map(serie => serie.data.label).join(', '); }, - [stateParams.valueAxes, stateParams.seriesParams] + [seriesParams, valueAxes] ); const removeButtonTooltip = useMemo( @@ -131,7 +135,7 @@ function ValueAxesPanel(props: ValueAxesPanelProps) { - {stateParams.valueAxes.map((axis, index) => ( + {valueAxes.map((axis, index) => ( <> - + ))} diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.test.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.test.tsx index bd512e9365783..955867e66d09f 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.test.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.test.tsx @@ -20,24 +20,15 @@ import React from 'react'; import { shallow } from 'enzyme'; import { ValueAxisOptions, ValueAxisOptionsParams } from './value_axis_options'; -import { Axis } from '../../../types'; +import { ValueAxis } from '../../../types'; import { TextInputOption } from '../../common'; import { LabelOptions } from './label_options'; -import { - ScaleTypes, - Positions, - getScaleTypes, - getAxisModes, - getPositions, -} from '../../../utils/collections'; -import { valueAxis, categoryAxis } from './mocks'; +import { ScaleTypes, Positions } from '../../../utils/collections'; +import { valueAxis, vis } from './mocks'; jest.mock('ui/new_platform'); const POSITION = 'position'; -const positions = getPositions(); -const axisModes = getAxisModes(); -const scaleTypes = getScaleTypes(); interface PositionOption { text: string; @@ -50,7 +41,7 @@ describe('ValueAxisOptions component', () => { let onValueAxisPositionChanged: jest.Mock; let setMultipleValidity: jest.Mock; let defaultProps: ValueAxisOptionsParams; - let axis: Axis; + let axis: ValueAxis; beforeEach(() => { setParamByIndex = jest.fn(); @@ -61,22 +52,13 @@ describe('ValueAxisOptions component', () => { defaultProps = { axis, index: 0, - stateParams: { - categoryAxes: [{ ...categoryAxis }], - valueAxes: [axis], - }, - vis: { - type: { - editorConfig: { - collections: { scaleTypes, axisModes, positions }, - }, - }, - }, + valueAxis, + vis, isCategoryAxisHorizontal: false, setParamByIndex, onValueAxisPositionChanged, setMultipleValidity, - } as any; + }; }); it('should init with the default set of props', () => { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx index d094a1d422385..0e78bf2f31ef6 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx @@ -21,15 +21,11 @@ import React, { useCallback, useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiSpacer, EuiAccordion, EuiHorizontalRule } from '@elastic/eui'; -import { BasicVislibParams, ValueAxis } from '../../../types'; +import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { ValueAxis } from '../../../types'; import { Positions } from '../../../utils/collections'; -import { - SelectOption, - SwitchOption, - TextInputOption, - ValidationVisOptionsProps, -} from '../../common'; -import { LabelOptions } from './label_options'; +import { SelectOption, SwitchOption, TextInputOption } from '../../common'; +import { LabelOptions, SetAxisLabel } from './label_options'; import { CustomExtentsOptions } from './custom_extents_options'; import { isAxisHorizontal } from './utils'; import { SetParamByIndex } from './'; @@ -39,25 +35,27 @@ export type SetScale = ( value: ValueAxis['scale'][T] ) => void; -export interface ValueAxisOptionsParams extends ValidationVisOptionsProps { +export interface ValueAxisOptionsParams { axis: ValueAxis; index: number; isCategoryAxisHorizontal: boolean; onValueAxisPositionChanged: (index: number, value: ValueAxis['position']) => void; setParamByIndex: SetParamByIndex; + valueAxis: ValueAxis; + vis: Vis; + setMultipleValidity: (paramName: string, isValid: boolean) => void; } -function ValueAxisOptions(props: ValueAxisOptionsParams) { - const { - axis, - index, - isCategoryAxisHorizontal, - stateParams, - vis, - onValueAxisPositionChanged, - setParamByIndex, - } = props; - +function ValueAxisOptions({ + axis, + index, + isCategoryAxisHorizontal, + valueAxis, + vis, + onValueAxisPositionChanged, + setParamByIndex, + setMultipleValidity, +}: ValueAxisOptionsParams) { const setValueAxis = useCallback( (paramName: T, value: ValueAxis[T]) => setParamByIndex('valueAxes', index, paramName, value), @@ -67,25 +65,37 @@ function ValueAxisOptions(props: ValueAxisOptionsParams) { const setValueAxisTitle = useCallback( (paramName: T, value: ValueAxis['title'][T]) => { const title = { - ...stateParams.valueAxes[index].title, + ...valueAxis.title, [paramName]: value, }; setParamByIndex('valueAxes', index, 'title', title); }, - [setParamByIndex, index, stateParams.valueAxes] + [valueAxis.title, setParamByIndex, index] ); const setValueAxisScale: SetScale = useCallback( (paramName, value) => { const scale = { - ...stateParams.valueAxes[index].scale, + ...valueAxis.scale, [paramName]: value, }; setParamByIndex('valueAxes', index, 'scale', scale); }, - [setParamByIndex, index, stateParams.valueAxes] + [valueAxis.scale, setParamByIndex, index] + ); + + const setAxisLabel: SetAxisLabel = useCallback( + (paramName, value) => { + const labels = { + ...valueAxis.labels, + [paramName]: value, + }; + + setParamByIndex('valueAxes', index, 'labels', labels); + }, + [valueAxis.labels, setParamByIndex, index] ); const onPositionChanged = useCallback( @@ -175,7 +185,11 @@ function ValueAxisOptions(props: ValueAxisOptionsParams) { setValue={setValueAxisTitle} /> - + ) : ( @@ -204,9 +218,10 @@ function ValueAxisOptions(props: ValueAxisOptionsParams) { <> From 435cb0b959f6d750717d976558eea1c7d1d04ac5 Mon Sep 17 00:00:00 2001 From: marshallmain <55718608+marshallmain@users.noreply.github.com> Date: Tue, 10 Mar 2020 12:31:57 -0400 Subject: [PATCH 18/23] [Endpoint] Sample data generator for endpoint app (#58936) * scaffolding and notes.md * add skeleton event generator to kibana * add optional entityID param to generateEvent * add tree generation * add tests * working tests * fix up tests * fix linting * fix event types * make process parent types consistent * make generator match types * move test resolver node out of common types * fix random string generation * fix typecheck errors * remove extraneous stuff * address PR comments * add test for full resolver tree * cleanup * make tests clearer * add seedrandom to endpoint plugin. contains DONOTMERGE example code * remove robs test * start replacing random with seedrandom * use seeded random for uuidv4 * separate out IP randomization * typecheck fixes Co-authored-by: oatkiller Co-authored-by: Elastic Machine --- .../endpoint/common/generate_data.test.ts | 168 +++++++ .../plugins/endpoint/common/generate_data.ts | 431 ++++++++++++++++++ x-pack/plugins/endpoint/common/types.ts | 75 +-- x-pack/plugins/endpoint/package.json | 4 +- .../store/alerts/mock_alert_result_list.ts | 158 +------ .../endpoint/store/managing/index.test.ts | 30 +- .../store/managing/middleware.test.ts | 33 +- .../store/managing/mock_host_result_list.ts | 30 +- .../metadata/source_process_accordion.tsx | 4 +- .../server/routes/resolver/utils/normalize.ts | 4 +- yarn.lock | 5 + 11 files changed, 668 insertions(+), 274 deletions(-) create mode 100644 x-pack/plugins/endpoint/common/generate_data.test.ts create mode 100644 x-pack/plugins/endpoint/common/generate_data.ts diff --git a/x-pack/plugins/endpoint/common/generate_data.test.ts b/x-pack/plugins/endpoint/common/generate_data.test.ts new file mode 100644 index 0000000000000..ebe3c25eef829 --- /dev/null +++ b/x-pack/plugins/endpoint/common/generate_data.test.ts @@ -0,0 +1,168 @@ +/* + * 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 { EndpointDocGenerator, Event } from './generate_data'; + +interface Node { + events: Event[]; + children: Node[]; + parent_entity_id?: string; +} + +describe('data generator', () => { + let generator: EndpointDocGenerator; + beforeEach(() => { + generator = new EndpointDocGenerator('seed'); + }); + + it('creates the same documents with same random seed', () => { + const generator1 = new EndpointDocGenerator('seed'); + const generator2 = new EndpointDocGenerator('seed'); + const timestamp = new Date().getTime(); + const metadata1 = generator1.generateEndpointMetadata(timestamp); + const metadata2 = generator2.generateEndpointMetadata(timestamp); + expect(metadata1).toEqual(metadata2); + }); + + it('creates different documents with different random seeds', () => { + const generator1 = new EndpointDocGenerator('seed'); + const generator2 = new EndpointDocGenerator('different seed'); + const timestamp = new Date().getTime(); + const metadata1 = generator1.generateEndpointMetadata(timestamp); + const metadata2 = generator2.generateEndpointMetadata(timestamp); + expect(metadata1).not.toEqual(metadata2); + }); + + it('creates endpoint metadata documents', () => { + const timestamp = new Date().getTime(); + const metadata = generator.generateEndpointMetadata(timestamp); + expect(metadata['@timestamp']).toEqual(timestamp); + expect(metadata.event.created).toEqual(timestamp); + expect(metadata.endpoint).not.toBeNull(); + expect(metadata.agent).not.toBeNull(); + expect(metadata.host).not.toBeNull(); + }); + + it('creates alert event documents', () => { + const timestamp = new Date().getTime(); + const alert = generator.generateAlert(timestamp); + expect(alert['@timestamp']).toEqual(timestamp); + expect(alert.event.action).not.toBeNull(); + expect(alert.endpoint).not.toBeNull(); + expect(alert.agent).not.toBeNull(); + expect(alert.host).not.toBeNull(); + expect(alert.process.entity_id).not.toBeNull(); + }); + + it('creates process event documents', () => { + const timestamp = new Date().getTime(); + const processEvent = generator.generateEvent({ timestamp }); + expect(processEvent['@timestamp']).toEqual(timestamp); + expect(processEvent.event.category).toEqual('process'); + expect(processEvent.event.kind).toEqual('event'); + expect(processEvent.event.type).toEqual('creation'); + expect(processEvent.agent).not.toBeNull(); + expect(processEvent.host).not.toBeNull(); + expect(processEvent.process.entity_id).not.toBeNull(); + }); + + it('creates other event documents', () => { + const timestamp = new Date().getTime(); + const processEvent = generator.generateEvent({ timestamp, eventCategory: 'dns' }); + expect(processEvent['@timestamp']).toEqual(timestamp); + expect(processEvent.event.category).toEqual('dns'); + expect(processEvent.event.kind).toEqual('event'); + expect(processEvent.event.type).toEqual('creation'); + expect(processEvent.agent).not.toBeNull(); + expect(processEvent.host).not.toBeNull(); + expect(processEvent.process.entity_id).not.toBeNull(); + }); + + describe('creates alert ancestor tree', () => { + let events: Event[]; + + beforeEach(() => { + events = generator.generateAlertEventAncestry(3); + }); + + it('with n-1 process events', () => { + for (let i = 1; i < events.length - 1; i++) { + expect(events[i].process.parent?.entity_id).toEqual(events[i - 1].process.entity_id); + expect(events[i].event.kind).toEqual('event'); + expect(events[i].event.category).toEqual('process'); + } + }); + + it('with a corresponding alert at the end', () => { + // The alert should be last and have the same entity_id as the previous process event + expect(events[events.length - 1].process.entity_id).toEqual( + events[events.length - 2].process.entity_id + ); + expect(events[events.length - 1].process.parent?.entity_id).toEqual( + events[events.length - 2].process.parent?.entity_id + ); + expect(events[events.length - 1].event.kind).toEqual('alert'); + expect(events[events.length - 1].event.category).toEqual('malware'); + }); + }); + + function buildResolverTree(events: Event[]): Node { + // First pass we gather up all the events by entity_id + const tree: Record = {}; + events.forEach(event => { + if (event.process.entity_id in tree) { + tree[event.process.entity_id].events.push(event); + } else { + tree[event.process.entity_id] = { + events: [event], + children: [], + parent_entity_id: event.process.parent?.entity_id, + }; + } + }); + // Second pass add child references to each node + for (const value of Object.values(tree)) { + if (value.parent_entity_id) { + tree[value.parent_entity_id].children.push(value); + } + } + // The root node must be first in the array or this fails + return tree[events[0].process.entity_id]; + } + + function countResolverEvents(rootNode: Node, generations: number): number { + // Start at the root, traverse N levels of the tree and check that we found all nodes + let nodes = [rootNode]; + let visitedEvents = 0; + for (let i = 0; i < generations + 1; i++) { + let nextNodes: Node[] = []; + nodes.forEach(node => { + nextNodes = nextNodes.concat(node.children); + visitedEvents += node.events.length; + }); + nodes = nextNodes; + } + return visitedEvents; + } + + it('creates tree of process children', () => { + const timestamp = new Date().getTime(); + const root = generator.generateEvent({ timestamp }); + const generations = 2; + const events = generator.generateDescendantsTree(root, generations); + const rootNode = buildResolverTree(events); + const visitedEvents = countResolverEvents(rootNode, generations); + expect(visitedEvents).toEqual(events.length); + }); + + it('creates full resolver tree', () => { + const alertAncestors = 3; + const generations = 2; + const events = generator.generateFullResolverTree(alertAncestors, generations); + const rootNode = buildResolverTree(events); + const visitedEvents = countResolverEvents(rootNode, alertAncestors + generations); + expect(visitedEvents).toEqual(events.length); + }); +}); diff --git a/x-pack/plugins/endpoint/common/generate_data.ts b/x-pack/plugins/endpoint/common/generate_data.ts new file mode 100644 index 0000000000000..a91cf0ffca783 --- /dev/null +++ b/x-pack/plugins/endpoint/common/generate_data.ts @@ -0,0 +1,431 @@ +/* + * 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 uuid from 'uuid'; +import seedrandom from 'seedrandom'; +import { AlertEvent, EndpointEvent, EndpointMetadata, OSFields } from './types'; + +export type Event = AlertEvent | EndpointEvent; + +interface EventOptions { + timestamp?: number; + entityID?: string; + parentEntityID?: string; + eventType?: string; + eventCategory?: string; +} + +const Windows: OSFields[] = [ + { + name: 'windows 10.0', + full: 'Windows 10', + version: '10.0', + variant: 'Windows Pro', + }, + { + name: 'windows 10.0', + full: 'Windows Server 2016', + version: '10.0', + variant: 'Windows Server', + }, + { + name: 'windows 6.2', + full: 'Windows Server 2012', + version: '6.2', + variant: 'Windows Server', + }, + { + name: 'windows 6.3', + full: 'Windows Server 2012R2', + version: '6.3', + variant: 'Windows Server Release 2', + }, +]; + +const Linux: OSFields[] = []; + +const Mac: OSFields[] = []; + +const OS: OSFields[] = [...Windows, ...Mac, ...Linux]; + +const POLICIES: Array<{ name: string; id: string }> = [ + { + name: 'Default', + id: '00000000-0000-0000-0000-000000000000', + }, + { + name: 'With Eventing', + id: 'C2A9093E-E289-4C0A-AA44-8C32A414FA7A', + }, +]; + +const FILE_OPERATIONS: string[] = ['creation', 'open', 'rename', 'execution', 'deletion']; + +// These are from the v1 schemas and aren't all valid ECS event categories, still in flux +const OTHER_EVENT_CATEGORIES: string[] = ['driver', 'file', 'library', 'network', 'registry']; + +export class EndpointDocGenerator { + agentId: string; + hostId: string; + hostname: string; + macAddress: string[]; + ip: string[]; + agentVersion: string; + os: OSFields; + policy: { name: string; id: string }; + random: seedrandom.prng; + + constructor(seed = Math.random().toString()) { + this.random = seedrandom(seed); + this.hostId = this.seededUUIDv4(); + this.agentId = this.seededUUIDv4(); + this.hostname = this.randomHostname(); + this.ip = this.randomArray(3, () => this.randomIP()); + this.macAddress = this.randomArray(3, () => this.randomMac()); + this.agentVersion = this.randomVersion(); + this.os = this.randomChoice(OS); + this.policy = this.randomChoice(POLICIES); + } + + public randomizeIPs() { + this.ip = this.randomArray(3, () => this.randomIP()); + } + + public generateEndpointMetadata(ts = new Date().getTime()): EndpointMetadata { + return { + '@timestamp': ts, + event: { + created: ts, + }, + endpoint: { + policy: { + id: this.policy.id, + }, + }, + agent: { + version: this.agentVersion, + id: this.agentId, + }, + host: { + id: this.hostId, + hostname: this.hostname, + ip: this.ip, + mac: this.macAddress, + os: this.os, + }, + }; + } + + public generateAlert( + ts = new Date().getTime(), + entityID = this.randomString(10), + parentEntityID?: string + ): AlertEvent { + return { + '@timestamp': ts, + agent: { + id: this.agentId, + version: this.agentVersion, + }, + event: { + action: this.randomChoice(FILE_OPERATIONS), + kind: 'alert', + category: 'malware', + id: this.seededUUIDv4(), + dataset: 'endpoint', + module: 'endpoint', + type: 'creation', + }, + endpoint: { + policy: { + id: this.policy.id, + }, + }, + file: { + owner: 'SYSTEM', + name: 'fake_malware.exe', + path: 'C:/fake_malware.exe', + accessed: ts, + mtime: ts, + created: ts, + size: 3456, + hash: { + md5: 'fake file md5', + sha1: 'fake file sha1', + sha256: 'fake file sha256', + }, + code_signature: { + trusted: false, + subject_name: 'bad signer', + }, + malware_classifier: { + identifier: 'endpointpe', + score: 1, + threshold: 0.66, + version: '3.0.33', + }, + temp_file_path: 'C:/temp/fake_malware.exe', + }, + host: { + id: this.hostId, + hostname: this.hostname, + ip: this.ip, + mac: this.macAddress, + os: this.os, + }, + process: { + pid: 2, + name: 'malware writer', + start: ts, + uptime: 0, + user: 'SYSTEM', + entity_id: entityID, + executable: 'C:/malware.exe', + parent: parentEntityID ? { entity_id: parentEntityID, pid: 1 } : undefined, + token: { + domain: 'NT AUTHORITY', + integrity_level: 16384, + integrity_level_name: 'system', + privileges: [ + { + description: 'Replace a process level token', + enabled: false, + name: 'SeAssignPrimaryTokenPrivilege', + }, + ], + sid: 'S-1-5-18', + type: 'tokenPrimary', + user: 'SYSTEM', + }, + code_signature: { + trusted: false, + subject_name: 'bad signer', + }, + hash: { + md5: 'fake md5', + sha1: 'fake sha1', + sha256: 'fake sha256', + }, + }, + dll: [ + { + pe: { + architecture: 'x64', + imphash: 'c30d230b81c734e82e86e2e2fe01cd01', + }, + code_signature: { + subject_name: 'Cybereason Inc', + trusted: true, + }, + compile_time: 1534424710, + hash: { + md5: '1f2d082566b0fc5f2c238a5180db7451', + sha1: 'ca85243c0af6a6471bdaa560685c51eefd6dbc0d', + sha256: '8ad40c90a611d36eb8f9eb24fa04f7dbca713db383ff55a03aa0f382e92061a2', + }, + malware_classifier: { + identifier: 'Whitelisted', + score: 0, + threshold: 0, + version: '3.0.0', + }, + mapped_address: 5362483200, + mapped_size: 0, + path: 'C:\\Program Files\\Cybereason ActiveProbe\\AmSvc.exe', + }, + ], + }; + } + + public generateEvent(options: EventOptions = {}): EndpointEvent { + return { + '@timestamp': options.timestamp ? options.timestamp : new Date().getTime(), + agent: { + id: this.agentId, + version: this.agentVersion, + type: 'endpoint', + }, + ecs: { + version: '1.4.0', + }, + event: { + category: options.eventCategory ? options.eventCategory : 'process', + kind: 'event', + type: options.eventType ? options.eventType : 'creation', + id: this.seededUUIDv4(), + }, + host: { + id: this.hostId, + hostname: this.hostname, + ip: this.ip, + mac: this.macAddress, + os: this.os, + }, + process: { + entity_id: options.entityID ? options.entityID : this.randomString(10), + parent: options.parentEntityID ? { entity_id: options.parentEntityID } : undefined, + }, + }; + } + + public generateFullResolverTree( + alertAncestors?: number, + childGenerations?: number, + maxChildrenPerNode?: number, + relatedEventsPerNode?: number, + percentNodesWithRelated?: number, + percentChildrenTerminated?: number + ): Event[] { + const ancestry = this.generateAlertEventAncestry(alertAncestors); + // ancestry will always have at least 2 elements, and the second to last element will be the process associated with the alert + const descendants = this.generateDescendantsTree( + ancestry[ancestry.length - 2], + childGenerations, + maxChildrenPerNode, + relatedEventsPerNode, + percentNodesWithRelated, + percentChildrenTerminated + ); + return ancestry.concat(descendants); + } + + public generateAlertEventAncestry(alertAncestors = 3): Event[] { + const events = []; + const startDate = new Date().getTime(); + const root = this.generateEvent({ timestamp: startDate + 1000 }); + events.push(root); + let ancestor = root; + for (let i = 0; i < alertAncestors; i++) { + ancestor = this.generateEvent({ + timestamp: startDate + 1000 * (i + 1), + parentEntityID: ancestor.process.entity_id, + }); + events.push(ancestor); + } + events.push( + this.generateAlert( + startDate + 1000 * alertAncestors, + ancestor.process.entity_id, + ancestor.process.parent?.entity_id + ) + ); + return events; + } + + public generateDescendantsTree( + root: Event, + generations = 2, + maxChildrenPerNode = 2, + relatedEventsPerNode = 3, + percentNodesWithRelated = 100, + percentChildrenTerminated = 100 + ): Event[] { + let events: Event[] = [root]; + let parents = [root]; + let timestamp = root['@timestamp']; + for (let i = 0; i < generations; i++) { + const newParents: EndpointEvent[] = []; + parents.forEach(element => { + // const numChildren = randomN(maxChildrenPerNode); + const numChildren = maxChildrenPerNode; + for (let j = 0; j < numChildren; j++) { + timestamp = timestamp + 1000; + const child = this.generateEvent({ + timestamp, + parentEntityID: element.process.entity_id, + }); + newParents.push(child); + } + }); + events = events.concat(newParents); + parents = newParents; + } + const terminationEvents: EndpointEvent[] = []; + let relatedEvents: EndpointEvent[] = []; + events.forEach(element => { + if (this.randomN(100) < percentChildrenTerminated) { + timestamp = timestamp + 1000; + terminationEvents.push( + this.generateEvent({ + timestamp, + entityID: element.process.entity_id, + parentEntityID: element.process.parent?.entity_id, + eventCategory: 'process', + eventType: 'end', + }) + ); + } + if (this.randomN(100) < percentNodesWithRelated) { + relatedEvents = relatedEvents.concat( + this.generateRelatedEvents(element, relatedEventsPerNode) + ); + } + }); + events = events.concat(terminationEvents); + events = events.concat(relatedEvents); + return events; + } + + public generateRelatedEvents(node: Event, numRelatedEvents = 10): EndpointEvent[] { + const ts = node['@timestamp'] + 1000; + const relatedEvents: EndpointEvent[] = []; + for (let i = 0; i < numRelatedEvents; i++) { + relatedEvents.push( + this.generateEvent({ + timestamp: ts, + entityID: node.process.entity_id, + parentEntityID: node.process.parent?.entity_id, + eventCategory: this.randomChoice(OTHER_EVENT_CATEGORIES), + }) + ); + } + return relatedEvents; + } + + private randomN(n: number): number { + return Math.floor(this.random() * n); + } + + private *randomNGenerator(max: number, count: number) { + while (count > 0) { + yield this.randomN(max); + count--; + } + } + + private randomArray(lengthLimit: number, generator: () => T): T[] { + const rand = this.randomN(lengthLimit) + 1; + return [...Array(rand).keys()].map(generator); + } + + private randomMac(): string { + return [...this.randomNGenerator(255, 6)].map(x => x.toString(16)).join('-'); + } + + private randomIP(): string { + return [10, ...this.randomNGenerator(255, 3)].map(x => x.toString()).join('.'); + } + + private randomVersion(): string { + return [6, ...this.randomNGenerator(10, 2)].map(x => x.toString()).join('.'); + } + + private randomChoice(choices: T[]): T { + return choices[this.randomN(choices.length)]; + } + + private randomString(length: number): string { + return [...this.randomNGenerator(36, length)].map(x => x.toString(36)).join(''); + } + + private randomHostname(): string { + return `Host-${this.randomString(10)}`; + } + + private seededUUIDv4(): string { + return uuid.v4({ random: [...this.randomNGenerator(255, 16)] }); + } +} diff --git a/x-pack/plugins/endpoint/common/types.ts b/x-pack/plugins/endpoint/common/types.ts index edcd2d7841b12..1c438c40fa38f 100644 --- a/x-pack/plugins/endpoint/common/types.ts +++ b/x-pack/plugins/endpoint/common/types.ts @@ -167,29 +167,34 @@ export type AlertEvent = Immutable<{ module: string; type: string; }; + endpoint: { + policy: { + id: string; + }; + }; process: { code_signature: { subject_name: string; trusted: boolean; }; - command_line: string; - domain: string; + command_line?: string; + domain?: string; pid: number; - ppid: number; + ppid?: number; entity_id: string; - parent: { + parent?: { pid: number; entity_id: string; }; name: string; hash: HashFields; - pe: { + pe?: { imphash: string; }; executable: string; - sid: string; + sid?: string; start: number; - malware_classifier: MalwareClassifierFields; + malware_classifier?: MalwareClassifierFields; token: { domain: string; type: string; @@ -197,9 +202,9 @@ export type AlertEvent = Immutable<{ sid: string; integrity_level: number; integrity_level_name: string; - privileges: PrivilegesFields[]; + privileges?: PrivilegesFields[]; }; - thread: ThreadFields[]; + thread?: ThreadFields[]; uptime: number; user: string; }; @@ -212,32 +217,20 @@ export type AlertEvent = Immutable<{ created: number; size: number; hash: HashFields; - pe: { + pe?: { imphash: string; }; code_signature: { trusted: boolean; subject_name: string; }; - malware_classifier: { - features: { - data: { - buffer: string; - decompressed_size: number; - encoding: string; - }; - }; - } & MalwareClassifierFields; + malware_classifier: MalwareClassifierFields; temp_file_path: string; }; host: HostFields; - thread: {}; - dll: DllFields[]; + dll?: DllFields[]; }>; -/** - * Metadata associated with an alert event. - */ interface AlertMetadata { id: string; @@ -252,9 +245,9 @@ interface AlertMetadata { export type AlertData = AlertEvent & AlertMetadata; export interface EndpointMetadata { - '@timestamp': string; + '@timestamp': number; event: { - created: Date; + created: number; }; endpoint: { policy: { @@ -262,8 +255,8 @@ export interface EndpointMetadata { }; }; agent: { - version: string; id: string; + version: string; }; host: HostFields; } @@ -310,23 +303,33 @@ export interface LegacyEndpointEvent { export interface EndpointEvent { '@timestamp': number; + agent: { + id: string; + version: string; + type: string; + }; + ecs: { + version: string; + }; event: { category: string; type: string; id: string; + kind: string; }; - endpoint: { - process: { + host: { + id: string; + hostname: string; + ip: string[]; + mac: string[]; + os: OSFields; + }; + process: { + entity_id: string; + parent?: { entity_id: string; - parent: { - entity_id: string; - }; }; }; - agent: { - id: string; - type: string; - }; } export type ResolverEvent = EndpointEvent | LegacyEndpointEvent; diff --git a/x-pack/plugins/endpoint/package.json b/x-pack/plugins/endpoint/package.json index 25afe2c8442ba..c7ba8b3fb4196 100644 --- a/x-pack/plugins/endpoint/package.json +++ b/x-pack/plugins/endpoint/package.json @@ -6,9 +6,11 @@ "license": "Elastic-License", "scripts": {}, "dependencies": { - "react-redux": "^7.1.0" + "react-redux": "^7.1.0", + "seedrandom": "^3.0.5" }, "devDependencies": { + "@types/seedrandom": ">=2.0.0 <4.0.0", "@types/react-redux": "^7.1.0", "redux-devtools-extension": "^2.13.8" } diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/alerts/mock_alert_result_list.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/alerts/mock_alert_result_list.ts index 7db94fc9d4266..3931723a55505 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/store/alerts/mock_alert_result_list.ts +++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/alerts/mock_alert_result_list.ts @@ -5,6 +5,7 @@ */ import { AlertResultList } from '../../../../../common/types'; +import { EndpointDocGenerator } from '../../../../../common/generate_data'; export const mockAlertResultList: (options?: { total?: number; @@ -24,160 +25,15 @@ export const mockAlertResultList: (options?: { const actualCountToReturn = Math.max(Math.min(total - numberToSkip, requestPageSize), 0); const alerts = []; + const generator = new EndpointDocGenerator(); for (let index = 0; index < actualCountToReturn; index++) { alerts.push({ - '@timestamp': 1542341895000, - id: 'xDUYMHABAJk0XnHd8rrd', - agent: { - id: 'ced9c68e-b94a-4d66-bb4c-6106514f0a2f', - version: '3.0.0', + ...generator.generateAlert(new Date().getTime() + index * 1000), + ...{ + id: 'xDUYMHABAJk0XnHd8rrd' + index, + prev: null, + next: null, }, - host: { - id: 'xrctvybuni', - hostname: 'HD-c15-bc09190a', - ip: ['10.179.244.14'], - mac: ['xsertcyvbunimkn56edtyf'], - os: { - full: 'Windows 10', - name: 'windows', - version: '10', - variant: '3', - }, - }, - thread: {}, - prev: null, - next: null, - event: { - id: '2f1c0928-3876-4e11-acbb-9199257c7b1c', - action: 'creation', - category: 'malware', - dataset: 'endpoint', - kind: 'alert', - module: 'endpoint', - type: 'creation', - }, - file: { - accessed: 1542789400, - created: 1542789400, - hash: { - md5: '4ace3baaa509d08510405e1b169e325b', - sha1: '27fb21cf5db95ffca43b234affa99becc4023b9d', - sha256: '6ed1c836dbf099be7845bdab7671def2c157643761b52251e04e9b6ee109ec75', - }, - pe: { - imphash: '835d619dfdf3cc727cebd91300ab3462', - }, - mtime: 1542789400, - owner: 'Administrators', - name: 'test name', - path: 'C:\\Windows\\TEMP\\tmp0000008f\\tmp00001be5', - size: 188416, - code_signature: { - subject_name: 'Cybereason Inc', - trusted: false, - }, - malware_classifier: { - features: { - data: { - buffer: - 'eAHtnU1oHHUUwHsQ7MGDiIIUD4sH8WBBxJtopiLoUY0pYo2ZTbJJ0yQ17m4+ms/NRzeVWpuUWCL4sWlEYvFQ8KJQ6NCTEA8eRD30sIo3PdSriLi7837Pko3LbHZ2M5m+XObHm/d/X////83O7jCZvzacHBpPplNdfalkdjSdyty674Ft59dN71Dpb9v5eKh8LMEHjsCF2wIfVlRKsHROYPGkQO5+gY2vBSYYdWZFYGwEO/cITHMqkxPYnBBY+07gtCuQ9gSGigJ5lPPYGXcE+jA4z3Ad1ZtAUiDUyrEEPYzqRnIKgxd/Rgc7gygPo5wn95PouN7OeEYJ1UXiJgRmvscgp/LOziIkkSyT+xRVnXhZ4DKh5goCkzidRHkGO4uvCyw9LDDtCay8ILCAzrJOJaGuZwUuvSewivJVIPsklq8JbL4qMJsTSCcExrGs83WKU295ZFo5lr2TaZbcUw5FeJy8tgTeLpCy2iGeS67ABXzlgbEi1UC5FxcZnA4y/CLK82Qxi847FGGZRTLsCUxR1aWEwOp1AmOjDRYYzgwusL9WfqBiGJxnVAanixTq7Dp22LBdlWMJzlOx8wmBK2Rx5WmBLJIRwtAijOQE+ooCb2B5xBOYRtlfNeXpLpA7oyZRTqHzGenkmIJPnhBIMrzTwSA6H93CO5l+c1NA99f6IwLH8fUKdjTmDpTbgS50+gGVnECnE4PpooC2guPoaPADSHrcncNHmEHtAFkq3+EI+A37zsrrTvH3WTkvJLoOTyBp10wx2JcgVCRahA4NrICE4a+hrMXsA3qAHItW188E8ejO7XV3eh/KCYwxlamEwCgL8lN2wTntfrhY/U0g/5KAdvUpT+AszWqBdqH7VLeeZrExK9Cv1UgIDKA8g/cx7QAEP+AhAfRaMKB2HOJh+BSFSqKjSytNGBlc6PrpxvK7lCVDxbSG3Z7AhCMwx6gelwgLAltXBXJUTH29j+U1LHdipx/QprfKfGnF0sBpdBYxmEQyTzW0h6/0khcuhhJYRufym+i4VKMocJMs/KvfoW3/UJb4PeZOSZVONThZz4djP/75TAXa/CVfOvX3RgVLIDreLPN1pP1osW7lGmHsEhjBOzf+EPBE4vndvWz5xb/cChxGcv1LAb+tluALKnZ47isf1MXvz1ZMlsCXbXtPceqhrcp1ps6YHwQeBXLEPCf7q23tl9uJui0bGBgYRAccv7uXr/g5Af+2oNTrpgTa/vnpjBvpLAwM4gRBPvIZGBgYGBgYGBgYGBgYGBgYGBgYGBgYNAOc9oMXs4GBgYFBcNBnww5QzDXgRtPSaZ5lg/itsRaslgZ3bnWEEVnhMetIBwiiVnlbCbWrEftrt11zdwWnseFW1QO63w1is3ptD1pV9xG0t+zvfUrzrvh380qwXWAVCw6h78GIfG7ZlzltXu6hd+y92fECRFhjuH3bXG8N43oXEHperdzvUbteaDxhVTUeq25fqhG1X6Ai8mtF6BDXz2wR+dzSgg4Qsxls5T11XMG+82y8GkG+b7kL69xg7mF1SFvhBgYGsYH/Xi7HE+PVkiB2jt1bNZxT+k4558jR53ydz5//1m1KOgYGBgYGBgYGEQfnsYaG2z1sdPJS79XQSu91ndobOAHCaN5vNzUk1bceQVzUpbw3iOuT+UFmR18bHrp3gyhDC56lCd1y85w2+HSNUwVhhdGC7blLf+bV/fqtvhMg1NDjCcugB1QXswbs8ekj/v1BgzFHBIIsyP+HfwFdMpzu', - decompressed_size: 27831, - encoding: 'zlib', - }, - }, - identifier: 'endpointpe', - score: 1, - threshold: 0.66, - version: '3.0.33', - }, - temp_file_path: 'C:\\Windows\\TEMP\\1bb9abfc-ca14-47b2-9f2c-10c323df42f9', - }, - process: { - pid: 1076, - ppid: 432, - entity_id: 'wertqwer', - parent: { - pid: 432, - entity_id: 'adsfsdaf', - }, - name: 'test name', - code_signature: { - subject_name: 'Cybereason Inc', - trusted: true, - }, - command_line: '"C:\\Program Files\\Cybereason ActiveProbe\\AmSvc.exe"', - domain: 'NT AUTHORITY', - executable: 'C:\\Program Files\\Cybereason ActiveProbe\\AmSvc.exe', - hash: { - md5: '1f2d082566b0fc5f2c238a5180db7451', - sha1: 'ca85243c0af6a6471bdaa560685c51eefd6dbc0d', - sha256: '8ad40c90a611d36eb8f9eb24fa04f7dbca713db383ff55a03aa0f382e92061a2', - }, - pe: { - imphash: 'c30d230b81c734e82e86e2e2fe01cd01', - }, - malware_classifier: { - identifier: 'Whitelisted', - score: 0, - threshold: 0, - version: '3.0.0', - }, - thread: [ - { - id: 1652, - service_name: 'CybereasonAntiMalware', - start: 1542788400, - start_address: 8791698721056, - start_address_module: 'C:\\Program Files\\Cybereason ActiveProbe\\gzfltum.dll', - }, - ], - sid: 'S-1-5-18', - start: 1542788400, - token: { - domain: 'NT AUTHORITY', - integrity_level: 16384, - integrity_level_name: 'system', - privileges: [ - { - description: 'Replace a process level token', - enabled: false, - name: 'SeAssignPrimaryTokenPrivilege', - }, - ], - sid: 'S-1-5-18', - type: 'tokenPrimary', - user: 'SYSTEM', - }, - uptime: 1025, - user: 'SYSTEM', - }, - dll: [ - { - pe: { - architecture: 'x64', - imphash: 'c30d230b81c734e82e86e2e2fe01cd01', - }, - code_signature: { - subject_name: 'Cybereason Inc', - trusted: true, - }, - compile_time: 1534424710, - hash: { - md5: '1f2d082566b0fc5f2c238a5180db7451', - sha1: 'ca85243c0af6a6471bdaa560685c51eefd6dbc0d', - sha256: '8ad40c90a611d36eb8f9eb24fa04f7dbca713db383ff55a03aa0f382e92061a2', - }, - malware_classifier: { - identifier: 'Whitelisted', - score: 0, - threshold: 0, - version: '3.0.0', - }, - mapped_address: 5362483200, - mapped_size: 0, - path: 'C:\\Program Files\\Cybereason ActiveProbe\\AmSvc.exe', - }, - ], }); } const mock: AlertResultList = { diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/managing/index.test.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/managing/index.test.ts index 6903c37d4684d..fba1dacb0d3bd 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/store/managing/index.test.ts +++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/managing/index.test.ts @@ -7,44 +7,20 @@ import { createStore, Dispatch, Store } from 'redux'; import { ManagementAction, managementListReducer } from './index'; import { EndpointMetadata } from '../../../../../common/types'; +import { EndpointDocGenerator } from '../../../../../common/generate_data'; import { ManagementListState } from '../../types'; import { listData } from './selectors'; describe('endpoint_list store concerns', () => { let store: Store; let dispatch: Dispatch; + const generator = new EndpointDocGenerator(); const createTestStore = () => { store = createStore(managementListReducer); dispatch = store.dispatch; }; const generateEndpoint = (): EndpointMetadata => { - return { - '@timestamp': new Date(1582231151055).toString(), - event: { - created: new Date(0), - }, - endpoint: { - policy: { - id: '', - }, - }, - agent: { - version: '', - id: '', - }, - host: { - id: '', - hostname: '', - ip: [''], - mac: [''], - os: { - name: '', - full: '', - version: '', - variant: '', - }, - }, - }; + return generator.generateEndpointMetadata(new Date().getTime()); }; const loadDataToStore = () => { dispatch({ diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/managing/middleware.test.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/managing/middleware.test.ts index f29e90509785d..3b37e0d79bacc 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/store/managing/middleware.test.ts +++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/managing/middleware.test.ts @@ -9,6 +9,7 @@ import { coreMock } from '../../../../../../../../src/core/public/mocks'; import { History, createBrowserHistory } from 'history'; import { managementListReducer, managementMiddlewareFactory } from './index'; import { EndpointMetadata, EndpointResultList } from '../../../../../common/types'; +import { EndpointDocGenerator } from '../../../../../common/generate_data'; import { ManagementListState } from '../../types'; import { AppAction } from '../action'; import { listData } from './selectors'; @@ -19,38 +20,14 @@ describe('endpoint list saga', () => { let store: Store; let getState: typeof store['getState']; let dispatch: Dispatch; - let history: History; + const generator = new EndpointDocGenerator(); // https://github.com/elastic/endpoint-app-team/issues/131 const generateEndpoint = (): EndpointMetadata => { - return { - '@timestamp': new Date(1582231151055).toString(), - event: { - created: new Date(0), - }, - endpoint: { - policy: { - id: '', - }, - }, - agent: { - version: '', - id: '', - }, - host: { - id: '', - hostname: '', - ip: [''], - mac: [''], - os: { - name: '', - full: '', - version: '', - variant: '', - }, - }, - }; + return generator.generateEndpointMetadata(new Date().getTime()); }; + + let history: History; const getEndpointListApiResponse = (): EndpointResultList => { return { endpoints: [generateEndpoint()], diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/managing/mock_host_result_list.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/managing/mock_host_result_list.ts index 866e5c59329e6..61833d1dfb957 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/store/managing/mock_host_result_list.ts +++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/managing/mock_host_result_list.ts @@ -5,6 +5,7 @@ */ import { EndpointResultList } from '../../../../../common/types'; +import { EndpointDocGenerator } from '../../../../../common/generate_data'; export const mockHostResultList: (options?: { total?: number; @@ -25,33 +26,8 @@ export const mockHostResultList: (options?: { const endpoints = []; for (let index = 0; index < actualCountToReturn; index++) { - endpoints.push({ - '@timestamp': new Date(1582231151055).toString(), - event: { - created: new Date('2020-02-20T20:39:11.055Z'), - }, - endpoint: { - policy: { - id: '00000000-0000-0000-0000-000000000000', - }, - }, - agent: { - version: '6.9.2', - id: '9a87fdac-e6c0-4f27-a25c-e349e7093cb1', - }, - host: { - id: '3ca26fe5-1c7d-42b8-8763-98256d161c9f', - hostname: 'bea-0.example.com', - ip: ['10.154.150.114', '10.43.37.62', '10.217.73.149'], - mac: ['ea-5a-a8-c0-5-95', '7e-d8-fe-7f-b6-4e', '23-31-5d-af-e6-2b'], - os: { - name: 'windows 6.2', - full: 'Windows Server 2012', - version: '6.2', - variant: 'Windows Server Release 2', - }, - }, - }); + const generator = new EndpointDocGenerator('seed'); + endpoints.push(generator.generateEndpointMetadata()); } const mock: EndpointResultList = { endpoints, diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/alerts/details/metadata/source_process_accordion.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/alerts/details/metadata/source_process_accordion.tsx index 4c961ad4b4964..4d921ee39d95b 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/view/alerts/details/metadata/source_process_accordion.tsx +++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/alerts/details/metadata/source_process_accordion.tsx @@ -51,13 +51,13 @@ export const SourceProcessAccordion = memo(({ alertData }: { alertData: Immutabl title: i18n.translate('xpack.endpoint.application.endpoint.alertDetails.malwareScore', { defaultMessage: 'MalwareScore', }), - description: alertData.process.malware_classifier.score, + description: alertData.process.malware_classifier?.score || '-', }, { title: i18n.translate('xpack.endpoint.application.endpoint.alertDetails.parentProcessID', { defaultMessage: 'Parent Process ID', }), - description: alertData.process.parent.pid, + description: alertData.process.parent?.pid || '-', }, { title: i18n.translate('xpack.endpoint.application.endpoint.alertDetails.signer', { diff --git a/x-pack/plugins/endpoint/server/routes/resolver/utils/normalize.ts b/x-pack/plugins/endpoint/server/routes/resolver/utils/normalize.ts index 4db8ee0bfbcef..67a532d949e81 100644 --- a/x-pack/plugins/endpoint/server/routes/resolver/utils/normalize.ts +++ b/x-pack/plugins/endpoint/server/routes/resolver/utils/normalize.ts @@ -21,7 +21,7 @@ export function extractEntityID(event: ResolverEvent) { if (isLegacyData(event)) { return String(event.endgame.unique_pid); } - return event.endpoint.process.entity_id; + return event.process.entity_id; } export function extractParentEntityID(event: ResolverEvent) { @@ -29,5 +29,5 @@ export function extractParentEntityID(event: ResolverEvent) { const ppid = event.endgame.unique_ppid; return ppid && String(ppid); // if unique_ppid is undefined return undefined } - return event.endpoint.process.parent?.entity_id; + return event.process.parent?.entity_id; } diff --git a/yarn.lock b/yarn.lock index 23a2e8e4718d9..c84f7932b4098 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5169,6 +5169,11 @@ "@types/tough-cookie" "*" form-data "^2.5.0" +"@types/seedrandom@>=2.0.0 <4.0.0": + version "2.4.28" + resolved "https://registry.yarnpkg.com/@types/seedrandom/-/seedrandom-2.4.28.tgz#9ce8fa048c1e8c85cb71d7fe4d704e000226036f" + integrity sha512-SMA+fUwULwK7sd/ZJicUztiPs8F1yCPwF3O23Z9uQ32ME5Ha0NmDK9+QTsYE4O2tHXChzXomSWWeIhCnoN1LqA== + "@types/selenium-webdriver@^4.0.5": version "4.0.5" resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-4.0.5.tgz#23041a4948c82daf2df9836e4d2358fec10d3e24" From 1b0d1f1c517dbc6ae63108212db1c5ee0bce091a Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Tue, 10 Mar 2020 12:45:49 -0400 Subject: [PATCH 19/23] Add a retry to dashboard test for a sometimes slow async operation (#59600) --- test/functional/apps/dashboard/dashboard_query_bar.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/functional/apps/dashboard/dashboard_query_bar.js b/test/functional/apps/dashboard/dashboard_query_bar.js index dc4c6a9a63d4d..13dea27f606f6 100644 --- a/test/functional/apps/dashboard/dashboard_query_bar.js +++ b/test/functional/apps/dashboard/dashboard_query_bar.js @@ -24,6 +24,7 @@ export default function({ getService, getPageObjects }) { const kibanaServer = getService('kibanaServer'); const pieChart = getService('pieChart'); const queryBar = getService('queryBar'); + const retry = getService('retry'); const PageObjects = getPageObjects(['common', 'dashboard', 'discover']); describe('dashboard query bar', () => { @@ -41,10 +42,11 @@ export default function({ getService, getPageObjects }) { await esArchiver.unload('dashboard/current/data'); await queryBar.clickQuerySubmitButton(); - const headers = await PageObjects.discover.getColumnHeaders(); - expect(headers.length).to.be(0); - - await pieChart.expectPieSliceCount(0); + await retry.tryForTime(5000, async () => { + const headers = await PageObjects.discover.getColumnHeaders(); + expect(headers.length).to.be(0); + await pieChart.expectPieSliceCount(0); + }); }); }); } From 8bc051ac49a63402f520676fcafe5182b16ecac4 Mon Sep 17 00:00:00 2001 From: Robert Oskamp Date: Tue, 10 Mar 2020 18:10:59 +0100 Subject: [PATCH 20/23] [ML] Functional tests - stabilize saved search tests (#59652) This PR stabilizes the saved search functional UI tests by adding a retry to navigateToApp('ml') --- .../machine_learning/anomaly_detection/saved_search_job.ts | 3 +-- .../test/functional/services/machine_learning/navigation.ts | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/x-pack/test/functional/apps/machine_learning/anomaly_detection/saved_search_job.ts b/x-pack/test/functional/apps/machine_learning/anomaly_detection/saved_search_job.ts index 66b2f00009b18..a13cf3d61128e 100644 --- a/x-pack/test/functional/apps/machine_learning/anomaly_detection/saved_search_job.ts +++ b/x-pack/test/functional/apps/machine_learning/anomaly_detection/saved_search_job.ts @@ -271,8 +271,7 @@ export default function({ getService }: FtrProviderContext) { }, ]; - // test failures, see #59354 - describe.skip('saved search', function() { + describe('saved search', function() { this.tags(['smoke', 'mlqa']); before(async () => { await esArchiver.load('ml/farequote'); diff --git a/x-pack/test/functional/services/machine_learning/navigation.ts b/x-pack/test/functional/services/machine_learning/navigation.ts index 06ab99b3dcb9f..b0f993eab1a2b 100644 --- a/x-pack/test/functional/services/machine_learning/navigation.ts +++ b/x-pack/test/functional/services/machine_learning/navigation.ts @@ -17,7 +17,10 @@ export function MachineLearningNavigationProvider({ return { async navigateToMl() { - return await PageObjects.common.navigateToApp('ml'); + await retry.tryForTime(60 * 1000, async () => { + await PageObjects.common.navigateToApp('ml'); + await testSubjects.existOrFail('mlPageOverview', { timeout: 2000 }); + }); }, async assertTabsExist(tabTypeSubject: string, areaSubjects: string[]) { From ecac63f258a645723a82db838b78073bef335e44 Mon Sep 17 00:00:00 2001 From: Steph Milovic Date: Tue, 10 Mar 2020 12:49:55 -0500 Subject: [PATCH 21/23] [SIEM] [Case] Insert timeline into case textarea (#59586) --- .../components/markdown_editor/form.tsx | 28 +- .../components/markdown_editor/index.tsx | 177 ++++++----- .../insert_timeline_popover/index.tsx | 85 ++++++ .../use_insert_timeline.tsx | 44 +++ .../timeline/search_super_select/index.tsx | 283 ++---------------- .../timeline/selectable_timeline/index.tsx | 276 +++++++++++++++++ .../{search_super_select => }/translations.ts | 4 + .../siem/public/containers/case/api.ts | 12 +- .../containers/case/use_update_comment.tsx | 11 +- .../case/components/add_comment/index.tsx | 19 +- .../case/components/all_cases/index.test.tsx | 8 +- .../pages/case/components/create/index.tsx | 16 +- .../components/user_action_tree/index.tsx | 2 +- .../components/user_action_tree/schema.ts | 23 ++ .../user_action_tree/user_action_markdown.tsx | 64 ++-- .../siem/public/pages/case/translations.ts | 4 + .../components/description_step/index.tsx | 2 +- .../step_about_rule/default_value.ts | 2 +- .../api/cases/comments/patch_comment.ts | 2 +- 19 files changed, 692 insertions(+), 370 deletions(-) create mode 100644 x-pack/legacy/plugins/siem/public/components/timeline/insert_timeline_popover/index.tsx create mode 100644 x-pack/legacy/plugins/siem/public/components/timeline/insert_timeline_popover/use_insert_timeline.tsx create mode 100644 x-pack/legacy/plugins/siem/public/components/timeline/selectable_timeline/index.tsx rename x-pack/legacy/plugins/siem/public/components/timeline/{search_super_select => }/translations.ts (84%) create mode 100644 x-pack/legacy/plugins/siem/public/pages/case/components/user_action_tree/schema.ts diff --git a/x-pack/legacy/plugins/siem/public/components/markdown_editor/form.tsx b/x-pack/legacy/plugins/siem/public/components/markdown_editor/form.tsx index 3c5287a6fac24..17c321b15418c 100644 --- a/x-pack/legacy/plugins/siem/public/components/markdown_editor/form.tsx +++ b/x-pack/legacy/plugins/siem/public/components/markdown_editor/form.tsx @@ -8,23 +8,27 @@ import { EuiFormRow } from '@elastic/eui'; import React, { useCallback } from 'react'; import { FieldHook, getFieldValidityAndErrorMessage } from '../../shared_imports'; -import { MarkdownEditor } from '.'; +import { CursorPosition, MarkdownEditor } from '.'; interface IMarkdownEditorForm { + bottomRightContent?: React.ReactNode; dataTestSubj: string; field: FieldHook; idAria: string; isDisabled: boolean; + onCursorPositionUpdate?: (cursorPosition: CursorPosition) => void; placeholder?: string; - footerContentRight?: React.ReactNode; + topRightContent?: React.ReactNode; } export const MarkdownEditorForm = ({ + bottomRightContent, dataTestSubj, field, idAria, isDisabled = false, + onCursorPositionUpdate, placeholder, - footerContentRight, + topRightContent, }: IMarkdownEditorForm) => { const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(field); @@ -37,21 +41,23 @@ export const MarkdownEditorForm = ({ return ( ); diff --git a/x-pack/legacy/plugins/siem/public/components/markdown_editor/index.tsx b/x-pack/legacy/plugins/siem/public/components/markdown_editor/index.tsx index 8572b447cced8..ee004a3c572bb 100644 --- a/x-pack/legacy/plugins/siem/public/components/markdown_editor/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/markdown_editor/index.tsx @@ -12,7 +12,7 @@ import { EuiTabbedContent, EuiTextArea, } from '@elastic/eui'; -import React, { useEffect, useMemo, useState } from 'react'; +import React, { useMemo, useCallback, ChangeEvent } from 'react'; import styled, { css } from 'styled-components'; import { Markdown } from '../markdown'; @@ -28,9 +28,25 @@ const Container = styled(EuiPanel)` padding: 0; background: ${theme.eui.euiColorLightestShade}; position: relative; + .markdown-tabs-header { + position: absolute; + top: ${theme.eui.euiSizeS}; + right: ${theme.eui.euiSizeS}; + z-index: ${theme.eui.euiZContentMenu}; + } .euiTab { padding: 10px; } + .markdown-tabs { + width: 100%; + } + .markdown-tabs-footer { + height: 41px; + padding: 0 ${theme.eui.euiSizeM}; + .euiLink { + font-size: ${theme.eui.euiSizeM}; + } + } .euiFormRow__labelWrapper { position: absolute; top: -${theme.eui.euiSizeL}; @@ -41,81 +57,108 @@ const Container = styled(EuiPanel)` `} `; -const Tabs = styled(EuiTabbedContent)` - width: 100%; -`; - -const Footer = styled(EuiFlexGroup)` - ${({ theme }) => css` - height: 41px; - padding: 0 ${theme.eui.euiSizeM}; - .euiLink { - font-size: ${theme.eui.euiSizeM}; - } - `} -`; - const MarkdownContainer = styled(EuiPanel)` min-height: 150px; overflow: auto; `; +export interface CursorPosition { + start: number; + end: number; +} + /** An input for entering a new case description */ export const MarkdownEditor = React.memo<{ - placeholder?: string; - footerContentRight?: React.ReactNode; - initialContent: string; + bottomRightContent?: React.ReactNode; + topRightContent?: React.ReactNode; + content: string; isDisabled?: boolean; onChange: (description: string) => void; -}>(({ placeholder, footerContentRight, initialContent, isDisabled = false, onChange }) => { - const [content, setContent] = useState(initialContent); - useEffect(() => { - onChange(content); - }, [content]); - const tabs = useMemo( - () => [ - { - id: 'comment', - name: i18n.MARKDOWN, - content: ( -