TS config cleanup (#90492)

* exclude all the plugins from src/plugins

* move all the used fixtures to discover

* remove src/fixtures alias

* remove unused fixtures

* cleanup x-pack/tsconfig.json

* dont compile apm/scripts

* fix tests

* dont include infra in xpack/tsconfig.json

* update list of includes
This commit is contained in:
Mikhail Shustov 2021-02-11 18:34:25 +01:00 committed by GitHub
parent 341e9cf2eb
commit a1490d46f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 216 additions and 1613 deletions

View file

@ -37,7 +37,6 @@ module.exports = {
'\\.ace\\.worker.js$': '<rootDir>/packages/kbn-test/target/jest/mocks/worker_module_mock.js',
'\\.editor\\.worker.js$': '<rootDir>/packages/kbn-test/target/jest/mocks/worker_module_mock.js',
'^(!!)?file-loader!': '<rootDir>/packages/kbn-test/target/jest/mocks/file_mock.js',
'^fixtures/(.*)': '<rootDir>/src/fixtures/$1',
'^src/core/(.*)': '<rootDir>/src/core/$1',
'^src/plugins/(.*)': '<rootDir>/src/plugins/$1',
},

View file

@ -124,7 +124,6 @@ export const REMOVE_EXTENSION = ['packages/kbn-plugin-generator/template/**/*.ej
* @type {Array}
*/
export const TEMPORARILY_IGNORED_PATHS = [
'src/fixtures/config_upgrade_from_4.0.0_to_4.0.1-snapshot.json',
'src/core/server/core_app/assets/favicons/android-chrome-192x192.png',
'src/core/server/core_app/assets/favicons/android-chrome-256x256.png',
'src/core/server/core_app/assets/favicons/android-chrome-512x512.png',

View file

@ -1,258 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export default {
took: 35,
timed_out: false,
_shards: {
total: 2,
successful: 2,
failed: 0,
},
hits: {
total: 32899,
max_score: 0,
hits: [],
},
aggregations: {
1: {
buckets: [
{
key_as_string: '2015-01-30T01:00:00.000Z',
key: 1422579600000,
doc_count: 18,
},
{
key_as_string: '2015-01-30T02:00:00.000Z',
key: 1422583200000,
doc_count: 68,
},
{
key_as_string: '2015-01-30T03:00:00.000Z',
key: 1422586800000,
doc_count: 146,
},
{
key_as_string: '2015-01-30T04:00:00.000Z',
key: 1422590400000,
doc_count: 149,
},
{
key_as_string: '2015-01-30T05:00:00.000Z',
key: 1422594000000,
doc_count: 363,
},
{
key_as_string: '2015-01-30T06:00:00.000Z',
key: 1422597600000,
doc_count: 555,
},
{
key_as_string: '2015-01-30T07:00:00.000Z',
key: 1422601200000,
doc_count: 878,
},
{
key_as_string: '2015-01-30T08:00:00.000Z',
key: 1422604800000,
doc_count: 1133,
},
{
key_as_string: '2015-01-30T09:00:00.000Z',
key: 1422608400000,
doc_count: 1438,
},
{
key_as_string: '2015-01-30T10:00:00.000Z',
key: 1422612000000,
doc_count: 1719,
},
{
key_as_string: '2015-01-30T11:00:00.000Z',
key: 1422615600000,
doc_count: 1813,
},
{
key_as_string: '2015-01-30T12:00:00.000Z',
key: 1422619200000,
doc_count: 1790,
},
{
key_as_string: '2015-01-30T13:00:00.000Z',
key: 1422622800000,
doc_count: 1582,
},
{
key_as_string: '2015-01-30T14:00:00.000Z',
key: 1422626400000,
doc_count: 1439,
},
{
key_as_string: '2015-01-30T15:00:00.000Z',
key: 1422630000000,
doc_count: 1154,
},
{
key_as_string: '2015-01-30T16:00:00.000Z',
key: 1422633600000,
doc_count: 847,
},
{
key_as_string: '2015-01-30T17:00:00.000Z',
key: 1422637200000,
doc_count: 588,
},
{
key_as_string: '2015-01-30T18:00:00.000Z',
key: 1422640800000,
doc_count: 374,
},
{
key_as_string: '2015-01-30T19:00:00.000Z',
key: 1422644400000,
doc_count: 152,
},
{
key_as_string: '2015-01-30T20:00:00.000Z',
key: 1422648000000,
doc_count: 140,
},
{
key_as_string: '2015-01-30T21:00:00.000Z',
key: 1422651600000,
doc_count: 73,
},
{
key_as_string: '2015-01-30T22:00:00.000Z',
key: 1422655200000,
doc_count: 28,
},
{
key_as_string: '2015-01-30T23:00:00.000Z',
key: 1422658800000,
doc_count: 9,
},
{
key_as_string: '2015-01-31T00:00:00.000Z',
key: 1422662400000,
doc_count: 29,
},
{
key_as_string: '2015-01-31T01:00:00.000Z',
key: 1422666000000,
doc_count: 38,
},
{
key_as_string: '2015-01-31T02:00:00.000Z',
key: 1422669600000,
doc_count: 70,
},
{
key_as_string: '2015-01-31T03:00:00.000Z',
key: 1422673200000,
doc_count: 136,
},
{
key_as_string: '2015-01-31T04:00:00.000Z',
key: 1422676800000,
doc_count: 173,
},
{
key_as_string: '2015-01-31T05:00:00.000Z',
key: 1422680400000,
doc_count: 370,
},
{
key_as_string: '2015-01-31T06:00:00.000Z',
key: 1422684000000,
doc_count: 545,
},
{
key_as_string: '2015-01-31T07:00:00.000Z',
key: 1422687600000,
doc_count: 845,
},
{
key_as_string: '2015-01-31T08:00:00.000Z',
key: 1422691200000,
doc_count: 1070,
},
{
key_as_string: '2015-01-31T09:00:00.000Z',
key: 1422694800000,
doc_count: 1419,
},
{
key_as_string: '2015-01-31T10:00:00.000Z',
key: 1422698400000,
doc_count: 1725,
},
{
key_as_string: '2015-01-31T11:00:00.000Z',
key: 1422702000000,
doc_count: 1801,
},
{
key_as_string: '2015-01-31T12:00:00.000Z',
key: 1422705600000,
doc_count: 1823,
},
{
key_as_string: '2015-01-31T13:00:00.000Z',
key: 1422709200000,
doc_count: 1657,
},
{
key_as_string: '2015-01-31T14:00:00.000Z',
key: 1422712800000,
doc_count: 1454,
},
{
key_as_string: '2015-01-31T15:00:00.000Z',
key: 1422716400000,
doc_count: 1131,
},
{
key_as_string: '2015-01-31T16:00:00.000Z',
key: 1422720000000,
doc_count: 810,
},
{
key_as_string: '2015-01-31T17:00:00.000Z',
key: 1422723600000,
doc_count: 583,
},
{
key_as_string: '2015-01-31T18:00:00.000Z',
key: 1422727200000,
doc_count: 384,
},
{
key_as_string: '2015-01-31T19:00:00.000Z',
key: 1422730800000,
doc_count: 165,
},
{
key_as_string: '2015-01-31T20:00:00.000Z',
key: 1422734400000,
doc_count: 135,
},
{
key_as_string: '2015-01-31T21:00:00.000Z',
key: 1422738000000,
doc_count: 72,
},
{
key_as_string: '2015-01-31T22:00:00.000Z',
key: 1422741600000,
doc_count: 8,
},
],
},
},
};

View file

@ -1,84 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import _ from 'lodash';
export default function GeoHashGridAggResponseFixture() {
// for vis:
//
// vis = new Vis(indexPattern, {
// type: 'tile_map',
// aggs:[
// { schema: 'metric', type: 'avg', params: { field: 'bytes' } },
// { schema: 'split', type: 'terms', params: { field: '@tags', size: 10 } },
// { schema: 'segment', type: 'geohash_grid', params: { field: 'geo.coordinates', precision: 3 } }
// ],
// params: {
// isDesaturated: true,
// mapType: 'Scaled%20Circle%20Markers'
// },
// });
const geoHashCharts = _.union(
_.range(48, 57), // 0-9
_.range(65, 90), // A-Z
_.range(97, 122) // a-z
);
const tags = _.times(_.random(4, 20), function (i) {
// random number of tags
let docCount = 0;
const buckets = _.times(_.random(40, 200), function () {
return _.sampleSize(geoHashCharts, 3).join('');
})
.sort()
.map(function (geoHash) {
const count = _.random(1, 5000);
docCount += count;
return {
key: geoHash,
doc_count: count,
1: {
value: 2048 + i,
},
};
});
return {
key: 'tag ' + (i + 1),
doc_count: docCount,
3: {
buckets: buckets,
},
1: {
value: 1000 + i,
},
};
});
return {
took: 3,
timed_out: false,
_shards: {
total: 4,
successful: 4,
failed: 0,
},
hits: {
total: 298,
max_score: 0.0,
hits: [],
},
aggregations: {
2: {
buckets: tags,
},
},
};
}

View file

@ -1,45 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export default {
took: 35,
timed_out: false,
_shards: {
total: 7,
successful: 7,
failed: 0,
},
hits: {
total: 218512,
max_score: 0,
hits: [],
},
aggregations: {
1: {
buckets: {
'*-1024.0': {
to: 1024,
to_as_string: '1024.0',
doc_count: 20904,
},
'1024.0-2560.0': {
from: 1024,
from_as_string: '1024.0',
to: 2560,
to_as_string: '2560.0',
doc_count: 23358,
},
'2560.0-*': {
from: 2560,
from_as_string: '2560.0',
doc_count: 174250,
},
},
},
},
};

View file

@ -1,25 +0,0 @@
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": ".kibana",
"_type": "config",
"_id": "4.0.0",
"_score": 1,
"_source": {
"buildNum": 5888,
"defaultIndex": "logstash-*"
}
}
]
}
}

