Skip to content

Commit

Permalink
Merge branch 'master' into 97247
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored May 18, 2021
2 parents 2612cba + 15abf24 commit 84c8f5c
Show file tree
Hide file tree
Showing 525 changed files with 2,394 additions and 5,990 deletions.
5 changes: 5 additions & 0 deletions packages/elastic-eslint-config-kibana/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ module.exports = {
to: '@kbn/tinymath',
disallowedMessage: `Don't use 'tinymath', use '@kbn/tinymath'`
},
{
from: '@kbn/test/types/ftr',
to: '@kbn/test',
disallowedMessage: `import from the root of @kbn/test instead`
},
],
],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pageLoadAssetSize:
searchprofiler: 67080
security: 95864
securityOss: 30806
securitySolution: 187863
securitySolution: 76000
share: 99061
snapshotRestore: 79032
spaces: 57868
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 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 { ElasticsearchClient } from 'src/core/server';
import { ElasticsearchClient } from '../elasticsearch_client';

interface AliasesResponse {
[indexName: string]: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 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 { ElasticsearchClient } from 'src/core/server';
import { ElasticsearchClient } from '../elasticsearch_client';

/**
* Retrieves the count of documents in a given index
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-securitysolution-es-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ export * from './delete_all_index';
export * from './delete_policy';
export * from './delete_template';
export * from './elasticsearch_client';
export * from './get_index_aliases';
export * from './get_index_count';
export * from './get_index_exists';
export * from './get_policy_exists';
export * from './get_template_exists';
export * from './read_index';
export * from './read_privileges';
export * from './set_policy';
export * from './set_template';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 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 { ElasticsearchClient } from 'kibana/server';
import { ElasticsearchClient } from '../elasticsearch_client';

export const readIndex = async (esClient: ElasticsearchClient, index: string): Promise<unknown> => {
return esClient.indices.get({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ export const from = new t.Type<string, string, unknown>(
t.identity
);
export type From = t.TypeOf<typeof from>;

export const fromOrUndefined = t.union([from, t.undefined]);
export type FromOrUndefined = t.TypeOf<typeof fromOrUndefined>;
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export * from './default_to_string';
export * from './default_uuid';
export * from './from';
export * from './language';
export * from './machine_learning_job_id';
export * from './max_signals';
export * from './normalized_ml_job_id';
export * from './references_default_array';
Expand All @@ -38,3 +39,4 @@ export * from './threat_subtechnique';
export * from './threat_tactic';
export * from './threat_technique';
export * from './throttle';
export * from './type';
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ import * as t from 'io-ts';

export const language = t.keyof({ eql: null, kuery: null, lucene: null });
export type Language = t.TypeOf<typeof language>;

export const languageOrUndefined = t.union([language, t.undefined]);
export type LanguageOrUndefined = t.TypeOf<typeof languageOrUndefined>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 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 @typescript-eslint/naming-convention */

import * as t from 'io-ts';

import { machine_learning_job_id_normalized } from '../normalized_ml_job_id';

export const machine_learning_job_id = t.union([t.string, machine_learning_job_id_normalized]);
export type MachineLearningJobId = t.TypeOf<typeof machine_learning_job_id>;

export const machineLearningJobIdOrUndefined = t.union([machine_learning_job_id, t.undefined]);
export type MachineLearningJobIdOrUndefined = t.TypeOf<typeof machineLearningJobIdOrUndefined>;
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ import { PositiveIntegerGreaterThanZero } from '@kbn/securitysolution-io-ts-type

export const max_signals = PositiveIntegerGreaterThanZero;
export type MaxSignals = t.TypeOf<typeof max_signals>;

export const maxSignalsOrUndefined = t.union([max_signals, t.undefined]);
export type MaxSignalsOrUndefined = t.TypeOf<typeof maxSignalsOrUndefined>;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Side Public License, v 1.
*/

/* eslint-disable @typescript-eslint/naming-convention */

import * as t from 'io-ts';
import { Either } from 'fp-ts/lib/Either';

Expand All @@ -26,3 +28,9 @@ export const RiskScore = new t.Type<number, number, unknown>(
);

export type RiskScoreC = typeof RiskScore;

export const risk_score = RiskScore;
export type RiskScore = t.TypeOf<typeof risk_score>;

export const riskScoreOrUndefined = t.union([risk_score, t.undefined]);
export type RiskScoreOrUndefined = t.TypeOf<typeof riskScoreOrUndefined>;
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

import * as t from 'io-ts';
import { operator } from '@kbn/securitysolution-io-ts-types';
import { RiskScore } from '../risk_score';

export const riskScoreOrUndefined = t.union([RiskScore, t.undefined]);
export type RiskScoreOrUndefined = t.TypeOf<typeof riskScoreOrUndefined>;
import { riskScoreOrUndefined } from '../risk_score';

export const risk_score_mapping_field = t.string;
export const risk_score_mapping_value = t.string;
Expand All @@ -28,3 +25,6 @@ export const risk_score_mapping_item = t.exact(

export const risk_score_mapping = t.array(risk_score_mapping_item);
export type RiskScoreMapping = t.TypeOf<typeof risk_score_mapping>;

export const riskScoreMappingOrUndefined = t.union([risk_score_mapping, t.undefined]);
export type RiskScoreMappingOrUndefined = t.TypeOf<typeof riskScoreMappingOrUndefined>;
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ export type Threat = t.TypeOf<typeof threat>;

export const threats = t.array(threat);
export type Threats = t.TypeOf<typeof threats>;

export const threatsOrUndefined = t.union([threats, t.undefined]);
export type ThreatsOrUndefined = t.TypeOf<typeof threatsOrUndefined>;
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ export const threat_subtechnique = t.type({
});

export const threat_subtechniques = t.array(threat_subtechnique);

export type ThreatSubtechnique = t.TypeOf<typeof threat_subtechnique>;
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ export const threat_technique = t.intersection([
),
]);
export const threat_techniques = t.array(threat_technique);

export type ThreatTechnique = t.TypeOf<typeof threat_technique>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 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 * as t from 'io-ts';

export const type = t.keyof({
eql: null,
machine_learning: null,
query: null,
saved_query: null,
threshold: null,
threat_match: null,
});
export type Type = t.TypeOf<typeof type>;

export const typeOrUndefined = t.union([type, t.undefined]);
export type TypeOrUndefined = t.TypeOf<typeof typeOrUndefined>;
2 changes: 0 additions & 2 deletions packages/kbn-securitysolution-io-ts-list-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export * from './default_create_comments_array';
export * from './default_namespace';
export * from './default_namespace_array';
export * from './default_update_comments_array';
export * from './default_version_number';
export * from './description';
export * from './endpoint';
export * from './entries';
Expand All @@ -43,4 +42,3 @@ export * from './type';
export * from './update_comment';
export * from './updated_at';
export * from './updated_by';
export * from './version';
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ export const type = t.keyof({

export const typeOrUndefined = t.union([type, t.undefined]);
export type Type = t.TypeOf<typeof type>;
export type TypeOrUndefined = t.TypeOf<typeof typeOrUndefined>;
2 changes: 2 additions & 0 deletions packages/kbn-securitysolution-io-ts-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export * from './default_empty_string';
export * from './default_string_array';
export * from './default_string_boolean_false';
export * from './default_uuid';
export * from './default_version_number';
export * from './empty_string_array';
export * from './iso_date_string';
export * from './non_empty_array';
Expand All @@ -26,3 +27,4 @@ export * from './positive_integer';
export * from './positive_integer_greater_than_zero';
export * from './string_to_positive_number';
export * from './uuid';
export * from './version';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import * as t from 'io-ts';
import { PositiveIntegerGreaterThanZero } from '@kbn/securitysolution-io-ts-types';
import { PositiveIntegerGreaterThanZero } from '../positive_integer_greater_than_zero';

/**
* Note this is just a positive number, but we use it as a type here which is still ok.
Expand All @@ -16,3 +16,6 @@ import { PositiveIntegerGreaterThanZero } from '@kbn/securitysolution-io-ts-type
*/
export const version = PositiveIntegerGreaterThanZero;
export type Version = t.TypeOf<typeof version>;

export const versionOrUndefined = t.union([version, t.undefined]);
export type VersionOrUndefined = t.TypeOf<typeof versionOrUndefined>;
4 changes: 2 additions & 2 deletions packages/kbn-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "1.0.0",
"private": true,
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target/index.js",
"types": "./target/types/index.d.ts",
"main": "./target",
"types": "./target/types",
"scripts": {
"build": "node scripts/build",
"kbn:bootstrap": "node scripts/build --source-maps",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-test/src/functional_test_runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export { FunctionalTestRunner } from './functional_test_runner';
export { readConfigFile, Config } from './lib';
export { runFtrCli } from './cli';
export * from './lib/docker_servers';
export * from './public_types';
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@
*/

import { ToolingLog } from '@kbn/dev-utils';
import {
Config,
Lifecycle,
FailureMetadata,
DockerServersService,
} from '../src/functional_test_runner/lib';
import { Test, Suite } from '../src/functional_test_runner/fake_mocha_types';

import { Config, Lifecycle, FailureMetadata, DockerServersService } from './lib';
import { Test, Suite } from './fake_mocha_types';

export { Lifecycle, Config, FailureMetadata };

Expand Down
4 changes: 1 addition & 3 deletions packages/kbn-test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"sourceRoot": "../../../../../packages/kbn-test/src",
"sourceRoot": "../../../../../../packages/kbn-test/src",
"types": [
"jest",
"node"
],
},
"include": [
"types/**/*",
"src/**/*",
"index.d.ts"
],
"exclude": [
"types/ftr_globals/**/*",
"**/__fixtures__/**/*"
]
}
5 changes: 0 additions & 5 deletions packages/kbn-test/types/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion test/accessibility/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { FtrConfigProviderContext } from '@kbn/test/types/ftr';
import { FtrConfigProviderContext } from '@kbn/test';
import { services } from './services';
import { pageObjects } from './page_objects';

Expand Down
2 changes: 1 addition & 1 deletion test/accessibility/ftr_provider_context.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { GenericFtrProviderContext } from '@kbn/test/types/ftr';
import { GenericFtrProviderContext } from '@kbn/test';

import { pageObjects } from './page_objects';
import { services } from './services';
Expand Down
2 changes: 1 addition & 1 deletion test/api_integration/ftr_provider_context.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { GenericFtrProviderContext } from '@kbn/test/types/ftr';
import { GenericFtrProviderContext } from '@kbn/test';

import { services } from './services';

Expand Down
2 changes: 1 addition & 1 deletion test/common/ftr_provider_context.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { GenericFtrProviderContext } from '@kbn/test/types/ftr';
import { GenericFtrProviderContext } from '@kbn/test';

import { services } from './services';

Expand Down
9 changes: 6 additions & 3 deletions test/functional/apps/dashboard/dashboard_save.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['dashboard', 'header']);
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize']);
const listingTable = getService('listingTable');
const testSubjects = getService('testSubjects');
const dashboardAddPanel = getService('dashboardAddPanel');

// FLAKY: https://github.com/elastic/kibana/issues/89476
describe.skip('dashboard save', function describeIndexTests() {
describe('dashboard save', function describeIndexTests() {
this.tags('includeFirefox');
const dashboardName = 'Dashboard Save Test';
const dashboardNameEnterKey = 'Dashboard Save Test with Enter Key';
Expand Down Expand Up @@ -127,6 +127,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

await PageObjects.dashboard.switchToEditMode();
await PageObjects.dashboard.expectExistsQuickSaveOption();
await dashboardAddPanel.clickMarkdownQuickButton();
await PageObjects.visualize.saveVisualizationAndReturn();
await PageObjects.dashboard.waitForRenderComplete();
await PageObjects.dashboard.clickQuickSave();

await testSubjects.existOrFail('saveDashboardSuccess');
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/discover/ftr_provider_context.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { GenericFtrProviderContext } from '@kbn/test/types/ftr';
import { GenericFtrProviderContext } from '@kbn/test';
import { services } from '../../services';
import { pageObjects } from '../../page_objects';

Expand Down
Loading

0 comments on commit 84c8f5c

Please sign in to comment.