Skip to content

Commit

Permalink
[ML] Remove export wildcard syntax for ML plugin. (#123177)
Browse files Browse the repository at this point in the history
Remove export wildcard syntax for ML plugin. Types exported at the plugin level were prefixed with Ml.
  • Loading branch information
walterra authored Jan 25, 2022
1 parent cef886f commit 0305c6e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
17 changes: 13 additions & 4 deletions x-pack/plugins/ml/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@
* 2.0.
*/

// TODO: https://github.com/elastic/kibana/issues/110898
/* eslint-disable @kbn/eslint/no_export_all */

import { PluginInitializerContext } from 'kibana/server';
import { MlServerPlugin } from './plugin';
export type { MlPluginSetup, MlPluginStart } from './plugin';
export * from './shared';
export type {
AnomalyRecordDoc as MlAnomalyRecordDoc,
AnomaliesTableRecord as MlAnomaliesTableRecord,
AnomalyResultType as MlAnomalyResultType,
DatafeedStats as MlDatafeedStats,
Job as MlJob,
} from './shared';
export {
UnknownMLCapabilitiesError,
InsufficientMLCapabilities,
MLPrivilegesUninitialized,
getHistogramsForFields,
} from './shared';

export const plugin = (ctx: PluginInitializerContext) => new MlServerPlugin(ctx);
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';

import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
import { buildExceptionFilter } from '@kbn/securitysolution-list-utils';
import { AnomalyRecordDoc as Anomaly } from '../../../../ml/server';
import { MlAnomalyRecordDoc as Anomaly } from '../../../../ml/server';

export type { Anomaly };
export type AnomalyResults = estypes.SearchResponse<Anomaly>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { KibanaRequest, SavedObjectsClientContract } from '../../../../../../src/core/server';
import { DatafeedStats, Job, MlPluginSetup } from '../../../../ml/server';
import { MlDatafeedStats, MlJob, MlPluginSetup } from '../../../../ml/server';
import { isJobStarted } from '../../../common/machine_learning/helpers';
import { isSecurityJob } from '../../../common/machine_learning/is_security_job';
import { DetectionsMetric, MlJobMetric, MlJobsUsage, MlJobUsage } from './types';
Expand Down Expand Up @@ -94,14 +94,14 @@ export const getMlJobMetrics = async (
.anomalyDetectorsProvider(fakeRequest, savedObjectClient)
.jobs(jobsType);

const jobDetailsCache = new Map<string, Job>();
const jobDetailsCache = new Map<string, MlJob>();
jobDetails.jobs.forEach((detail) => jobDetailsCache.set(detail.job_id, detail));

const datafeedStats = await ml
.anomalyDetectorsProvider(fakeRequest, savedObjectClient)
.datafeedStats();

const datafeedStatsCache = new Map<string, DatafeedStats>();
const datafeedStatsCache = new Map<string, MlDatafeedStats>();
datafeedStats.datafeeds.forEach((datafeedStat) =>
datafeedStatsCache.set(`${datafeedStat.datafeed_id}`, datafeedStat)
);
Expand Down

0 comments on commit 0305c6e

Please sign in to comment.