View file

@ -1,35 +0,0 @@
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1,
"hits": [
{
"_index": ".kibana",
"_type": "config",
"_id": "4.0.1-SNAPSHOT",
"_score": 1,
"_source": {
"buildNum": 5921,
"defaultIndex": "logstash-*"
}
},
{
"_index": ".kibana",
"_type": "config",
"_id": "4.0.0",
"_score": 1,
"_source": {
"buildNum": 5888,
"defaultIndex": "logstash-*"
}
}
]
}
}

View file

@ -1,35 +0,0 @@
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1,
"hits": [
{
"_index": ".kibana",
"_type": "config",
"_id": "4.0.1",
"_score": 1,
"_source": {
"buildNum": 5921,
"defaultIndex": "logstash-*"
}
},
{
"_index": ".kibana",
"_type": "config",
"_id": "4.0.0",
"_score": 1,
"_source": {
"buildNum": 5888,
"defaultIndex": "logstash-*"
}
}
]
}
}

View file

@ -1,28 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
const results = {};
results.timeSeries = {
data: {
ordered: {
date: true,
interval: 600000,
max: 1414437217559,
min: 1414394017559,
},
},
label: 'apache',
value: 44,
point: {
label: 'apache',
x: 1414400400000,
y: 44,
y0: 0,
},
};

View file

