Skip to content

Commit

Permalink
Merge branch 'master' into fix/olm-hide_content_while_checking_if_ent…
Browse files Browse the repository at this point in the history
…ries_exists-100137
  • Loading branch information
kibanamachine authored May 18, 2021
2 parents ed2873a + 574b455 commit 6e29972
Show file tree
Hide file tree
Showing 572 changed files with 4,062 additions and 6,903 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.

1 change: 0 additions & 1 deletion src/plugins/home/server/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export type { TutorialsRegistrySetup, TutorialsRegistryStart } from './tutorials
export { TutorialsCategory } from './tutorials';

export type {
ParamTypes,
InstructionSetSchema,
ParamsSchema,
InstructionsSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
* Side Public License, v 1.
*/

import { SavedObject } from 'src/core/server';
import type { SampleDatasetSchema } from './sample_dataset_schema';
export type { SampleDatasetSchema, AppLinkSchema, DataIndexSchema } from './sample_dataset_schema';

export enum DatasetStatusTypes {
NOT_INSTALLED = 'not_installed',
Expand All @@ -26,57 +27,4 @@ export enum EmbeddableTypes {
SEARCH_EMBEDDABLE_TYPE = 'search',
VISUALIZE_EMBEDDABLE_TYPE = 'visualization',
}
export interface DataIndexSchema {
id: string;

// path to newline delimented JSON file containing data relative to KIBANA_HOME
dataPath: string;

// Object defining Elasticsearch field mappings (contents of index.mappings.type.properties)
fields: object;

// times fields that will be updated relative to now when data is installed
timeFields: string[];

// Reference to now in your test data set.
// When data is installed, timestamps are converted to the present time.
// The distance between a timestamp and currentTimeMarker is preserved but the date and time will change.
// For example:
// sample data set: timestamp: 2018-01-01T00:00:00Z, currentTimeMarker: 2018-01-01T12:00:00Z
// installed data set: timestamp: 2018-04-18T20:33:14Z, currentTimeMarker: 2018-04-19T08:33:14Z
currentTimeMarker: string;

// Set to true to move timestamp to current week, preserving day of week and time of day
// Relative distance from timestamp to currentTimeMarker will not remain the same
preserveDayOfWeekTimeOfDay: boolean;
}

export interface AppLinkSchema {
path: string;
icon: string;
label: string;
}

export interface SampleDatasetSchema<T = unknown> {
id: string;
name: string;
description: string;
previewImagePath: string;
darkPreviewImagePath: string;

// saved object id of main dashboard for sample data set
overviewDashboard: string;
appLinks: AppLinkSchema[];

// saved object id of default index-pattern for sample data set
defaultIndex: string;

// Kibana saved objects (index patter, visualizations, dashboard, ...)
// Should provide a nice demo of Kibana's functionality with the sample data set
savedObjects: Array<SavedObject<T>>;
dataIndices: DataIndexSchema[];
status?: string | undefined;
statusMsg?: unknown;
}

export type SampleDatasetProvider = () => SampleDatasetSchema;
Loading

0 comments on commit 6e29972

Please sign in to comment.