= (
coreSetup: CoreSetup,
@@ -49,6 +50,7 @@ export type ServiceFromProvider = P extends CanvasServiceProvider ?
export const services = {
notify: new CanvasServiceProvider(notifyServiceFactory),
+ platform: new CanvasServiceProvider(platformServiceFactory),
};
export interface CanvasServices {
@@ -70,4 +72,4 @@ export const stopServices = () => {
Object.entries(services).forEach(([key, provider]) => provider.stop());
};
-export const { notify: notifyService } = services;
+export const { notify: notifyService, platform: platformService } = services;
diff --git a/x-pack/legacy/plugins/canvas/public/services/platform.ts b/x-pack/legacy/plugins/canvas/public/services/platform.ts
new file mode 100644
index 00000000000000..440e9523044c1c
--- /dev/null
+++ b/x-pack/legacy/plugins/canvas/public/services/platform.ts
@@ -0,0 +1,24 @@
+/*
+ * 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 { CanvasServiceFactory } from '.';
+import { CoreStart, CoreSetup, CanvasSetupDeps, CanvasStartDeps } from '../plugin';
+
+interface PlatformService {
+ coreSetup: CoreSetup;
+ coreStart: CoreStart;
+ setupPlugins: CanvasSetupDeps;
+ startPlugins: CanvasStartDeps;
+}
+
+export const platformServiceFactory: CanvasServiceFactory = (
+ coreSetup,
+ coreStart,
+ setupPlugins,
+ startPlugins
+) => {
+ return { coreSetup, coreStart, setupPlugins, startPlugins };
+};
diff --git a/x-pack/legacy/plugins/canvas/public/state/initial_state.js b/x-pack/legacy/plugins/canvas/public/state/initial_state.js
index 40c017543147fc..bfa68b33908e01 100644
--- a/x-pack/legacy/plugins/canvas/public/state/initial_state.js
+++ b/x-pack/legacy/plugins/canvas/public/state/initial_state.js
@@ -5,7 +5,7 @@
*/
import { get } from 'lodash';
-import { getCoreStart } from '../legacy';
+import { platformService } from '../services';
import { getDefaultWorkpad } from './defaults';
export const getInitialState = path => {
@@ -13,7 +13,7 @@ export const getInitialState = path => {
app: {}, // Kibana stuff in here
assets: {}, // assets end up here
transient: {
- canUserWrite: getCoreStart().application.capabilities.canvas.save,
+ canUserWrite: platformService.getService().coreStart.application.capabilities.canvas.save,
zoomScale: 1,
elementStats: {
total: 0,
diff --git a/x-pack/legacy/plugins/canvas/public/state/reducers/workpad.js b/x-pack/legacy/plugins/canvas/public/state/reducers/workpad.js
index 12733680ed32d4..30f9c638a054fe 100644
--- a/x-pack/legacy/plugins/canvas/public/state/reducers/workpad.js
+++ b/x-pack/legacy/plugins/canvas/public/state/reducers/workpad.js
@@ -5,7 +5,7 @@
*/
import { handleActions } from 'redux-actions';
-import { getCoreStart } from '../../legacy';
+import { platformService } from '../../services';
import { getDefaultWorkpad } from '../defaults';
import {
setWorkpad,
@@ -22,11 +22,13 @@ import { APP_ROUTE_WORKPAD } from '../../../common/lib/constants';
export const workpadReducer = handleActions(
{
[setWorkpad]: (workpadState, { payload }) => {
- getCoreStart().chrome.recentlyAccessed.add(
- `${APP_ROUTE_WORKPAD}/${payload.id}`,
- payload.name,
- payload.id
- );
+ platformService
+ .getService()
+ .coreStart.chrome.recentlyAccessed.add(
+ `${APP_ROUTE_WORKPAD}/${payload.id}`,
+ payload.name,
+ payload.id
+ );
return payload;
},
@@ -39,11 +41,13 @@ export const workpadReducer = handleActions(
},
[setName]: (workpadState, { payload }) => {
- getCoreStart().chrome.recentlyAccessed.add(
- `${APP_ROUTE_WORKPAD}/${workpadState.id}`,
- payload,
- workpadState.id
- );
+ platformService
+ .getService()
+ .coreStart.chrome.recentlyAccessed.add(
+ `${APP_ROUTE_WORKPAD}/${workpadState.id}`,
+ payload,
+ workpadState.id
+ );
return { ...workpadState, name: payload };
},
diff --git a/x-pack/legacy/plugins/maps/index.js b/x-pack/legacy/plugins/maps/index.js
index d1e8892fa2c984..a1186e04ee27a6 100644
--- a/x-pack/legacy/plugins/maps/index.js
+++ b/x-pack/legacy/plugins/maps/index.js
@@ -54,7 +54,7 @@ export function maps(kibana) {
emsLandingPageUrl: mapConfig.emsLandingPageUrl,
kbnPkgVersion: serverConfig.get('pkg.version'),
regionmapLayers: _.get(mapConfig, 'regionmap.layers', []),
- tilemap: _.get(mapConfig, 'tilemap', []),
+ tilemap: _.get(mapConfig, 'tilemap', {}),
};
},
styleSheetPaths: `${__dirname}/public/index.scss`,
diff --git a/x-pack/legacy/plugins/maps/public/angular/map_controller.js b/x-pack/legacy/plugins/maps/public/angular/map_controller.js
index 1b1fbf111fe04b..bb1a6b74d43a70 100644
--- a/x-pack/legacy/plugins/maps/public/angular/map_controller.js
+++ b/x-pack/legacy/plugins/maps/public/angular/map_controller.js
@@ -336,7 +336,7 @@ app.controller(
function addFilters(newFilters) {
newFilters.forEach(filter => {
- filter.$state = esFilters.FilterStateStore.APP_STATE;
+ filter.$state = { store: esFilters.FilterStateStore.APP_STATE };
});
$scope.updateFiltersAndDispatch([...$scope.filters, ...newFilters]);
}
diff --git a/x-pack/legacy/plugins/monitoring/common/constants.ts b/x-pack/legacy/plugins/monitoring/common/constants.ts
index 3a4c7b71dcd03d..36030e1fa7f2a5 100644
--- a/x-pack/legacy/plugins/monitoring/common/constants.ts
+++ b/x-pack/legacy/plugins/monitoring/common/constants.ts
@@ -251,7 +251,7 @@ export const ALERT_TYPES = [ALERT_TYPE_LICENSE_EXPIRATION, ALERT_TYPE_CLUSTER_ST
/**
* Matches the id for the built-in in email action type
- * See x-pack/legacy/plugins/actions/server/builtin_action_types/email.ts
+ * See x-pack/plugins/actions/server/builtin_action_types/email.ts
*/
export const ALERT_ACTION_TYPE_EMAIL = '.email';
diff --git a/x-pack/legacy/plugins/monitoring/public/np_imports/angular/modules.ts b/x-pack/legacy/plugins/monitoring/public/np_imports/angular/modules.ts
index a047c25c2b1d74..c6031cb2203341 100644
--- a/x-pack/legacy/plugins/monitoring/public/np_imports/angular/modules.ts
+++ b/x-pack/legacy/plugins/monitoring/public/np_imports/angular/modules.ts
@@ -5,6 +5,8 @@
*/
import angular, { IWindowService } from 'angular';
+// required for `ngSanitize` angular module
+import 'angular-sanitize';
import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular';
import { AppMountContext } from 'kibana/public';
diff --git a/x-pack/legacy/plugins/remote_clusters/index.ts b/x-pack/legacy/plugins/remote_clusters/index.ts
deleted file mode 100644
index 439cb818d8a562..00000000000000
--- a/x-pack/legacy/plugins/remote_clusters/index.ts
+++ /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 { resolve } from 'path';
-import { Legacy } from 'kibana';
-
-import { PLUGIN } from './common';
-
-export function remoteClusters(kibana: any) {
- return new kibana.Plugin({
- id: PLUGIN.ID,
- configPrefix: 'xpack.remote_clusters',
- publicDir: resolve(__dirname, 'public'),
- require: ['kibana'],
- uiExports: {
- styleSheetPaths: resolve(__dirname, 'public/index.scss'),
- },
- // TODO: Remove once CCR has migrated to NP
- config(Joi: any) {
- return Joi.object({
- // display menu item
- ui: Joi.object({
- enabled: Joi.boolean().default(true),
- }).default(),
-
- // enable plugin
- enabled: Joi.boolean().default(true),
- }).default();
- },
- isEnabled(config: Legacy.KibanaConfig) {
- return (
- config.get('xpack.remote_clusters.enabled') && config.get('xpack.index_management.enabled')
- );
- },
- init() {},
- });
-}
diff --git a/x-pack/legacy/plugins/security/index.ts b/x-pack/legacy/plugins/security/index.ts
index 5b2218af1fd521..b1dec2ce82c520 100644
--- a/x-pack/legacy/plugins/security/index.ts
+++ b/x-pack/legacy/plugins/security/index.ts
@@ -78,9 +78,7 @@ export const security = (kibana: Record) =>
// features are up to date.
xpackInfo
.feature(this.id)
- .registerLicenseCheckResultsGenerator(() =>
- securityPlugin.__legacyCompat.license.getFeatures()
- );
+ .registerLicenseCheckResultsGenerator(() => securityPlugin.license.getFeatures());
server.expose({
getUser: async (request: LegacyRequest) =>
diff --git a/x-pack/legacy/plugins/task_manager/server/index.ts b/x-pack/legacy/plugins/task_manager/server/index.ts
index 3ea687f7003f40..a3167920efa06c 100644
--- a/x-pack/legacy/plugins/task_manager/server/index.ts
+++ b/x-pack/legacy/plugins/task_manager/server/index.ts
@@ -6,8 +6,6 @@
import { Root } from 'joi';
import { Legacy } from 'kibana';
-import mappings from './mappings.json';
-import { migrations } from './migrations';
import { createLegacyApi, getTaskManagerSetup } from './legacy';
export { LegacyTaskManagerApi, getTaskManagerSetup, getTaskManagerStart } from './legacy';
@@ -21,19 +19,6 @@ import {
ArrayOrItem,
} from '../../../../../src/legacy/plugin_discovery/types';
-const savedObjectSchemas = {
- task: {
- hidden: true,
- isNamespaceAgnostic: true,
- convertToAliasScript: `ctx._id = ctx._source.type + ':' + ctx._id`,
- // legacy config is marked as any in core, no choice here
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- indexPattern(config: any) {
- return config.get('xpack.task_manager.index');
- },
- },
-};
-
export function taskManager(kibana: LegacyPluginApi): ArrayOrItem {
return new kibana.Plugin({
id: 'task_manager',
@@ -58,7 +43,7 @@ export function taskManager(kibana: LegacyPluginApi): ArrayOrItem {
// we can't tell the Kibana Platform Task Manager plugin to
// to wait to `start` as that happens before legacy plugins
@@ -77,10 +62,5 @@ export function taskManager(kibana: LegacyPluginApi): ArrayOrItem
- new kibana.Plugin({
- configPrefix: 'xpack.uptime',
- id: PLUGIN.ID,
- publicDir: resolve(__dirname, 'public'),
- require: ['alerting', 'kibana', 'elasticsearch', 'xpack_main'],
- uiExports: {
- app: {
- description: i18n.translate('xpack.uptime.pluginDescription', {
- defaultMessage: 'Uptime monitoring',
- description: 'The description text that will be shown to users in Kibana',
- }),
- icon: 'plugins/uptime/icons/heartbeat_white.svg',
- euiIconType: 'uptimeApp',
- title: i18n.translate('xpack.uptime.uptimeFeatureCatalogueTitle', {
- defaultMessage: 'Uptime',
- }),
- main: 'plugins/uptime/app',
- order: 8900,
- url: '/app/uptime#/',
- category: DEFAULT_APP_CATEGORIES.observability,
- },
- home: ['plugins/uptime/register_feature'],
- },
- });
diff --git a/x-pack/legacy/plugins/uptime/public/apps/index.ts b/x-pack/legacy/plugins/uptime/public/apps/index.ts
deleted file mode 100644
index d58bf8398fcdea..00000000000000
--- a/x-pack/legacy/plugins/uptime/public/apps/index.ts
+++ /dev/null
@@ -1,16 +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 { Plugin } from './plugin';
-import 'uiExports/embeddableFactories';
-
-const plugin = new Plugin({
- opaqueId: Symbol('uptime'),
- env: {} as any,
- config: { get: () => ({} as any) },
-});
-plugin.setup(npSetup);
diff --git a/x-pack/legacy/plugins/uptime/public/apps/plugin.ts b/x-pack/legacy/plugins/uptime/public/apps/plugin.ts
deleted file mode 100644
index e73598c44c9f08..00000000000000
--- a/x-pack/legacy/plugins/uptime/public/apps/plugin.ts
+++ /dev/null
@@ -1,56 +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 { LegacyCoreSetup, PluginInitializerContext, AppMountParameters } from 'src/core/public';
-import { PluginsSetup } from 'ui/new_platform/new_platform';
-import { FeatureCatalogueCategory } from '../../../../../../src/plugins/home/public';
-import { UMFrontendLibs } from '../lib/lib';
-import { PLUGIN } from '../../common/constants';
-import { getKibanaFrameworkAdapter } from '../lib/adapters/framework/new_platform_adapter';
-
-export interface SetupObject {
- core: LegacyCoreSetup;
- plugins: PluginsSetup;
-}
-
-export class Plugin {
- constructor(
- // @ts-ignore this is added to satisfy the New Platform typing constraint,
- // but we're not leveraging any of its functionality yet.
- private readonly initializerContext: PluginInitializerContext
- ) {}
-
- public setup(setup: SetupObject) {
- const { core, plugins } = setup;
- const { home } = plugins;
-
- home.featureCatalogue.register({
- category: FeatureCatalogueCategory.DATA,
- description: PLUGIN.DESCRIPTION,
- icon: 'uptimeApp',
- id: PLUGIN.ID,
- path: '/app/uptime#/',
- showOnHomePage: true,
- title: PLUGIN.TITLE,
- });
-
- core.application.register({
- id: PLUGIN.ID,
- euiIconType: 'uptimeApp',
- order: 8900,
- title: 'Uptime',
- async mount(params: AppMountParameters) {
- const [coreStart] = await core.getStartServices();
- const { element } = params;
- const libs: UMFrontendLibs = {
- framework: getKibanaFrameworkAdapter(coreStart, plugins),
- };
- libs.framework.render(element);
- return () => {};
- },
- });
- }
-}
diff --git a/x-pack/legacy/plugins/uptime/public/register_feature.ts b/x-pack/legacy/plugins/uptime/public/register_feature.ts
deleted file mode 100644
index 2f83fa33ba4bc5..00000000000000
--- a/x-pack/legacy/plugins/uptime/public/register_feature.ts
+++ /dev/null
@@ -1,25 +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 { i18n } from '@kbn/i18n';
-import { npSetup } from 'ui/new_platform';
-import { FeatureCatalogueCategory } from '../../../../../src/plugins/home/public';
-
-const {
- plugins: { home },
-} = npSetup;
-
-home.featureCatalogue.register({
- id: 'uptime',
- title: i18n.translate('xpack.uptime.uptimeFeatureCatalogueTitle', { defaultMessage: 'Uptime' }),
- description: i18n.translate('xpack.uptime.featureCatalogueDescription', {
- defaultMessage: 'Perform endpoint health checks and uptime monitoring.',
- }),
- icon: 'uptimeApp',
- path: `uptime#/`,
- showOnHomePage: true,
- category: FeatureCatalogueCategory.DATA,
-});
diff --git a/x-pack/legacy/plugins/uptime/tsconfig.json b/x-pack/legacy/plugins/uptime/tsconfig.json
deleted file mode 100644
index 53425909db3e8b..00000000000000
--- a/x-pack/legacy/plugins/uptime/tsconfig.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "extends": "../../../tsconfig.json",
- "exclude": ["**/node_modules/**"],
- "paths": {
- "react": ["../../../node_modules/@types/react"]
- }
-}
\ No newline at end of file
diff --git a/x-pack/package.json b/x-pack/package.json
index 604889c6094b9c..dcc9b8c61cb960 100644
--- a/x-pack/package.json
+++ b/x-pack/package.json
@@ -105,6 +105,7 @@
"@types/recompose": "^0.30.6",
"@types/reduce-reducers": "^1.0.0",
"@types/redux-actions": "^2.6.1",
+ "@types/set-value": "^2.0.0",
"@types/sinon": "^7.0.13",
"@types/styled-components": "^4.4.2",
"@types/supertest": "^2.0.5",
@@ -344,6 +345,7 @@
"rison-node": "0.3.1",
"rxjs": "^6.5.3",
"semver": "5.7.0",
+ "set-value": "^3.0.2",
"squel": "^5.13.0",
"stats-lite": "^2.2.0",
"style-it": "^2.1.3",
diff --git a/x-pack/plugins/actions/server/lib/action_executor.ts b/x-pack/plugins/actions/server/lib/action_executor.ts
index 101e18f2583e39..3e9262c05efac4 100644
--- a/x-pack/plugins/actions/server/lib/action_executor.ts
+++ b/x-pack/plugins/actions/server/lib/action_executor.ts
@@ -17,7 +17,7 @@ import {
import { EncryptedSavedObjectsPluginStart } from '../../../encrypted_saved_objects/server';
import { SpacesServiceSetup } from '../../../spaces/server';
import { EVENT_LOG_ACTIONS } from '../plugin';
-import { IEvent, IEventLogger } from '../../../event_log/server';
+import { IEvent, IEventLogger, SAVED_OBJECT_REL_PRIMARY } from '../../../event_log/server';
export interface ActionExecutorContext {
logger: Logger;
@@ -110,7 +110,16 @@ export class ActionExecutor {
const actionLabel = `${actionTypeId}:${actionId}: ${name}`;
const event: IEvent = {
event: { action: EVENT_LOG_ACTIONS.execute },
- kibana: { saved_objects: [{ type: 'action', id: actionId, ...namespace }] },
+ kibana: {
+ saved_objects: [
+ {
+ rel: SAVED_OBJECT_REL_PRIMARY,
+ type: 'action',
+ id: actionId,
+ ...namespace,
+ },
+ ],
+ },
};
eventLogger.startTiming(event);
diff --git a/x-pack/plugins/actions/server/plugin.ts b/x-pack/plugins/actions/server/plugin.ts
index 10e4d645843401..a6cc1fb5463bbb 100644
--- a/x-pack/plugins/actions/server/plugin.ts
+++ b/x-pack/plugins/actions/server/plugin.ts
@@ -53,6 +53,7 @@ import {
} from './routes';
import { IEventLogger, IEventLogService } from '../../event_log/server';
import { initializeActionsTelemetry, scheduleActionsTelemetry } from './usage/task';
+import { setupSavedObjects } from './saved_objects';
const EVENT_LOG_PROVIDER = 'actions';
export const EVENT_LOG_ACTIONS = {
@@ -133,19 +134,7 @@ export class ActionsPlugin implements Plugin, Plugi
);
}
- // Encrypted attributes
- // - `secrets` properties will be encrypted
- // - `config` will be included in AAD
- // - everything else excluded from AAD
- plugins.encryptedSavedObjects.registerType({
- type: 'action',
- attributesToEncrypt: new Set(['secrets']),
- attributesToExcludeFromAAD: new Set(['name']),
- });
- plugins.encryptedSavedObjects.registerType({
- type: 'action_task_params',
- attributesToEncrypt: new Set(['apiKey']),
- });
+ setupSavedObjects(core.savedObjects, plugins.encryptedSavedObjects);
plugins.eventLog.registerProviderActions(EVENT_LOG_PROVIDER, Object.values(EVENT_LOG_ACTIONS));
this.eventLogger = plugins.eventLog.getLogger({
diff --git a/x-pack/plugins/actions/server/saved_objects/index.ts b/x-pack/plugins/actions/server/saved_objects/index.ts
new file mode 100644
index 00000000000000..dbd7925f968713
--- /dev/null
+++ b/x-pack/plugins/actions/server/saved_objects/index.ts
@@ -0,0 +1,42 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { SavedObjectsServiceSetup } from 'kibana/server';
+import mappings from './mappings.json';
+import { EncryptedSavedObjectsPluginSetup } from '../../../encrypted_saved_objects/server';
+
+export function setupSavedObjects(
+ savedObjects: SavedObjectsServiceSetup,
+ encryptedSavedObjects: EncryptedSavedObjectsPluginSetup
+) {
+ savedObjects.registerType({
+ name: 'action',
+ hidden: false,
+ namespaceType: 'single',
+ mappings: mappings.action,
+ });
+
+ // Encrypted attributes
+ // - `secrets` properties will be encrypted
+ // - `config` will be included in AAD
+ // - everything else excluded from AAD
+ encryptedSavedObjects.registerType({
+ type: 'action',
+ attributesToEncrypt: new Set(['secrets']),
+ attributesToExcludeFromAAD: new Set(['name']),
+ });
+
+ savedObjects.registerType({
+ name: 'action_task_params',
+ hidden: false,
+ namespaceType: 'single',
+ mappings: mappings.action_task_params,
+ });
+ encryptedSavedObjects.registerType({
+ type: 'action_task_params',
+ attributesToEncrypt: new Set(['apiKey']),
+ });
+}
diff --git a/x-pack/legacy/plugins/actions/server/mappings.json b/x-pack/plugins/actions/server/saved_objects/mappings.json
similarity index 100%
rename from x-pack/legacy/plugins/actions/server/mappings.json
rename to x-pack/plugins/actions/server/saved_objects/mappings.json
diff --git a/x-pack/plugins/alerting/server/plugin.ts b/x-pack/plugins/alerting/server/plugin.ts
index c03d3506a051d4..8cdde2eeb9877a 100644
--- a/x-pack/plugins/alerting/server/plugin.ts
+++ b/x-pack/plugins/alerting/server/plugin.ts
@@ -58,6 +58,7 @@ import { Services } from './types';
import { registerAlertsUsageCollector } from './usage';
import { initializeAlertingTelemetry, scheduleAlertingTelemetry } from './usage/task';
import { IEventLogger, IEventLogService } from '../../event_log/server';
+import { setupSavedObjects } from './saved_objects';
const EVENT_LOG_PROVIDER = 'alerting';
export const EVENT_LOG_ACTIONS = {
@@ -134,17 +135,7 @@ export class AlertingPlugin {
);
}
- // Encrypted attributes
- plugins.encryptedSavedObjects.registerType({
- type: 'alert',
- attributesToEncrypt: new Set(['apiKey']),
- attributesToExcludeFromAAD: new Set([
- 'scheduledTaskId',
- 'muteAll',
- 'mutedInstanceIds',
- 'updatedBy',
- ]),
- });
+ setupSavedObjects(core.savedObjects, plugins.encryptedSavedObjects);
plugins.eventLog.registerProviderActions(EVENT_LOG_PROVIDER, Object.values(EVENT_LOG_ACTIONS));
this.eventLogger = plugins.eventLog.getLogger({
diff --git a/x-pack/plugins/alerting/server/saved_objects/index.ts b/x-pack/plugins/alerting/server/saved_objects/index.ts
new file mode 100644
index 00000000000000..4efec2fe55ef01
--- /dev/null
+++ b/x-pack/plugins/alerting/server/saved_objects/index.ts
@@ -0,0 +1,33 @@
+/*
+ * 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 { SavedObjectsServiceSetup } from 'kibana/server';
+import mappings from './mappings.json';
+import { EncryptedSavedObjectsPluginSetup } from '../../../encrypted_saved_objects/server';
+
+export function setupSavedObjects(
+ savedObjects: SavedObjectsServiceSetup,
+ encryptedSavedObjects: EncryptedSavedObjectsPluginSetup
+) {
+ savedObjects.registerType({
+ name: 'alert',
+ hidden: false,
+ namespaceType: 'single',
+ mappings: mappings.alert,
+ });
+
+ // Encrypted attributes
+ encryptedSavedObjects.registerType({
+ type: 'alert',
+ attributesToEncrypt: new Set(['apiKey']),
+ attributesToExcludeFromAAD: new Set([
+ 'scheduledTaskId',
+ 'muteAll',
+ 'mutedInstanceIds',
+ 'updatedBy',
+ ]),
+ });
+}
diff --git a/x-pack/legacy/plugins/alerting/server/mappings.json b/x-pack/plugins/alerting/server/saved_objects/mappings.json
similarity index 100%
rename from x-pack/legacy/plugins/alerting/server/mappings.json
rename to x-pack/plugins/alerting/server/saved_objects/mappings.json
diff --git a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts b/x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts
index 0e46ef4919626a..a564b87f2ca50c 100644
--- a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts
+++ b/x-pack/plugins/alerting/server/task_runner/create_execution_handler.test.ts
@@ -95,6 +95,7 @@ test('calls actionsPlugin.execute per selected action', async () => {
"saved_objects": Array [
Object {
"id": "1",
+ "rel": "primary",
"type": "alert",
},
Object {
diff --git a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts b/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts
index 5c3e36b88879dd..16fadc8b06cd59 100644
--- a/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts
+++ b/x-pack/plugins/alerting/server/task_runner/create_execution_handler.ts
@@ -9,7 +9,7 @@ import { AlertAction, State, Context, AlertType } from '../types';
import { Logger } from '../../../../../src/core/server';
import { transformActionParams } from './transform_action_params';
import { PluginStartContract as ActionsPluginStartContract } from '../../../../plugins/actions/server';
-import { IEventLogger, IEvent } from '../../../event_log/server';
+import { IEventLogger, IEvent, SAVED_OBJECT_REL_PRIMARY } from '../../../event_log/server';
import { EVENT_LOG_ACTIONS } from '../plugin';
interface CreateExecutionHandlerOptions {
@@ -96,7 +96,7 @@ export function createExecutionHandler({
instance_id: alertInstanceId,
},
saved_objects: [
- { type: 'alert', id: alertId, ...namespace },
+ { rel: SAVED_OBJECT_REL_PRIMARY, type: 'alert', id: alertId, ...namespace },
{ type: 'action', id: action.id, ...namespace },
],
},
diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts b/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts
index 26d8a1d1777c04..35a0018049c335 100644
--- a/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts
+++ b/x-pack/plugins/alerting/server/task_runner/task_runner.test.ts
@@ -172,6 +172,7 @@ describe('Task Runner', () => {
Object {
"id": "1",
"namespace": undefined,
+ "rel": "primary",
"type": "alert",
},
],
@@ -234,6 +235,7 @@ describe('Task Runner', () => {
Object {
"id": "1",
"namespace": undefined,
+ "rel": "primary",
"type": "alert",
},
],
@@ -254,6 +256,7 @@ describe('Task Runner', () => {
Object {
"id": "1",
"namespace": undefined,
+ "rel": "primary",
"type": "alert",
},
],
@@ -274,6 +277,7 @@ describe('Task Runner', () => {
Object {
"id": "1",
"namespace": undefined,
+ "rel": "primary",
"type": "alert",
},
Object {
@@ -351,6 +355,7 @@ describe('Task Runner', () => {
Object {
"id": "1",
"namespace": undefined,
+ "rel": "primary",
"type": "alert",
},
],
@@ -371,6 +376,7 @@ describe('Task Runner', () => {
Object {
"id": "1",
"namespace": undefined,
+ "rel": "primary",
"type": "alert",
},
],
@@ -568,6 +574,7 @@ describe('Task Runner', () => {
Object {
"id": "1",
"namespace": undefined,
+ "rel": "primary",
"type": "alert",
},
],
diff --git a/x-pack/plugins/alerting/server/task_runner/task_runner.ts b/x-pack/plugins/alerting/server/task_runner/task_runner.ts
index 26970dc6b2b0d9..bf005301adc07c 100644
--- a/x-pack/plugins/alerting/server/task_runner/task_runner.ts
+++ b/x-pack/plugins/alerting/server/task_runner/task_runner.ts
@@ -25,7 +25,7 @@ import { promiseResult, map, Resultable, asOk, asErr, resolveErr } from '../lib/
import { taskInstanceToAlertTaskInstance } from './alert_task_instance';
import { AlertInstances } from '../alert_instance/alert_instance';
import { EVENT_LOG_ACTIONS } from '../plugin';
-import { IEvent, IEventLogger } from '../../../event_log/server';
+import { IEvent, IEventLogger, SAVED_OBJECT_REL_PRIMARY } from '../../../event_log/server';
import { isAlertSavedObjectNotFoundError } from '../lib/is_alert_not_found_error';
const FALLBACK_RETRY_INTERVAL: IntervalSchedule = { interval: '5m' };
@@ -174,7 +174,16 @@ export class TaskRunner {
const alertLabel = `${this.alertType.id}:${alertId}: '${name}'`;
const event: IEvent = {
event: { action: EVENT_LOG_ACTIONS.execute },
- kibana: { saved_objects: [{ type: 'alert', id: alertId, namespace }] },
+ kibana: {
+ saved_objects: [
+ {
+ rel: SAVED_OBJECT_REL_PRIMARY,
+ type: 'alert',
+ id: alertId,
+ namespace,
+ },
+ ],
+ },
};
eventLogger.startTiming(event);
@@ -393,7 +402,14 @@ function generateNewAndResolvedInstanceEvents(params: GenerateNewAndResolvedInst
alerting: {
instance_id: id,
},
- saved_objects: [{ type: 'alert', id: params.alertId, namespace: params.namespace }],
+ saved_objects: [
+ {
+ rel: SAVED_OBJECT_REL_PRIMARY,
+ type: 'alert',
+ id: params.alertId,
+ namespace: params.namespace,
+ },
+ ],
},
message,
};
diff --git a/x-pack/plugins/data_enhanced/public/search/async_search_strategy.test.ts b/x-pack/plugins/data_enhanced/public/search/async_search_strategy.test.ts
index a7d6aa894d91db..6c635cc5b4489a 100644
--- a/x-pack/plugins/data_enhanced/public/search/async_search_strategy.test.ts
+++ b/x-pack/plugins/data_enhanced/public/search/async_search_strategy.test.ts
@@ -96,6 +96,34 @@ describe('Async search strategy', () => {
});
});
+ // For bug fixed in https://github.com/elastic/kibana/pull/64155
+ it('Continues polling if no records are returned on first async request', async () => {
+ mockSearch
+ .mockReturnValueOnce(of({ id: 1, total: 0, loaded: 0, is_running: true, is_partial: true }))
+ .mockReturnValueOnce(
+ of({ id: 1, total: 2, loaded: 2, is_running: false, is_partial: false })
+ );
+
+ const asyncSearch = asyncSearchStrategyProvider({
+ core: mockCoreStart,
+ getSearchStrategy: jest.fn().mockImplementation(() => {
+ return () => {
+ return {
+ search: mockSearch,
+ };
+ };
+ }),
+ });
+
+ expect(mockSearch).toBeCalledTimes(0);
+
+ await asyncSearch.search(mockRequest, mockOptions).toPromise();
+
+ expect(mockSearch).toBeCalledTimes(2);
+ expect(mockSearch.mock.calls[0][0]).toEqual(mockRequest);
+ expect(mockSearch.mock.calls[1][0]).toEqual({ id: 1, serverStrategy: 'foo' });
+ });
+
it('only sends the ID and server strategy after the first request', async () => {
mockSearch
.mockReturnValueOnce(of({ id: 1, total: 2, loaded: 1, is_running: true, is_partial: true }))
diff --git a/x-pack/plugins/endpoint/common/alert_constants.ts b/x-pack/plugins/endpoint/common/alert_constants.ts
new file mode 100644
index 00000000000000..85e1643d684f2c
--- /dev/null
+++ b/x-pack/plugins/endpoint/common/alert_constants.ts
@@ -0,0 +1,34 @@
+/*
+ * 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 AlertConstants {
+ /**
+ * The prefix for all Alert APIs
+ */
+ static BASE_API_URL = '/api/endpoint';
+ /**
+ * The path for the Alert's Index Pattern API.
+ */
+ static INDEX_PATTERN_ROUTE = `${AlertConstants.BASE_API_URL}/index_pattern`;
+ /**
+ * Alert's Index pattern
+ */
+ static ALERT_INDEX_NAME = 'events-endpoint-1';
+ /**
+ * A paramter passed to Alert's Index Pattern.
+ */
+ static EVENT_DATASET = 'events';
+ /**
+ * Alert's Search API default page size
+ */
+ static DEFAULT_TOTAL_HITS = 10000;
+ /**
+ * Alerts
+ **/
+ static ALERT_LIST_DEFAULT_PAGE_SIZE = 10;
+ static ALERT_LIST_DEFAULT_SORT = '@timestamp';
+ static MAX_LONG_INT = '9223372036854775807'; // 2^63-1
+}
diff --git a/x-pack/plugins/endpoint/common/generate_data.ts b/x-pack/plugins/endpoint/common/generate_data.ts
index 4f5a6eaeb0a5eb..e40fc3e386bc89 100644
--- a/x-pack/plugins/endpoint/common/generate_data.ts
+++ b/x-pack/plugins/endpoint/common/generate_data.ts
@@ -9,9 +9,9 @@ import seedrandom from 'seedrandom';
import {
AlertEvent,
EndpointEvent,
- HostFields,
+ Host,
HostMetadata,
- OSFields,
+ HostOS,
PolicyData,
HostPolicyResponse,
HostPolicyResponseActionStatus,
@@ -29,7 +29,7 @@ interface EventOptions {
processName?: string;
}
-const Windows: OSFields[] = [
+const Windows: HostOS[] = [
{
name: 'windows 10.0',
full: 'Windows 10',
@@ -56,11 +56,11 @@ const Windows: OSFields[] = [
},
];
-const Linux: OSFields[] = [];
+const Linux: HostOS[] = [];
-const Mac: OSFields[] = [];
+const Mac: HostOS[] = [];
-const OS: OSFields[] = [...Windows, ...Mac, ...Linux];
+const OS: HostOS[] = [...Windows, ...Mac, ...Linux];
const POLICIES: Array<{ name: string; id: string }> = [
{
@@ -102,7 +102,7 @@ interface HostInfo {
version: string;
id: string;
};
- host: HostFields;
+ host: Host;
endpoint: {
policy: {
id: string;
@@ -307,7 +307,7 @@ export class EndpointDocGenerator {
process: {
entity_id: options.entityID ? options.entityID : this.randomString(10),
parent: options.parentEntityID ? { entity_id: options.parentEntityID } : undefined,
- name: options.processName ? options.processName : 'powershell.exe',
+ name: options.processName ? options.processName : randomProcessName(),
},
};
}
@@ -645,3 +645,16 @@ export class EndpointDocGenerator {
return uuid.v4({ random: [...this.randomNGenerator(255, 16)] });
}
}
+
+const fakeProcessNames = [
+ 'lsass.exe',
+ 'notepad.exe',
+ 'mimikatz.exe',
+ 'powershell.exe',
+ 'iexlorer.exe',
+ 'explorer.exe',
+];
+/** Return a random fake process name */
+function randomProcessName(): string {
+ return fakeProcessNames[Math.floor(Math.random() * fakeProcessNames.length)];
+}
diff --git a/x-pack/plugins/endpoint/common/models/event.ts b/x-pack/plugins/endpoint/common/models/event.ts
index 650486f3c3858d..47f39d2d117976 100644
--- a/x-pack/plugins/endpoint/common/models/event.ts
+++ b/x-pack/plugins/endpoint/common/models/event.ts
@@ -4,17 +4,13 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { EndpointEvent, LegacyEndpointEvent } from '../types';
+import { LegacyEndpointEvent, ResolverEvent } from '../types';
-export function isLegacyEvent(
- event: EndpointEvent | LegacyEndpointEvent
-): event is LegacyEndpointEvent {
+export function isLegacyEvent(event: ResolverEvent): event is LegacyEndpointEvent {
return (event as LegacyEndpointEvent).endgame !== undefined;
}
-export function eventTimestamp(
- event: EndpointEvent | LegacyEndpointEvent
-): string | undefined | number {
+export function eventTimestamp(event: ResolverEvent): string | undefined | number {
if (isLegacyEvent(event)) {
return event.endgame.timestamp_utc;
} else {
@@ -22,10 +18,31 @@ export function eventTimestamp(
}
}
-export function eventName(event: EndpointEvent | LegacyEndpointEvent): string {
+export function eventName(event: ResolverEvent): string {
if (isLegacyEvent(event)) {
return event.endgame.process_name ? event.endgame.process_name : '';
} else {
return event.process.name;
}
}
+
+export function eventId(event: ResolverEvent): string {
+ if (isLegacyEvent(event)) {
+ return event.endgame.serial_event_id ? String(event.endgame.serial_event_id) : '';
+ }
+ return event.event.id;
+}
+
+export function entityId(event: ResolverEvent): string {
+ if (isLegacyEvent(event)) {
+ return event.endgame.unique_pid ? String(event.endgame.unique_pid) : '';
+ }
+ return event.process.entity_id;
+}
+
+export function parentEntityId(event: ResolverEvent): string | undefined {
+ if (isLegacyEvent(event)) {
+ return event.endgame.unique_ppid ? String(event.endgame.unique_ppid) : undefined;
+ }
+ return event.process.parent?.entity_id;
+}
diff --git a/x-pack/plugins/endpoint/common/schema/alert_index.ts b/x-pack/plugins/endpoint/common/schema/alert_index.ts
index 7b48780f2d86bb..cffc00661515f6 100644
--- a/x-pack/plugins/endpoint/common/schema/alert_index.ts
+++ b/x-pack/plugins/endpoint/common/schema/alert_index.ts
@@ -7,7 +7,7 @@
import { schema, Type } from '@kbn/config-schema';
import { i18n } from '@kbn/i18n';
import { decode } from 'rison-node';
-import { EndpointAppConstants } from '../types';
+import { AlertConstants } from '../alert_constants';
/**
* Used to validate GET requests against the index of the alerting APIs.
@@ -18,7 +18,7 @@ export const alertingIndexGetQuerySchema = schema.object(
schema.number({
min: 1,
max: 100,
- defaultValue: EndpointAppConstants.ALERT_LIST_DEFAULT_PAGE_SIZE,
+ defaultValue: AlertConstants.ALERT_LIST_DEFAULT_PAGE_SIZE,
})
),
page_index: schema.maybe(
diff --git a/x-pack/plugins/endpoint/common/schema/resolver.ts b/x-pack/plugins/endpoint/common/schema/resolver.ts
new file mode 100644
index 00000000000000..f21307e407fd0a
--- /dev/null
+++ b/x-pack/plugins/endpoint/common/schema/resolver.ts
@@ -0,0 +1,59 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { schema } from '@kbn/config-schema';
+
+/**
+ * Used to validate GET requests for a complete resolver tree.
+ */
+export const validateTree = {
+ params: schema.object({ id: schema.string() }),
+ query: schema.object({
+ children: schema.number({ defaultValue: 10, min: 0, max: 100 }),
+ generations: schema.number({ defaultValue: 3, min: 0, max: 3 }),
+ ancestors: schema.number({ defaultValue: 3, min: 0, max: 5 }),
+ events: schema.number({ defaultValue: 100, min: 0, max: 1000 }),
+ afterEvent: schema.maybe(schema.string()),
+ afterChild: schema.maybe(schema.string()),
+ legacyEndpointID: schema.maybe(schema.string()),
+ }),
+};
+
+/**
+ * Used to validate GET requests for non process events for a specific event.
+ */
+export const validateEvents = {
+ params: schema.object({ id: schema.string() }),
+ query: schema.object({
+ events: schema.number({ defaultValue: 100, min: 1, max: 1000 }),
+ afterEvent: schema.maybe(schema.string()),
+ legacyEndpointID: schema.maybe(schema.string()),
+ }),
+};
+
+/**
+ * Used to validate GET requests for the ancestors of a process event.
+ */
+export const validateAncestry = {
+ params: schema.object({ id: schema.string() }),
+ query: schema.object({
+ ancestors: schema.number({ defaultValue: 0, min: 0, max: 10 }),
+ legacyEndpointID: schema.maybe(schema.string()),
+ }),
+};
+
+/**
+ * Used to validate GET requests for children of a specified process event.
+ */
+export const validateChildren = {
+ params: schema.object({ id: schema.string() }),
+ query: schema.object({
+ children: schema.number({ defaultValue: 10, min: 10, max: 100 }),
+ generations: schema.number({ defaultValue: 3, min: 0, max: 3 }),
+ afterChild: schema.maybe(schema.string()),
+ legacyEndpointID: schema.maybe(schema.string()),
+ }),
+};
diff --git a/x-pack/plugins/endpoint/common/types.ts b/x-pack/plugins/endpoint/common/types.ts
index 4da4f9bc797ca6..8fce15d1c794c8 100644
--- a/x-pack/plugins/endpoint/common/types.ts
+++ b/x-pack/plugins/endpoint/common/types.ts
@@ -25,32 +25,44 @@ export type Immutable = T extends undefined | null | boolean | string | numbe
? ImmutableSet
: ImmutableObject;
-export type ImmutableArray = ReadonlyArray>;
-export type ImmutableMap = ReadonlyMap, Immutable>;
-export type ImmutableSet = ReadonlySet>;
-export type ImmutableObject = { readonly [K in keyof T]: Immutable };
-
-export type Direction = 'asc' | 'desc';
-
-export class EndpointAppConstants {
- static BASE_API_URL = '/api/endpoint';
- static INDEX_PATTERN_ROUTE = `${EndpointAppConstants.BASE_API_URL}/index_pattern`;
- static ALERT_INDEX_NAME = 'events-endpoint-1';
- static EVENT_DATASET = 'events';
- static DEFAULT_TOTAL_HITS = 10000;
- /**
- * Legacy events are stored in indices with endgame-* prefix
- */
- static LEGACY_EVENT_INDEX_NAME = 'endgame-*';
+type ImmutableArray = ReadonlyArray>;
+type ImmutableMap = ReadonlyMap, Immutable>;
+type ImmutableSet = ReadonlySet>;
+type ImmutableObject = { readonly [K in keyof T]: Immutable };
- /**
- * Alerts
- **/
- static ALERT_LIST_DEFAULT_PAGE_SIZE = 10;
- static ALERT_LIST_DEFAULT_SORT = '@timestamp';
- static MAX_LONG_INT = '9223372036854775807'; // 2^63-1
+/**
+ * Values for the Alert APIs 'order' and 'direction' parameters.
+ */
+export type AlertAPIOrdering = 'asc' | 'desc';
+
+export interface ResolverNodeStats {
+ totalEvents: number;
+ totalAlerts: number;
+}
+
+export interface ResolverNodePagination {
+ nextChild?: string | null;
+ nextEvent?: string | null;
+ nextAncestor?: string | null;
+ nextAlert?: string | null;
}
+/**
+ * A node that contains pointers to other nodes, arrrays of resolver events, and any metadata associated with resolver specific data
+ */
+export interface ResolverNode {
+ id: string;
+ children: ResolverNode[];
+ events: ResolverEvent[];
+ lifecycle: ResolverEvent[];
+ ancestors?: ResolverNode[];
+ pagination: ResolverNodePagination;
+ stats?: ResolverNodeStats;
+}
+
+/**
+ * Returned by 'api/endpoint/alerts'
+ */
export interface AlertResultList {
/**
* The alerts restricted by page size.
@@ -88,6 +100,9 @@ export interface AlertResultList {
prev: string | null;
}
+/**
+ * Returned by the server via /api/endpoint/metadata
+ */
export interface HostResultList {
/* the hosts restricted by the page size */
hosts: HostInfo[];
@@ -99,43 +114,61 @@ export interface HostResultList {
request_page_index: number;
}
-export interface OSFields {
+/**
+ * Operating System metadata for a host.
+ */
+export interface HostOS {
full: string;
name: string;
version: string;
variant: string;
}
-export interface HostFields {
+
+/**
+ * Host metadata. Describes an endpoint host.
+ */
+export interface Host {
id: string;
hostname: string;
ip: string[];
mac: string[];
- os: OSFields;
+ os: HostOS;
}
-export interface HashFields {
+
+/**
+ * A record of hashes for something. Provides hashes in multiple formats. A favorite structure of the Elastic Endpoint.
+ */
+interface Hashes {
+ /**
+ * A hash in MD5 format.
+ */
md5: string;
+ /**
+ * A hash in SHA-1 format.
+ */
sha1: string;
+ /**
+ * A hash in SHA-256 format.
+ */
sha256: string;
}
-export interface MalwareClassificationFields {
+
+interface MalwareClassification {
identifier: string;
score: number;
threshold: number;
version: string;
}
-export interface PrivilegesFields {
- description: string;
- name: string;
- enabled: boolean;
-}
-export interface ThreadFields {
+
+interface ThreadFields {
id: number;
service_name: string;
start: number;
start_address: number;
start_address_module: string;
}
-export interface DllFields {
+
+interface DllFields {
pe: {
architecture: string;
imphash: string;
@@ -145,8 +178,8 @@ export interface DllFields {
trusted: boolean;
};
compile_time: number;
- hash: HashFields;
- malware_classification: MalwareClassificationFields;
+ hash: Hashes;
+ malware_classification: MalwareClassification;
mapped_address: number;
mapped_size: number;
path: string;
@@ -154,7 +187,6 @@ export interface DllFields {
/**
* Describes an Alert Event.
- * Should be in line with ECS schema.
*/
export type AlertEvent = Immutable<{
'@timestamp': number;
@@ -191,14 +223,14 @@ export type AlertEvent = Immutable<{
entity_id: string;
};
name: string;
- hash: HashFields;
+ hash: Hashes;
pe?: {
imphash: string;
};
executable: string;
sid?: string;
start: number;
- malware_classification?: MalwareClassificationFields;
+ malware_classification?: MalwareClassification;
token: {
domain: string;
type: string;
@@ -206,7 +238,11 @@ export type AlertEvent = Immutable<{
sid: string;
integrity_level: number;
integrity_level_name: string;
- privileges?: PrivilegesFields[];
+ privileges?: Array<{
+ description: string;
+ name: string;
+ enabled: boolean;
+ }>;
};
thread?: ThreadFields[];
uptime: number;
@@ -220,7 +256,7 @@ export type AlertEvent = Immutable<{
mtime: number;
created: number;
size: number;
- hash: HashFields;
+ hash: Hashes;
pe?: {
imphash: string;
};
@@ -228,10 +264,10 @@ export type AlertEvent = Immutable<{
trusted: boolean;
subject_name: string;
};
- malware_classification: MalwareClassificationFields;
+ malware_classification: MalwareClassification;
temp_file_path: string;
};
- host: HostFields;
+ host: Host;
dll?: DllFields[];
}>;
@@ -249,9 +285,6 @@ interface AlertState {
};
}
-/**
- * Union of alert data and metadata.
- */
export type AlertData = AlertEvent & AlertMetadata;
export type AlertDetails = AlertData & AlertState;
@@ -301,7 +334,7 @@ export type HostMetadata = Immutable<{
id: string;
version: string;
};
- host: HostFields;
+ host: Host;
}>;
/**
@@ -365,7 +398,7 @@ export interface EndpointEvent {
hostname: string;
ip: string[];
mac: string[];
- os: OSFields;
+ os: HostOS;
};
process: {
entity_id: string;
@@ -500,28 +533,22 @@ export interface PolicyConfig {
};
}
-/**
- * Windows-specific policy configuration that is supported via the UI
- */
-type WindowsPolicyConfig = Pick;
-
-/**
- * Mac-specific policy configuration that is supported via the UI
- */
-type MacPolicyConfig = Pick;
-
-/**
- * Linux-specific policy configuration that is supported via the UI
- */
-type LinuxPolicyConfig = Pick;
-
/**
* The set of Policy configuration settings that are show/edited via the UI
*/
export interface UIPolicyConfig {
- windows: WindowsPolicyConfig;
- mac: MacPolicyConfig;
- linux: LinuxPolicyConfig;
+ /**
+ * Windows-specific policy configuration that is supported via the UI
+ */
+ windows: Pick;
+ /**
+ * Mac-specific policy configuration that is supported via the UI
+ */
+ mac: Pick;
+ /**
+ * Linux-specific policy configuration that is supported via the UI
+ */
+ linux: Pick;
}
interface PolicyConfigAdvancedOptions {
diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/store/alerts/middleware.ts b/x-pack/plugins/endpoint/public/applications/endpoint/store/alerts/middleware.ts
index 90d6b8b82198af..6bc728db99819c 100644
--- a/x-pack/plugins/endpoint/public/applications/endpoint/store/alerts/middleware.ts
+++ b/x-pack/plugins/endpoint/public/applications/endpoint/store/alerts/middleware.ts
@@ -9,7 +9,7 @@ import { AlertResultList, AlertDetails } from '../../../../../common/types';
import { ImmutableMiddlewareFactory, AlertListState } from '../../types';
import { isOnAlertPage, apiQueryParams, hasSelectedAlert, uiQueryParams } from './selectors';
import { cloneHttpFetchQuery } from '../../../../common/clone_http_fetch_query';
-import { EndpointAppConstants } from '../../../../../common/types';
+import { AlertConstants } from '../../../../../common/alert_constants';
export const alertMiddlewareFactory: ImmutableMiddlewareFactory = (
coreStart,
@@ -18,7 +18,7 @@ export const alertMiddlewareFactory: ImmutableMiddlewareFactory
async function fetchIndexPatterns(): Promise