@ -1,621 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export const metricOnly = {
hits: { total: 1000, hits: [], max_score: 0 },
aggregations: {
agg_1: { value: 412032 },
},
};
export const threeTermBuckets = {
hits: { total: 1000, hits: [], max_score: 0 },
aggregations: {
agg_2: {
buckets: [
{
key: 'png',
doc_count: 50,
agg_1: { value: 412032 },
agg_3: {
buckets: [
{
key: 'IT',
doc_count: 10,
agg_1: { value: 9299 },
agg_4: {
buckets: [
{ key: 'win', doc_count: 4, agg_1: { value: 0 } },
{ key: 'mac', doc_count: 6, agg_1: { value: 9299 } },
],
},
},
{
key: 'US',
doc_count: 20,
agg_1: { value: 8293 },
agg_4: {
buckets: [
{ key: 'linux', doc_count: 12, agg_1: { value: 3992 } },
{ key: 'mac', doc_count: 8, agg_1: { value: 3029 } },
],
},
},
],
},
},
{
key: 'css',
doc_count: 20,
agg_1: { value: 412032 },
agg_3: {
buckets: [
{
key: 'MX',
doc_count: 7,
agg_1: { value: 9299 },
agg_4: {
buckets: [
{ key: 'win', doc_count: 3, agg_1: { value: 4992 } },
{ key: 'mac', doc_count: 4, agg_1: { value: 5892 } },
],
},
},
{
key: 'US',
doc_count: 13,
agg_1: { value: 8293 },
agg_4: {
buckets: [
{ key: 'linux', doc_count: 12, agg_1: { value: 3992 } },
{ key: 'mac', doc_count: 1, agg_1: { value: 3029 } },
],
},
},
],
},
},
{
key: 'html',
doc_count: 90,
agg_1: { value: 412032 },
agg_3: {
buckets: [
{
key: 'CN',
doc_count: 85,
agg_1: { value: 9299 },
agg_4: {
buckets: [
{ key: 'win', doc_count: 46, agg_1: { value: 4992 } },
{ key: 'mac', doc_count: 39, agg_1: { value: 5892 } },
],
},
},
{
key: 'FR',
doc_count: 15,
agg_1: { value: 8293 },
agg_4: {
buckets: [
{ key: 'win', doc_count: 3, agg_1: { value: 3992 } },
{ key: 'mac', doc_count: 12, agg_1: { value: 3029 } },
],
},
},
],
},
},
],
},
},
};
export const oneTermOneHistogramBucketWithTwoMetricsOneTopHitOneDerivative = {
hits: { total: 1000, hits: [], max_score: 0 },
aggregations: {
agg_3: {
buckets: [
{
key: 'png',
doc_count: 50,
agg_4: {
buckets: [
{
key_as_string: '2014-09-28T00:00:00.000Z',
key: 1411862400000,
doc_count: 1,
agg_1: { value: 9283 },
agg_2: { value: 1411862400000 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 23,
},
},
],
},
},
},
{
key_as_string: '2014-09-29T00:00:00.000Z',
key: 1411948800000,
doc_count: 2,
agg_1: { value: 28349 },
agg_2: { value: 1411948800000 },
agg_5: { value: 203 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 39,
},
},
],
},
},
},
{
key_as_string: '2014-09-30T00:00:00.000Z',
key: 1412035200000,
doc_count: 3,
agg_1: { value: 84330 },
agg_2: { value: 1412035200000 },
agg_5: { value: 200 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 329,
},
},
],
},
},
},
{
key_as_string: '2014-10-01T00:00:00.000Z',
key: 1412121600000,
doc_count: 4,
agg_1: { value: 34992 },
agg_2: { value: 1412121600000 },
agg_5: { value: 103 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 22,
},
},
],
},
},
},
{
key_as_string: '2014-10-02T00:00:00.000Z',
key: 1412208000000,
doc_count: 5,
agg_1: { value: 145432 },
agg_2: { value: 1412208000000 },
agg_5: { value: 153 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 93,
},
},
],
},
},
},
{
key_as_string: '2014-10-03T00:00:00.000Z',
key: 1412294400000,
doc_count: 35,
agg_1: { value: 220943 },
agg_2: { value: 1412294400000 },
agg_5: { value: 239 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 72,
},
},
],
},
},
},
],
},
},
{
key: 'css',
doc_count: 20,
agg_4: {
buckets: [
{
key_as_string: '2014-09-28T00:00:00.000Z',
key: 1411862400000,
doc_count: 1,
agg_1: { value: 9283 },
agg_2: { value: 1411862400000 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 75,
},
},
],
},
},
},
{
key_as_string: '2014-09-29T00:00:00.000Z',
key: 1411948800000,
doc_count: 2,
agg_1: { value: 28349 },
agg_2: { value: 1411948800000 },
agg_5: { value: 10 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 11,
},
},
],
},
},
},
{
key_as_string: '2014-09-30T00:00:00.000Z',
key: 1412035200000,
doc_count: 3,
agg_1: { value: 84330 },
agg_2: { value: 1412035200000 },
agg_5: { value: 24 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 238,
},
},
],
},
},
},
{
key_as_string: '2014-10-01T00:00:00.000Z',
key: 1412121600000,
doc_count: 4,
agg_1: { value: 34992 },
agg_2: { value: 1412121600000 },
agg_5: { value: 49 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 343,
},
},
],
},
},
},
{
key_as_string: '2014-10-02T00:00:00.000Z',
key: 1412208000000,
doc_count: 5,
agg_1: { value: 145432 },
agg_2: { value: 1412208000000 },
agg_5: { value: 100 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 837,
},
},
],
},
},
},
{
key_as_string: '2014-10-03T00:00:00.000Z',
key: 1412294400000,
doc_count: 5,
agg_1: { value: 220943 },
agg_2: { value: 1412294400000 },
agg_5: { value: 23 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 302,
},
},
],
},
},
},
],
},
},
{
key: 'html',
doc_count: 90,
agg_4: {
buckets: [
{
key_as_string: '2014-09-28T00:00:00.000Z',
key: 1411862400000,
doc_count: 10,
agg_1: { value: 9283 },
agg_2: { value: 1411862400000 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 30,
},
},
],
},
},
},
{
key_as_string: '2014-09-29T00:00:00.000Z',
key: 1411948800000,
doc_count: 20,
agg_1: { value: 28349 },
agg_2: { value: 1411948800000 },
agg_5: { value: 1 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 43,
},
},
],
},
},
},
{
key_as_string: '2014-09-30T00:00:00.000Z',
key: 1412035200000,
doc_count: 30,
agg_1: { value: 84330 },
agg_2: { value: 1412035200000 },
agg_5: { value: 5 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 88,
},
},
],
},
},
},
{
key_as_string: '2014-10-01T00:00:00.000Z',
key: 1412121600000,
doc_count: 11,
agg_1: { value: 34992 },
agg_2: { value: 1412121600000 },
agg_5: { value: 10 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 91,
},
},
],
},
},
},
{
key_as_string: '2014-10-02T00:00:00.000Z',
key: 1412208000000,
doc_count: 12,
agg_1: { value: 145432 },
agg_2: { value: 1412208000000 },
agg_5: { value: 43 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 534,
},
},
],
},
},
},
{
key_as_string: '2014-10-03T00:00:00.000Z',
key: 1412294400000,
doc_count: 7,
agg_1: { value: 220943 },
agg_2: { value: 1412294400000 },
agg_5: { value: 1 },
agg_6: {
hits: {
total: 2,
hits: [
{
fields: {
bytes: 553,
},
},
],
},
},
},
],
},
},
],
},
},
};
export const oneRangeBucket = {
took: 35,
timed_out: false,
_shards: {
total: 1,
successful: 1,
failed: 0,
},
hits: {
total: 6039,
max_score: 0,
hits: [],
},
aggregations: {
agg_2: {
buckets: {
'0.0-1000.0': {
from: 0,
from_as_string: '0.0',
to: 1000,
to_as_string: '1000.0',
doc_count: 606,
},
'1000.0-2000.0': {
from: 1000,
from_as_string: '1000.0',
to: 2000,
to_as_string: '2000.0',
doc_count: 298,
},
},
},
},
};
export const oneFilterBucket = {
took: 11,
timed_out: false,
_shards: {
total: 1,
successful: 1,
failed: 0,
},
hits: {
total: 6005,
max_score: 0,
hits: [],
},
aggregations: {
agg_2: {
buckets: {
'type:apache': {
doc_count: 4844,
},
'type:nginx': {
doc_count: 1161,
},
},
},
},
};
export const oneHistogramBucket = {
took: 37,
timed_out: false,
_shards: {
total: 6,
successful: 6,
failed: 0,
},
hits: {
total: 49208,
max_score: 0,
hits: [],
},
aggregations: {
agg_2: {
buckets: [
{
key_as_string: '2014-09-28T00:00:00.000Z',
key: 1411862400000,
doc_count: 8247,
},
{
key_as_string: '2014-09-29T00:00:00.000Z',
key: 1411948800000,
doc_count: 8184,
},
{
key_as_string: '2014-09-30T00:00:00.000Z',
key: 1412035200000,
doc_count: 8269,
},
{
key_as_string: '2014-10-01T00:00:00.000Z',
key: 1412121600000,
doc_count: 8141,
},
{
key_as_string: '2014-10-02T00:00:00.000Z',
key: 1412208000000,
doc_count: 8148,
},
{
key_as_string: '2014-10-03T00:00:00.000Z',
key: 1412294400000,
doc_count: 8219,
},
],
},
},
};

View file

@ -1,68 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export default {
test: {
mappings: {
testType: {
baz: {
full_name: 'baz',
mapping: {
bar: {
type: 'long',
},
},
},
'foo.bar': {
full_name: 'foo.bar',
mapping: {
bar: {
type: 'string',
},
},
},
not_analyzed_field: {
full_name: 'not_analyzed_field',
mapping: {
bar: {
type: 'string',
index: 'not_analyzed',
},
},
},
index_no_field: {
full_name: 'index_no_field',
mapping: {
bar: {
type: 'string',
index: 'no',
},
},
},
_id: {
full_name: '_id',
mapping: {
_id: {
store: false,
index: 'no',
},
},
},
_timestamp: {
full_name: '_timestamp',
mapping: {
_timestamp: {
store: true,
index: 'no',
},
},
},
},
},
},
};

View file

@ -1,41 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export default function fitsFixture() {
return [
// extension
// | machine.os
//timestamp | | bytes
//| ssl ip | | | request
[0, true, '192.168.0.1', 'php', 'Linux', 10, 'foo'],
[1, true, '192.168.0.1', 'php', 'Linux', 20, 'bar'],
[2, true, '192.168.0.1', 'php', 'Linux', 30, 'bar'],
[3, true, '192.168.0.1', 'php', 'Linux', 30, 'baz'],
[4, true, '192.168.0.1', 'php', 'Linux', 30, 'baz'],
[5, true, '192.168.0.1', 'php', 'Linux', 40.141592, 'bat'],
[6, true, '192.168.0.1', 'php', 'Linux', 40.141592, 'bat'],
[7, true, '192.168.0.1', 'php', 'Linux', 40.141592, 'bat'],
[8, true, '192.168.0.1', 'php', 'Linux', 40.141592, 'bat'],
[9, true, '192.168.0.1', 'php', 'Linux', 40.141592, 'bat'],
].map((row, i) => {
return {
_score: 1,
_id: 1000 + i,
_index: 'test-index',
_source: {
'@timestamp': row[0],
ssl: row[1],
ip: row[2],
extension: row[3],
'machine.os': row[4],
bytes: row[5],
request: row[6],
},
};
});
}

View file

@ -1,46 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export default {
test: {
mappings: {
testType: {
baz: {
full_name: 'baz',
mapping: {
bar: {
type: 'long',
},
},
},
'foo.bar': {
full_name: 'foo.bar',
mapping: {
bar: {
type: 'string',
},
},
},
},
},
},
duplicates: {
mappings: {
testType: {
baz: {
full_name: 'baz',
mapping: {
bar: {
type: 'date',
},
},
},
},
},
},
};

View file

@ -1,19 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import sinon from 'sinon';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
export default function (Private) {
const indexPatterns = Private(FixturesStubbedLogstashIndexPatternProvider);
const getIndexPatternStub = sinon.stub().resolves(indexPatterns);
return {
get: getIndexPatternStub,
};
}

View file

@ -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
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import _ from 'lodash';
import sinon from 'sinon';
function MockState(defaults) {
this.on = _.noop;
this.off = _.noop;
this.save = sinon.stub();
this.replace = sinon.stub();
_.assign(this, defaults);
}
export default MockState;

View file

@ -1,33 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { set } from '@elastic/safer-lodash-set';
import _ from 'lodash';
let values = {};
export default {
get: function (path, def) {
return _.get(values, path, def);
},
set: function (path, val) {
set(values, path, val);
return val;
},
setSilent: function (path, val) {
set(values, path, val);
return val;
},
emit: _.noop,
on: _.noop,
off: _.noop,
clearAllKeys: function () {
values = {};
},
_reset: function () {
values = {};
},
};

View file

@ -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
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import hits from 'fixtures/real_hits';
export default {
took: 73,
timed_out: false,
_shards: {
total: 144,
successful: 144,
failed: 0,
},
hits: {
total: 49487,
max_score: 1.0,
hits: hits,
},
};

View file

@ -1,54 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import sinon from 'sinon';
import searchResponse from 'fixtures/search_response';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
export default function stubSearchSource(Private, $q, Promise) {
let deferedResult = $q.defer();
const indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
let onResultsCount = 0;
return {
setField: sinon.spy(),
fetch: sinon.spy(),
destroy: sinon.spy(),
getField: function (param) {
switch (param) {
case 'index':
return indexPattern;
default:
throw new Error(`Param "${param}" is not implemented in the stubbed search source`);
}
},
crankResults: function () {
deferedResult.resolve(searchResponse);
deferedResult = $q.defer();
},
onResults: function () {
onResultsCount++;
// Up to the test to resolve this manually
// For example:
// someHandler.resolve(require('fixtures/search_response'))
return deferedResult.promise;
},
getOnResultsCount: function () {
return onResultsCount;
},
_flatten: function () {
return Promise.resolve({ index: indexPattern, body: {} });
},
_requestStartHandlers: [],
onRequestStart(fn) {
this._requestStartHandlers.push(fn);
},
requestIsStopped() {},
};
}

View file

@ -6,7 +6,8 @@
* Side Public License, v 1.
*/
import { shouldReadFieldFromDocValues, castEsToKbnFieldTypeName } from '../plugins/data/server';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { shouldReadFieldFromDocValues, castEsToKbnFieldTypeName } from '../../../data/server';
function stubbedLogstashFields() {
return [

View file

@ -6,11 +6,12 @@
* Side Public License, v 1.
*/
import stubbedLogstashFields from 'fixtures/logstash_fields';
import stubbedLogstashFields from './logstash_fields';
import { getKbnFieldType } from '../../../data/common';
import { getKbnFieldType } from '../plugins/data/common';
import { getStubIndexPattern } from '../plugins/data/public/test_utils';
import { uiSettingsServiceMock } from '../core/public/ui_settings/ui_settings_service.mock';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getStubIndexPattern } from '../../../data/public/test_utils';
import { uiSettingsServiceMock } from '../../../../core/public/mocks';
const uiSettingSetupMock = uiSettingsServiceMock.createSetupContract();
uiSettingSetupMock.get.mockImplementation((item, defaultValue) => {

View file

@ -7,7 +7,7 @@
*/
// @ts-expect-error
import stubbedLogstashFields from '../../../../fixtures/logstash_fields';
import stubbedLogstashFields from '../__fixtures__/logstash_fields';
const mockLogstashFields = stubbedLogstashFields();

View file

@ -12,9 +12,9 @@ import 'angular-sanitize';
import 'angular-route';
import _ from 'lodash';
import sinon from 'sinon';
import { getFakeRow } from 'fixtures/fake_row';
import { getFakeRow } from '../../../../__fixtures__/fake_row';
import $ from 'jquery';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import FixturesStubbedLogstashIndexPatternProvider from '../../../../__fixtures__/stubbed_logstash_index_pattern';
import { setScopedHistory, setServices, setDocViewsRegistry } from '../../../../kibana_services';
import { coreMock } from '../../../../../../../core/public/mocks';
import { dataPluginMock } from '../../../../../../data/public/mocks';

View file

@ -12,8 +12,8 @@ import 'angular-mocks';
import 'angular-sanitize';
import 'angular-route';
import { createBrowserHistory } from 'history';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import hits from 'fixtures/real_hits';
import FixturesStubbedLogstashIndexPatternProvider from '../../../__fixtures__/stubbed_logstash_index_pattern';
import hits from '../../../__fixtures__/real_hits';
import { coreMock } from '../../../../../../core/public/mocks';
import { dataPluginMock } from '../../../../../data/public/mocks';
import { navigationPluginMock } from '../../../../../navigation/public/mocks';

View file

@ -8,7 +8,7 @@
import { getDefaultSort } from './get_default_sort';
// @ts-ignore
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import FixturesStubbedLogstashIndexPatternProvider from '../../../../__fixtures__/stubbed_logstash_index_pattern';
import { IndexPattern } from '../../../../kibana_services';
describe('getDefaultSort function', function () {

View file

@ -8,7 +8,7 @@
import { getSort, getSortArray } from './get_sort';
// @ts-ignore
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import FixturesStubbedLogstashIndexPatternProvider from '../../../../__fixtures__/stubbed_logstash_index_pattern';
import { IndexPattern } from '../../../../kibana_services';
describe('docTable', function () {

View file

@ -8,7 +8,7 @@
import { getSortForSearchSource } from './get_sort_for_search_source';
// @ts-ignore
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import FixturesStubbedLogstashIndexPatternProvider from '../../../../__fixtures__/stubbed_logstash_index_pattern';
import { IndexPattern } from '../../../../kibana_services';
import { SortOrder } from '../components/table_header/helpers';

View file

@ -9,7 +9,7 @@
import React from 'react';
import { findTestSubject } from '@elastic/eui/lib/test';
// @ts-ignore
import stubbedLogstashFields from 'fixtures/logstash_fields';
import stubbedLogstashFields from '../../../__fixtures__/logstash_fields';
import { mountWithIntl } from '@kbn/test/jest';
import { DiscoverField } from './discover_field';
import { coreMock } from '../../../../../../core/public/mocks';

View file

@ -9,7 +9,7 @@
import React from 'react';
import { findTestSubject } from '@elastic/eui/lib/test';
// @ts-ignore
import stubbedLogstashFields from 'fixtures/logstash_fields';
import stubbedLogstashFields from '../../../__fixtures__/logstash_fields';
import { mountWithIntl } from '@kbn/test/jest';
import { DiscoverFieldDetails } from './discover_field_details';
import { coreMock } from '../../../../../../core/public/mocks';

View file

@ -9,7 +9,7 @@
import React from 'react';
import { findTestSubject } from '@elastic/eui/lib/test';
// @ts-ignore
import stubbedLogstashFields from 'fixtures/logstash_fields';
import stubbedLogstashFields from '../../../__fixtures__/logstash_fields';
import { mountWithIntl } from '@kbn/test/jest';
import { coreMock } from '../../../../../../core/public/mocks';
import { IndexPatternField } from '../../../../../data/public';

View file

@ -10,9 +10,9 @@ import { each, cloneDeep } from 'lodash';
import { ReactWrapper } from 'enzyme';
import { findTestSubject } from '@elastic/eui/lib/test';
// @ts-ignore
import realHits from 'fixtures/real_hits.js';
import realHits from '../../../__fixtures__/real_hits.js';
// @ts-ignore
import stubbedLogstashFields from 'fixtures/logstash_fields';
import stubbedLogstashFields from '../../../__fixtures__/logstash_fields';
import { mountWithIntl } from '@kbn/test/jest';
import React from 'react';
import { DiscoverSidebarProps } from './discover_sidebar';

View file

@ -10,9 +10,9 @@ import { each, cloneDeep } from 'lodash';
import { ReactWrapper } from 'enzyme';
import { findTestSubject } from '@elastic/eui/lib/test';
// @ts-ignore
import realHits from 'fixtures/real_hits.js';
import realHits from '../../../__fixtures__/real_hits.js';
// @ts-ignore
import stubbedLogstashFields from 'fixtures/logstash_fields';
import stubbedLogstashFields from '../../../__fixtures__/logstash_fields';
import { mountWithIntl } from '@kbn/test/jest';
import React from 'react';
import { coreMock } from '../../../../../../core/public/mocks';

View file

@ -8,9 +8,9 @@
import _ from 'lodash';
// @ts-ignore
import realHits from 'fixtures/real_hits.js';
import realHits from '../../../../__fixtures__/real_hits.js';
// @ts-ignore
import stubbedLogstashFields from 'fixtures/logstash_fields';
import stubbedLogstashFields from '../../../../__fixtures__/logstash_fields';
import { coreMock } from '../../../../../../../core/public/mocks';
import { IndexPattern } from '../../../../../../data/public';
import { getStubIndexPattern } from '../../../../../../data/public/test_utils';

View file

@ -0,0 +1,75 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { shouldReadFieldFromDocValues, castEsToKbnFieldTypeName } from '../../../data/server';
function stubbedLogstashFields() {
return [
// |aggregatable
// | |searchable
// name esType | | |metadata | subType
['bytes', 'long', true, true, { count: 10 }],
['ssl', 'boolean', true, true, { count: 20 }],
['@timestamp', 'date', true, true, { count: 30 }],
['time', 'date', true, true, { count: 30 }],
['@tags', 'keyword', true, true],
['utc_time', 'date', true, true],
['phpmemory', 'integer', true, true],
['ip', 'ip', true, true],
['request_body', 'attachment', true, true],
['point', 'geo_point', true, true],
['area', 'geo_shape', true, true],
['hashed', 'murmur3', false, true],
['geo.coordinates', 'geo_point', true, true],
['extension', 'text', true, true],
['extension.keyword', 'keyword', true, true, {}, { multi: { parent: 'extension' } }],
['machine.os', 'text', true, true],
['machine.os.raw', 'keyword', true, true, {}, { multi: { parent: 'machine.os' } }],
['geo.src', 'keyword', true, true],
['_id', '_id', true, true],
['_type', '_type', true, true],
['_source', '_source', true, true],
['non-filterable', 'text', true, false],
['non-sortable', 'text', false, false],
['custom_user_field', 'conflict', true, true],
['script string', 'text', true, false, { script: "'i am a string'" }],
['script number', 'long', true, false, { script: '1234' }],
['script date', 'date', true, false, { script: '1234', lang: 'painless' }],
['script murmur3', 'murmur3', true, false, { script: '1234' }],
].map(function (row) {
const [name, esType, aggregatable, searchable, metadata = {}, subType = undefined] = row;
const {
count = 0,
script,
lang = script ? 'expression' : undefined,
scripted = !!script,
} = metadata;
// the conflict type is actually a kbnFieldType, we
// don't have any other way to represent it here
const type = esType === 'conflict' ? esType : castEsToKbnFieldTypeName(esType);
return {
name,
type,
esTypes: [esType],
readFromDocValues: shouldReadFieldFromDocValues(aggregatable, esType),
aggregatable,
searchable,
count,
script,
lang,
scripted,
subType,
};
});
}
export default stubbedLogstashFields;

View file

@ -0,0 +1,47 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import stubbedLogstashFields from './logstash_fields';
import { getKbnFieldType } from '../../../data/common';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getStubIndexPattern } from '../../../data/public/test_utils';
import { uiSettingsServiceMock } from '../../../../core/public/mocks';
const uiSettingSetupMock = uiSettingsServiceMock.createSetupContract();
uiSettingSetupMock.get.mockImplementation((item, defaultValue) => {
return defaultValue;
});
export default function stubbedLogstashIndexPatternService() {
const mockLogstashFields = stubbedLogstashFields();
const fields = mockLogstashFields.map(function (field) {
const kbnType = getKbnFieldType(field.type);
if (!kbnType || kbnType.name === 'unknown') {
throw new TypeError(`unknown type ${field.type}`);
}
return {
...field,
sortable: 'sortable' in field ? !!field.sortable : kbnType.sortable,
filterable: 'filterable' in field ? !!field.filterable : kbnType.filterable,
displayName: field.name,
};
});
const indexPattern = getStubIndexPattern('logstash-*', (cfg) => cfg, 'time', fields, {
uiSettings: uiSettingSetupMock,
});
indexPattern.id = 'logstash-*';
indexPattern.isTimeNanosBased = () => false;
return indexPattern;
}

View file

@ -26,7 +26,7 @@ jest.mock('./services', () => {
// eslint-disable-next-line
const { SearchSource } = require('../../data/common/search/search_source');
// eslint-disable-next-line
const fixturesStubbedLogstashIndexPatternProvider = require('../../../fixtures/stubbed_logstash_index_pattern');
const fixturesStubbedLogstashIndexPatternProvider = require('./__fixtures__/stubbed_logstash_index_pattern');
const visType = new BaseVisType({
name: 'pie',
title: 'pie',

View file

@ -1,11 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
declare module 'react-virtualized' {
export type ListProps = any;
}

View file

@ -5,8 +5,7 @@
// Allows for importing from `kibana` package for the exported types.
"kibana": ["./kibana"],
"kibana/public": ["src/core/public"],
"kibana/server": ["src/core/server"],
"fixtures/*": ["src/fixtures/*"]
"kibana/server": ["src/core/server"]
},
// Support .tsx files and transform JSX into calls to React.createElement
"jsx": "react",

View file

@ -7,65 +7,7 @@
"exclude": [
"src/**/__fixtures__/**/*",
"src/core/**/*",
"src/plugins/telemetry_management_section/**/*",
"src/plugins/advanced_settings/**/*",
"src/plugins/apm_oss/**/*",
"src/plugins/bfetch/**/*",
"src/plugins/charts/**/*",
"src/plugins/console/**/*",
"src/plugins/dashboard/**/*",
"src/plugins/discover/**/*",
"src/plugins/data/**/*",
"src/plugins/dev_tools/**/*",
"src/plugins/embeddable/**/*",
"src/plugins/es_ui_shared/**/*",
"src/plugins/expressions/**/*",
"src/plugins/home/**/*",
"src/plugins/input_control_vis/**/*",
"src/plugins/inspector/**/*",
"src/plugins/kibana_legacy/**/*",
"src/plugins/kibana_overview/**/*",
"src/plugins/kibana_react/**/*",
"src/plugins/kibana_usage_collection/**/*",
"src/plugins/kibana_utils/**/*",
"src/plugins/legacy_export/**/*",
"src/plugins/management/**/*",
"src/plugins/maps_legacy/**/*",
"src/plugins/navigation/**/*",
"src/plugins/newsfeed/**/*",
"src/plugins/region_map/**/*",
"src/plugins/saved_objects/**/*",
"src/plugins/saved_objects_management/**/*",
"src/plugins/saved_objects_tagging_oss/**/*",
"src/plugins/security_oss/**/*",
"src/plugins/share/**/*",
"src/plugins/spaces_oss/**/*",
"src/plugins/telemetry/**/*",
"src/plugins/telemetry_collection_manager/**/*",
"src/plugins/tile_map/**/*",
"src/plugins/timelion/**/*",
"src/plugins/ui_actions/**/*",
"src/plugins/url_forwarding/**/*",
"src/plugins/usage_collection/**/*",
"src/plugins/presentation_util/**/*",
"src/plugins/vis_default_editor/**/*",
"src/plugins/vis_type_markdown/**/*",
"src/plugins/vis_type_metric/**/*",
"src/plugins/vis_type_table/**/*",
"src/plugins/vis_type_tagcloud/**/*",
"src/plugins/vis_type_timelion/**/*",
"src/plugins/vis_type_timeseries/**/*",
"src/plugins/vis_type_vislib/**/*",
"src/plugins/vis_type_vega/**/*",
"src/plugins/vis_type_xy/**/*",
"src/plugins/visualizations/**/*",
"src/plugins/visualize/**/*",
"src/plugins/index_pattern_management/**/*",
// In the build we actually exclude **/public/**/* from this config so that
// we can run the TSC on both this and the .browser version of this config
// file, but if we did it during development IDEs would not be able to find
// the tsconfig.json file for public files correctly.
// "src/**/public/**/*"
"src/plugins/**/*"
],
"references": [
{ "path": "./src/core/tsconfig.json" },

View file

@ -19,7 +19,10 @@ let httpClient: HttpSetup;
export type UseRequestConfig = _UseRequestConfig;
interface RequestError extends Error {
/**
* @internal
*/
export interface RequestError extends Error {
statusCode?: number;
}

View file

@ -7,10 +7,10 @@
import React from 'react';
import { I18nProvider } from '@kbn/i18n/react';
import { MockedKeys } from '@kbn/utility-types/jest';
import { coreMock } from '../../../../../../../src/core/public/mocks';
import { createStartDepsMock } from './plugin_dependencies';
import { IStorage, Storage } from '../../../../../../../src/plugins/kibana_utils/public';
import { MockedKeys } from '../../../../../../../packages/kbn-utility-types/jest/index';
import { setHttpClient } from '../hooks/use_request';
import { MockedFleetStartServices } from './types';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { MockedKeys } from '../../../../../../../packages/kbn-utility-types/jest/index';
import { MockedKeys } from '@kbn/utility-types/jest';
import { FleetSetupDeps, FleetStart, FleetStartDeps, FleetStartServices } from '../../../plugin';
export type MockedFleetStartServices = MockedKeys<FleetStartServices>;

View file

@ -10,6 +10,9 @@ import {
loggingSystemMock,
savedObjectsServiceMock,
} from 'src/core/server/mocks';
import { coreMock } from '../../../../src/core/server/mocks';
import { licensingMock } from '../../../plugins/licensing/server/mocks';
import { FleetAppContext } from './plugin';
import { encryptedSavedObjectsMock } from '../../encrypted_saved_objects/server/mocks';
import { securityMock } from '../../security/server/mocks';
@ -29,6 +32,17 @@ export const createAppContextStartContractMock = (): FleetAppContext => {
};
};
function createCoreRequestHandlerContextMock() {
return {
core: coreMock.createRequestHandlerContext(),
licensing: licensingMock.createRequestHandlerContext(),
};
}
export const xpackMocks = {
createRequestHandlerContext: createCoreRequestHandlerContextMock,
};
export const createPackagePolicyServiceMock = () => {
return {
compilePackagePolicyInputs: jest.fn(),

View file

@ -5,11 +5,12 @@
* 2.0.
*/
import {
import type {
CoreSetup,
KibanaRequest,
LifecycleResponseFactory,
OnPreAuthToolkit,
OnPreAuthHandler,
} from 'kibana/server';
import { LIMITED_CONCURRENCY_ROUTE_TAG } from '../../common';
import { FleetConfigType } from '../index';
@ -48,7 +49,7 @@ export function createLimitedPreAuthHandler({
}: {
isMatch: (request: KibanaRequest) => boolean;
maxCounter: IMaxCounter;
}) {
}): OnPreAuthHandler {
return function preAuthHandler(
request: KibanaRequest,
response: LifecycleResponseFactory,

View file

@ -9,9 +9,8 @@ import { httpServerMock, httpServiceMock } from 'src/core/server/mocks';
import { IRouter, KibanaRequest, RequestHandler, RouteConfig } from 'kibana/server';
import { registerRoutes } from './index';
import { PACKAGE_POLICY_API_ROUTES } from '../../../common/constants';
import { xpackMocks } from '../../../../../mocks';
import { appContextService } from '../../services';
import { createAppContextStartContractMock } from '../../mocks';
import { createAppContextStartContractMock, xpackMocks } from '../../mocks';
import { PackagePolicyServiceInterface, ExternalCallback } from '../..';
import { CreatePackagePolicyRequestSchema } from '../../types/rest_spec';
import { packagePolicyService } from '../../services';

View file

@ -5,11 +5,10 @@
* 2.0.
*/
import { xpackMocks } from '../../../../../../x-pack/mocks';
import { httpServerMock } from 'src/core/server/mocks';
import { PostIngestSetupResponse } from '../../../common';
import { RegistryError } from '../../errors';
import { createAppContextStartContractMock } from '../../mocks';
import { createAppContextStartContractMock, xpackMocks } from '../../mocks';
import { FleetSetupHandler } from './handlers';
import { appContextService } from '../../services/app_context';
import { setupIngestManager } from '../../services/setup';

View file

@ -10,7 +10,8 @@ import { EncryptedSavedObjectsPluginSetup } from '../../../encrypted_saved_objec
import {
migratePackagePolicyToV7110,
migratePackagePolicyToV7120,
} from '../../../security_solution/common';
// @ts-expect-error
} from './security_solution';
import {
OUTPUT_SAVED_OBJECT_TYPE,
AGENT_POLICY_SAVED_OBJECT_TYPE,

View file

@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export {
migratePackagePolicyToV7110,
migratePackagePolicyToV7120,
} from '../../../security_solution/common';

View file

@ -7,6 +7,8 @@
import { BehaviorSubject, Observable } from 'rxjs';
import { first } from 'rxjs/operators';
import { kibanaPackageJSON } from '@kbn/utils';
import {
ElasticsearchClient,
SavedObjectsServiceStart,
@ -18,7 +20,6 @@ import {
EncryptedSavedObjectsClient,
EncryptedSavedObjectsPluginSetup,
} from '../../../encrypted_saved_objects/server';
import packageJSON from '../../../../../package.json';
import { SecurityPluginStart } from '../../../security/server';
import { FleetConfigType } from '../../common';
import { ExternalCallback, ExternalCallbacksStorage, FleetAppContext } from '../plugin';
@ -33,8 +34,8 @@ class AppContextService {
private configSubject$?: BehaviorSubject<FleetConfigType>;
private savedObjects: SavedObjectsServiceStart | undefined;
private isProductionMode: FleetAppContext['isProductionMode'] = false;
private kibanaVersion: FleetAppContext['kibanaVersion'] = packageJSON.version;
private kibanaBranch: FleetAppContext['kibanaBranch'] = packageJSON.branch;
private kibanaVersion: FleetAppContext['kibanaVersion'] = kibanaPackageJSON.version;
private kibanaBranch: FleetAppContext['kibanaBranch'] = kibanaPackageJSON.branch;
private cloud?: CloudSetup;
private logger: Logger | undefined;
private httpSetup?: HttpServiceSetup;

View file

@ -12,10 +12,9 @@ import { PackageInfo, PackagePolicySOAttributes } from '../types';
import { SavedObjectsUpdateResponse } from 'src/core/server';
import { httpServerMock } from 'src/core/server/mocks';
import { KibanaRequest } from 'kibana/server';
import { xpackMocks } from '../../../../mocks';
import { ExternalCallback } from '..';
import { appContextService } from './app_context';
import { createAppContextStartContractMock } from '../mocks';
import { createAppContextStartContractMock, xpackMocks } from '../mocks';
async function mockedGetAssetsData(_a: any, _b: any, dataset: string) {
if (dataset === 'dataset1') {

View file

@ -565,3 +565,5 @@ async function _compilePackageStream(
export type PackagePolicyServiceInterface = PackagePolicyService;
export const packagePolicyService = new PackagePolicyService();
export type { PackagePolicyService };

View file

@ -5,8 +5,7 @@
* 2.0.
*/
import { xpackMocks } from '../../../../../x-pack/mocks';
import { createAppContextStartContractMock } from '../mocks';
import { createAppContextStartContractMock, xpackMocks } from '../mocks';
import { appContextService } from './app_context';
import { setupIngestManager } from './setup';

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
@ -12,7 +12,9 @@
"common/**/*",
"public/**/*",
"server/**/*",
"scripts/**/*"
"scripts/**/*",
"package.json",
"../../typings/**/*"
],
"references": [
{ "path": "../../../src/core/tsconfig.json" },

View file

@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",

View file

@ -1,69 +1,24 @@
{
"extends": "../tsconfig.base.json",
"include": ["mocks.ts", "typings/**/*", "plugins/**/*", "tasks/**/*"],
"include": [
"mocks.ts",
"typings/**/*",
"tasks/**/*",
"plugins/apm/**/*",
"plugins/case/**/*",
"plugins/lists/**/*",
"plugins/logstash/**/*",
"plugins/monitoring/**/*",
"plugins/security_solution/**/*",
"plugins/xpack_legacy/**/*",
"plugins/drilldowns/url_drilldown/**/*"
],
"exclude": [
"plugins/actions/**/*",
"plugins/alerts/**/*",
"test/**/*",
"plugins/apm/e2e/cypress/**/*",
"plugins/apm/ftr_e2e/**/*",
"plugins/apm/scripts/**/*",
"plugins/banners/**/*",
"plugins/canvas/**/*",
"plugins/console_extensions/**/*",
"plugins/code/**/*",
"plugins/data_enhanced/**/*",
"plugins/discover_enhanced/**/*",
"plugins/dashboard_mode/**/*",
"plugins/dashboard_enhanced/**/*",
"plugins/fleet/**/*",
"plugins/global_search/**/*",
"plugins/global_search_providers/**/*",
"plugins/graph/**/*",
"plugins/features/**/*",
"plugins/file_upload/**/*",
"plugins/embeddable_enhanced/**/*",
"plugins/event_log/**/*",
"plugins/enterprise_search/**/*",
"plugins/infra/**/*",
"plugins/licensing/**/*",
"plugins/lens/**/*",
"plugins/maps/**/*",
"plugins/maps_legacy_licensing/**/*",
"plugins/ml/**/*",
"plugins/observability/**/*",
"plugins/osquery/**/*",
"plugins/reporting/**/*",
"plugins/searchprofiler/**/*",
"plugins/security_solution/cypress/**/*",
"plugins/task_manager/**/*",
"plugins/telemetry_collection_xpack/**/*",
"plugins/transform/**/*",
"plugins/translations/**/*",
"plugins/triggers_actions_ui/**/*",
"plugins/ui_actions_enhanced/**/*",
"plugins/spaces/**/*",
"plugins/security/**/*",
"plugins/stack_alerts/**/*",
"plugins/encrypted_saved_objects/**/*",
"plugins/beats_management/**/*",
"plugins/cloud/**/*",
"plugins/saved_objects_tagging/**/*",
"plugins/global_search_bar/**/*",
"plugins/ingest_pipelines/**/*",
"plugins/license_management/**/*",
"plugins/snapshot_restore/**/*",
"plugins/painless_lab/**/*",
"plugins/watcher/**/*",
"plugins/runtime_fields/**/*",
"plugins/index_management/**/*",
"plugins/grokdebugger/**/*",
"plugins/upgrade_assistant/**/*",
"plugins/rollup/**/*",
"plugins/remote_clusters/**/*",
"plugins/cross_cluster_replication/**/*",
"plugins/index_lifecycle_management/**/*",
"plugins/uptime/**/*",
"test/**/*"
"plugins/security_solution/cypress/**/*"
],
"compilerOptions": {
// overhead is too significant
@ -121,6 +76,7 @@
{ "path": "./plugins/event_log/tsconfig.json" },
{ "path": "./plugins/features/tsconfig.json" },
{ "path": "./plugins/file_upload/tsconfig.json" },
{ "path": "./plugins/fleet/tsconfig.json" },
{ "path": "./plugins/global_search_bar/tsconfig.json" },
{ "path": "./plugins/global_search_providers/tsconfig.json" },
{ "path": "./plugins/global_search/tsconfig.json" },