From 13bd1930699499f5fa2632b149c105934c4e16e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?= Date: Fri, 23 Aug 2024 13:59:34 +0200 Subject: [PATCH 1/5] Flaky #190724 (#191010) --- .../core/apps/core-apps-server-internal/src/core_app.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core/apps/core-apps-server-internal/src/core_app.ts b/packages/core/apps/core-apps-server-internal/src/core_app.ts index e9676c792292..5ee8fe4938a4 100644 --- a/packages/core/apps/core-apps-server-internal/src/core_app.ts +++ b/packages/core/apps/core-apps-server-internal/src/core_app.ts @@ -29,13 +29,13 @@ import type { import type { InternalStaticAssets } from '@kbn/core-http-server-internal'; import { combineLatest, - concatMap, firstValueFrom, map, type Observable, ReplaySubject, shareReplay, Subject, + switchMap, takeUntil, timer, } from 'rxjs'; @@ -238,7 +238,7 @@ export class CoreAppsService { // Poll for updates combineLatest([savedObjectsClient$, timer(0, 10_000)]) .pipe( - concatMap(async ([soClient]) => { + switchMap(async ([soClient]) => { try { const persistedOverrides = await soClient.get>( DYNAMIC_CONFIG_OVERRIDES_SO_TYPE, @@ -300,7 +300,10 @@ export class CoreAppsService { await soClient.create(DYNAMIC_CONFIG_OVERRIDES_SO_TYPE, newGlobalOverrides, { id: DYNAMIC_CONFIG_OVERRIDES_SO_ID, overwrite: true, + refresh: false, }); + // set it again in memory in case the timer polling the SO for updates has overridden it during this update. + this.configService.setDynamicConfigOverrides(req.body); } catch (err) { if (err instanceof ValidationError) { return res.badRequest({ body: err }); From f9c43f61c987ec0b236f87012fda1fd4c22c7f2a Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Fri, 23 Aug 2024 15:28:57 +0200 Subject: [PATCH 2/5] [ML] Replace apiDoc annotations with routes definitions for OpenAPI spec generation (#190840) ## Summary - Removes `apidoc-markdown` dependency and custom scripts for generating internal documentation for ML Kibana endpoints - Replaces apidoc annotations with `summary` and `description` props for route handlers and kbn-schemas to generate an OpenAPI spec file - `/internal/ml/jobs/delete_jobs` route was not versioned for some reason, I changed that #### How to test 1. Enable OAS endpoint in `kibana.dev.yml` ```yaml server.oas.enabled: true ``` 2. Start Kibana dev server ```bash yarn start --no-base-path ``` 3. Call the OAS endpoint for ML _internal_ routes ```bash curl -s -u : http://localhost:5601/api/oas\?pathStartsWith\=/internal/ml\&access\=internal -o ml_kibana_openapi.json ``` --- package.json | 1 - renovate.json | 9 - x-pack/plugins/ml/package.json | 13 - .../apidoc_scripts/apidoc_config/apidoc.json | 198 -------- .../apidoc_config/apidoc_config.ts | 19 - .../apidoc_scripts/apidoc_config/index.js | 9 - .../content_page/content_page.ts | 67 --- .../apidoc_scripts/content_page/index.js | 9 - .../header_generator/header_generator.ts | 24 - .../apidoc_scripts/header_generator/index.js | 9 - .../apidoc_scripts/schema_extractor/index.ts | 8 - .../schema_extractor/schema_extractor.test.ts | 234 --------- .../schema_extractor/schema_extractor.ts | 185 ------- .../apidoc_scripts/schema_parser/index.js | 9 - .../schema_parser/schema_parser.ts | 38 -- .../apidoc_scripts/schema_worker/index.js | 9 - .../schema_worker/schema_worker.ts | 85 ---- .../ml/scripts/apidoc_scripts/template.md | 147 ------ .../ml/scripts/apidoc_scripts/types.ts | 43 -- .../apidoc_scripts/version_filter/index.js | 9 - .../version_filter/version_filter.ts | 21 - x-pack/plugins/ml/server/routes/README.md | 17 +- x-pack/plugins/ml/server/routes/alerting.ts | 8 +- .../plugins/ml/server/routes/annotations.ts | 31 +- .../ml/server/routes/anomaly_detectors.ts | 238 +++------ x-pack/plugins/ml/server/routes/calendars.ts | 54 +- .../ml/server/routes/data_frame_analytics.ts | 181 ++----- .../ml/server/routes/data_visualizer.ts | 21 +- x-pack/plugins/ml/server/routes/datafeeds.ts | 110 +--- .../ml/server/routes/fields_service.ts | 43 +- x-pack/plugins/ml/server/routes/filters.ts | 81 +-- .../ml/server/routes/inference_models.ts | 19 +- .../ml/server/routes/job_audit_messages.ts | 34 +- .../plugins/ml/server/routes/job_service.ts | 318 +++--------- .../ml/server/routes/job_validation.ts | 58 +-- x-pack/plugins/ml/server/routes/management.ts | 13 +- .../ml/server/routes/model_management.ts | 18 +- x-pack/plugins/ml/server/routes/modules.ts | 365 ++------------ .../plugins/ml/server/routes/notifications.ts | 18 +- .../ml/server/routes/results_service.ts | 125 ++--- .../plugins/ml/server/routes/saved_objects.ts | 120 +---- .../routes/schemas/annotations_schema.ts | 13 + .../schemas/anomaly_detectors_schema.ts | 72 +-- .../server/routes/schemas/calendars_schema.ts | 3 +- .../schemas/data_frame_analytics_schema.ts | 11 +- .../routes/schemas/data_visualizer_schema.ts | 11 +- .../routes/schemas/fields_service_schema.ts | 75 ++- .../server/routes/schemas/filters_schema.ts | 5 +- .../server/routes/schemas/inference_schema.ts | 24 +- .../schemas/job_audit_messages_schema.ts | 3 +- .../routes/schemas/job_service_schema.ts | 13 +- .../ml/server/routes/schemas/modules.ts | 233 ++++++--- .../routes/schemas/notifications_schema.ts | 15 +- .../routes/schemas/results_service_schema.ts | 71 +-- .../routes/schemas/runtime_mappings_schema.ts | 1 - .../ml/server/routes/schemas/saved_objects.ts | 5 +- x-pack/plugins/ml/server/routes/system.ts | 60 +-- .../ml/server/routes/trained_models.ts | 165 ++---- x-pack/plugins/ml/tsconfig.json | 1 - yarn.lock | 471 +----------------- 60 files changed, 791 insertions(+), 3479 deletions(-) delete mode 100644 x-pack/plugins/ml/package.json delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/apidoc_config/apidoc.json delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/apidoc_config/apidoc_config.ts delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/apidoc_config/index.js delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/content_page/content_page.ts delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/content_page/index.js delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/header_generator/header_generator.ts delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/header_generator/index.js delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/schema_extractor/index.ts delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/schema_extractor/schema_extractor.test.ts delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/schema_extractor/schema_extractor.ts delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/schema_parser/index.js delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/schema_parser/schema_parser.ts delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/schema_worker/index.js delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/schema_worker/schema_worker.ts delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/template.md delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/types.ts delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/version_filter/index.js delete mode 100644 x-pack/plugins/ml/scripts/apidoc_scripts/version_filter/version_filter.ts diff --git a/package.json b/package.json index aeb93ebd56b5..038ba497cfa1 100644 --- a/package.json +++ b/package.json @@ -1625,7 +1625,6 @@ "@wojtekmaj/enzyme-adapter-react-17": "^0.6.7", "@yarnpkg/lockfile": "^1.1.0", "aggregate-error": "^3.1.0", - "apidoc-markdown": "^7.3.2", "argsplit": "^1.0.5", "autoprefixer": "^10.4.7", "axe-core": "^4.10.0", diff --git a/renovate.json b/renovate.json index 0d9b15c7cf06..efc05624f16f 100644 --- a/renovate.json +++ b/renovate.json @@ -437,15 +437,6 @@ "minimumReleaseAge": "7 days", "enabled": true }, - { - "groupName": "machine learning modules", - "matchDepNames": ["apidoc-markdown"], - "reviewers": ["team:ml-ui"], - "matchBaseBranches": ["main"], - "labels": ["Team:ML", "release_note:skip", "backport:all-open"], - "minimumReleaseAge": "7 days", - "enabled": true - }, { "groupName": "Kibana ES|QL Team", "matchDepNames": ["recast"], diff --git a/x-pack/plugins/ml/package.json b/x-pack/plugins/ml/package.json deleted file mode 100644 index df3b357a415e..000000000000 --- a/x-pack/plugins/ml/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "author": "Elastic", - "name": "@kbn/ml-plugin", - "version": "1.0.0", - "private": true, - "license": "Elastic License 2.0", - "scripts": { - "generateHeader": "node scripts/apidoc_scripts/header_generator/index.js", - "generateApidocConfig": "node scripts/apidoc_scripts/apidoc_config/index.js", - "generateContentPage": "node scripts/apidoc_scripts/content_page/index.js", - "apiDocs": "yarn generateContentPage && yarn generateHeader && yarn generateApidocConfig && cd ./scripts/apidoc_scripts/ && ../../../../../node_modules/.bin/apidoc-markdown -i ../../server/routes -c ./apidoc_config.json -o ./ML_API.mdx --parse-workers apischema=./schema_worker/index.js --parse-parsers apischema=./schema_parser/index.js --parse-filters apiversion=./version_filter/index.js --header ./header.md --template ./template.md" - } -} diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/apidoc_config/apidoc.json b/x-pack/plugins/ml/scripts/apidoc_scripts/apidoc_config/apidoc.json deleted file mode 100644 index f262a3c6029a..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/apidoc_config/apidoc.json +++ /dev/null @@ -1,198 +0,0 @@ -{ - "name": "ml_kibana_api", - "description": "This is the documentation of the REST API provided by the Machine Learning Kibana plugin. Each API is experimental and can include breaking changes in any version.", - "title": "ML Kibana API", - "order": [ - "DataFrameAnalytics", - "GetDataFrameAnalytics", - "GetDataFrameAnalyticsById", - "GetDataFrameAnalyticsStats", - "GetDataFrameAnalyticsStatsById", - "EvaluateDataFrameAnalytics", - "ExplainDataFrameAnalytics", - "StartDataFrameAnalyticsJob", - "StopsDataFrameAnalyticsJob", - "GetDataFrameAnalyticsMessages", - "UpdateDataFrameAnalytics", - "DeleteDataFrameAnalytics", - "JobsExist", - "GetDataFrameAnalyticsIdMap", - "AnalyticsNewJobCaps", - "ValidateDataFrameAnalytics", - - "DataVisualizer", - "GetHistogramsForFields", - - "AnomalyDetectors", - "CreateAnomalyDetectors", - "OpenAnomalyDetectorsJob", - "GetAnomalyDetectors", - "GetAnomalyDetectorsById", - "GetAnomalyDetectorsStats", - "GetAnomalyDetectorsStatsById", - "CloseAnomalyDetectorsJob", - "ResetAnomalyDetectorsJob", - "ValidateAnomalyDetector", - "ForecastAnomalyDetector", - "GetRecords", - "GetBuckets", - "GetOverallBuckets", - "GetCategories", - "UpdateAnomalyDetectors", - "DeleteAnomalyDetectorsJob", - - "FileDataVisualizer", - "AnalyzeFile", - - "ResultsService", - "GetAnomaliesTableData", - "GetDatafeedResultsChartData", - "GetCategoryDefinition", - "GetMaxAnomalyScore", - "GetCategoryExamples", - "GetPartitionFieldsValues", - "AnomalySearch", - "GetCategorizerStats", - "GetCategoryStoppedPartitions", - "GetAnomalyChartsData", - "GetAnomalyRecords", - - "Modules", - "DataRecognizer", - "RecognizeIndex", - "GetModule", - "SetupModule", - "CheckExistingModuleJobs", - - "Notifications", - "GetNotifications", - "GetNotificationCounts", - - "Annotations", - "GetAnnotations", - "IndexAnnotations", - "DeleteAnnotation", - - "JobService", - "ForceStartDatafeeds", - "StopDatafeeds", - "CloseJobs", - "ResetJobs", - "JobsSummary", - "JobsWithTimeRange", - "GetJobForCloning", - "CreateFullJobsList", - "GetAllGroups", - "JobsExist", - "NewJobCaps", - "NewJobLineChart", - "NewJobPopulationChart", - "GetAllJobAndGroupIds", - "GetLookBackProgress", - "ValidateCategoryValidation", - "TopCategories", - "DatafeedPreview", - "UpdateGroups", - "BlockingJobTasks", - "DeleteJobs", - "RevertModelSnapshot", - "BulkCreateJobs", - - "Calendars", - "PutCalendars", - "GetCalendars", - "GetCalendarById", - "UpdateCalendarById", - "DeleteCalendarById", - - "Filters", - "CreateFilter", - "GetFilters", - "GetFilterById", - "GetFiltersStats", - "UpdateFilter", - "DeleteFilter", - - "Indices", - "FieldCaps", - - "SystemRoutes", - "HasPrivileges", - "MlCapabilitiesResponse", - "MlNodeCount", - "MlInfo", - "MlEsSearch", - "MlIndexExists", - "MlReindexWithPipeline", - "MlSpecificIndexExists", - - "JobAuditMessages", - "GetJobAuditMessages", - "GetAllJobAuditMessages", - "ClearJobAuditMessages", - - "JobValidation", - "EstimateBucketSpan", - "CalculateModelMemoryLimit", - "ValidateCardinality", - "ValidateJob", - "ValidateDataFeedPreview", - - "DatafeedService", - "CreateDatafeed", - "PreviewDatafeed", - "GetDatafeeds", - "GetDatafeed", - "GetDatafeedsStats", - "GetDatafeedStats", - "UpdateDatafeed", - "StartDatafeed", - "StopDatafeed", - "DeleteDatafeed", - - "FieldsService", - "GetCardinalityOfFields", - "GetTimeFieldRange", - - "MLSavedObjects", - "SavedObjectsStatus", - "SyncMLSavedObjects", - "InitializeMLSavedObjects", - "SyncCheck", - "UpdateJobsSpaces", - "UpdateTrainedModelsSpaces", - "RemoveMLSpaceAwareItemsFromCurrentSpace", - "JobsSpaces", - "TrainedModelsSpaces", - "CanDeleteMLSpaceAwareItems", - - "TrainedModels", - "GetTrainedModel", - "GetTrainedModelStats", - "GetTrainedModelStatsById", - "GetTrainedModelPipelines", - "StartTrainedModelDeployment", - "UpdateTrainedModelDeployment", - "StopTrainedModelDeployment", - "PutTrainedModel", - "DeleteTrainedModel", - "SimulateIngestPipeline", - "InferTrainedModelDeployment", - "CreateInferencePipeline", - "GetIngestPipelines", - "GetTrainedModelDownloadList", - "GetElserConfig", - "InstallElasticTrainedModel", - "ModelsDownloadStatus", - - "Alerting", - "PreviewAlert", - - "Management", - "ManagementList", - - "ModelManagement", - "GetModelManagementNodesOverview", - "GetModelManagementMemoryUsage" - ] -} diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/apidoc_config/apidoc_config.ts b/x-pack/plugins/ml/scripts/apidoc_scripts/apidoc_config/apidoc_config.ts deleted file mode 100644 index e5498d88dc00..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/apidoc_config/apidoc_config.ts +++ /dev/null @@ -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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import * as fs from 'fs'; -import * as path from 'path'; -import { kibanaPackageJson } from '@kbn/repo-info'; - -export function generateConfig() { - const apidocConfig = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'apidoc.json'), 'utf8')); - apidocConfig.version = kibanaPackageJson.version; - fs.writeFileSync( - path.resolve(__dirname, '..', 'apidoc_config.json'), - JSON.stringify(apidocConfig, null, 2) - ); -} diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/apidoc_config/index.js b/x-pack/plugins/ml/scripts/apidoc_scripts/apidoc_config/index.js deleted file mode 100644 index 6a1bf35da557..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/apidoc_config/index.js +++ /dev/null @@ -1,9 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -require('../../../../../../src/setup_node_env'); -require('./apidoc_config').generateConfig(); diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/content_page/content_page.ts b/x-pack/plugins/ml/scripts/apidoc_scripts/content_page/content_page.ts deleted file mode 100644 index 8b992817c843..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/content_page/content_page.ts +++ /dev/null @@ -1,67 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import * as fs from 'fs'; -import * as path from 'path'; -// @ts-ignore can only be default-imported using the 'esModuleInterop' flag -import moment from 'moment'; -import { kibanaPackageJson } from '@kbn/repo-info'; -// eslint-disable-next-line import/no-extraneous-dependencies -import { createDoc } from 'apidoc-light'; - -interface Group { - anchor: string; - text: string; -} - -const getContent = (groups: Group[]) => { - const groupsStr = groups - .map(({ anchor, text }) => `- `) - .join('\n'); - - return `--- -id: uiMlKibanaRestApi -slug: /ml-team/docs/ui/rest-api/ml-kibana-rest-api -title: Machine Learning Kibana REST API -image: https://source.unsplash.com/400x175/?Nature -description: This page contains documentation for the ML Kibana REST API. -date: ${moment().format('YYYY-MM-DD')} -tags: ['machine learning','internal docs', 'UI'] ---- - -_Updated for ${kibanaPackageJson.version}_ - -Some of the features of the Machine Learning (ML) Kibana plugin are provided via a REST API, which is ideal for creating an integration with the ML plugin. - -Each API is experimental and can include breaking changes in any version of the ML plugin, or might have been entirely removed from the plugin. - -- - -The following APIs are available: - -${groupsStr}`; -}; - -export const generateContentPage = () => { - const doc = createDoc({ - src: path.resolve(__dirname, '..', '..', '..', 'server', 'routes'), - config: path.resolve(__dirname, '..', 'apidoc_config', 'apidoc.json'), - // if you don't want to generate the output files: - dryRun: true, - // if you don't want to see any log output: - silent: true, - }); - - const groups = [...new Set(doc.data.map((v) => v.group))].map((group) => { - return { - anchor: `-${group.toLowerCase()}`, - text: group.replace(/([a-z])([A-Z])/g, '$1 $2'), - }; - }); - - fs.writeFileSync(path.resolve(__dirname, '..', 'ml_kibana_api.mdx'), getContent(groups)); -}; diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/content_page/index.js b/x-pack/plugins/ml/scripts/apidoc_scripts/content_page/index.js deleted file mode 100644 index 5b0aced7aed1..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/content_page/index.js +++ /dev/null @@ -1,9 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -require('../../../../../../src/setup_node_env'); -require('./content_page').generateContentPage(); diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/header_generator/header_generator.ts b/x-pack/plugins/ml/scripts/apidoc_scripts/header_generator/header_generator.ts deleted file mode 100644 index 1dd682b44239..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/header_generator/header_generator.ts +++ /dev/null @@ -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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import * as fs from 'fs'; -import * as path from 'path'; -// @ts-ignore can only be default-imported using the 'esModuleInterop' flag -import moment from 'moment'; - -const getHeaderString = () => `--- -id: uiMlApi -slug: /ml-team/docs/ui/rest-api/ml-api -title: ML API reference -description: Reference documentation for the ML API. -date: ${moment().format('YYYY-MM-DD')} -tags: ['machine learning','internal docs', 'UI'] ----`; - -export function run() { - fs.writeFileSync(path.resolve(__dirname, '..', 'header.md'), getHeaderString()); -} diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/header_generator/index.js b/x-pack/plugins/ml/scripts/apidoc_scripts/header_generator/index.js deleted file mode 100644 index 6a7235d0e664..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/header_generator/index.js +++ /dev/null @@ -1,9 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -require('../../../../../../src/setup_node_env'); -require('./header_generator').run(); diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_extractor/index.ts b/x-pack/plugins/ml/scripts/apidoc_scripts/schema_extractor/index.ts deleted file mode 100644 index a352a28aa664..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_extractor/index.ts +++ /dev/null @@ -1,8 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export { extractDocumentation, type DocEntry } from './schema_extractor'; diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_extractor/schema_extractor.test.ts b/x-pack/plugins/ml/scripts/apidoc_scripts/schema_extractor/schema_extractor.test.ts deleted file mode 100644 index 75c29ed052fa..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_extractor/schema_extractor.test.ts +++ /dev/null @@ -1,234 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { extractDocumentation } from './schema_extractor'; -import * as path from 'path'; - -// TODO: fix the schema extractor to maintain the same functionality as before on TS v5 -describe.skip('schema_extractor', () => { - it('should serialize schema definition', () => { - const result = extractDocumentation([ - path.resolve( - __dirname, - '..', - '..', - '..', - 'server', - 'routes', - 'schemas', - 'datafeeds_schema.ts' - ), - ]); - - expect(result.get('startDatafeedSchema')).toEqual([ - { - name: 'start', - documentation: '', - type: 'string | number', - }, - { - name: 'end', - documentation: '', - type: 'string | number', - }, - { - name: 'timeout', - documentation: '', - type: 'any', - }, - ]); - - expect(result.get('datafeedConfigSchema')).toEqual([ - { - name: 'datafeed_id', - documentation: '', - type: 'string', - }, - { - name: 'feed_id', - documentation: '', - type: 'string', - }, - { - name: 'aggregations', - documentation: '', - type: 'any', - }, - { - name: 'aggs', - documentation: '', - type: 'any', - }, - { - name: 'chunking_config', - documentation: '', - type: 'chunking_config', - nested: [ - { - name: 'mode', - documentation: '', - type: '"auto" | "manual" | "off"', - }, - { - name: 'time_span', - documentation: '', - type: 'string | number', - }, - ], - }, - { - name: 'frequency', - documentation: '', - type: 'string', - }, - { - name: 'indices', - documentation: '', - type: 'string[]', - }, - { - name: 'indexes', - documentation: '', - type: 'string[]', - }, - { - name: 'job_id', - documentation: '', - type: 'string', - }, - { - name: 'query', - documentation: '', - type: 'any', - }, - { - name: 'max_empty_searches', - documentation: '', - type: 'number', - }, - { - name: 'query_delay', - documentation: '', - type: 'string', - }, - { - name: 'script_fields', - documentation: '', - type: 'any', - }, - { - name: 'runtime_mappings', - documentation: '', - type: 'any', - }, - { - name: 'scroll_size', - documentation: '', - type: 'number', - }, - { - name: 'delayed_data_check_config', - documentation: '', - type: 'any', - }, - { - name: 'indices_options', - documentation: '', - type: 'indices_options', - nested: [ - { - name: 'expand_wildcards', - documentation: '', - type: '"all" | "open" | "closed" | "hidden" | "none"[]', - }, - { - name: 'ignore_unavailable', - documentation: '', - type: 'boolean', - }, - { - name: 'allow_no_indices', - documentation: '', - type: 'boolean', - }, - { - name: 'ignore_throttled', - documentation: '', - type: 'boolean', - }, - ], - }, - ]); - - expect(result.get('deleteDatafeedQuerySchema')).toEqual([ - { - name: 'force', - documentation: '', - type: 'boolean', - }, - ]); - }); - - it('serializes schema with nested objects and nullable', () => { - const result = extractDocumentation([ - path.resolve( - __dirname, - '..', - '..', - '..', - 'server', - 'routes', - 'schemas', - 'results_service_schema.ts' - ), - ]); - expect(result.get('getCategorizerStatsSchema')).toEqual([ - { - name: 'partitionByValue', - documentation: - 'Optional value to fetch the categorizer stats where results are filtered by partition_by_value = value', - type: 'any', // FIXME string - }, - ]); - - // @ts-ignore - expect(result.get('partitionFieldValuesSchema')![5].nested[0]).toEqual({ - name: 'partition_field', - documentation: '', - type: 'partition_field', - nested: [ - { - name: 'applyTimeRange', - documentation: '', - type: 'boolean', - }, - { - name: 'anomalousOnly', - documentation: '', - type: 'boolean', - }, - { - name: 'sort', - documentation: '', - type: 'sort', - nested: [ - { - name: 'by', - documentation: '', - type: 'string', - }, - { - name: 'order', - documentation: '', - type: 'string', - }, - ], - }, - ], - }); - }); -}); diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_extractor/schema_extractor.ts b/x-pack/plugins/ml/scripts/apidoc_scripts/schema_extractor/schema_extractor.ts deleted file mode 100644 index 4c2e34398f57..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_extractor/schema_extractor.ts +++ /dev/null @@ -1,185 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import * as ts from 'typescript'; -export interface DocEntry { - name: string; - documentation?: string; - type: string; - optional?: boolean; - nested?: DocEntry[]; -} - -/** Generate documentation for all schema definitions in a set of .ts files */ -export function extractDocumentation(fileNames: string[]): Map { - const options = { - target: ts.ScriptTarget.ES2015, - module: ts.ModuleKind.CommonJS, - }; - - // Build a program using the set of root file names in fileNames - const program = ts.createProgram(fileNames, options); - - // Get the checker, we will use it to find more about properties - const checker: ts.TypeChecker = program.getTypeChecker(); - - // Result map - const result = new Map(); - - // Visit every sourceFile in the program - for (const sourceFile of program.getSourceFiles()) { - if (!sourceFile.isDeclarationFile) { - // Walk the tree to search for schemas - ts.forEachChild(sourceFile, visit); - } - } - - return result; - - /** visit nodes finding exported schemas */ - function visit(node: ts.Node) { - if (isNodeExported(node) && ts.isVariableDeclaration(node)) { - const schemaName = node.name.getText(); - try { - const schemaType = checker.getTypeAtLocation(node); - result.set(schemaName, extractDocEntries(schemaType!)); - } catch (e) { - // FIXME TypeError: Cannot read properties of undefined (reading 'flags') - // eslint-disable-next-line no-console - console.error(e, 'Unable to extract type at location'); - } - } - - if (node.getChildCount() > 0) { - ts.forEachChild(node, visit); - } - } - - /** - * Extracts doc entries for the schema definition - * @param schemaType - */ - function extractDocEntries(schemaType: ts.Type): DocEntry[] { - const collection: DocEntry[] = []; - - const members = getTypeMembers(schemaType); - - if (!members) { - return collection; - } - - members.forEach((member) => { - collection.push(serializeProperty(member)); - }); - - return collection; - } - - /** - * Resolves members of the type - * @param type - */ - function getTypeMembers(type: ts.Type): ts.Symbol[] | undefined { - const argsOfType = checker.getTypeArguments(type as unknown as ts.TypeReference); - - let members = type.getProperties(); - - if (argsOfType && argsOfType.length > 0) { - members = argsOfType[0].getProperties(); - } - - return members; - } - - /** - * Extracts properties of the type. - * @param type - */ - function resolveTypeProperties(type: ts.Type): ts.Symbol[] { - let props = type.getProperties(); - - const typeArguments = checker.getTypeArguments(type as unknown as ts.TypeReference); - - if (type.aliasTypeArguments) { - // @ts-ignores - props = type.aliasTypeArguments[0].getProperties(); - } - - if (typeArguments.length > 0) { - props = resolveTypeProperties(typeArguments[0]); - } - - return props; - } - - function serializeProperty(symbol: ts.Symbol): DocEntry { - // @ts-ignore - const typeOfSymbol = symbol.type; - if (typeOfSymbol === undefined) { - return { - name: symbol.getName(), - documentation: getCommentString(symbol), - type: 'any', - }; - } - - let targetType: ts.TypeReference | ts.Type = - typeOfSymbol.getProperty('type')?.type ?? typeOfSymbol; - - const isArrayOf = targetType.symbol?.name === 'Array'; - if (isArrayOf) { - targetType = checker.getTypeArguments(targetType as ts.TypeReference)[0]; - } - - let typeAsString = checker.typeToString(targetType); - const nestedEntries: DocEntry[] = []; - - if ( - targetType.aliasTypeArguments || - checker.getTypeArguments(targetType as ts.TypeReference).length > 0 - ) { - // Resolve complex types, objects and arrays, that contain nested properties - const typeProperties = resolveTypeProperties(targetType); - - if (Array.isArray(typeProperties) && typeProperties.length > 0) { - // we hit an object or collection - typeAsString = - targetType.symbol?.name === 'Array' || typeOfSymbol.symbol?.name === 'Array' - ? `${symbol.getName()}[]` - : symbol.getName(); - - typeProperties.forEach((member) => { - nestedEntries.push(serializeProperty(member)); - }); - } - } - - const res = { - name: symbol.getName(), - documentation: getCommentString(symbol), - type: isArrayOf ? `${typeAsString}[]` : typeAsString, - ...(nestedEntries.length > 0 ? { nested: nestedEntries } : {}), - }; - - return res; - } - - function getCommentString(symbol: ts.Symbol): string { - return ts.displayPartsToString(symbol.getDocumentationComment(checker)).replace(/\n/g, ' '); - } - - /** - * True if this is visible outside this file, false otherwise - */ - function isNodeExported(node: ts.Node): boolean { - return ( - // eslint-disable-next-line no-bitwise - (ts.getCombinedModifierFlags(node as ts.Declaration) & ts.ModifierFlags.Export) !== 0 || - (!!node.parent && node.parent.kind === ts.SyntaxKind.SourceFile) - ); - } -} diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_parser/index.js b/x-pack/plugins/ml/scripts/apidoc_scripts/schema_parser/index.js deleted file mode 100644 index 46bf224d0d78..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_parser/index.js +++ /dev/null @@ -1,9 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -require('../../../../../../src/setup_node_env'); -module.exports = require('./schema_parser'); diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_parser/schema_parser.ts b/x-pack/plugins/ml/scripts/apidoc_scripts/schema_parser/schema_parser.ts deleted file mode 100644 index 2e43e2700197..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_parser/schema_parser.ts +++ /dev/null @@ -1,38 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export function parse(content?: string) { - const schema = typeof content === 'string' && content.trim(); - - if (!schema) { - return null; - } - - const result = schema.match(/\((\w+)\)\s+(\w+)/); - - if (result === null || result.length < 3) { - throw new Error( - 'Invalid schema definition. Required format is `@apiSchema () `' - ); - } - - const group = result[1]; - - return { - group, - name: result[2], - }; -} - -/** - * Exports - */ -module.exports = { - parse, - path: 'local.schemas', - method: 'push', -}; diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_worker/index.js b/x-pack/plugins/ml/scripts/apidoc_scripts/schema_worker/index.js deleted file mode 100644 index 0c86ab03c7da..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_worker/index.js +++ /dev/null @@ -1,9 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -require('../../../../../../src/setup_node_env'); -module.exports = require('./schema_worker'); diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_worker/schema_worker.ts b/x-pack/plugins/ml/scripts/apidoc_scripts/schema_worker/schema_worker.ts deleted file mode 100644 index b0c228192de7..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/schema_worker/schema_worker.ts +++ /dev/null @@ -1,85 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import * as fs from 'fs'; -import * as path from 'path'; -import type { DocEntry } from '../schema_extractor'; -import { extractDocumentation } from '../schema_extractor'; -import type { ApiParameter, Block } from '../types'; - -export function postProcess(parsedFiles: any[]): void { - const schemasDirPath = path.resolve(__dirname, '..', '..', '..', 'server', 'routes', 'schemas'); - - const schemaFiles = fs - .readdirSync(schemasDirPath) - .map((filename) => path.resolve(schemasDirPath, filename)); - - const schemaDocs = extractDocumentation(schemaFiles); - - parsedFiles.forEach((parsedFile) => { - // @ts-ignore - parsedFile.forEach((block: Block) => { - const { - local: { schemas }, - } = block; - if (!schemas || schemas.length === 0) return; - - for (const schema of schemas) { - const { name: schemaName, group: paramsGroup } = schema; - const schemaFields = schemaDocs.get(schemaName); - - if (!schemaFields) return; - - updateBlockParameters(schemaFields, block, paramsGroup); - } - }); - }); -} - -/** - * Extracts schema's doc entries to apidoc parameters - * @param docEntries - * @param block - * @param paramsGroup - */ -function updateBlockParameters(docEntries: DocEntry[], block: Block, paramsGroup: string): void { - if (!block.local.parameter) { - block.local.parameter = {}; - } - if (!block.local.parameter.fields) { - block.local.parameter.fields = {}; - } - - if (!block.local.parameter.fields![paramsGroup]) { - block.local.parameter.fields![paramsGroup] = []; - } - const collection = block.local.parameter.fields![paramsGroup] as ApiParameter[]; - - for (const field of docEntries) { - collection.push({ - group: paramsGroup, - type: escapeSpecial(field.type), - size: undefined, - allowedValues: undefined, - optional: !!field.optional, - field: field.name, - defaultValue: undefined, - description: field.documentation, - }); - - if (field.nested) { - updateBlockParameters(field.nested, block, field.name); - } - } -} - -/** - * Escape special character to make sure the markdown table isn't broken - */ -function escapeSpecial(str: string): string { - return str.replace(/\|/g, '\\|'); -} diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/template.md b/x-pack/plugins/ml/scripts/apidoc_scripts/template.md deleted file mode 100644 index 11a469bfeec5..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/template.md +++ /dev/null @@ -1,147 +0,0 @@ -<% if (header) { -%> -<%- header %> -<% } -%> - - -v<%= project.version %> - -<%= project.description %> - -<% if (prepend) { -%> -<%- prepend %> -<% } -%> -<% data.forEach(group => { -%> - -## <%= group.name %> -<% group.subs.forEach(sub => { -%> - -### <%= sub.title %> -[Back to top](#top) - -<%- sub.description ? `${sub.description}\n\n` : '' -%> -``` -<%- sub.type.toUpperCase() %> <%= sub.url %> -``` -<% if (sub.header && sub.header.fields && sub.header.fields.Header.length) { -%> - -##### Headers -| Name | Type | Description | -|---------|-----------|--------------------------------------| -<% sub.header.fields.Header.forEach(header => { -%> -| <%- header.field %> | <%- header.type ? `\`${header.type}\`` : '' %> | <%- header.optional ? '**optional**' : '' %><%- header.description %> | -<% }) // foreach parameter -%> -<% } // if parameters -%> -<% if (sub.header && sub.header.examples && sub.header.examples.length) { -%> - -##### Header examples -<% sub.header.examples.forEach(example => { -%> -<%= example.title %> - -``` -<%- example.content %> -``` -<% }) // foreach example -%> -<% } // if example -%> -<% if (sub.parameter && sub.parameter.fields) { -%> -<% Object.keys(sub.parameter.fields).forEach(g => { -%> - -##### Parameters - `<%= g -%>` -| Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -<% sub.parameter.fields[g].forEach(param => { -%> -| <%- param.field -%> | <%- param.type ? `\`${param.type}\`` : '' %> | <%- param.optional ? '**optional** ' : '' -%><%- param.description -%> -<% if (param.defaultValue) { -%> -_Default value: <%= param.defaultValue %>_
<% } -%> -<% if (param.size) { -%> -_Size range: <%- param.size %>_
<% } -%> -<% if (param.allowedValues) { -%> -_Allowed values: <%- param.allowedValues %>_<% } -%> | -<% }) // foreach (group) parameter -%> -<% }) // foreach param parameter -%> -<% } // if parameters -%> -<% if (sub.examples && sub.examples.length) { -%> - -##### Examples -<% sub.examples.forEach(example => { -%> -<%= example.title %> - -``` -<%- example.content %> -``` -<% }) // foreach example -%> -<% } // if example -%> -<% if (sub.parameter && sub.parameter.examples && sub.parameter.examples.length) { -%> - -##### Parameters examples -<% sub.parameter.examples.forEach(exampleParam => { -%> -`<%= exampleParam.type %>` - <%= exampleParam.title %> - -```<%= exampleParam.type %> -<%- exampleParam.content %> -``` -<% }) // foreach exampleParam -%> -<% } // if exampleParam -%> -<% if (sub.success && sub.success.fields) { -%> - -##### Success response -<% Object.keys(sub.success.fields).forEach(g => { -%> - -###### Success response - `<%= g %>` -| Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -<% sub.success.fields[g].forEach(param => { -%> -| <%- param.field %> | <%- param.type ? `\`${param.type}\`` : '' %> | <%- param.optional ? '**optional**' : '' %><%- param.description -%> -<% if (param.defaultValue) { -%> -_Default value: <%- param.defaultValue %>_
<% } -%> -<% if (param.size) { -%> -_Size range: <%- param.size -%>_
<% } -%> -<% if (param.allowedValues) { -%> -_Allowed values: <%- param.allowedValues %>_<% } -%> | -<% }) // foreach (group) parameter -%> -<% }) // foreach field -%> -<% } // if success.fields -%> -<% if (sub.success && sub.success.examples && sub.success.examples.length) { -%> - -##### Success response example -<% sub.success.examples.forEach(example => { -%> - -###### Success response example - `<%= example.title %>` - -``` -<%- example.content %> -``` -<% }) // foreach success example -%> -<% } // if success.examples -%> -<% if (sub.error && sub.error.fields) { -%> - -##### Error response -<% Object.keys(sub.error.fields).forEach(g => { -%> - -###### Error response - `<%= g %>` -| Name | Type | Description | -|:---------|:-----------|:--------------------------------------| -<% sub.error.fields[g].forEach(param => { -%> -| <%- param.field %> | <%- param.type ? `\`${param.type}\`` : '' %> | <%- param.optional ? '**optional**' : '' %><%- param.description -%> -<% if (param.defaultValue) { -%> -_Default value: <%- param.defaultValue %>_
<% } -%> -<% if (param.size) { -%> -_Size range: <%- param.size -%>_
<% } -%> -<% if (param.allowedValues) { -%> -_Allowed values: <%- param.allowedValues %>_<% } -%> | -<% }) // foreach (group) parameter -%> -<% }) // foreach field -%> -<% } // if error.fields -%> -<% if (sub.error && sub.error.examples && sub.error.examples.length) { -%> - -##### Error response example -<% sub.error.examples.forEach(example => { -%> - -###### Error response example - `<%= example.title %>` - -``` -<%- example.content %> -``` -<% }) // foreach error example -%> -<% } // if error.examples -%> -<% }) // foreach sub -%> -<% }) // foreach group -%> diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/types.ts b/x-pack/plugins/ml/scripts/apidoc_scripts/types.ts deleted file mode 100644 index dc0e2c3805c9..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/types.ts +++ /dev/null @@ -1,43 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export interface ApiParameter { - group: string; - type: any; - size: undefined; - allowedValues: undefined; - optional: boolean; - field: string; - defaultValue: undefined; - description?: string; -} - -interface Local { - group: string; - type: string; - url: string; - title: string; - name: string; - description: string; - parameter: { - fields?: { - [key: string]: ApiParameter[] | undefined; - }; - }; - success: { fields: ObjectConstructor[] }; - version: string; - filename: string; - schemas?: Array<{ - name: string; - group: string; - }>; -} - -export interface Block { - global: any; - local: Local; -} diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/version_filter/index.js b/x-pack/plugins/ml/scripts/apidoc_scripts/version_filter/index.js deleted file mode 100644 index 6e4f3e483552..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/version_filter/index.js +++ /dev/null @@ -1,9 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -require('../../../../../../src/setup_node_env'); -module.exports = require('./version_filter'); diff --git a/x-pack/plugins/ml/scripts/apidoc_scripts/version_filter/version_filter.ts b/x-pack/plugins/ml/scripts/apidoc_scripts/version_filter/version_filter.ts deleted file mode 100644 index 7569715a5bc6..000000000000 --- a/x-pack/plugins/ml/scripts/apidoc_scripts/version_filter/version_filter.ts +++ /dev/null @@ -1,21 +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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { kibanaPackageJson } from '@kbn/repo-info'; -import type { Block } from '../types'; - -/** - * Post Filter parsed results. - * Updates api version of the endpoints. - */ -export function postFilter(parsedFiles: any[]) { - parsedFiles.forEach((parsedFile) => { - parsedFile.forEach((block: Block) => { - block.local.version = kibanaPackageJson.version; - }); - }); -} diff --git a/x-pack/plugins/ml/server/routes/README.md b/x-pack/plugins/ml/server/routes/README.md index b4ed848e28d6..3dd10d1c39b8 100644 --- a/x-pack/plugins/ml/server/routes/README.md +++ b/x-pack/plugins/ml/server/routes/README.md @@ -2,17 +2,16 @@ This folder contains ML API routes in Kibana. -Each route handler requires [apidoc-markdown](https://github.com/apidoc/apidoc-markdown) annotations in order -to generate documentation. +For better API documentation, each route handler needs a `summary` and `description`. Kibana schema definitions, which are used to validate requests and responses, also appear in the documentation. To improve the documentation's clarity, it's important to include a detailed `description` for each property in these schema definitions as well. -There are custom parser and worker (`x-pack/plugins/ml/server/routes/apidoc_scripts`) to process api schemas for each documentation entry. It's written with typescript so make sure all the scripts in the folder are compiled before executing `apidoc` command. +To generate an OpenAPI spec file, make sure the OAS Kibana endpoint is enabled in `kibana.dev.yml` -Make sure you have run `yarn kbn bootstrap` to get all requires dev dependencies. Then execute the following command from the ml plugin folder: +```yaml +server.oas.enabled: true ``` -yarn run apiDocs -``` -It compiles all the required scripts and generates the documentation both in HTML and Markdown formats. +And after starting Kibana `yarn start --no-base-path`, call the `oas` endpoint and output to a file, e.g. -It will create a new directory `routes_doc` (next to the `routes` folder) which contains the documentation in HTML format -as well as `ML_API.md` file. +```bash +curl -s -u : http://localhost:5601/api/oas\?pathStartsWith\=/internal/ml\&access\=internal -o ml_kibana_openapi.json +``` diff --git a/x-pack/plugins/ml/server/routes/alerting.ts b/x-pack/plugins/ml/server/routes/alerting.ts index 64eba6846c58..ec4ec2b7c748 100644 --- a/x-pack/plugins/ml/server/routes/alerting.ts +++ b/x-pack/plugins/ml/server/routes/alerting.ts @@ -17,12 +17,6 @@ export function alertingRoutes( ) { /** * @apiGroup Alerting - * - * @api {post} /internal/ml/alerting/preview Preview alerting condition - * @apiName PreviewAlert - * @apiDescription Returns a preview of the alerting condition - * - * @apiSchema (body) mlAnomalyDetectionAlertPreviewRequest */ router.versioned .post({ @@ -31,6 +25,8 @@ export function alertingRoutes( options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Previews an alerting condition', + description: 'Returns a preview of the alerting condition', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/annotations.ts b/x-pack/plugins/ml/server/routes/annotations.ts index 3f776b884888..49528052c2bc 100644 --- a/x-pack/plugins/ml/server/routes/annotations.ts +++ b/x-pack/plugins/ml/server/routes/annotations.ts @@ -15,6 +15,7 @@ import { annotationServiceProvider } from '../models/annotation_service'; import { wrapError } from '../client/error_wrapper'; import type { RouteInitialization } from '../types'; import { + annotationsResponseSchema, deleteAnnotationSchema, getAnnotationsSchema, indexAnnotationSchema, @@ -40,15 +41,6 @@ export function annotationRoutes( ) { /** * @apiGroup Annotations - * - * @api {post} /internal/ml/annotations Gets annotations - * @apiName GetAnnotations - * @apiDescription Gets annotations. - * - * @apiSchema (body) getAnnotationsSchema - * - * @apiSuccess {Boolean} success - * @apiSuccess {Object} annotations */ router.versioned .post({ @@ -57,12 +49,17 @@ export function annotationRoutes( options: { tags: ['access:ml:canGetAnnotations'], }, + summary: 'Gets annotations', + description: 'Gets annotations.', }) .addVersion( { version: '1', validate: { request: { body: getAnnotationsSchema }, + response: { + 200: { body: annotationsResponseSchema, description: 'Get annotations response' }, + }, }, }, routeGuard.fullLicenseAPIGuard(async ({ client, request, response }) => { @@ -81,12 +78,6 @@ export function annotationRoutes( /** * @apiGroup Annotations - * - * @api {put} /internal/ml/annotations/index Index annotation - * @apiName IndexAnnotations - * @apiDescription Index the annotation. - * - * @apiSchema (body) indexAnnotationSchema */ router.versioned .put({ @@ -95,6 +86,8 @@ export function annotationRoutes( options: { tags: ['access:ml:canCreateAnnotation'], }, + summary: 'Indexes annotation', + description: 'Indexes the annotation.', }) .addVersion( { @@ -129,12 +122,6 @@ export function annotationRoutes( /** * @apiGroup Annotations - * - * @api {delete} /internal/ml/annotations/delete/:annotationId Deletes annotation - * @apiName DeleteAnnotation - * @apiDescription Deletes specified annotation - * - * @apiSchema (params) deleteAnnotationSchema */ router.versioned .delete({ @@ -143,6 +130,8 @@ export function annotationRoutes( options: { tags: ['access:ml:canDeleteAnnotation'], }, + summary: 'Deletes annotation', + description: 'Deletes the specified annotation.', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/anomaly_detectors.ts b/x-pack/plugins/ml/server/routes/anomaly_detectors.ts index 02725de279e8..1fafd467595e 100644 --- a/x-pack/plugins/ml/server/routes/anomaly_detectors.ts +++ b/x-pack/plugins/ml/server/routes/anomaly_detectors.ts @@ -23,6 +23,7 @@ import { updateModelSnapshotsSchema, updateModelSnapshotBodySchema, forceQuerySchema, + getAnomalyDetectorsResponse, } from './schemas/anomaly_detectors_schema'; import { getAuthorizationHeader } from '../lib/request_authorization'; @@ -30,16 +31,6 @@ import { getAuthorizationHeader } from '../lib/request_authorization'; * Routes for the anomaly detectors */ export function jobRoutes({ router, routeGuard }: RouteInitialization) { - /** - * @apiGroup AnomalyDetectors - * - * @api {get} /internal/ml/anomaly_detectors Get anomaly detectors data - * @apiName GetAnomalyDetectors - * @apiDescription Returns the list of anomaly detection jobs. - * - * @apiSuccess {Number} count - * @apiSuccess {Object[]} jobs - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors`, @@ -47,11 +38,17 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Gets anomaly detectors', + description: 'Returns the list of anomaly detection jobs.', }) .addVersion( { version: '1', - validate: false, + validate: { + response: { + 200: { body: getAnomalyDetectorsResponse, description: 'Anomaly detectors response' }, + }, + }, }, routeGuard.fullLicenseAPIGuard(async ({ mlClient, response }) => { try { @@ -65,15 +62,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {get} /internal/ml/anomaly_detectors/:jobId Get anomaly detection data by id - * @apiName GetAnomalyDetectorsById - * @apiDescription Returns the anomaly detection job. - * - * @apiSchema (params) jobIdSchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}`, @@ -81,6 +69,8 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Gets anomaly detector by ID', + description: 'Returns the anomaly detection job by ID', }) .addVersion( { @@ -104,16 +94,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {get} /internal/ml/anomaly_detectors/_stats Get anomaly detection stats - * @apiName GetAnomalyDetectorsStats - * @apiDescription Returns anomaly detection jobs statistics. - * - * @apiSuccess {Number} count - * @apiSuccess {Object[]} jobs - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/_stats`, @@ -121,6 +101,8 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Gets anomaly detectors stats', + description: 'Returns the anomaly detection jobs statistics.', }) .addVersion( { @@ -139,15 +121,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {get} /internal/ml/anomaly_detectors/:jobId/_stats Get stats for requested anomaly detection job - * @apiName GetAnomalyDetectorsStatsById - * @apiDescription Returns anomaly detection job statistics. - * - * @apiSchema (params) jobIdSchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}/_stats`, @@ -155,6 +128,8 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Gets anomaly detector stats by ID', + description: 'Returns the anomaly detection job statistics by ID', }) .addVersion( { @@ -178,18 +153,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {put} /internal/ml/anomaly_detectors/:jobId Create an anomaly detection job - * @apiName CreateAnomalyDetectors - * @apiDescription Creates an anomaly detection job. - * - * @apiSchema (params) jobIdSchema - * @apiSchema (body) anomalyDetectionJobSchema - * - * @apiSuccess {Object} job the configuration of the job that has been created. - */ router.versioned .put({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}`, @@ -197,6 +160,8 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Creates an anomaly detection job', + description: 'Creates an anomaly detection job.', }) .addVersion( { @@ -206,6 +171,12 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { params: jobIdSchema, body: schema.object(anomalyDetectionJobSchema), }, + response: { + 200: { + body: () => schema.any(), + description: 'The configuration of the job that has been created.', + }, + }, }, }, routeGuard.fullLicenseAPIGuard(async ({ mlClient, request, response }) => { @@ -229,16 +200,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {post} /internal/ml/anomaly_detectors/:jobId/_update Update an anomaly detection job - * @apiName UpdateAnomalyDetectors - * @apiDescription Updates certain properties of an anomaly detection job. - * - * @apiSchema (params) jobIdSchema - * @apiSchema (body) anomalyDetectionUpdateJobSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}/_update`, @@ -246,6 +207,8 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canUpdateJob'], }, + summary: 'Updates an anomaly detection job', + description: 'Updates certain properties of an anomaly detection job.', }) .addVersion( { @@ -274,15 +237,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {post} /internal/ml/anomaly_detectors/:jobId/_open Open specified job - * @apiName OpenAnomalyDetectorsJob - * @apiDescription Opens an anomaly detection job. - * - * @apiSchema (params) jobIdSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}/_open`, @@ -290,6 +244,8 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canOpenJob'], }, + summary: 'Opens an anomaly detection job', + description: 'Opens an anomaly detection job.', }) .addVersion( { @@ -313,16 +269,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {post} /internal/ml/anomaly_detectors/:jobId/_close Close specified job - * @apiName CloseAnomalyDetectorsJob - * @apiDescription Closes an anomaly detection job. - * - * @apiSchema (params) jobIdSchema - * @apiSchema (query) forceQuerySchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}/_close`, @@ -330,6 +276,8 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCloseJob'], }, + summary: 'Closes an anomaly detection job', + description: 'Closes an anomaly detection job.', }) .addVersion( { @@ -360,16 +308,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {delete} /internal/ml/anomaly_detectors/:jobId Delete specified job - * @apiName DeleteAnomalyDetectorsJob - * @apiDescription Deletes specified anomaly detection job. - * - * @apiSchema (params) jobIdSchema - * @apiSchema (query) forceQuerySchema - */ router.versioned .delete({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}`, @@ -377,6 +315,8 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canDeleteJob'], }, + summary: 'Deletes an anomaly detection job', + description: 'Deletes specified anomaly detection job.', }) .addVersion( { @@ -408,13 +348,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {post} /internal/ml/anomaly_detectors/_validate/detector Validate detector - * @apiName ValidateAnomalyDetector - * @apiDescription Validates specified detector. - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/_validate/detector`, @@ -422,6 +355,8 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Validates detector', + description: 'Validates specified detector.', }) .addVersion( { @@ -444,16 +379,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {post} /internal/ml/anomaly_detectors/:jobId/_forecast Create forecast for specified job - * @apiName ForecastAnomalyDetector - * @apiDescription Creates a forecast for the specified anomaly detection job, predicting the future behavior of a time series by using its historical behavior. - * - * @apiSchema (params) jobIdSchema - * @apiSchema (body) forecastAnomalyDetector - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}/_forecast`, @@ -461,6 +386,9 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canForecastJob'], }, + summary: 'Creates forecast for specified job', + description: + 'Creates a forecast for the specified anomaly detection job, predicting the future behavior of a time series by using its historical behavior.', }) .addVersion( { @@ -491,19 +419,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {post} /internal/ml/anomaly_detectors/:jobId/results/buckets Obtain bucket scores for the specified job ID - * @apiName GetBuckets - * @apiDescription The get buckets API presents a chronological view of the records, grouped by bucket. - * - * @apiSchema (params) getBucketParamsSchema - * @apiSchema (body) getBucketsSchema - * - * @apiSuccess {Number} count - * @apiSuccess {Object[]} buckets - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}/results/buckets/{timestamp?}`, @@ -511,6 +426,9 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Gets bucket scores', + description: + 'The get buckets API presents a chronological view of the records, grouped by bucket.', }) .addVersion( { @@ -520,6 +438,12 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { params: getBucketParamsSchema, body: getBucketsSchema, }, + response: { + 200: { + body: () => + schema.object({ count: schema.number(), buckets: schema.arrayOf(schema.any()) }), + }, + }, }, }, routeGuard.fullLicenseAPIGuard(async ({ mlClient, request, response }) => { @@ -538,19 +462,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {post} /internal/ml/anomaly_detectors/:jobId/results/overall_buckets Obtain overall bucket scores for the specified job ID - * @apiName GetOverallBuckets - * @apiDescription Retrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs. - * - * @apiSchema (params) jobIdSchema - * @apiSchema (body) getOverallBucketsSchema - * - * @apiSuccess {Number} count - * @apiSuccess {Object[]} overall_buckets - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}/results/overall_buckets`, @@ -558,6 +469,9 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get overall buckets', + description: + 'Retrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs.', }) .addVersion( { @@ -588,15 +502,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {get} /internal/ml/anomaly_detectors/:jobId/results/categories/:categoryId Get results category data by job ID and category ID - * @apiName GetCategories - * @apiDescription Returns the categories results for the specified job ID and category ID. - * - * @apiSchema (params) getCategoriesSchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}/results/categories/{categoryId}`, @@ -604,6 +509,8 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get categories', + description: 'Retrieves the categories results for the specified job ID and category ID.', }) .addVersion( { @@ -629,15 +536,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {get} /internal/ml/anomaly_detectors/:jobId/model_snapshots Get model snapshots by job ID - * @apiName GetModelSnapshots - * @apiDescription Returns the model snapshots for the specified job ID - * - * @apiSchema (params) getModelSnapshotsSchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}/model_snapshots`, @@ -645,13 +543,15 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get model snapshots by job ID', + description: 'Returns the model snapshots for the specified job ID', }) .addVersion( { version: '1', validate: { request: { - params: getModelSnapshotsSchema, + params: jobIdSchema, }, }, }, @@ -669,15 +569,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {get} /internal/ml/anomaly_detectors/:jobId/model_snapshots/:snapshotId Get model snapshots by job ID and snapshot ID - * @apiName GetModelSnapshotsById - * @apiDescription Returns the model snapshots for the specified job ID and snapshot ID - * - * @apiSchema (params) getModelSnapshotsSchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}/model_snapshots/{snapshotId}`, @@ -685,6 +576,8 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get model snapshots by id', + description: 'Returns the model snapshots for the specified job ID and snapshot ID', }) .addVersion( { @@ -710,16 +603,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {post} /internal/ml/anomaly_detectors/:jobId/model_snapshots/:snapshotId/_update Update model snapshot by snapshot ID - * @apiName UpdateModelSnapshotsById - * @apiDescription Updates the model snapshot for the specified snapshot ID - * - * @apiSchema (params) updateModelSnapshotsSchema - * @apiSchema (body) updateModelSnapshotBodySchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}/model_snapshots/{snapshotId}/_update`, @@ -727,6 +610,8 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Updates model snapshot by snapshot ID', + description: 'Updates the model snapshot for the specified snapshot ID', }) .addVersion( { @@ -754,15 +639,6 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup AnomalyDetectors - * - * @api {delete} /internal/ml/anomaly_detectors/:jobId/model_snapshots/:snapshotId Delete model snapshots by snapshot ID - * @apiName GetModelSnapshotsById - * @apiDescription Deletes the model snapshot for the specified snapshot ID - * - * @apiSchema (params) updateModelSnapshotsSchema - */ router.versioned .delete({ path: `${ML_INTERNAL_BASE_PATH}/anomaly_detectors/{jobId}/model_snapshots/{snapshotId}`, @@ -770,6 +646,8 @@ export function jobRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Deletes model snapshots by snapshot ID', + description: 'Deletes the model snapshot for the specified snapshot ID', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/calendars.ts b/x-pack/plugins/ml/server/routes/calendars.ts index 31192ee29786..9ca93a78a51a 100644 --- a/x-pack/plugins/ml/server/routes/calendars.ts +++ b/x-pack/plugins/ml/server/routes/calendars.ts @@ -44,13 +44,6 @@ function getCalendarsByIds(mlClient: MlClient, calendarIds: string[]) { } export function calendars({ router, routeGuard }: RouteInitialization) { - /** - * @apiGroup Calendars - * - * @api {get} /internal/ml/calendars Gets calendars - * @apiName GetCalendars - * @apiDescription Gets calendars - size limit has been explicitly set to 1000 - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/calendars`, @@ -58,6 +51,8 @@ export function calendars({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetCalendars'], }, + summary: 'Gets calendars', + description: 'Gets calendars - size limit has been explicitly set to 10000', }) .addVersion( { @@ -77,15 +72,6 @@ export function calendars({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup Calendars - * - * @api {get} /internal/ml/calendars/:calendarIds Gets a calendar - * @apiName GetCalendarById - * @apiDescription Gets calendar by id - * - * @apiSchema (params) calendarIdsSchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/calendars/{calendarIds}`, @@ -93,6 +79,8 @@ export function calendars({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetCalendars'], }, + summary: 'Gets a calendar', + description: 'Gets a calendar by id', }) .addVersion( { @@ -123,15 +111,6 @@ export function calendars({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup Calendars - * - * @api {put} /internal/ml/calendars Creates a calendar - * @apiName PutCalendars - * @apiDescription Creates a calendar - * - * @apiSchema (body) calendarSchema - */ router.versioned .put({ path: `${ML_INTERNAL_BASE_PATH}/calendars`, @@ -139,6 +118,8 @@ export function calendars({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateCalendar'], }, + summary: 'Creates a calendar', + description: 'Creates a calendar', }) .addVersion( { @@ -164,16 +145,6 @@ export function calendars({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup Calendars - * - * @api {put} /internal/ml/calendars/:calendarId Updates a calendar - * @apiName UpdateCalendarById - * @apiDescription Updates a calendar - * - * @apiSchema (params) calendarIdSchema - * @apiSchema (body) calendarSchema - */ router.versioned .put({ path: `${ML_INTERNAL_BASE_PATH}/calendars/{calendarId}`, @@ -181,6 +152,8 @@ export function calendars({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateCalendar'], }, + summary: 'Updates a calendar', + description: 'Updates a calendar', }) .addVersion( { @@ -208,15 +181,6 @@ export function calendars({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup Calendars - * - * @api {delete} /internal/ml/calendars/:calendarId Deletes a calendar - * @apiName DeleteCalendarById - * @apiDescription Deletes a calendar - * - * @apiSchema (params) calendarIdSchema - */ router.versioned .delete({ path: `${ML_INTERNAL_BASE_PATH}/calendars/{calendarId}`, @@ -224,6 +188,8 @@ export function calendars({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canDeleteCalendar'], }, + summary: 'Deletes a calendar', + description: 'Deletes a calendar', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/data_frame_analytics.ts b/x-pack/plugins/ml/server/routes/data_frame_analytics.ts index 730fdaad26fb..e408c2a719fb 100644 --- a/x-pack/plugins/ml/server/routes/data_frame_analytics.ts +++ b/x-pack/plugins/ml/server/routes/data_frame_analytics.ts @@ -115,16 +115,6 @@ export function dataFrameAnalyticsRoutes( return body?.has_all_requested === true; } - /** - * @apiGroup DataFrameAnalytics - * - * @api {get} /internal/ml/data_frame/analytics Get analytics data - * @apiName GetDataFrameAnalytics - * @apiDescription Returns the list of data frame analytics jobs. - * - * @apiSuccess {Number} count - * @apiSuccess {Object[]} data_frame_analytics - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics`, @@ -132,6 +122,8 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canGetDataFrameAnalytics'], }, + summary: 'Gets data frame analytics', + description: 'Returns the list of data frame analytics jobs.', }) .addVersion( { @@ -157,15 +149,6 @@ export function dataFrameAnalyticsRoutes( }) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {get} /internal/ml/data_frame/analytics/:analyticsId Get analytics data by id - * @apiName GetDataFrameAnalyticsById - * @apiDescription Returns the data frame analytics job. - * - * @apiSchema (params) analyticsIdSchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/{analyticsId}`, @@ -173,6 +156,8 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canGetDataFrameAnalytics'], }, + summary: 'Gets data frame analytics by id', + description: 'Returns the data frame analytics job by id.', }) .addVersion( { @@ -202,13 +187,6 @@ export function dataFrameAnalyticsRoutes( }) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {get} /internal/ml/data_frame/analytics/_stats Get analytics stats - * @apiName GetDataFrameAnalyticsStats - * @apiDescription Returns data frame analytics jobs statistics. - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/_stats`, @@ -216,6 +194,8 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canGetDataFrameAnalytics'], }, + summary: 'Gets data frame analytics stats', + description: 'Returns the data frame analytics job statistics.', }) .addVersion( { @@ -234,15 +214,6 @@ export function dataFrameAnalyticsRoutes( }) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {get} /internal/ml/data_frame/analytics/:analyticsId/_stats Get stats for requested analytics job - * @apiName GetDataFrameAnalyticsStatsById - * @apiDescription Returns data frame analytics job statistics. - * - * @apiSchema (params) analyticsIdSchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/{analyticsId}/_stats`, @@ -250,6 +221,8 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canGetDataFrameAnalytics'], }, + summary: 'Gets data frame analytics stats by id', + description: 'Returns the data frame analytics job statistics by id.', }) .addVersion( { @@ -275,17 +248,6 @@ export function dataFrameAnalyticsRoutes( }) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {put} /internal/ml/data_frame/analytics/:analyticsId Instantiate a data frame analytics job - * @apiName UpdateDataFrameAnalytics - * @apiDescription This API creates a data frame analytics job that performs an analysis - * on the source index and stores the outcome in a destination index. - * - * @apiSchema (params) analyticsIdSchema - * @apiSchema (body) dataAnalyticsJobConfigSchema - */ router.versioned .put({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/{analyticsId}`, @@ -293,6 +255,9 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canCreateDataFrameAnalytics'], }, + summary: 'Updates data frame analytics job', + description: + 'This API creates a data frame analytics job that performs an analysis on the source index and stores the outcome in a destination index.', }) .addVersion( { @@ -360,15 +325,6 @@ export function dataFrameAnalyticsRoutes( ) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {post} /internal/ml/data_frame/_evaluate Evaluate the data frame analytics for an annotated index - * @apiName EvaluateDataFrameAnalytics - * @apiDescription Evaluates the data frame analytics for an annotated index. - * - * @apiSchema (body) dataAnalyticsEvaluateSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/_evaluate`, @@ -376,6 +332,8 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canGetDataFrameAnalytics'], }, + summary: 'Evaluates the data frame analytics', + description: 'Evaluates the data frame analytics for an annotated index.', }) .addVersion( { @@ -404,16 +362,6 @@ export function dataFrameAnalyticsRoutes( }) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {post} /internal/ml/data_frame/_explain Explain a data frame analytics config - * @apiName ExplainDataFrameAnalytics - * @apiDescription This API provides explanations for a data frame analytics config - * that either exists already or one that has not been created yet. - * - * @apiSchema (body) dataAnalyticsExplainSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/_explain`, @@ -421,6 +369,9 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canCreateDataFrameAnalytics'], }, + summary: 'Explains a data frame analytics job config', + description: + 'This API provides explanations for a data frame analytics job config that either exists already or one that has not been created yet.', }) .addVersion( { @@ -448,15 +399,6 @@ export function dataFrameAnalyticsRoutes( }) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {delete} /internal/ml/data_frame/analytics/:analyticsId Delete specified analytics job - * @apiName DeleteDataFrameAnalytics - * @apiDescription Deletes specified data frame analytics job. - * - * @apiSchema (params) analyticsIdSchema - */ router.versioned .delete({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/{analyticsId}`, @@ -464,6 +406,8 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canDeleteDataFrameAnalytics'], }, + summary: 'Deletes data frame analytics job', + description: 'Deletes specified data frame analytics job.', }) .addVersion( { @@ -558,15 +502,6 @@ export function dataFrameAnalyticsRoutes( ) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {post} /internal/ml/data_frame/analytics/:analyticsId/_start Start specified analytics job - * @apiName StartDataFrameAnalyticsJob - * @apiDescription Starts a data frame analytics job. - * - * @apiSchema (params) analyticsIdSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/{analyticsId}/_start`, @@ -574,6 +509,8 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canStartStopDataFrameAnalytics'], }, + summary: 'Starts specified analytics job', + description: 'Starts a data frame analytics job.', }) .addVersion( { @@ -599,16 +536,6 @@ export function dataFrameAnalyticsRoutes( }) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {post} /internal/ml/data_frame/analytics/:analyticsId/_stop Stop specified analytics job - * @apiName StopsDataFrameAnalyticsJob - * @apiDescription Stops a data frame analytics job. - * - * @apiSchema (params) analyticsIdSchema - * @apiSchema (query) stopsDataFrameAnalyticsJobQuerySchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/{analyticsId}/_stop`, @@ -616,6 +543,8 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canStartStopDataFrameAnalytics'], }, + summary: 'Stops specified analytics job', + description: 'Stops a data frame analytics job.', }) .addVersion( { @@ -643,15 +572,6 @@ export function dataFrameAnalyticsRoutes( }) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {post} /internal/ml/data_frame/analytics/:analyticsId/_update Update specified analytics job - * @apiName UpdateDataFrameAnalyticsJob - * @apiDescription Updates a data frame analytics job. - * - * @apiSchema (params) analyticsIdSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/{analyticsId}/_update`, @@ -659,6 +579,8 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canCreateDataFrameAnalytics'], }, + summary: 'Updates specified analytics job', + description: 'Updates a data frame analytics job.', }) .addVersion( { @@ -689,15 +611,6 @@ export function dataFrameAnalyticsRoutes( }) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {get} /internal/ml/data_frame/analytics/:analyticsId/messages Get analytics job messages - * @apiName GetDataFrameAnalyticsMessages - * @apiDescription Returns the list of audit messages for data frame analytics jobs. - * - * @apiSchema (params) analyticsIdSchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/{analyticsId}/messages`, @@ -705,6 +618,8 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canGetDataFrameAnalytics'], }, + summary: 'Gets data frame analytics messages', + description: 'Returns the list of audit messages for data frame analytics jobs.', }) .addVersion( { @@ -730,16 +645,6 @@ export function dataFrameAnalyticsRoutes( }) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {post} /internal/ml/data_frame/analytics/jobs_exist Check whether jobs exist in current or any space - * @apiName JobsExist - * @apiDescription Checks if each of the jobs in the specified list of IDs exists. - * If allSpaces is true, the check will look across all spaces. - * - * @apiSchema (params) jobsExistSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/jobs_exist`, @@ -747,6 +652,9 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canGetDataFrameAnalytics'], }, + summary: 'Checks if jobs exist', + description: + 'Checks if each of the jobs in the specified list of IDs exists. If allSpaces is true, the check will look across all spaces.', }) .addVersion( { @@ -788,15 +696,6 @@ export function dataFrameAnalyticsRoutes( }) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {get} /internal/ml/data_frame/analytics/map/:analyticsId Get objects leading up to analytics job - * @apiName GetDataFrameAnalyticsIdMap - * @apiDescription Returns map of objects leading up to analytics job. - * - * @apiParam {String} analyticsId Analytics ID. - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/map/{analyticsId}`, @@ -804,6 +703,8 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canGetDataFrameAnalytics'], }, + summary: 'Gets a data frame analytics jobs map', + description: 'Returns map of objects leading up to analytics job.', }) .addVersion( { @@ -856,13 +757,6 @@ export function dataFrameAnalyticsRoutes( }) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {get} /internal/ml/data_frame/analytics/new_job_caps/:indexPattern Get fields for a pattern of indices used for analytics - * @apiName AnalyticsNewJobCaps - * @apiDescription Retrieve the index fields for analytics - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/new_job_caps/{indexPattern}`, @@ -870,6 +764,8 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get fields for a pattern of indices used for analytics', + description: 'Returns the fields for a pattern of indices used for analytics.', }) .addVersion( { @@ -909,15 +805,6 @@ export function dataFrameAnalyticsRoutes( }) ); - /** - * @apiGroup DataFrameAnalytics - * - * @api {post} /internal/ml/data_frame/validate Validate the data frame analytics job config - * @apiName ValidateDataFrameAnalytics - * @apiDescription Validates the data frame analytics job config. - * - * @apiSchema (body) dataAnalyticsJobConfigSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/data_frame/analytics/validate`, @@ -925,6 +812,8 @@ export function dataFrameAnalyticsRoutes( options: { tags: ['access:ml:canCreateDataFrameAnalytics'], }, + summary: 'Validates the data frame analytics job config', + description: 'Validates the data frame analytics job config.', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/data_visualizer.ts b/x-pack/plugins/ml/server/routes/data_visualizer.ts index 75d27e19ed3b..32a782a2acd6 100644 --- a/x-pack/plugins/ml/server/routes/data_visualizer.ts +++ b/x-pack/plugins/ml/server/routes/data_visualizer.ts @@ -12,6 +12,7 @@ import { ML_INTERNAL_BASE_PATH } from '../../common/constants/app'; import { wrapError } from '../client/error_wrapper'; import { DataVisualizer } from '../models/data_visualizer'; import { + dataVisualizerFieldHistogramsResponse, dataVisualizerFieldHistogramsSchema, indexPatternSchema, } from './schemas/data_visualizer_schema'; @@ -33,18 +34,6 @@ function getHistogramsForFields( * Routes for the index data visualizer. */ export function dataVisualizerRoutes({ router, routeGuard }: RouteInitialization) { - /** - * @apiGroup DataVisualizer - * - * @api {post} /internal/ml/data_visualizer/get_field_histograms/:indexPattern Get histograms for fields - * @apiName GetHistogramsForFields - * @apiDescription Returns the histograms on a list fields in the specified index pattern. - * - * @apiSchema (params) indexPatternSchema - * @apiSchema (body) dataVisualizerFieldHistogramsSchema - * - * @apiSuccess {Object} fieldName histograms by field, keyed on the name of the field. - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/data_visualizer/get_field_histograms/{indexPattern}`, @@ -52,6 +41,8 @@ export function dataVisualizerRoutes({ router, routeGuard }: RouteInitialization options: { tags: ['access:ml:canGetFieldInfo'], }, + summary: 'Gets histograms for fields', + description: 'Returns the histograms on a list fields in the specified index pattern.', }) .addVersion( { @@ -61,6 +52,12 @@ export function dataVisualizerRoutes({ router, routeGuard }: RouteInitialization params: indexPatternSchema, body: dataVisualizerFieldHistogramsSchema, }, + response: { + 200: { + body: dataVisualizerFieldHistogramsResponse, + description: 'Histograms by field, keyed on the name of the field.', + }, + }, }, }, routeGuard.basicLicenseAPIGuard(async ({ client, request, response }) => { diff --git a/x-pack/plugins/ml/server/routes/datafeeds.ts b/x-pack/plugins/ml/server/routes/datafeeds.ts index 193231a473b6..a8fbc8c2ceac 100644 --- a/x-pack/plugins/ml/server/routes/datafeeds.ts +++ b/x-pack/plugins/ml/server/routes/datafeeds.ts @@ -21,13 +21,6 @@ import { getAuthorizationHeader } from '../lib/request_authorization'; * Routes for datafeed service */ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { - /** - * @apiGroup DatafeedService - * - * @api {get} /internal/ml/datafeeds Get all datafeeds - * @apiName GetDatafeeds - * @apiDescription Retrieves configuration information for datafeeds - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/datafeeds`, @@ -35,6 +28,8 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetDatafeeds'], }, + summary: 'Gets all datafeeds', + description: 'Retrieves configuration information for datafeeds.', }) .addVersion( { @@ -53,15 +48,6 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup DatafeedService - * - * @api {get} /internal/ml/datafeeds/:datafeedId Get datafeed for given datafeed id - * @apiName GetDatafeed - * @apiDescription Retrieves configuration information for datafeed - * - * @apiSchema (params) datafeedIdSchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/datafeeds/{datafeedId}`, @@ -69,6 +55,8 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetDatafeeds'], }, + summary: 'Get datafeed for given datafeed id', + description: 'Retrieves configuration information for a datafeed.', }) .addVersion( { @@ -93,13 +81,6 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup DatafeedService - * - * @api {get} /internal/ml/datafeeds/_stats Get stats for all datafeeds - * @apiName GetDatafeedsStats - * @apiDescription Retrieves usage information for datafeeds - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/datafeeds/_stats`, @@ -107,6 +88,8 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetDatafeeds'], }, + summary: 'Gets stats for all datafeeds', + description: 'Retrieves usage information for datafeeds.', }) .addVersion( { @@ -125,15 +108,6 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup DatafeedService - * - * @api {get} /internal/ml/datafeeds/:datafeedId/_stats Get datafeed stats for given datafeed id - * @apiName GetDatafeedStats - * @apiDescription Retrieves usage information for datafeed - * - * @apiSchema (params) datafeedIdSchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/datafeeds/{datafeedId}/_stats`, @@ -141,6 +115,8 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetDatafeeds'], }, + summary: 'Get datafeed stats for given datafeed id', + description: 'Retrieves usage information for a datafeed.', }) .addVersion( { @@ -167,16 +143,6 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup DatafeedService - * - * @api {put} /internal/ml/datafeeds/:datafeedId Creates datafeed - * @apiName CreateDatafeed - * @apiDescription Instantiates a datafeed - * - * @apiSchema (params) datafeedIdSchema - * @apiSchema (body) datafeedConfigSchema - */ router.versioned .put({ path: `${ML_INTERNAL_BASE_PATH}/datafeeds/{datafeedId}`, @@ -184,6 +150,8 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateDatafeed'], }, + summary: 'Creates a datafeed', + description: 'Instantiates a datafeed.', }) .addVersion( { @@ -216,16 +184,6 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup DatafeedService - * - * @api {post} /internal/ml/datafeeds/:datafeedId/_update Updates datafeed for given datafeed id - * @apiName UpdateDatafeed - * @apiDescription Updates certain properties of a datafeed - * - * @apiSchema (params) datafeedIdSchema - * @apiSchema (body) datafeedConfigSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/datafeeds/{datafeedId}/_update`, @@ -233,6 +191,8 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canUpdateDatafeed'], }, + summary: 'Updates a datafeed', + description: 'Updates certain properties of a datafeed.', }) .addVersion( { @@ -265,16 +225,6 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup DatafeedService - * - * @api {delete} /internal/ml/datafeeds/:datafeedId Deletes datafeed - * @apiName DeleteDatafeed - * @apiDescription Deletes an existing datafeed - * - * @apiSchema (params) datafeedIdSchema - * @apiSchema (query) deleteDatafeedQuerySchema - */ router.versioned .delete({ path: `${ML_INTERNAL_BASE_PATH}/datafeeds/{datafeedId}`, @@ -282,6 +232,8 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canDeleteDatafeed'], }, + summary: 'Deletes a datafeed', + description: 'Deletes an existing datafeed.', }) .addVersion( { @@ -314,16 +266,6 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup DatafeedService - * - * @api {post} /internal/ml/datafeeds/:datafeedId/_start Starts datafeed for given datafeed id(s) - * @apiName StartDatafeed - * @apiDescription Starts one or more datafeeds - * - * @apiSchema (params) datafeedIdSchema - * @apiSchema (body) startDatafeedSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/datafeeds/{datafeedId}/_start`, @@ -331,6 +273,8 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canStartStopDatafeed'], }, + summary: 'Starts a datafeed', + description: 'Starts one or more datafeeds', }) .addVersion( { @@ -364,15 +308,6 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup DatafeedService - * - * @api {post} /internal/ml/datafeeds/:datafeedId/_stop Stops datafeed for given datafeed id(s) - * @apiName StopDatafeed - * @apiDescription Stops one or more datafeeds - * - * @apiSchema (params) datafeedIdSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/datafeeds/{datafeedId}/_stop`, @@ -380,6 +315,8 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canStartStopDatafeed'], }, + summary: 'Stops a datafeed', + description: 'Stops one or more datafeeds', }) .addVersion( { @@ -407,15 +344,6 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup DatafeedService - * - * @api {get} /internal/ml/datafeeds/:datafeedId/_preview Preview datafeed for given datafeed id - * @apiName PreviewDatafeed - * @apiDescription Previews a datafeed - * - * @apiSchema (params) datafeedIdSchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/datafeeds/{datafeedId}/_preview`, @@ -423,6 +351,8 @@ export function dataFeedRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canPreviewDatafeed'], }, + summary: 'Previews a datafeed', + description: 'Previews a datafeed', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/fields_service.ts b/x-pack/plugins/ml/server/routes/fields_service.ts index ddb107dc979b..ae4bfa6110a3 100644 --- a/x-pack/plugins/ml/server/routes/fields_service.ts +++ b/x-pack/plugins/ml/server/routes/fields_service.ts @@ -10,7 +10,9 @@ import { ML_INTERNAL_BASE_PATH } from '../../common/constants/app'; import { wrapError } from '../client/error_wrapper'; import type { RouteInitialization } from '../types'; import { + getCardinalityOfFieldsResponse, getCardinalityOfFieldsSchema, + getTimeFieldRangeResponse, getTimeFieldRangeSchema, } from './schemas/fields_service_schema'; import { fieldsServiceProvider } from '../models/fields_service'; @@ -31,17 +33,6 @@ function getTimeFieldRange(client: IScopedClusterClient, payload: any) { * Routes for fields service */ export function fieldsService({ router, routeGuard }: RouteInitialization) { - /** - * @apiGroup FieldsService - * - * @api {post} /internal/ml/fields_service/field_cardinality Get cardinality of fields - * @apiName GetCardinalityOfFields - * @apiDescription Returns the cardinality of one or more fields. Returns an Object whose keys are the names of the fields, with values equal to the cardinality of the field - * - * @apiSchema (body) getCardinalityOfFieldsSchema - * - * @apiSuccess {number} fieldName cardinality of the field. - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/fields_service/field_cardinality`, @@ -49,6 +40,9 @@ export function fieldsService({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetFieldInfo'], }, + summary: 'Gets cardinality of fields', + description: + 'Returns the cardinality of one or more fields. Returns an Object whose keys are the names of the fields, with values equal to the cardinality of the field', }) .addVersion( { @@ -57,6 +51,12 @@ export function fieldsService({ router, routeGuard }: RouteInitialization) { request: { body: getCardinalityOfFieldsSchema, }, + response: { + 200: { + body: getCardinalityOfFieldsResponse, + description: 'Cardinality of fields', + }, + }, }, }, routeGuard.fullLicenseAPIGuard(async ({ client, request, response }) => { @@ -72,18 +72,6 @@ export function fieldsService({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup FieldsService - * - * @api {post} /internal/ml/fields_service/time_field_range Get time field range - * @apiName GetTimeFieldRange - * @apiDescription Returns the time range for the given index and query using the specified time range. - * - * @apiSchema (body) getTimeFieldRangeSchema - * - * @apiSuccess {Object} start start of time range with epoch and string properties. - * @apiSuccess {Object} end end of time range with epoch and string properties. - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/fields_service/time_field_range`, @@ -91,6 +79,9 @@ export function fieldsService({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetFieldInfo'], }, + summary: 'Get time field range', + description: + 'Returns the time range for the given index and query using the specified time range.', }) .addVersion( { @@ -99,6 +90,12 @@ export function fieldsService({ router, routeGuard }: RouteInitialization) { request: { body: getTimeFieldRangeSchema, }, + response: { + 200: { + body: getTimeFieldRangeResponse, + description: 'Cardinality of fields', + }, + }, }, }, routeGuard.basicLicenseAPIGuard(async ({ client, request, response }) => { diff --git a/x-pack/plugins/ml/server/routes/filters.ts b/x-pack/plugins/ml/server/routes/filters.ts index cb60b5733929..c654bbf0e2ba 100644 --- a/x-pack/plugins/ml/server/routes/filters.ts +++ b/x-pack/plugins/ml/server/routes/filters.ts @@ -46,16 +46,6 @@ function deleteFilter(mlClient: MlClient, filterId: string) { } export function filtersRoutes({ router, routeGuard }: RouteInitialization) { - /** - * @apiGroup Filters - * - * @api {get} /internal/ml/filters Get filters - * @apiName GetFilters - * @apiDescription Retrieves the list of filters which are used for custom rules in anomaly detection. Sets the size limit explicitly to return a maximum of 1000. - * - * @apiSuccess {Boolean} success - * @apiSuccess {Object[]} filters list of filters - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/filters`, @@ -63,6 +53,9 @@ export function filtersRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetFilters'], }, + summary: 'Gets filters', + description: + 'Retrieves the list of filters which are used for custom rules in anomaly detection. Sets the size limit explicitly to return a maximum of 1000.', }) .addVersion( { @@ -82,18 +75,6 @@ export function filtersRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup Filters - * - * @api {get} /internal/ml/filters/:filterId Gets filter by ID - * @apiName GetFilterById - * @apiDescription Retrieves the filter with the specified ID. - * - * @apiSchema (params) filterIdSchema - * - * @apiSuccess {Boolean} success - * @apiSuccess {Object} filter the filter with the specified ID - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/filters/{filterId}`, @@ -101,6 +82,8 @@ export function filtersRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetFilters'], }, + summary: 'Gets filter by ID', + description: 'Retrieves the filter with the specified ID.', }) .addVersion( { @@ -121,18 +104,6 @@ export function filtersRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup Filters - * - * @api {put} /internal/ml/filters Creates a filter - * @apiName CreateFilter - * @apiDescription Instantiates a filter, for use by custom rules in anomaly detection. - * - * @apiSchema (body) createFilterSchema - * - * @apiSuccess {Boolean} success - * @apiSuccess {Object} filter created filter - */ router.versioned .put({ path: `${ML_INTERNAL_BASE_PATH}/filters`, @@ -140,6 +111,8 @@ export function filtersRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateFilter'], }, + summary: 'Creates a filter', + description: 'Instantiates a filter, for use by custom rules in anomaly detection.', }) .addVersion( { @@ -162,19 +135,6 @@ export function filtersRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup Filters - * - * @api {put} /internal/ml/filters/:filterId Updates a filter - * @apiName UpdateFilter - * @apiDescription Updates the description of a filter, adds items or removes items. - * - * @apiSchema (params) filterIdSchema - * @apiSchema (body) updateFilterSchema - * - * @apiSuccess {Boolean} success - * @apiSuccess {Object} filter updated filter - */ router.versioned .put({ path: `${ML_INTERNAL_BASE_PATH}/filters/{filterId}`, @@ -182,6 +142,8 @@ export function filtersRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateFilter'], }, + summary: 'Updates a filter', + description: 'Updates the description of a filter, adds items or removes items.', }) .addVersion( { @@ -208,15 +170,6 @@ export function filtersRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup Filters - * - * @api {delete} /internal/ml/filters/:filterId Delete filter - * @apiName DeleteFilter - * @apiDescription Deletes the filter with the specified ID. - * - * @apiSchema (params) filterIdSchema - */ router.versioned .delete({ path: `${ML_INTERNAL_BASE_PATH}/filters/{filterId}`, @@ -224,6 +177,8 @@ export function filtersRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canDeleteFilter'], }, + summary: 'Deletes a filter', + description: 'Deletes the filter with the specified ID.', }) .addVersion( { @@ -248,17 +203,6 @@ export function filtersRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup Filters - * - * @api {get} /internal/ml/filters/_stats Gets filters stats - * @apiName GetFiltersStats - * @apiDescription Retrieves the list of filters which are used for custom rules in anomaly detection, - * with stats on the list of jobs and detectors which are using each filter. - * - * @apiSuccess {Boolean} success - * @apiSuccess {Object[]} filters list of filters with stats on usage - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/filters/_stats`, @@ -266,6 +210,9 @@ export function filtersRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetFilters'], }, + summary: 'Gets filters stats', + description: + 'Retrieves the list of filters which are used for custom rules in anomaly detection, with stats on the list of jobs and detectors which are using each filter.', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/inference_models.ts b/x-pack/plugins/ml/server/routes/inference_models.ts index cb12d87e2b6f..21ce595b691c 100644 --- a/x-pack/plugins/ml/server/routes/inference_models.ts +++ b/x-pack/plugins/ml/server/routes/inference_models.ts @@ -19,13 +19,6 @@ export function inferenceModelRoutes( { router, routeGuard }: RouteInitialization, cloud: CloudSetup ) { - /** - * @apiGroup TrainedModels - * - * @api {put} /internal/ml/_inference/:taskType/:inferenceId Create Inference Endpoint - * @apiName CreateInferenceEndpoint - * @apiDescription Create Inference Endpoint - */ router.versioned .put({ path: `${ML_INTERNAL_BASE_PATH}/_inference/{taskType}/{inferenceId}`, @@ -33,6 +26,8 @@ export function inferenceModelRoutes( options: { tags: ['access:ml:canCreateInferenceEndpoint'], }, + summary: 'Create an inference endpoint', + description: 'Create an inference endpoint', }) .addVersion( { @@ -64,13 +59,7 @@ export function inferenceModelRoutes( } ) ); - /** - * @apiGroup TrainedModels - * - * @api {put} /internal/ml/_inference/:taskType/:inferenceId Create Inference Endpoint - * @apiName CreateInferenceEndpoint - * @apiDescription Create Inference Endpoint - */ + router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/_inference/all`, @@ -78,6 +67,8 @@ export function inferenceModelRoutes( options: { tags: ['access:ml:canGetTrainedModels'], }, + summary: 'Get all inference endpoints', + description: 'Get all inference endpoints', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/job_audit_messages.ts b/x-pack/plugins/ml/server/routes/job_audit_messages.ts index 7763361c2c6f..4cc23555f71b 100644 --- a/x-pack/plugins/ml/server/routes/job_audit_messages.ts +++ b/x-pack/plugins/ml/server/routes/job_audit_messages.ts @@ -19,16 +19,6 @@ import { * Routes for job audit message routes */ export function jobAuditMessagesRoutes({ router, routeGuard }: RouteInitialization) { - /** - * @apiGroup JobAuditMessages - * - * @api {get} /internal/ml/job_audit_messages/messages/:jobId Get audit messages - * @apiName GetJobAuditMessages - * @apiDescription Returns audit messages for specified job ID - * - * @apiSchema (params) jobAuditMessagesJobIdSchema - * @apiSchema (query) jobAuditMessagesQuerySchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/job_audit_messages/messages/{jobId}`, @@ -36,6 +26,8 @@ export function jobAuditMessagesRoutes({ router, routeGuard }: RouteInitializati options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Gets audit messages', + description: 'Retrieves the audit messages for the specified job ID.', }) .addVersion( { @@ -70,15 +62,6 @@ export function jobAuditMessagesRoutes({ router, routeGuard }: RouteInitializati ) ); - /** - * @apiGroup JobAuditMessages - * - * @api {get} /internal/ml/job_audit_messages/messages Get all audit messages - * @apiName GetAllJobAuditMessages - * @apiDescription Returns all audit messages - * - * @apiSchema (query) jobAuditMessagesQuerySchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/job_audit_messages/messages`, @@ -86,6 +69,8 @@ export function jobAuditMessagesRoutes({ router, routeGuard }: RouteInitializati options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Gets all audit messages', + description: 'Retrieves all audit messages.', }) .addVersion( { @@ -113,15 +98,6 @@ export function jobAuditMessagesRoutes({ router, routeGuard }: RouteInitializati ) ); - /** - * @apiGroup JobAuditMessages - * - * @api {put} /internal/ml/job_audit_messages/clear_messages Clear messages - * @apiName ClearJobAuditMessages - * @apiDescription Clear the job audit messages. - * - * @apiSchema (body) clearJobAuditMessagesSchema - */ router.versioned .put({ path: `${ML_INTERNAL_BASE_PATH}/job_audit_messages/clear_messages`, @@ -129,6 +105,8 @@ export function jobAuditMessagesRoutes({ router, routeGuard }: RouteInitializati options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Clear messages', + description: 'Clear the job audit messages.', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/job_service.ts b/x-pack/plugins/ml/server/routes/job_service.ts index 3ddbf8a46cb6..37d4bf134004 100644 --- a/x-pack/plugins/ml/server/routes/job_service.ts +++ b/x-pack/plugins/ml/server/routes/job_service.ts @@ -39,15 +39,6 @@ import type { Datafeed, Job } from '../../common/types/anomaly_detection_jobs'; * Routes for job service */ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/force_start_datafeeds Start datafeeds - * @apiName ForceStartDatafeeds - * @apiDescription Starts one or more datafeeds - * - * @apiSchema (body) forceStartDatafeedSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/force_start_datafeeds`, @@ -55,6 +46,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canStartStopDatafeed'], }, + summary: 'Starts datafeeds', + description: 'Starts one or more datafeeds.', }) .addVersion( { @@ -80,15 +73,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/stop_datafeeds Stop datafeeds - * @apiName StopDatafeeds - * @apiDescription Stops one or more datafeeds - * - * @apiSchema (body) datafeedIdsSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/stop_datafeeds`, @@ -96,6 +80,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canStartStopDatafeed'], }, + summary: 'Stops datafeeds', + description: 'Stops one or more datafeeds.', }) .addVersion( { @@ -121,53 +107,44 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/delete_jobs Delete jobs - * @apiName DeleteJobs - * @apiDescription Deletes an existing anomaly detection job - * - * @apiSchema (body) jobIdsSchema - */ - router.post( - { + router.versioned + .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/delete_jobs`, - validate: { - body: deleteJobsSchema, - }, + access: 'internal', options: { tags: ['access:ml:canDeleteJob'], }, - }, - routeGuard.fullLicenseAPIGuard(async ({ client, mlClient, request, response, context }) => { - try { - const alerting = await context.alerting; - const rulesClient = alerting?.getRulesClient(); - const { deleteJobs } = jobServiceProvider(client, mlClient, rulesClient); + summary: 'Deletes jobs', + description: 'Deletes an existing anomaly detection job.', + }) + .addVersion( + { + version: '1', + validate: { + request: { + body: deleteJobsSchema, + }, + }, + }, + routeGuard.fullLicenseAPIGuard(async ({ client, mlClient, request, response, context }) => { + try { + const alerting = await context.alerting; + const rulesClient = alerting?.getRulesClient(); + const { deleteJobs } = jobServiceProvider(client, mlClient, rulesClient); - const { jobIds, deleteUserAnnotations, deleteAlertingRules } = request.body; + const { jobIds, deleteUserAnnotations, deleteAlertingRules } = request.body; - const resp = await deleteJobs(jobIds, deleteUserAnnotations, deleteAlertingRules); + const resp = await deleteJobs(jobIds, deleteUserAnnotations, deleteAlertingRules); - return response.ok({ - body: resp, - }); - } catch (e) { - return response.customError(wrapError(e)); - } - }) - ); + return response.ok({ + body: resp, + }); + } catch (e) { + return response.customError(wrapError(e)); + } + }) + ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/close_jobs Close jobs - * @apiName CloseJobs - * @apiDescription Closes one or more anomaly detection jobs - * - * @apiSchema (body) jobIdsSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/close_jobs`, @@ -175,6 +152,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCloseJob'], }, + summary: 'Closes jobs', + description: 'Closes one or more anomaly detection jobs.', }) .addVersion( { @@ -200,15 +179,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/reset_jobs Reset multiple jobs - * @apiName ResetJobs - * @apiDescription Resets one or more anomaly detection jobs - * - * @apiSchema (body) jobIdsSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/reset_jobs`, @@ -216,6 +186,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canResetJob'], }, + summary: 'Resets jobs', + description: 'Resets one or more anomaly detection jobs.', }) .addVersion( { @@ -241,15 +213,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/force_stop_and_close_job Force stop and close job - * @apiName ForceStopAndCloseJob - * @apiDescription Force stops the datafeed and then force closes the anomaly detection job specified by job ID - * - * @apiSchema (body) jobIdSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/force_stop_and_close_job`, @@ -257,6 +220,9 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCloseJob', 'access:ml:canStartStopDatafeed'], }, + summary: 'Force stops and closes job', + description: + 'Force stops the datafeed and then force closes the anomaly detection job specified by job ID', }) .addVersion( { @@ -282,20 +248,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/jobs_summary Jobs summary - * @apiName JobsSummary - * @apiDescription Returns a list of anomaly detection jobs, with summary level information for every job. - * For any supplied job IDs, full job information will be returned, which include the analysis configuration, - * job stats, datafeed stats, and calendars. - * - * @apiSchema (body) optionalJobIdsSchema - * - * @apiSuccess {Array} jobsList list of jobs. For any supplied job IDs, the job object will contain a fullJob property - * which includes the full configuration and stats for the job. - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/jobs_summary`, @@ -303,6 +255,9 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Jobs summary', + description: + 'Returns a list of anomaly detection jobs, with summary level information for every job. For any supplied job IDs, full job information will be returned, which include the analysis configuration, job stats, datafeed stats, and calendars', }) .addVersion( { @@ -327,15 +282,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/jobs_with_geo Jobs summary - * @apiName JobsSummary - * @apiDescription Returns a list of anomaly detection jobs with analysis config with fields supported by maps. - * - * @apiSuccess {Array} jobIds list of job ids. - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/jobs/jobs_with_geo`, @@ -343,6 +289,9 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Jobs with geo', + description: + 'Returns a list of anomaly detection jobs with analysis config with fields supported by maps.', }) .addVersion( { @@ -369,15 +318,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/jobs_with_time_range Jobs with time range - * @apiName JobsWithTimeRange - * @apiDescription Creates a list of jobs with data about the job's time range - * - * @apiSchema (body) jobsWithTimerangeSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/jobs_with_time_range`, @@ -385,6 +325,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Jobs with time range', + description: "Creates a list of jobs with data about the job's time range.", }) .addVersion( { @@ -405,15 +347,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/job_for_cloning Get job for cloning - * @apiName GetJobForCloning - * @apiDescription Get the job configuration with auto generated fields excluded for cloning - * - * @apiSchema (body) jobIdSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/job_for_cloning`, @@ -421,6 +354,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get job for cloning', + description: 'Get the job configuration with auto generated fields excluded for cloning', }) .addVersion( { @@ -446,15 +381,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/jobs Create jobs list - * @apiName CreateFullJobsList - * @apiDescription Creates a list of jobs - * - * @apiSchema (body) optionalJobIdsSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/jobs`, @@ -462,6 +388,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Create jobs list', + description: 'Creates a list of jobs.', }) .addVersion( { @@ -492,13 +420,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {get} /internal/ml/jobs/groups Get job groups - * @apiName GetAllGroups - * @apiDescription Returns array of group objects with job ids listed for each group - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/jobs/groups`, @@ -506,6 +427,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get all groups', + description: 'Returns array of group objects with job ids listed for each group.', }) .addVersion( { @@ -526,15 +449,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/update_groups Update job groups - * @apiName UpdateGroups - * @apiDescription Updates 'groups' property of an anomaly detection job - * - * @apiSchema (body) updateGroupsSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/update_groups`, @@ -542,6 +456,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canUpdateJob'], }, + summary: 'Update job groups', + description: 'Updates the groups property of an anomaly detection job.', }) .addVersion( { @@ -567,13 +483,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {get} /internal/ml/jobs/blocking_jobs_tasks Get blocking job tasks - * @apiName BlockingJobTasks - * @apiDescription Gets the ids of deleting, resetting or reverting anomaly detection jobs - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/jobs/blocking_jobs_tasks`, @@ -581,6 +490,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get blocking job tasks', + description: 'Gets the ids of deleting, resetting or reverting anomaly detection jobs.', }) .addVersion( { @@ -601,16 +512,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/jobs_exist Check whether jobs exists in current or any space - * @apiName JobsExist - * @apiDescription Checks if each of the jobs in the specified list of IDs exist. - * If allSpaces is true, the check will look across all spaces. - * - * @apiSchema (body) jobsExistSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/jobs_exist`, @@ -618,6 +519,9 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Check if jobs exist', + description: + 'Checks if each of the jobs in the specified list of IDs exist. If allSpaces is true, the check will look across all spaces.', }) .addVersion( { @@ -643,13 +547,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {get} /internal/ml/jobs/new_job_caps/:indexPattern Get new job capabilities - * @apiName NewJobCaps - * @apiDescription Retrieve the capabilities of fields for indices - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/jobs/new_job_caps/{indexPattern}`, @@ -657,6 +554,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get new job capabilities', + description: 'Retrieve the capabilities of fields for indices', }) .addVersion( { @@ -688,15 +587,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { ) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/new_job_line_chart Get job line chart data - * @apiName NewJobLineChart - * @apiDescription Returns line chart data for anomaly detection job - * - * @apiSchema (body) chartSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/new_job_line_chart`, @@ -704,6 +594,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Get job line chart data', + description: 'Returns line chart data for anomaly detection job', }) .addVersion( { @@ -754,15 +646,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/new_job_population_chart Get population job chart data - * @apiName NewJobPopulationChart - * @apiDescription Returns population job chart data - * - * @apiSchema (body) chartSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/new_job_population_chart`, @@ -770,6 +653,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Get job population chart data', + description: 'Returns population chart data for anomaly detection job', }) .addVersion( { @@ -818,13 +703,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {get} /internal/ml/jobs/all_jobs_and_group_ids Get all job and group IDs - * @apiName GetAllJobAndGroupIds - * @apiDescription Returns a list of all job IDs and all group IDs - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/jobs/all_jobs_and_group_ids`, @@ -832,6 +710,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get all job and group IDs', + description: 'Returns a list of all job IDs and all group IDs', }) .addVersion( { @@ -852,15 +732,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/look_back_progress Get lookback progress - * @apiName GetLookBackProgress - * @apiDescription Returns current progress of anomaly detection job - * - * @apiSchema (body) lookBackProgressSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/look_back_progress`, @@ -868,6 +739,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Get lookback progress', + description: 'Returns current progress of anomaly detection job', }) .addVersion( { @@ -893,15 +766,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/categorization_field_validation Get categorization field examples - * @apiName ValidateCategoryValidation - * @apiDescription Validates a field for categorization - * - * @apiSchema (body) categorizationFieldValidationSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/categorization_field_validation`, @@ -909,6 +773,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Get categorization field examples', + description: 'Returns examples of categorization field', }) .addVersion( { @@ -957,15 +823,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/top_categories Get top categories - * @apiName TopCategories - * @apiDescription Returns list of top categories - * - * @apiSchema (body) topCategoriesSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/top_categories`, @@ -973,6 +830,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get top categories', + description: 'Returns list of top categories', }) .addVersion( { @@ -1014,6 +873,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canPreviewDatafeed'], }, + summary: 'Get datafeed preview', + description: 'Returns a preview of the datafeed search', }) .addVersion( { @@ -1053,15 +914,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/revert_model_snapshot Revert model snapshot - * @apiName RevertModelSnapshot - * @apiDescription Reverts a job to a specified snapshot. Also allows the job to replayed to a specified date and to auto create calendars to skip analysis of specified date ranges - * - * @apiSchema (body) revertModelSnapshotSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/revert_model_snapshot`, @@ -1069,6 +921,9 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canCreateJob', 'access:ml:canStartStopDatafeed'], }, + summary: 'Revert model snapshot', + description: + 'Reverts a job to a specified snapshot. Also allows the job to replayed to a specified date and to auto create calendars to skip analysis of specified date ranges', }) .addVersion( { @@ -1102,15 +957,6 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { }) ); - /** - * @apiGroup JobService - * - * @api {post} /internal/ml/jobs/bulk_create Bulk create jobs and datafeeds - * @apiName BulkCreateJobs - * @apiDescription Bulk create jobs and datafeeds. - * - * @apiSchema (body) bulkCreateSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/jobs/bulk_create`, @@ -1118,6 +964,8 @@ export function jobServiceRoutes({ router, routeGuard }: RouteInitialization) { options: { tags: ['access:ml:canPreviewDatafeed'], }, + summary: 'Bulk create jobs and datafeeds', + description: 'Bulk create jobs and datafeeds.', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/job_validation.ts b/x-pack/plugins/ml/server/routes/job_validation.ts index b33d952f695d..0418ccc57e2b 100644 --- a/x-pack/plugins/ml/server/routes/job_validation.ts +++ b/x-pack/plugins/ml/server/routes/job_validation.ts @@ -63,15 +63,6 @@ export function jobValidationRoutes({ router, mlLicense, routeGuard }: RouteInit ); } - /** - * @apiGroup JobValidation - * - * @api {post} /internal/ml/validate/estimate_bucket_span Estimate bucket span - * @apiName EstimateBucketSpan - * @apiDescription Estimates minimum viable bucket span based on the characteristics of a pre-viewed subset of the data - * - * @apiSchema (body) estimateBucketSpanSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/validate/estimate_bucket_span`, @@ -79,6 +70,9 @@ export function jobValidationRoutes({ router, mlLicense, routeGuard }: RouteInit options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Estimates bucket span', + description: + 'Estimates the minimum viable bucket span based on the characteristics of a pre-viewed subset of the data.', }) .addVersion( { @@ -114,17 +108,6 @@ export function jobValidationRoutes({ router, mlLicense, routeGuard }: RouteInit }) ); - /** - * @apiGroup JobValidation - * - * @api {post} /internal/ml/validate/calculate_model_memory_limit Calculates model memory limit - * @apiName CalculateModelMemoryLimit - * @apiDescription Calls _estimate_model_memory endpoint to retrieve model memory estimation. - * - * @apiSchema (body) modelMemoryLimitSchema - * - * @apiSuccess {String} modelMemoryLimit - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/validate/calculate_model_memory_limit`, @@ -132,6 +115,8 @@ export function jobValidationRoutes({ router, mlLicense, routeGuard }: RouteInit options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Calculates model memory limit', + description: 'Calls _estimate_model_memory endpoint to retrieve model memory estimation.', }) .addVersion( { @@ -155,15 +140,6 @@ export function jobValidationRoutes({ router, mlLicense, routeGuard }: RouteInit }) ); - /** - * @apiGroup JobValidation - * - * @api {post} /internal/ml/validate/cardinality Validate cardinality - * @apiName ValidateCardinality - * @apiDescription Validates cardinality for the given job configuration - * - * @apiSchema (body) validateCardinalitySchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/validate/cardinality`, @@ -171,6 +147,8 @@ export function jobValidationRoutes({ router, mlLicense, routeGuard }: RouteInit options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Validates cardinality', + description: 'Validates cardinality for the given job configuration.', }) .addVersion( { @@ -195,15 +173,6 @@ export function jobValidationRoutes({ router, mlLicense, routeGuard }: RouteInit }) ); - /** - * @apiGroup JobValidation - * - * @api {post} /internal/ml/validate/job Validates job - * @apiName ValidateJob - * @apiDescription Validates the given job configuration - * - * @apiSchema (body) validateJobSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/validate/job`, @@ -211,6 +180,8 @@ export function jobValidationRoutes({ router, mlLicense, routeGuard }: RouteInit options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Validates job', + description: 'Validates the given job configuration.', }) .addVersion( { @@ -240,15 +211,6 @@ export function jobValidationRoutes({ router, mlLicense, routeGuard }: RouteInit }) ); - /** - * @apiGroup DataFeedPreviewValidation - * - * @api {post} /internal/ml/validate/datafeed_preview Validates datafeed preview - * @apiName ValidateDataFeedPreview - * @apiDescription Validates that the datafeed preview runs successfully and produces results - * - * @apiSchema (body) validateDatafeedPreviewSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/validate/datafeed_preview`, @@ -256,6 +218,8 @@ export function jobValidationRoutes({ router, mlLicense, routeGuard }: RouteInit options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Validates datafeed preview', + description: 'Validates that the datafeed preview runs successfully and produces results.', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/management.ts b/x-pack/plugins/ml/server/routes/management.ts index 7a74bac8d512..422e5e0944aa 100644 --- a/x-pack/plugins/ml/server/routes/management.ts +++ b/x-pack/plugins/ml/server/routes/management.ts @@ -25,16 +25,6 @@ import { filterForEnabledFeatureModels } from './trained_models'; * Routes for management service */ export function managementRoutes({ router, routeGuard, getEnabledFeatures }: RouteInitialization) { - /** - * @apiGroup Management - * - * @api {get} /internal/ml/management/list/:listType Management list - * @apiName ManagementList - * @apiDescription Returns a list of anomaly detection jobs, data frame analytics jobs or trained models - * - * @apiSchema (params) listTypeSchema - * - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/management/list/{listType}`, @@ -46,6 +36,9 @@ export function managementRoutes({ router, routeGuard, getEnabledFeatures }: Rou 'access:ml:canCreateTrainedModels', ], }, + summary: 'Gets management list', + description: + 'Retrieves the list of anomaly detection jobs, data frame analytics jobs or trained models.', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/model_management.ts b/x-pack/plugins/ml/server/routes/model_management.ts index 31f29fcf6c8a..d568b0f3ed91 100644 --- a/x-pack/plugins/ml/server/routes/model_management.ts +++ b/x-pack/plugins/ml/server/routes/model_management.ts @@ -25,13 +25,6 @@ export function modelManagementRoutes({ routeGuard, getEnabledFeatures, }: RouteInitialization) { - /** - * @apiGroup ModelManagement - * - * @api {get} /internal/ml/model_management/nodes_overview Get node overview about the models allocation - * @apiName GetModelManagementNodesOverview - * @apiDescription Retrieves the list of ML nodes with memory breakdown and allocated models info - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/model_management/nodes_overview`, @@ -44,6 +37,8 @@ export function modelManagementRoutes({ 'access:ml:canGetTrainedModels', ], }, + summary: 'Get node overview about the models allocation', + description: 'Retrieves the list of ML nodes with memory breakdown and allocated models info', }) .addVersion( { @@ -63,13 +58,6 @@ export function modelManagementRoutes({ }) ); - /** - * @apiGroup ModelManagement - * - * @api {get} /internal/ml/model_management/memory_usage Memory usage for jobs and trained models - * @apiName GetModelManagementMemoryUsage - * @apiDescription Returns the memory usage for jobs and trained models - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/model_management/memory_usage`, @@ -82,6 +70,8 @@ export function modelManagementRoutes({ 'access:ml:canGetTrainedModels', ], }, + summary: 'Get memory usage for jobs and trained models', + description: 'Retrieves the memory usage for jobs and trained models', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/modules.ts b/x-pack/plugins/ml/server/routes/modules.ts index b8551e2e961f..b9f25170ee8b 100644 --- a/x-pack/plugins/ml/server/routes/modules.ts +++ b/x-pack/plugins/ml/server/routes/modules.ts @@ -16,6 +16,10 @@ import { optionalModuleIdParamSchema, recognizeModulesSchema, setupModuleBodySchema, + recognizeModulesSchemaResponse, + getModulesSchemaResponse, + dataRecognizerConfigResponse, + jobExistsResponse, } from './schemas/modules'; import type { RouteInitialization } from '../types'; @@ -26,35 +30,6 @@ export function dataRecognizer( { router, routeGuard }: RouteInitialization, compatibleModuleType: CompatibleModule | null ) { - /** - * @apiGroup Modules - * - * @api {get} /internal/ml/modules/recognize/:indexPatternTitle Recognize index pattern - * @apiName RecognizeIndex - * @apiDescription By supplying an index pattern, discover if any of the modules are a match for data in that index. - * @apiSchema (params) recognizeModulesSchema - * @apiSchema (query) moduleFilterSchema - * @apiSuccess {object[]} modules Array of objects describing the modules which match the index pattern, sorted by module ID. - * @apiSuccessExample {json} Success-Response: - * [{ - * "id": "nginx_ecs", - * "title": "Nginx access logs", - * "query": { - * "bool": { - * "filter": [ - * { "term": { "event.dataset": "nginx.access" } }, - * { "exists": { "field": "source.address" } }, - * { "exists": { "field": "url.original" } }, - * { "exists": { "field": "http.response.status_code" } } - * ] - * } - * }, - * "description": "Find unusual activity in HTTP access logs from filebeat (ECS)", - * "logo": { - * "icon": "logoNginx" - * } - * }] - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/modules/recognize/{indexPatternTitle}`, @@ -62,6 +37,9 @@ export function dataRecognizer( options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Recognize index pattern', + description: + 'By supplying an index pattern, discover if any of the modules are a match for data in that index.', }) .addVersion( { @@ -71,6 +49,11 @@ export function dataRecognizer( params: recognizeModulesSchema, query: moduleFilterSchema, }, + response: { + 200: { + body: recognizeModulesSchemaResponse, + }, + }, }, }, routeGuard.fullLicenseAPIGuard( @@ -108,115 +91,6 @@ export function dataRecognizer( ) ); - /** - * @apiGroup Modules - * - * @api {get} /internal/ml/modules/get_module/:moduleId Get module - * @apiName GetModule - * @apiDescription Retrieve a whole ML module, containing jobs, datafeeds and saved objects. If - * no module ID is supplied, returns all modules. - * @apiSchema (params) moduleIdParamSchema - * @apiSchema (query) moduleFilterSchema - * @apiSuccess {object} module When a module ID is specified, returns a module object containing - * all of the jobs, datafeeds and saved objects which will be created when the module is setup. - * @apiSuccess {object[]} modules If no module ID is supplied, an array of all modules will be returned. - * @apiSuccessExample {json} Success-Response: - * { - * "id":"sample_data_ecommerce", - * "title":"Kibana sample data eCommerce", - * "description":"Find anomalies in eCommerce total sales data", - * "type":"Sample Dataset", - * "logoFile":"logo.json", - * "defaultIndexPattern":"kibana_sample_data_ecommerce", - * "query":{ - * "bool":{ - * "filter":[ - * { - * "term":{ - * "_index":"kibana_sample_data_ecommerce" - * } - * } - * ] - * } - * }, - * "jobs":[ - * { - * "id":"high_sum_total_sales", - * "config":{ - * "groups":[ - * "kibana_sample_data", - * "kibana_sample_ecommerce" - * ], - * "description":"Find customers spending an unusually high amount in an hour", - * "analysis_config":{ - * "bucket_span":"1h", - * "detectors":[ - * { - * "detector_description":"High total sales", - * "function":"high_sum", - * "field_name":"taxful_total_price", - * "over_field_name":"customer_full_name.keyword" - * } - * ], - * "influencers":[ - * "customer_full_name.keyword", - * "category.keyword" - * ] - * }, - * "analysis_limits":{ - * "model_memory_limit":"10mb" - * }, - * "data_description":{ - * "time_field":"order_date" - * }, - * "model_plot_config":{ - * "enabled":true - * }, - * "custom_settings":{ - * "created_by":"ml-module-sample", - * "custom_urls":[ - * { - * "url_name":"Raw data", - * "url_value":"kibana#/discover?_g=(time:(from:'$earliest$',mode:absolute,to:'$latest$'))&_a - * (index:ff959d40-b880-11e8-a6d9-e546fe2bba5f,query:(language:kuery,query:'customer_full_name - * keyword:\"$customer_full_name.keyword$\"'),sort:!('@timestamp',desc))" - * }, - * { - * "url_name":"Data dashboard", - * "url_value":"kibana#/dashboard/722b74f0-b882-11e8-a6d9-e546fe2bba5f?_g=(filters:!(),time:(from:'$earliest$', - * mode:absolute,to:'$latest$'))&_a=(filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f - * index:'INDEX_PATTERN_ID', key:customer_full_name.keyword,negate:!f,params:(query:'$customer_full_name.keyword$') - * type:phrase,value:'$customer_full_name.keyword$'),query:(match:(customer_full_name.keyword: - * (query:'$customer_full_name.keyword$',type:phrase))))),query:(language:kuery, query:''))" - * } - * ] - * } - * } - * } - * ], - * "datafeeds":[ - * { - * "id":"datafeed-high_sum_total_sales", - * "config":{ - * "job_id":"high_sum_total_sales", - * "indexes":[ - * "INDEX_PATTERN_NAME" - * ], - * "query":{ - * "bool":{ - * "filter":[ - * { - * "term":{ "_index":"kibana_sample_data_ecommerce" } - * } - * ] - * } - * } - * } - * } - * ], - * "kibana":{} - * } - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/modules/get_module/{moduleId?}`, @@ -224,6 +98,9 @@ export function dataRecognizer( options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get module', + description: + 'Retrieve a whole ML module, containing jobs, datafeeds and saved objects. If no module ID is supplied, returns all modules.', }) .addVersion( { @@ -233,6 +110,13 @@ export function dataRecognizer( params: optionalModuleIdParamSchema, query: moduleFilterSchema, }, + response: { + 200: { + body: getModulesSchemaResponse, + description: + 'When a module ID is specified, returns a module object containing all of the jobs, datafeeds and saved objects which will be created when the module is setup. If no module ID is supplied, an array of all modules will be returned.', + }, + }, }, }, routeGuard.fullLicenseAPIGuard( @@ -279,146 +163,6 @@ export function dataRecognizer( ) ); - /** - * @apiGroup Modules - * - * @api {post} /internal/ml/modules/setup/:moduleId Set up module - * @apiName SetupModule - * @apiDescription Runs the module setup process. - * This creates jobs, datafeeds and kibana saved objects. It allows for customization of the module, - * overriding the default configuration. It also allows the user to start the datafeed. - * @apiSchema (params) moduleIdParamSchema - * @apiSchema (body) setupModuleBodySchema - * @apiParamExample {json} jobOverrides-no-job-ID: - * "jobOverrides": { - * "analysis_limits": { - * "model_memory_limit": "13mb" - * } - * } - * @apiParamExample {json} jobOverrides-with-job-ID: - * "jobOverrides": [ - * { - * "analysis_limits": { - * "job_id": "foo" - * "model_memory_limit": "13mb" - * } - * } - * ] - * @apiParamExample {json} datafeedOverrides: - * "datafeedOverrides": [ - * { - * "scroll_size": 1001 - * }, - * { - * "job_id": "visitor_rate_ecs", - * "frequency": "30m" - * } - * ] - * @apiParamExample {json} query-overrrides-datafeedOverrides-query: - * { - * "query": {"bool":{"must":[{"match_all":{}}]}} - * "datafeedOverrides": { - * "query": {} - * } - * } - * @apiSuccess {object} results An object containing the results of creating the items in a module, - * i.e. the jobs, datafeeds and saved objects. Each item is listed by id with a success flag - * signifying whether the creation was successful. If the item creation failed, an error object - * with also be supplied containing the error. - * @apiSuccessExample {json} Success-Response: - * { - * "jobs": [{ - * "id": "test-visitor_rate_ecs", - * "success": true - * }, { - * "id": "test-status_code_rate_ecs", - * "success": true - * }, { - * "id": "test-source_ip_url_count_ecs", - * "success": true - * }, { - * "id": "test-source_ip_request_rate_ecs", - * "success": true - * }, { - * "id": "test-low_request_rate_ecs", - * "success": true - * }], - * "datafeeds": [{ - * "id": "datafeed-test-visitor_rate_ecs", - * "success": true, - * "started": false - * }, { - * "id": "datafeed-test-status_code_rate_ecs", - * "success": true, - * "started": false - * }, { - * "id": "datafeed-test-source_ip_url_count_ecs", - * "success": true, - * "started": false - * }, { - * "id": "datafeed-test-low_request_rate_ecs", - * "success": true, - * "started": false - * }, { - * "id": "datafeed-test-source_ip_request_rate_ecs", - * "success": true, - * "started": false - * }], - * "kibana": { - * "dashboard": [{ - * "id": "ml_http_access_explorer_ecs", - * "success": true - * }], - * "search": [{ - * "id": "ml_http_access_filebeat_ecs", - * "success": true - * }], - * "visualization": [{ - * "id": "ml_http_access_map_ecs", - * "success": true - * }, { - * "id": "ml_http_access_source_ip_timechart_ecs", - * "success": true - * }, { - * "id": "ml_http_access_status_code_timechart_ecs", - * "success": true - * }, { - * "id": "ml_http_access_top_source_ips_table_ecs", - * "success": true - * }, { - * "id": "ml_http_access_top_urls_table_ecs", - * "success": true - * }, { - * "id": "ml_http_access_events_timechart_ecs", - * "success": true - * }, { - * "id": "ml_http_access_unique_count_url_timechart_ecs", - * "success": true - * }] - * } - * } - * @apiSuccessExample {json} Error-Response: - * { - * "jobs": [{ - * "id": "test-status_code_rate_ecs", - * "success": false, - * "error": { - * "msg": "[resource_already_exists_exception] The job cannot be created with the Id 'test-status_code_rate_ecs'. The Id is - * already used.", - * "path": "/_ml/anomaly_detectors/test-status_code_rate_ecs", - * "query": {}, - * "body": "{...}", - * "statusCode": 400, - * "response": "{\"error\":{\"root_cause\":[{\"type\":\"resource_already_exists_exception\",\"reason\":\"The job cannot be created - * with the Id 'test-status_code_rate_ecs'. The Id is already used.\"}],\"type\":\"resource_already_exists_exception\", - * \"reason\":\"The job cannot be created with the Id 'test-status_code_rate_ecs'. The Id is already used.\"},\"status\":400}" - * } - * }, - * }, - * ... - * }] - * } - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/modules/setup/{moduleId}`, @@ -426,6 +170,9 @@ export function dataRecognizer( options: { tags: ['access:ml:canCreateJob'], }, + summary: 'Setup module', + description: + 'Runs the module setup process. This creates jobs, datafeeds and kibana saved objects. It allows for customization of the module, overriding the default configuration. It also allows the user to start the datafeed.', }) .addVersion( { @@ -435,6 +182,13 @@ export function dataRecognizer( params: moduleIdParamSchema, body: setupModuleBodySchema, }, + response: { + 200: { + body: dataRecognizerConfigResponse, + description: + 'An object containing the results of creating the items in a module, i.e. the jobs, datafeeds and saved objects. Each item is listed by id with a success flag signifying whether the creation was successful. If the item creation failed, an error object will also be supplied containing the error.', + }, + }, }, }, routeGuard.fullLicenseAPIGuard( @@ -501,56 +255,12 @@ export function dataRecognizer( ); /** - * @apiGroup Modules - * - * @api {get} /internal/ml/modules/jobs_exist/:moduleId Check if module jobs exist - * @apiName CheckExistingModuleJobs - * @apiDescription Check whether the jobs in the module with the specified ID exist in the - * current list of jobs. The check runs a test to see if any of the jobs in existence - * have an ID which ends with the ID of each job in the module. This is done as a prefix - * may be supplied in the setup endpoint which is added to the start of the ID of every job in the module. - * @apiSchema (params) moduleIdParamSchema + * @apiSuccess {boolean} jobsExist true if all the jobs in the module have a matching job with an * ID which ends with the job ID specified in the module, false otherwise. * @apiSuccess {Object[]} jobs present if the jobs do all exist, with each object having keys of id, * and optionally earliestTimestampMs, latestTimestampMs, latestResultsTimestampMs * properties if the job has processed any data. - * @apiSuccessExample {json} Success-Response: - * { - * "jobsExist":true, - * "jobs":[ - * { - * "id":"nginx_low_request_rate_ecs", - * "earliestTimestampMs":1547016291000, - * "latestTimestampMs":1548256497000 - * "latestResultsTimestampMs":1548255600000 - * }, - * { - * "id":"nginx_source_ip_request_rate_ecs", - * "earliestTimestampMs":1547015109000, - * "latestTimestampMs":1548257222000 - * "latestResultsTimestampMs":1548255600000 - * }, - * { - * "id":"nginx_source_ip_url_count_ecs", - * "earliestTimestampMs":1547015109000, - * "latestTimestampMs":1548257222000 - * "latestResultsTimestampMs":1548255600000 - * }, - * { - * "id":"nginx_status_code_rate_ecs", - * "earliestTimestampMs":1547015109000, - * "latestTimestampMs":1548257222000 - * "latestResultsTimestampMs":1548255600000 - * }, - * { - * "id":"nginx_visitor_rate_ecs", - * "earliestTimestampMs":1547016291000, - * "latestTimestampMs":1548256497000 - * "latestResultsTimestampMs":1548255600000 - * } - * ] - * } */ router.versioned .get({ @@ -559,6 +269,8 @@ export function dataRecognizer( options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Check if module jobs exist', + description: `Check whether the jobs in the module with the specified ID exist in the current list of jobs. The check runs a test to see if any of the jobs in existence have an ID which ends with the ID of each job in the module. This is done as a prefix may be supplied in the setup endpoint which is added to the start of the ID of every job in the module.`, }) .addVersion( { @@ -567,6 +279,13 @@ export function dataRecognizer( request: { params: moduleIdParamSchema, }, + response: { + 200: { + body: jobExistsResponse, + description: + 'jobs present if the jobs do all exist, with each object having keys of id, and optionally earliestTimestampMs, latestTimestampMs, latestResultsTimestampMs properties if the job has processed any data.', + }, + }, }, }, routeGuard.fullLicenseAPIGuard( diff --git a/x-pack/plugins/ml/server/routes/notifications.ts b/x-pack/plugins/ml/server/routes/notifications.ts index c248399ff001..02e7694834b7 100644 --- a/x-pack/plugins/ml/server/routes/notifications.ts +++ b/x-pack/plugins/ml/server/routes/notifications.ts @@ -19,13 +19,6 @@ export function notificationsRoutes({ routeGuard, getEnabledFeatures, }: RouteInitialization) { - /** - * @apiGroup Notifications - * - * @api {get} /internal/ml/notifications Get notifications - * @apiName GetNotifications - * @apiDescription Retrieves notifications based on provided criteria. - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/notifications`, @@ -37,6 +30,8 @@ export function notificationsRoutes({ 'access:ml:canGetTrainedModels', ], }, + summary: 'Get notifications', + description: 'Retrieves notifications based on provided criteria.', }) .addVersion( { @@ -68,13 +63,6 @@ export function notificationsRoutes({ ) ); - /** - * @apiGroup Notifications - * - * @api {get} /internal/ml/notifications/count Get notification counts - * @apiName GetNotificationCounts - * @apiDescription Counts notifications by level. - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/notifications/count`, @@ -86,6 +74,8 @@ export function notificationsRoutes({ 'access:ml:canGetTrainedModels', ], }, + summary: 'Get notification counts', + description: 'Counts notifications by level.', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/results_service.ts b/x-pack/plugins/ml/server/routes/results_service.ts index 225f39adc0d6..e558c1f94a30 100644 --- a/x-pack/plugins/ml/server/routes/results_service.ts +++ b/x-pack/plugins/ml/server/routes/results_service.ts @@ -106,15 +106,6 @@ function getCategoryStoppedPartitions(mlClient: MlClient, payload: any) { * Routes for results service */ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization) { - /** - * @apiGroup ResultsService - * - * @api {post} /internal/ml/results/anomalies_table_data Get anomalies records for table display - * @apiName GetAnomaliesTableData - * @apiDescription Retrieves anomaly records for an anomaly detection job and formats them for anomalies table display. - * - * @apiSchema (body) anomaliesTableDataSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/results/anomalies_table_data`, @@ -122,6 +113,9 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get anomalies records for table display', + description: + 'Retrieves anomaly records for an anomaly detection job and formats them for anomalies table display.', }) .addVersion( { @@ -145,15 +139,6 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization }) ); - /** - * @apiGroup ResultsService - * - * @api {post} /internal/ml/results/category_definition Get category definition - * @apiName GetCategoryDefinition - * @apiDescription Returns the definition of the category with the specified ID and job ID - * - * @apiSchema (body) categoryDefinitionSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/results/category_definition`, @@ -161,6 +146,8 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get category definition', + description: 'Returns the definition of the category with the specified ID and job ID.', }) .addVersion( { @@ -184,15 +171,6 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization }) ); - /** - * @apiGroup ResultsService - * - * @api {post} /internal/ml/results/max_anomaly_score Get the maximum anomaly_score - * @apiName GetMaxAnomalyScore - * @apiDescription Returns the maximum anomaly score of the bucket results for the request job ID(s) and time range - * - * @apiSchema (body) maxAnomalyScoreSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/results/max_anomaly_score`, @@ -200,6 +178,9 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get the maximum anomaly_score', + description: + 'Returns the maximum anomaly score of the bucket results for the request job ID(s) and time range.', }) .addVersion( { @@ -223,15 +204,6 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization }) ); - /** - * @apiGroup ResultsService - * - * @api {post} /internal/ml/results/category_examples Get category examples - * @apiName GetCategoryExamples - * @apiDescription Returns examples for the categories with the specified IDs from the job with the supplied ID - * - * @apiSchema (body) categoryExamplesSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/results/category_examples`, @@ -239,6 +211,9 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get category examples', + description: + 'Returns examples for the categories with the specified IDs from the job with the supplied ID.', }) .addVersion( { @@ -262,15 +237,6 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization }) ); - /** - * @apiGroup ResultsService - * - * @api {post} /internal/ml/results/partition_fields_values Returns partition fields values - * @apiName GetPartitionFieldsValues - * @apiDescription Returns the partition fields with values that match the provided criteria for the specified job ID. - * - * @apiSchema (body) partitionFieldValuesSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/results/partition_fields_values`, @@ -278,6 +244,9 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get partition fields values', + description: + 'Returns the partition fields with values that match the provided criteria for the specified job ID.', }) .addVersion( { @@ -301,14 +270,6 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization }) ); - /** - * @apiGroup ResultsService - * - * @api {post} /internal/ml/results/anomaly_search Run a search on the anomaly results index - * @apiName AnomalySearch - * @apiDescription Runs the supplied query against the anomaly results index for the specified job IDs. - * @apiSchema (body) anomalySearchSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/results/anomaly_search`, @@ -316,6 +277,9 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Run a search on the anomaly results index', + description: + 'Runs the supplied query against the anomaly results index for the specified job IDs.', }) .addVersion( { @@ -339,15 +303,6 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization }) ); - /** - * @apiGroup ResultsService - * - * @api {get} /internal/ml/results/:jobId/categorizer_stats Return categorizer statistics - * @apiName GetCategorizerStats - * @apiDescription Returns the categorizer stats for the specified job ID - * @apiSchema (params) jobIdSchema - * @apiSchema (query) getCategorizerStatsSchema - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/results/{jobId}/categorizer_stats`, @@ -355,6 +310,8 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get categorizer statistics', + description: 'Returns the categorizer statistics for the specified job ID.', }) .addVersion( { @@ -378,14 +335,6 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization }) ); - /** - * @apiGroup ResultsService - * - * @api {post} /internal/ml/results/category_stopped_partitions Get partitions that have stopped being categorized - * @apiName GetCategoryStoppedPartitions - * @apiDescription Returns information on the partitions that have stopped being categorized due to the categorization status changing from ok to warn. Can return either the list of stopped partitions for each job, or just the list of job IDs. - * @apiSchema (body) getCategorizerStoppedPartitionsSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/results/category_stopped_partitions`, @@ -393,6 +342,9 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get partitions that have stopped being categorized', + description: + 'Returns information on the partitions that have stopped being categorized due to the categorization status changing from ok to warn. Can return either the list of stopped partitions for each job, or just the list of job IDs.', }) .addVersion( { @@ -415,15 +367,6 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization }) ); - /** - * @apiGroup ResultsService - * - * @api {post} /internal/ml/results/datafeed_results_chart Get datafeed results chart data - * @apiName GetDatafeedResultsChartData - * @apiDescription Returns datafeed results chart data - * - * @apiSchema (body) getDatafeedResultsChartDataSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/results/datafeed_results_chart`, @@ -431,6 +374,8 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get datafeed results chart data', + description: 'Returns datafeed results chart data', }) .addVersion( { @@ -455,15 +400,6 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization }) ); - /** - * @apiGroup ResultsService - * - * @api {post} /internal/ml/results/anomaly_charts Get data for anomaly charts - * @apiName GetAnomalyChartsData - * @apiDescription Returns anomaly charts data - * - * @apiSchema (body) getAnomalyChartsSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/results/anomaly_charts`, @@ -471,6 +407,8 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get data for anomaly charts', + description: 'Returns anomaly charts data', }) .addVersion( { @@ -495,15 +433,6 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization }) ); - /** - * @apiGroup ResultsService - * - * @api {post} /internal/ml/results/anomaly_records Get anomaly records for criteria - * @apiName GetAnomalyRecords - * @apiDescription Returns anomaly records - * - * @apiSchema (body) getAnomalyRecordsSchema - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/results/anomaly_records`, @@ -511,6 +440,8 @@ export function resultsServiceRoutes({ router, routeGuard }: RouteInitialization options: { tags: ['access:ml:canGetJobs'], }, + summary: 'Get anomaly records for criteria', + description: 'Returns anomaly records', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/saved_objects.ts b/x-pack/plugins/ml/server/routes/saved_objects.ts index 485ce7ffe1f7..74eb14ef68f8 100644 --- a/x-pack/plugins/ml/server/routes/saved_objects.ts +++ b/x-pack/plugins/ml/server/routes/saved_objects.ts @@ -28,14 +28,6 @@ export function savedObjectsRoutes( { router, routeGuard }: RouteInitialization, { getSpaces, resolveMlCapabilities }: SavedObjectsRouteDeps ) { - /** - * @apiGroup MLSavedObjects - * - * @api {get} /internal/ml/saved_objects/status Get job and trained model saved object status - * @apiName SavedObjectsStatus - * @apiDescription Lists all jobs, trained models and saved objects to view the relationship status between them - * - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/saved_objects/status`, @@ -43,6 +35,9 @@ export function savedObjectsRoutes( options: { tags: ['access:ml:canGetJobs', 'access:ml:canGetTrainedModels'], }, + summary: 'Get job and trained model saved object status', + description: + 'Lists all jobs, trained models and saved objects to view the relationship status between them', }) .addVersion( { @@ -63,17 +58,6 @@ export function savedObjectsRoutes( }) ); - /** - * @apiGroup MLSavedObjects - * - * @api {get} /api/ml/saved_objects/sync Sync job and trained models saved objects - * @apiName SyncMLSavedObjects - * @apiDescription Synchronizes saved objects for jobs and trained models. Saved objects will be created for items which are missing them, - * and saved objects will be deleted for items which no longer exist. - * Updates missing datafeed IDs in saved objects for datafeeds which exist, and - * removes datafeed IDs for datafeeds which no longer exist. - * - */ router.versioned .get({ path: `${ML_EXTERNAL_BASE_PATH}/saved_objects/sync`, @@ -116,14 +100,6 @@ export function savedObjectsRoutes( ) ); - /** - * @apiGroup MLSavedObjects - * - * @api {get} /internal/ml/saved_objects/initialize Create saved objects for all job and trained models - * @apiName InitializeMLSavedObjects - * @apiDescription Create saved objects for jobs and trained models which are missing them. - * - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/saved_objects/initialize`, @@ -135,6 +111,9 @@ export function savedObjectsRoutes( 'access:ml:canCreateTrainedModels', ], }, + summary: 'Create saved objects for all job and trained models', + description: + 'Creates saved objects for machine learning jobs and trained models which are missing them.', }) .addVersion( { @@ -162,14 +141,6 @@ export function savedObjectsRoutes( ) ); - /** - * @apiGroup MLSavedObjects - * - * @api {get} /internal/ml/saved_objects/sync_needed Check whether job and trained model saved objects need synchronizing - * @apiName SyncCheck - * @apiDescription Check whether job and trained model saved objects need synchronizing. - * - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/saved_objects/sync_check`, @@ -181,6 +152,8 @@ export function savedObjectsRoutes( 'access:ml:canGetTrainedModels', ], }, + summary: 'Check whether job and trained model saved objects need synchronizing', + description: 'Check whether job and trained model saved objects need synchronizing.', }) .addVersion( { @@ -208,15 +181,6 @@ export function savedObjectsRoutes( ) ); - /** - * @apiGroup MLSavedObjects - * - * @api {post} /internal/ml/saved_objects/update_jobs_spaces Update what spaces jobs are assigned to - * @apiName UpdateJobsSpaces - * @apiDescription Update a list of jobs to add and/or remove them from given spaces. - * - * @apiSchema (body) updateJobsSpaces - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/saved_objects/update_jobs_spaces`, @@ -224,6 +188,8 @@ export function savedObjectsRoutes( options: { tags: ['access:ml:canCreateJob', 'access:ml:canCreateDataFrameAnalytics'], }, + summary: 'Update what spaces jobs are assigned to', + description: 'Update a list of jobs to add and/or remove them from given spaces.', }) .addVersion( { @@ -254,15 +220,6 @@ export function savedObjectsRoutes( }) ); - /** - * @apiGroup MLSavedObjects - * - * @api {post} /internal/ml/saved_objects/update_trained_models_spaces Update what spaces trained models are assigned to - * @apiName UpdateTrainedModelsSpaces - * @apiDescription Update a list of trained models to add and/or remove them from given spaces. - * - * @apiSchema (body) updateTrainedModelsSpaces - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/saved_objects/update_trained_models_spaces`, @@ -270,6 +227,8 @@ export function savedObjectsRoutes( options: { tags: ['access:ml:canCreateTrainedModels'], }, + summary: 'Update what spaces trained models are assigned to', + description: 'Update a list of trained models to add and/or remove them from given spaces.', }) .addVersion( { @@ -299,15 +258,6 @@ export function savedObjectsRoutes( }) ); - /** - * @apiGroup MLSavedObjects - * - * @api {post} /internal/ml/saved_objects/remove_item_from_current_space Remove jobs or trained models from the current space - * @apiName RemoveMLSpaceAwareItemsFromCurrentSpace - * @apiDescription Remove a list of jobs or trained models from the current space. - * - * @apiSchema (body) itemsAndCurrentSpace - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/saved_objects/remove_item_from_current_space`, @@ -315,6 +265,8 @@ export function savedObjectsRoutes( options: { tags: ['access:ml:canCreateJob', 'access:ml:canCreateDataFrameAnalytics'], }, + summary: 'Remove jobs or trained models from the current space', + description: 'Remove a list of jobs or trained models from the current space.', }) .addVersion( { @@ -370,14 +322,6 @@ export function savedObjectsRoutes( }) ); - /** - * @apiGroup MLSavedObjects - * - * @api {get} /internal/ml/saved_objects/jobs_spaces Get all jobs and their spaces - * @apiName JobsSpaces - * @apiDescription List all jobs and their spaces. - * - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/saved_objects/jobs_spaces`, @@ -385,6 +329,8 @@ export function savedObjectsRoutes( options: { tags: ['access:ml:canGetJobs', 'access:ml:canGetDataFrameAnalytics'], }, + summary: 'Get all jobs and their spaces', + description: 'List all jobs and their spaces.', }) .addVersion( { @@ -405,14 +351,6 @@ export function savedObjectsRoutes( }) ); - /** - * @apiGroup MLSavedObjects - * - * @api {get} /internal/ml/saved_objects/trained_models_spaces Get all trained models and their spaces - * @apiName TrainedModelsSpaces - * @apiDescription List all trained models and their spaces. - * - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/saved_objects/trained_models_spaces`, @@ -420,6 +358,8 @@ export function savedObjectsRoutes( options: { tags: ['access:ml:canGetTrainedModels'], }, + summary: 'Get all trained models and their spaces', + description: 'List all trained models and their spaces.', }) .addVersion( { @@ -440,28 +380,6 @@ export function savedObjectsRoutes( }) ); - /** - * @apiGroup MLSavedObjects - * - * @api {post} /internal/ml/saved_objects/can_delete_ml_space_aware_item Check whether user can delete a job or trained model - * @apiName CanDeleteMLSpaceAwareItems - * @apiDescription Check the user's ability to delete jobs or trained models. Returns whether they are able - * to fully delete the job or trained model and whether they are able to remove it from - * the current space. - * Note, this is only for enabling UI controls. A user calling endpoints - * directly will still be able to delete or remove the job or trained model from a space. - * - * @apiSchema (params) itemTypeSchema - * @apiSchema (body) canDeleteMLSpaceAwareItemsSchema - * @apiSuccessExample {json} Error-Response: - * { - * "my_job": { - * "canDelete": false, - * "canRemoveFromSpace": true - * } - * } - * - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/saved_objects/can_delete_ml_space_aware_item/{jobType}`, @@ -473,6 +391,8 @@ export function savedObjectsRoutes( 'access:ml:canGetTrainedModels', ], }, + summary: 'Check whether user can delete a job or trained model', + description: `Check the user's ability to delete jobs or trained models. Returns whether they are able to fully delete the job or trained model and whether they are able to remove it from the current space. Note, this is only for enabling UI controls. A user calling endpoints directly will still be able to delete or remove the job or trained model from a space.`, }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/schemas/annotations_schema.ts b/x-pack/plugins/ml/server/routes/schemas/annotations_schema.ts index 73e876f0a912..aa1b1d57ce63 100644 --- a/x-pack/plugins/ml/server/routes/schemas/annotations_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/annotations_schema.ts @@ -6,7 +6,9 @@ */ import { schema } from '@kbn/config-schema'; +import type { Annotations } from '../../../common/types/annotations'; import { ANNOTATION_TYPE } from '../../../common/constants/annotations'; +import type { JobId } from '../../shared'; export const indexAnnotationSchema = schema.object({ timestamp: schema.number(), @@ -68,4 +70,15 @@ export const getAnnotationsSchema = schema.object({ ), }); +export const annotationsResponseSchema = () => { + return schema.object({ + success: schema.boolean(), + annotations: schema.recordOf( + schema.string(), + schema.arrayOf(indexAnnotationSchema) + ), + totalCount: schema.number(), + }); +}; + export const deleteAnnotationSchema = schema.object({ annotationId: schema.string() }); diff --git a/x-pack/plugins/ml/server/routes/schemas/anomaly_detectors_schema.ts b/x-pack/plugins/ml/server/routes/schemas/anomaly_detectors_schema.ts index 4b7fc5bf245c..370b5d657e7c 100644 --- a/x-pack/plugins/ml/server/routes/schemas/anomaly_detectors_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/anomaly_detectors_schema.ts @@ -21,13 +21,15 @@ const customRulesSchema = schema.maybe( conditions: schema.maybe(schema.arrayOf(schema.any())), scope: schema.maybe(schema.any()), params: schema.maybe(schema.any()), - }) + }), + { meta: { description: 'Custom rules' } } ) ); const AnalysisLimits = schema.object({ - /** Limit of categorization examples */ - categorization_examples_limit: schema.maybe(schema.number()), + categorization_examples_limit: schema.maybe( + schema.number({ meta: { description: 'Limit of categorization examples' } }) + ), model_memory_limit: schema.string(), }); @@ -48,7 +50,6 @@ const detectorSchema = schema.object({ ]) ), use_null: schema.maybe(schema.boolean()), - /** Custom rules */ custom_rules: customRulesSchema, detector_index: schema.maybe(schema.number()), }); @@ -61,8 +62,9 @@ const customUrlSchema = { const customSettingsSchema = schema.object( { - /** Indicates the creator entity */ - created_by: schema.maybe(schema.string()), + created_by: schema.maybe( + schema.string({ meta: { description: 'Indicates the creator entity' } }) + ), custom_urls: schema.maybe(schema.arrayOf(schema.maybe(schema.object(customUrlSchema)))), }, { unknowns: 'allow' } // Create / Update job API allows other fields to be added to custom_settings. @@ -119,7 +121,6 @@ export const anomalyDetectionJobSchema = { allow_lazy_open: schema.maybe(schema.any()), data_counts: schema.maybe(schema.any()), data_description: schema.object({ - /** Format */ format: schema.maybe(schema.string()), time_field: schema.string(), time_format: schema.maybe(schema.string()), @@ -145,9 +146,12 @@ export const anomalyDetectionJobSchema = { datafeed_config: schema.maybe(datafeedConfigSchema), }; +export const jobIdSchemaBasic = { + jobId: schema.string({ meta: { description: 'Job ID' } }), +}; + export const jobIdSchema = schema.object({ - /** Job ID. */ - jobId: schema.string(), + ...jobIdSchemaBasic, }); export const getBucketsSchema = schema.object({ @@ -156,14 +160,14 @@ export const getBucketsSchema = schema.object({ end: schema.maybe(schema.string()), exclude_interim: schema.maybe(schema.boolean()), expand: schema.maybe(schema.boolean()), - /** Page definition */ page: schema.maybe( - schema.object({ - /** Page offset */ - from: schema.number(), - /** Size of the page */ - size: schema.number(), - }) + schema.object( + { + from: schema.number({ meta: { description: 'Page offset' } }), + size: schema.number({ meta: { description: 'Size of the page' } }), + }, + { meta: { description: 'Page definition' } } + ) ), sort: schema.maybe(schema.string()), start: schema.maybe(schema.string()), @@ -183,43 +187,41 @@ export const getOverallBucketsSchema = schema.object({ }); export const getCategoriesSchema = schema.object({ - /** Category ID */ - categoryId: schema.string(), - /** Job ID */ - jobId: schema.string(), + categoryId: schema.string({ meta: { description: 'Category ID' } }), + ...jobIdSchemaBasic, }); export const getModelSnapshotsSchema = schema.object({ - /** Snapshot ID */ - snapshotId: schema.maybe(schema.string()), - /** Job ID */ - jobId: schema.string(), + snapshotId: schema.maybe(schema.string({ meta: { description: 'Snapshot ID' } })), + ...jobIdSchemaBasic, }); export const updateModelSnapshotsSchema = schema.object({ - /** Snapshot ID */ - snapshotId: schema.string(), - /** Job ID */ - jobId: schema.string(), + snapshotId: schema.string({ meta: { description: 'Snapshot ID' } }), + ...jobIdSchemaBasic, }); export const updateModelSnapshotBodySchema = schema.object({ - /** description */ description: schema.maybe(schema.string()), - /** retain */ retain: schema.maybe(schema.boolean()), }); export const forecastAnomalyDetector = schema.object({ duration: schema.any() }); export const forceQuerySchema = schema.object({ - /** force close */ force: schema.maybe(schema.boolean()), }); export const jobForCloningSchema = schema.object({ - /** Whether to retain the created_by custom setting. */ - retainCreatedBy: schema.maybe(schema.boolean()), - /** Job ID */ - jobId: schema.string(), + retainCreatedBy: schema.maybe( + schema.boolean({ meta: { description: 'Whether to retain the created_by custom setting.' } }) + ), + ...jobIdSchemaBasic, }); + +export const getAnomalyDetectorsResponse = () => { + return schema.object({ + count: schema.number(), + jobs: schema.arrayOf(schema.any()), + }); +}; diff --git a/x-pack/plugins/ml/server/routes/schemas/calendars_schema.ts b/x-pack/plugins/ml/server/routes/schemas/calendars_schema.ts index bc33ac3c57f4..1ca473d77661 100644 --- a/x-pack/plugins/ml/server/routes/schemas/calendars_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/calendars_schema.ts @@ -27,6 +27,5 @@ export const calendarSchema = schema.object({ export const calendarIdSchema = schema.object({ calendarId: schema.string() }); export const calendarIdsSchema = schema.object({ - /** Comma-separated list of calendar IDs */ - calendarIds: schema.string(), + calendarIds: schema.string({ meta: { description: 'Comma-separated list of calendar IDs' } }), }); diff --git a/x-pack/plugins/ml/server/routes/schemas/data_frame_analytics_schema.ts b/x-pack/plugins/ml/server/routes/schemas/data_frame_analytics_schema.ts index 1cafc7dd8b11..d5f696eb3a8d 100644 --- a/x-pack/plugins/ml/server/routes/schemas/data_frame_analytics_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/data_frame_analytics_schema.ts @@ -66,24 +66,15 @@ export const dataFrameAnalyticsExplainSchema = schema.object({ }); export const dataFrameAnalyticsIdSchema = schema.object({ - /** - * Analytics ID - */ - analyticsId: schema.string(), + analyticsId: schema.string({ meta: { description: 'Analytics ID' } }), }); export const dataFrameAnalyticsQuerySchema = schema.object({ - /** - * Analytics Query - */ excludeGenerated: schema.maybe(schema.boolean()), size: schema.maybe(schema.number()), }); export const deleteDataFrameAnalyticsJobSchema = schema.object({ - /** - * Analytics Destination Index - */ deleteDestIndex: schema.maybe(schema.boolean()), deleteDestDataView: schema.maybe(schema.boolean()), force: schema.maybe(schema.boolean()), diff --git a/x-pack/plugins/ml/server/routes/schemas/data_visualizer_schema.ts b/x-pack/plugins/ml/server/routes/schemas/data_visualizer_schema.ts index 37ed15a41c4a..e1fc95b6ce00 100644 --- a/x-pack/plugins/ml/server/routes/schemas/data_visualizer_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/data_visualizer_schema.ts @@ -13,9 +13,12 @@ export const indexPatternSchema = schema.object({ indexPattern: schema.string(), }); +const querySchemaBasic = { + query: schema.any({ meta: { description: 'Query to match documents in the index' } }), +}; + export const dataVisualizerFieldHistogramsSchema = schema.object({ - /** Query to match documents in the index. */ - query: schema.any(), + ...querySchemaBasic, /** The fields to return histogram data. */ fields: schema.arrayOf(schema.any()), /** Number of documents to be collected in the sample processed on each shard, or -1 for no sampling. */ @@ -62,3 +65,7 @@ export const dataVisualizerOverallStatsSchema = schema.object({ /** Optional search time runtime fields */ runtimeMappings: runtimeMappingsSchema, }); + +export const dataVisualizerFieldHistogramsResponse = () => { + return schema.any(); +}; diff --git a/x-pack/plugins/ml/server/routes/schemas/fields_service_schema.ts b/x-pack/plugins/ml/server/routes/schemas/fields_service_schema.ts index 719a35e7f66c..986b73133494 100644 --- a/x-pack/plugins/ml/server/routes/schemas/fields_service_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/fields_service_schema.ts @@ -9,31 +9,64 @@ import { schema } from '@kbn/config-schema'; import { runtimeMappingsSchema } from './runtime_mappings_schema'; import { indicesOptionsSchema } from './datafeeds_schema'; +const indexPatternSchema = { + index: schema.oneOf([schema.string(), schema.arrayOf(schema.string())], { + meta: { description: 'Index or indexes for which to return the time range.' }, + }), +}; + +const querySchema = { + query: schema.maybe( + schema.any({ meta: { description: 'Query to match documents in the index(es).' } }) + ), +}; + +const timeFieldNameSchema = { + timeFieldName: schema.maybe( + schema.string({ meta: { description: 'Name of the time field in the index' } }) + ), +}; + export const getCardinalityOfFieldsSchema = schema.object({ - /** Index or indexes for which to return the time range. */ - index: schema.oneOf([schema.string(), schema.arrayOf(schema.string())]), - /** Name(s) of the field(s) to return cardinality information. */ - fieldNames: schema.maybe(schema.arrayOf(schema.string())), - /** Query to match documents in the index(es) (optional). */ - query: schema.maybe(schema.any()), - /** Name of the time field in the index. */ - timeFieldName: schema.maybe(schema.string()), - /** Earliest timestamp for search, as epoch ms (optional). */ - earliestMs: schema.maybe(schema.oneOf([schema.number(), schema.string()])), - /** Latest timestamp for search, as epoch ms (optional). */ - latestMs: schema.maybe(schema.oneOf([schema.number(), schema.string()])), + ...indexPatternSchema, + fieldNames: schema.maybe( + schema.arrayOf(schema.string(), { + meta: { description: 'Name(s) of the field(s) to return cardinality information.' }, + }) + ), + ...querySchema, + ...timeFieldNameSchema, + earliestMs: schema.maybe( + schema.oneOf([schema.number(), schema.string()], { + meta: { description: 'Earliest timestamp for search, as epoch ms' }, + }) + ), + latestMs: schema.maybe( + schema.oneOf([schema.number(), schema.string()], { + meta: { description: 'Latest timestamp for search, as epoch ms' }, + }) + ), }); export const getTimeFieldRangeSchema = schema.object({ - /** Index or indexes for which to return the time range. */ - index: schema.oneOf([schema.string(), schema.arrayOf(schema.string())]), - /** Name of the time field in the index. */ - timeFieldName: schema.maybe(schema.string()), - /** Query to match documents in the index(es). */ - query: schema.maybe(schema.any()), - /** Additional search options. */ + ...indexPatternSchema, + ...timeFieldNameSchema, + ...querySchema, runtimeMappings: runtimeMappingsSchema, indicesOptions: indicesOptionsSchema, - /** Return times from the future. */ - allowFutureTime: schema.maybe(schema.boolean()), + allowFutureTime: schema.maybe( + schema.boolean({ meta: { description: 'Return times from the future' } }) + ), }); + +export const getCardinalityOfFieldsResponse = () => { + return schema.recordOf(schema.string(), schema.number()); +}; + +export const getTimeFieldRangeResponse = () => { + return schema.object({ + start: schema.number(), + end: schema.number(), + success: schema.boolean(), + }); +}; diff --git a/x-pack/plugins/ml/server/routes/schemas/filters_schema.ts b/x-pack/plugins/ml/server/routes/schemas/filters_schema.ts index 43a900c63cae..45b3acdde524 100644 --- a/x-pack/plugins/ml/server/routes/schemas/filters_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/filters_schema.ts @@ -20,8 +20,5 @@ export const updateFilterSchema = schema.object({ }); export const filterIdSchema = schema.object({ - /** - * ID of the filter - */ - filterId: schema.string(), + filterId: schema.string({ meta: { description: 'ID of the filter' } }), }); diff --git a/x-pack/plugins/ml/server/routes/schemas/inference_schema.ts b/x-pack/plugins/ml/server/routes/schemas/inference_schema.ts index 662b3313a06e..1f33e0931e85 100644 --- a/x-pack/plugins/ml/server/routes/schemas/inference_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/inference_schema.ts @@ -7,22 +7,17 @@ import { schema } from '@kbn/config-schema'; +const modelIdSchemaBasic = { + modelId: schema.string({ meta: { description: 'Model ID' } }), +}; + export const modelIdSchema = schema.object({ - /** - * Model ID - */ - modelId: schema.string(), + ...modelIdSchemaBasic, }); export const modelAndDeploymentIdSchema = schema.object({ - /** - * Model ID - */ - modelId: schema.string(), - /** - * Deployment ID - */ - deploymentId: schema.string(), + ...modelIdSchemaBasic, + deploymentId: schema.string({ meta: { description: 'Deployment ID' } }), }); export const createInferenceSchema = schema.object({ taskType: schema.oneOf([schema.literal('sparse_embedding'), schema.literal('text_embedding')]), @@ -73,9 +68,8 @@ export const pipelineSimulateBody = schema.object({ export const pipelineDocs = schema.arrayOf(schema.string()); export const stopDeploymentSchema = schema.object({ - modelId: schema.string(), - /** force stop */ - force: schema.maybe(schema.boolean()), + ...modelIdSchemaBasic, + force: schema.maybe(schema.boolean({ meta: { description: 'Force stop' } })), }); export const deleteTrainedModelQuerySchema = schema.object({ diff --git a/x-pack/plugins/ml/server/routes/schemas/job_audit_messages_schema.ts b/x-pack/plugins/ml/server/routes/schemas/job_audit_messages_schema.ts index aeff76f057fc..e88d3290377b 100644 --- a/x-pack/plugins/ml/server/routes/schemas/job_audit_messages_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/job_audit_messages_schema.ts @@ -8,8 +8,7 @@ import { schema } from '@kbn/config-schema'; export const jobAuditMessagesJobIdSchema = schema.object({ - /** Job ID. */ - jobId: schema.maybe(schema.string()), + jobId: schema.maybe(schema.string({ meta: { description: 'Job ID' } })), }); export const jobAuditMessagesQuerySchema = schema.object({ diff --git a/x-pack/plugins/ml/server/routes/schemas/job_service_schema.ts b/x-pack/plugins/ml/server/routes/schemas/job_service_schema.ts index 2df702809386..0feb0e70d267 100644 --- a/x-pack/plugins/ml/server/routes/schemas/job_service_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/job_service_schema.ts @@ -61,21 +61,22 @@ export const forceStartDatafeedSchema = schema.object({ end: schema.maybe(schema.number()), }); +const jobIds = { + jobIds: schema.arrayOf(schema.string(), { meta: { description: 'List of job IDs.' } }), +}; + export const jobIdsSchema = schema.object({ - /** List of job IDs. */ - jobIds: schema.arrayOf(schema.string()), + ...jobIds, }); export const deleteJobsSchema = schema.object({ - /** List of job IDs. */ - jobIds: schema.arrayOf(schema.string()), + ...jobIds, deleteUserAnnotations: schema.maybe(schema.boolean()), deleteAlertingRules: schema.maybe(schema.boolean()), }); export const optionalJobIdsSchema = schema.object({ - /** Optional list of job IDs. */ - jobIds: schema.maybe(schema.arrayOf(schema.string())), + jobIds: schema.maybe(jobIds.jobIds), }); export const lookBackProgressSchema = { diff --git a/x-pack/plugins/ml/server/routes/schemas/modules.ts b/x-pack/plugins/ml/server/routes/schemas/modules.ts index 6514f55cccfd..50fe45b653e4 100644 --- a/x-pack/plugins/ml/server/routes/schemas/modules.ts +++ b/x-pack/plugins/ml/server/routes/schemas/modules.ts @@ -8,98 +8,169 @@ import { schema } from '@kbn/config-schema'; export const setupModuleBodySchema = schema.object({ - /** - * Job ID prefix. This will be added to the start of the ID every job created by the module (optional). - */ - prefix: schema.maybe(schema.string()), - /** - * List of group IDs. This will override the groups assigned to each job created by the module (optional). - */ - groups: schema.maybe(schema.arrayOf(schema.string())), - /** - * Name of kibana index pattern. Overrides the index used in each datafeed and each index pattern - * used in the custom urls and saved objects created by the module. A matching index pattern must - * exist in kibana if the module contains custom urls or saved objects which rely on an index pattern ID. - * If the module does not contain custom urls or saved objects which require an index pattern ID, the - * indexPatternName can be any index name or pattern that will match an ES index. It can also be a comma - * separated list of names. If no indexPatternName is supplied, the default index pattern specified in - * the manifest.json will be used (optional). - */ - indexPatternName: schema.maybe(schema.string()), - /** - * ES Query DSL object. Overrides the query object for each datafeed created by the module (optional). - */ - query: schema.maybe(schema.any()), - /** - * Flag to specify that each job created by the module uses a dedicated index (optional). - */ - useDedicatedIndex: schema.maybe(schema.boolean()), - /** - * Flag to specify that each datafeed created by the module is started once saved. Defaults to false (optional). - */ - startDatafeed: schema.maybe(schema.boolean()), - /** - * Start date for datafeed. Specified in epoch seconds. Only used if startDatafeed is true. - * If not specified, a value of 0 is used i.e. start at the beginning of the data (optional). - */ - start: schema.maybe(schema.number()), - /** - * End date for datafeed. Specified in epoch seconds. Only used if startDatafeed is true. - * If not specified, the datafeed will continue to run in real time (optional). - */ - end: schema.maybe(schema.number()), - /** - * Partial job configuration which will override jobs contained in the module. Can be an array of objects. - * If a job_id is specified, only that job in the module will be overridden. - * Applied before any of the existing - * overridable options (e.g. useDedicatedIndex, groups, indexPatternName etc) - * and so can be overridden themselves (optional). - */ - jobOverrides: schema.maybe(schema.any()), - /** - * Partial datafeed configuration which will override datafeeds contained in the module. - * Can be an array of objects. - * If a datafeed_id or a job_id is specified, - * only that datafeed in the module will be overridden. Applied before any of the existing - * overridable options (e.g. useDedicatedIndex, groups, indexPatternName etc) - * and so can be overridden themselves (optional). - */ - datafeedOverrides: schema.maybe(schema.any()), - /** - * Indicates whether an estimate of the model memory limit - * should be made by checking the cardinality of fields in the job configurations (optional). - */ - estimateModelMemory: schema.maybe(schema.boolean()), - - /** - * Add each job created to the * space (optional) - */ - applyToAllSpaces: schema.maybe(schema.boolean()), + prefix: schema.maybe( + schema.string({ + meta: { + description: + 'Job ID prefix. This will be added to the start of the ID every job created by the module (optional).', + }, + }) + ), + groups: schema.maybe( + schema.arrayOf(schema.string(), { + meta: { + description: + 'List of group IDs. This will override the groups assigned to each job created by the module (optional).', + }, + }) + ), + indexPatternName: schema.maybe( + schema.string({ + meta: { + description: `Name of kibana index pattern. Overrides the index used in each datafeed and each index pattern used in the custom urls and saved objects created by the module. A matching index pattern must exist in kibana if the module contains custom urls or saved objects which rely on an index pattern ID. If the module does not contain custom urls or saved objects which require an index pattern ID, the indexPatternName can be any index name or pattern that will match an ES index. It can also be a comma separated list of names. If no indexPatternName is supplied, the default index pattern specified in the manifest.json will be used (optional).`, + }, + }) + ), + query: schema.maybe( + schema.any({ + meta: { + description: + 'ES Query DSL object. Overrides the query object for each datafeed created by the module (optional).', + }, + }) + ), + useDedicatedIndex: schema.maybe( + schema.boolean({ + meta: { + description: + 'Flag to specify that each job created by the module uses a dedicated index (optional).', + }, + }) + ), + startDatafeed: schema.maybe( + schema.boolean({ + meta: { + description: + 'Flag to specify that each datafeed created by the module is started once saved. Defaults to false (optional).', + }, + }) + ), + start: schema.maybe( + schema.number({ + meta: { + description: + 'Start date for datafeed. Specified in epoch seconds. Only used if startDatafeed is true. If not specified, a value of 0 is used i.e. start at the beginning of the data (optional).', + }, + }) + ), + end: schema.maybe( + schema.number({ + meta: { + description: `End date for datafeed. Specified in epoch seconds. Only used if startDatafeed is true. If not specified, the datafeed will continue to run in real time (optional).`, + }, + }) + ), + jobOverrides: schema.maybe( + schema.any({ + meta: { + description: + 'Partial job configuration which will override jobs contained in the module. Can be an array of objects. If a job_id is specified, only that job in the module will be overridden. Applied before any of the existing overridable options (e.g. useDedicatedIndex, groups, indexPatternName etc) and so can be overridden themselves (optional).', + }, + }) + ), + datafeedOverrides: schema.maybe( + schema.any({ + meta: { + description: + 'Partial datafeed configuration which will override datafeeds contained in the module. Can be an array of objects. If a datafeed_id or a job_id is specified, only that datafeed in the module will be overridden. Applied before any of the existing overridable options (e.g. useDedicatedIndex, groups, indexPatternName etc) and so can be overridden themselves (optional).', + }, + }) + ), + estimateModelMemory: schema.maybe( + schema.boolean({ + meta: { + description: + 'Indicates whether an estimate of the model memory limit should be made by checking the cardinality of fields in the job configurations (optional).', + }, + }) + ), + applyToAllSpaces: schema.maybe( + schema.boolean({ meta: { description: 'Add each job created to the * space (optional)' } }) + ), }); export const optionalModuleIdParamSchema = schema.object({ - /** - * ID of the module. - */ - moduleId: schema.maybe(schema.string()), + moduleId: schema.maybe(schema.string({ meta: { description: 'ID of the module' } })), }); export const moduleIdParamSchema = schema.object({ - /** - * ID of the module. - */ - moduleId: schema.string(), + moduleId: schema.string({ meta: { description: 'ID of the module' } }), }); export const recognizeModulesSchema = schema.object({ - /** - * Index pattern to recognize. Note that this does not need to be a Kibana - * index pattern, and can be the name of a single Elasticsearch index, - * or include a wildcard (*) to match multiple indices. - */ - indexPatternTitle: schema.string(), + indexPatternTitle: schema.string({ + meta: { + description: + 'Index pattern to recognize. Note that this does not need to be a Kibana index pattern, and can be the name of a single Elasticsearch index, or include a wildcard (*) to match multiple indices.', + }, + }), }); export const moduleFilterSchema = schema.object({ filter: schema.maybe(schema.string()), }); + +export const recognizeModulesSchemaResponse = () => + schema.arrayOf( + schema.object({ + id: schema.string(), + title: schema.string(), + query: schema.any(), + description: schema.string(), + logo: schema.any(), + }) + ); + +const moduleSchema = schema.object({ + id: schema.string(), + title: schema.string(), + description: schema.string(), + type: schema.string(), + logo: schema.maybe(schema.any()), + logoFile: schema.maybe(schema.string()), + defaultIndexPattern: schema.string(), + query: schema.any(), + jobs: schema.arrayOf(schema.any()), + datafeeds: schema.arrayOf(schema.any()), + kibana: schema.any(), + tags: schema.maybe(schema.arrayOf(schema.string())), +}); + +export const getModulesSchemaResponse = () => + schema.oneOf([moduleSchema, schema.arrayOf(moduleSchema)]); + +/** + * + * @link DataRecognizerConfigResponse + */ +export const dataRecognizerConfigResponse = () => + schema.object({ + datafeeds: schema.arrayOf(schema.any()), + jobs: schema.arrayOf(schema.any()), + kibana: schema.any(), + }); + +export const jobExistsResponse = () => + schema.object({ + jobsExist: schema.boolean(), + jobs: schema.maybe( + schema.arrayOf( + schema.object({ + id: schema.string(), + earliestTimestampMs: schema.number(), + latestTimestampMs: schema.number(), + latestResultsTimestampMs: schema.maybe(schema.number()), + }) + ) + ), + }); diff --git a/x-pack/plugins/ml/server/routes/schemas/notifications_schema.ts b/x-pack/plugins/ml/server/routes/schemas/notifications_schema.ts index e65aac0f95a9..8d02f40cad69 100644 --- a/x-pack/plugins/ml/server/routes/schemas/notifications_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/notifications_schema.ts @@ -9,13 +9,9 @@ import type { TypeOf } from '@kbn/config-schema'; import { schema } from '@kbn/config-schema'; export const getNotificationsQuerySchema = schema.object({ - /** - * Search string for the message content - */ - queryString: schema.maybe(schema.string()), - /** - * Sort field - */ + queryString: schema.maybe( + schema.string({ meta: { description: 'Search string for the message content' } }) + ), sortField: schema.oneOf( [ schema.literal('timestamp'), @@ -25,13 +21,12 @@ export const getNotificationsQuerySchema = schema.object({ ], { defaultValue: 'timestamp', + meta: { description: 'Sort field' }, } ), - /** - * Sort direction - */ sortDirection: schema.oneOf([schema.literal('asc'), schema.literal('desc')], { defaultValue: 'desc', + meta: { description: 'Sort direction' }, }), earliest: schema.maybe(schema.string()), latest: schema.maybe(schema.string()), diff --git a/x-pack/plugins/ml/server/routes/schemas/results_service_schema.ts b/x-pack/plugins/ml/server/routes/schemas/results_service_schema.ts index a13f3d4f2a80..5b3d268c2fff 100644 --- a/x-pack/plugins/ml/server/routes/schemas/results_service_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/results_service_schema.ts @@ -82,34 +82,32 @@ export const partitionFieldValuesSchema = schema.object({ export type FieldsConfig = TypeOf['fieldsConfig']; export type FieldConfig = TypeOf; -export const getCategorizerStatsSchema = schema.nullable( - schema.object({ - /** - * Optional value to fetch the categorizer stats - * where results are filtered by partition_by_value = value - */ - partitionByValue: schema.maybe(schema.string()), - }) -); +export const getCategorizerStatsSchema = schema.object({ + partitionByValue: schema.maybe( + schema.string({ + meta: { + description: + 'Optional value to fetch the categorizer stats where results are filtered by partition_by_value = value', + }, + }) + ), +}); export const getCategorizerStoppedPartitionsSchema = schema.object({ - /** - * List of jobIds to fetch the categorizer partitions for - */ - jobIds: schema.arrayOf(schema.string()), - /** - * Field to aggregate results by: 'job_id' or 'partition_field_value' - * If by job_id, will return list of jobIds with at least one partition that have stopped - * If by partition_field_value, it will return a list of categorizer stopped partitions for each job_id - */ - fieldToBucket: schema.maybe(schema.string()), + jobIds: schema.arrayOf(schema.string(), { + meta: { description: 'List of jobIds to fetch the categorizer partitions for' }, + }), + fieldToBucket: schema.maybe( + schema.string({ + meta: { + description: `Field to aggregate results by: 'job_id' or 'partition_field_value'. If by job_id, will return list of jobIds with at least one partition that have stopped. If by partition_field_value, it will return a list of categorizer stopped partitions for each job_id`, + }, + }) + ), }); export const getDatafeedResultsChartDataSchema = schema.object({ - /** - * Job id to fetch the bucket results for - */ - jobId: schema.string(), + jobId: schema.string({ meta: { description: 'Job id to fetch the bucket results for' } }), start: schema.number(), end: schema.number(), }); @@ -117,21 +115,24 @@ export const getDatafeedResultsChartDataSchema = schema.object({ export const getAnomalyChartsSchema = schema.object({ jobIds: schema.arrayOf(schema.string()), influencers: schema.arrayOf(schema.any()), - /** - * Severity threshold - */ - threshold: schema.number({ defaultValue: 0, min: 0, max: 99 }), + threshold: schema.number({ + defaultValue: 0, + min: 0, + max: 99, + meta: { description: 'Severity threshold' }, + }), earliestMs: schema.number(), latestMs: schema.number(), - /** - * Maximum amount of series data. - */ - maxResults: schema.number({ defaultValue: 6, min: 1, max: 50 }), + maxResults: schema.number({ + defaultValue: 6, + min: 1, + max: 50, + meta: { description: 'Maximum amount of series data' }, + }), influencersFilterQuery: schema.maybe(schema.any()), - /** - * Optimal number of data points per chart - */ - numberOfPoints: schema.number(), + numberOfPoints: schema.number({ + meta: { description: 'Optimal number of data points per chart' }, + }), timeBounds: schema.object({ min: schema.maybe(schema.number()), max: schema.maybe(schema.number()), diff --git a/x-pack/plugins/ml/server/routes/schemas/runtime_mappings_schema.ts b/x-pack/plugins/ml/server/routes/schemas/runtime_mappings_schema.ts index 44b0ad53bf85..37cb28ff4d1c 100644 --- a/x-pack/plugins/ml/server/routes/schemas/runtime_mappings_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/runtime_mappings_schema.ts @@ -12,7 +12,6 @@ import { isRuntimeField } from '@kbn/ml-runtime-field-utils'; /** * Schema for validating a runtime field */ - export const runtimeMappingsSchema = schema.object( {}, { diff --git a/x-pack/plugins/ml/server/routes/schemas/saved_objects.ts b/x-pack/plugins/ml/server/routes/schemas/saved_objects.ts index fb133fb8955c..d40638c496f0 100644 --- a/x-pack/plugins/ml/server/routes/schemas/saved_objects.ts +++ b/x-pack/plugins/ml/server/routes/schemas/saved_objects.ts @@ -44,6 +44,7 @@ export const syncJobObjects = schema.object({ simulate: schema.maybe(schema.bool export const syncCheckSchema = schema.object({ mlSavedObjectType: schema.maybe(schema.string()) }); export const canDeleteMLSpaceAwareItemsSchema = schema.object({ - /** List of job or trained model IDs. */ - ids: schema.arrayOf(schema.string()), + ids: schema.arrayOf(schema.string(), { + meta: { description: 'List of job or trained model IDs' }, + }), }); diff --git a/x-pack/plugins/ml/server/routes/system.ts b/x-pack/plugins/ml/server/routes/system.ts index ba985c8b0d39..632464e2c65f 100644 --- a/x-pack/plugins/ml/server/routes/system.ts +++ b/x-pack/plugins/ml/server/routes/system.ts @@ -23,13 +23,6 @@ export function systemRoutes( { router, mlLicense, routeGuard }: RouteInitialization, { getSpaces, cloud, resolveMlCapabilities }: SystemRouteDeps ) { - /** - * @apiGroup SystemRoutes - * - * @api {post} /internal/ml/_has_privileges Check privileges - * @apiName HasPrivileges - * @apiDescription Checks if the user has required privileges - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/_has_privileges`, @@ -37,6 +30,8 @@ export function systemRoutes( options: { tags: ['access:ml:canGetMlInfo'], }, + summary: 'Check privileges', + description: 'Checks if the user has required privileges', }) .addVersion( { @@ -92,17 +87,12 @@ export function systemRoutes( }) ); - /** - * @apiGroup SystemRoutes - * - * @api {get} /internal/ml/ml_capabilities Check ML capabilities - * @apiName MlCapabilitiesResponse - * @apiDescription Checks ML capabilities - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/ml_capabilities`, access: 'internal', + summary: 'Check ML capabilities', + description: 'Checks ML capabilities', }) .addVersion( { @@ -135,13 +125,6 @@ export function systemRoutes( }) ); - /** - * @apiGroup SystemRoutes - * - * @api {get} /internal/ml/ml_node_count Get the amount of ML nodes - * @apiName MlNodeCount - * @apiDescription Returns the amount of ML nodes. - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/ml_node_count`, @@ -149,6 +132,8 @@ export function systemRoutes( options: { tags: ['access:ml:canGetMlInfo'], }, + summary: 'Get the number of ML nodes', + description: 'Returns the number of ML nodes', }) .addVersion( { @@ -166,13 +151,6 @@ export function systemRoutes( }) ); - /** - * @apiGroup SystemRoutes - * - * @api {get} /internal/ml/info Get ML info - * @apiName MlInfo - * @apiDescription Returns defaults and limits used by machine learning. - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/info`, @@ -180,6 +158,8 @@ export function systemRoutes( options: { tags: ['access:ml:canGetMlInfo'], }, + summary: 'Get ML info', + description: 'Returns defaults and limits used by machine learning', }) .addVersion( { @@ -201,14 +181,6 @@ export function systemRoutes( }) ); - /** - * @apiGroup SystemRoutes - * - * @apiDeprecated - * - * @api {post} /internal/ml/es_search ES Search wrapper - * @apiName MlEsSearch - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/es_search`, @@ -216,6 +188,8 @@ export function systemRoutes( options: { tags: ['access:ml:canGetJobs'], }, + deprecated: true, + summary: 'ES Search wrapper', }) .addVersion( { @@ -238,12 +212,6 @@ export function systemRoutes( }) ); - /** - * @apiGroup SystemRoutes - * - * @api {post} /internal/ml/index_exists ES Field caps wrapper checks if index exists - * @apiName MlIndexExists - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/index_exists`, @@ -251,6 +219,7 @@ export function systemRoutes( options: { tags: ['access:ml:canGetFieldInfo'], }, + summary: 'ES Field caps wrapper checks if index exists', }) .addVersion( { @@ -286,12 +255,6 @@ export function systemRoutes( }) ); - /** - * @apiGroup SystemRoutes - * - * @api {post} /internal/ml/reindex_with_pipeline ES reindex wrapper to reindex with pipeline - * @apiName MlReindexWithPipeline - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/reindex_with_pipeline`, @@ -299,6 +262,7 @@ export function systemRoutes( options: { tags: ['access:ml:canCreateTrainedModels'], }, + summary: 'ES reindex wrapper to reindex with pipeline', }) .addVersion( { diff --git a/x-pack/plugins/ml/server/routes/trained_models.ts b/x-pack/plugins/ml/server/routes/trained_models.ts index a41967704136..2f3e402e05be 100644 --- a/x-pack/plugins/ml/server/routes/trained_models.ts +++ b/x-pack/plugins/ml/server/routes/trained_models.ts @@ -103,13 +103,6 @@ export function trainedModelsRoutes( { router, routeGuard, getEnabledFeatures }: RouteInitialization, cloud: CloudSetup ) { - /** - * @apiGroup TrainedModels - * - * @api {get} /internal/ml/trained_models/:modelId Get info of a trained inference model - * @apiName GetTrainedModel - * @apiDescription Retrieves configuration information for a trained model. - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/{modelId?}`, @@ -117,6 +110,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canGetTrainedModels'], }, + summary: 'Get info of a trained inference model', + description: 'Retrieves configuration information for a trained model.', }) .addVersion( { @@ -278,13 +273,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {get} /internal/ml/trained_models/_stats Get stats for all trained models - * @apiName GetTrainedModelStats - * @apiDescription Retrieves usage information for all trained models. - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/_stats`, @@ -292,6 +280,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canGetTrainedModels'], }, + summary: 'Get stats for all trained models', + description: 'Retrieves usage information for all trained models.', }) .addVersion( { @@ -312,13 +302,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {get} /internal/ml/trained_models/:modelId/_stats Get stats of a trained model - * @apiName GetTrainedModelStatsById - * @apiDescription Retrieves usage information for trained models. - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/{modelId}/_stats`, @@ -326,6 +309,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canGetTrainedModels'], }, + summary: 'Get stats for a trained model', + description: 'Retrieves usage information for a trained model.', }) .addVersion( { @@ -352,13 +337,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {get} /internal/ml/trained_models/:modelId/pipelines Get trained model pipelines - * @apiName GetTrainedModelPipelines - * @apiDescription Retrieves pipelines associated with a trained model - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/{modelId}/pipelines`, @@ -366,6 +344,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canGetTrainedModels'], }, + summary: 'Get trained model pipelines', + description: 'Retrieves ingest pipelines associated with a trained model.', }) .addVersion( { @@ -391,13 +371,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {get} /internal/ml/trained_models/ingest_pipelines Get ingest pipelines - * @apiName GetIngestPipelines - * @apiDescription Retrieves pipelines - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/ingest_pipelines`, @@ -405,6 +378,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canGetTrainedModels'], // TODO: update permissions }, + summary: 'Get ingest pipelines', + description: 'Retrieves ingest pipelines.', }) .addVersion( { @@ -423,13 +398,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {post} /internal/ml/trained_models/create_inference_pipeline creates the pipeline with inference processor - * @apiName CreateInferencePipeline - * @apiDescription Creates the inference pipeline - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/create_inference_pipeline`, @@ -437,6 +405,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canCreateTrainedModels'], }, + summary: 'Create an inference pipeline', + description: 'Creates a pipeline with inference processor', }) .addVersion( { @@ -463,13 +433,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {put} /internal/ml/trained_models/:modelId Put a trained model - * @apiName PutTrainedModel - * @apiDescription Adds a new trained model - */ router.versioned .put({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/{modelId}`, @@ -477,6 +440,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canCreateTrainedModels'], }, + summary: 'Put a trained model', + description: 'Adds a new trained model', }) .addVersion( { @@ -508,13 +473,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {delete} /internal/ml/trained_models/:modelId Delete a trained model - * @apiName DeleteTrainedModel - * @apiDescription Deletes an existing trained model that is currently not referenced by an ingest pipeline. - */ router.versioned .delete({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/{modelId}`, @@ -522,6 +480,9 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canDeleteTrainedModels'], }, + summary: 'Delete a trained model', + description: + 'Deletes an existing trained model that is currently not referenced by an ingest pipeline.', }) .addVersion( { @@ -557,13 +518,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {post} /internal/ml/trained_models/:modelId/deployment/_start Start trained model deployment - * @apiName StartTrainedModelDeployment - * @apiDescription Starts trained model deployment. - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/{modelId}/deployment/_start`, @@ -571,6 +525,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canStartStopTrainedModels'], }, + summary: 'Start trained model deployment', + description: 'Starts trained model deployment.', }) .addVersion( { @@ -603,13 +559,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {post} /internal/ml/trained_models/:modelId/deployment/_update Update trained model deployment - * @apiName UpdateTrainedModelDeployment - * @apiDescription Updates trained model deployment. - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/{modelId}/{deploymentId}/deployment/_update`, @@ -617,6 +566,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canStartStopTrainedModels'], }, + summary: 'Update trained model deployment', + description: 'Updates trained model deployment.', }) .addVersion( { @@ -642,13 +593,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {post} /internal/ml/trained_models/:modelId/deployment/_stop Stop trained model deployment - * @apiName StopTrainedModelDeployment - * @apiDescription Stops trained model deployment. - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/{modelId}/{deploymentId}/deployment/_stop`, @@ -656,6 +600,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canStartStopTrainedModels'], }, + summary: 'Stop trained model deployment', + description: 'Stops trained model deployment.', }) .addVersion( { @@ -695,13 +641,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {post} /internal/ml/trained_models/pipeline_simulate Simulates an ingest pipeline - * @apiName SimulateIngestPipeline - * @apiDescription Simulates an ingest pipeline. - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/pipeline_simulate`, @@ -709,6 +648,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canTestTrainedModels'], }, + summary: 'Simulates an ingest pipeline', + description: 'Simulates an ingest pipeline.', }) .addVersion( { @@ -735,13 +676,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {post} /internal/ml/trained_models/infer/:modelId Evaluates a trained model - * @apiName InferTrainedModelDeployment - * @apiDescription Evaluates a trained model. - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/infer/{modelId}/{deploymentId}`, @@ -749,6 +683,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canTestTrainedModels'], }, + summary: 'Evaluates a trained model.', + description: 'Evaluates a trained model.', }) .addVersion( { @@ -784,13 +720,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {get} /internal/ml/trained_models/model_downloads Gets available models for download - * @apiName GetTrainedModelDownloadList - * @apiDescription Gets available models for download with default and recommended flags based on the cluster OS and CPU architecture. - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/model_downloads`, @@ -798,6 +727,9 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canGetTrainedModels'], }, + summary: 'Get available models for download', + description: + 'Gets available models for download with supported and recommended flags based on the cluster OS and CPU architecture.', }) .addVersion( { @@ -817,13 +749,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {get} /internal/ml/trained_models/elser_config Gets ELSER config for download - * @apiName GetElserConfig - * @apiDescription Gets ELSER config for download based on the cluster OS and CPU architecture. - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/elser_config`, @@ -831,6 +756,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canGetTrainedModels'], }, + summary: 'Get ELSER config for download', + description: 'Gets ELSER config for download based on the cluster OS and CPU architecture.', }) .addVersion( { @@ -858,13 +785,6 @@ export function trainedModelsRoutes( }) ); - /** - * @apiGroup TrainedModels - * - * @api {post} /internal/ml/trained_models/install_elastic_trained_model/:modelId Installs Elastic trained model - * @apiName InstallElasticTrainedModel - * @apiDescription Downloads and installs Elastic trained model. - */ router.versioned .post({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/install_elastic_trained_model/{modelId}`, @@ -872,6 +792,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canCreateTrainedModels'], }, + summary: 'Install Elastic trained model', + description: 'Downloads and installs Elastic trained model.', }) .addVersion( { @@ -901,13 +823,6 @@ export function trainedModelsRoutes( ) ); - /** - * @apiGroup TrainedModels - * - * @api {get} /internal/ml/trained_models/download_status Gets models download status - * @apiName ModelsDownloadStatus - * @apiDescription Gets download status for all currently downloading models - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/download_status`, @@ -915,6 +830,8 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canCreateTrainedModels'], }, + summary: 'Get models download status', + description: 'Gets download status for all currently downloading models.', }) .addVersion( { @@ -936,13 +853,6 @@ export function trainedModelsRoutes( ) ); - /** - * @apiGroup TrainedModels - * - * @api {get} /internal/ml/trained_models/curated_model_config Gets curated model config - * @apiName ModelsCuratedConfigs - * @apiDescription Gets curated model config for the specified model based on cluster architecture - */ router.versioned .get({ path: `${ML_INTERNAL_BASE_PATH}/trained_models/curated_model_config/{modelName}`, @@ -950,6 +860,9 @@ export function trainedModelsRoutes( options: { tags: ['access:ml:canGetTrainedModels'], }, + summary: 'Get curated model config', + description: + 'Gets curated model config for the specified model based on cluster architecture.', }) .addVersion( { diff --git a/x-pack/plugins/ml/tsconfig.json b/x-pack/plugins/ml/tsconfig.json index 516d156cf04d..8353c023f195 100644 --- a/x-pack/plugins/ml/tsconfig.json +++ b/x-pack/plugins/ml/tsconfig.json @@ -68,7 +68,6 @@ "@kbn/ml-url-state", "@kbn/monaco", "@kbn/react-field", - "@kbn/repo-info", "@kbn/rison", "@kbn/saved-objects-finder-plugin", "@kbn/saved-objects-management-plugin", diff --git a/yarn.lock b/yarn.lock index eda377e5180c..4e4b9dc467d3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2973,18 +2973,6 @@ resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-1.3.2.tgz#439b0b50c152c89fd369d2a17eff54869b4d79b8" integrity sha512-5Frickan9c89QbPkSu6I6y8p+9eR6hZkdPahGmNDsTFX8FHLPAozyzCZMKUeW8FyYwnlCKUjqIEqxY+UctARiw== -"@isaacs/cliui@^8.0.2": - version "8.0.2" - resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" - integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== - dependencies: - string-width "^5.1.2" - string-width-cjs "npm:string-width@^4.2.0" - strip-ansi "^7.0.1" - strip-ansi-cjs "npm:strip-ansi@^6.0.1" - wrap-ansi "^8.1.0" - wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" - "@istanbuljs/load-nyc-config@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz#10602de5570baea82f8afbfa2630b24e7a8cfe5b" @@ -8164,11 +8152,6 @@ node-addon-api "^3.2.1" node-gyp-build "^4.3.0" -"@pkgjs/parseargs@^0.11.0": - version "0.11.0" - resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" - integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== - "@pmmmwh/react-refresh-webpack-plugin@^0.5.3": version "0.5.7" resolved "https://registry.yarnpkg.com/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.5.7.tgz#58f8217ba70069cc6a73f5d7e05e85b458c150e2" @@ -8184,27 +8167,6 @@ schema-utils "^3.0.0" source-map "^0.7.3" -"@pnpm/config.env-replace@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz#ab29da53df41e8948a00f2433f085f54de8b3a4c" - integrity sha512-htyl8TWnKL7K/ESFa1oW2UB5lVDxuF5DpM7tBi6Hu2LNL3mWkIzNLG6N4zoCUP1lCKNxWy/3iu8mS8MvToGd6w== - -"@pnpm/network.ca-file@^1.0.1": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@pnpm/network.ca-file/-/network.ca-file-1.0.2.tgz#2ab05e09c1af0cdf2fcf5035bea1484e222f7983" - integrity sha512-YcPQ8a0jwYU9bTdJDpXjMi7Brhkr1mXsXrUJvjqM2mQDgkRiz8jFaQGOdaLxgjtUfQgZhKy/O3cG/YwmgKaxLA== - dependencies: - graceful-fs "4.2.10" - -"@pnpm/npm-conf@^2.1.0": - version "2.2.2" - resolved "https://registry.yarnpkg.com/@pnpm/npm-conf/-/npm-conf-2.2.2.tgz#0058baf1c26cbb63a828f0193795401684ac86f0" - integrity sha512-UA91GwWPhFExt3IizW6bOeY/pQ0BkuNwKjk9iQW9KqxluGCrg4VenZ0/L+2Y0+ZOtme72EVvg6v0zo3AMQRCeA== - dependencies: - "@pnpm/config.env-replace" "^1.1.0" - "@pnpm/network.ca-file" "^1.0.1" - config-chain "^1.1.11" - "@polka/url@^1.0.0-next.20": version "1.0.0-next.21" resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.21.tgz#5de5a2385a35309427f6011992b544514d559aa1" @@ -8456,11 +8418,6 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.0.0.tgz#2ff674e9611b45b528896d820d3d7a812de2f0e4" integrity sha512-FyD2meJpDPjyNQejSjvnhpgI/azsQkA4lGbuu5BQZfjvJ9cbRZXzeWL2HceCekW4lixO9JPesIIQkSoLjeJHNQ== -"@sindresorhus/is@^5.2.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-5.6.0.tgz#41dd6093d34652cddb5d5bdeee04eafc33826668" - integrity sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g== - "@sinonjs/commons@^1", "@sinonjs/commons@^1.3.0", "@sinonjs/commons@^1.4.0", "@sinonjs/commons@^1.7.0": version "1.7.2" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.7.2.tgz#505f55c74e0272b43f6c52d81946bed7058fc0e2" @@ -9670,13 +9627,6 @@ dependencies: defer-to-connect "^2.0.0" -"@szmarczak/http-timer@^5.0.1": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-5.0.1.tgz#c7c1bf1141cdd4751b0399c8fc7b8b664cd5be3a" - integrity sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw== - dependencies: - defer-to-connect "^2.0.1" - "@tanstack/match-sorter-utils@^8.7.0": version "8.7.0" resolved "https://registry.yarnpkg.com/@tanstack/match-sorter-utils/-/match-sorter-utils-8.7.0.tgz#60b09a6d3d7974d5f86f1318053c1bd5a85fb0be" @@ -10562,11 +10512,6 @@ resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812" integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ== -"@types/http-cache-semantics@^4.0.2": - version "4.0.4" - resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz#b979ebad3919799c979b17c72621c0bc0a31c6c4" - integrity sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA== - "@types/http-proxy@^1.17.4", "@types/http-proxy@^1.17.8": version "1.17.9" resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.9.tgz#7f0e7931343761efde1e2bf48c40f02f3f75705a" @@ -12282,7 +12227,7 @@ amdefine@>=0.0.4: resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= -ansi-align@^3.0.0, ansi-align@^3.0.1: +ansi-align@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.1.tgz#0cdf12e111ace773a86e9a1fad1225c43cb19a59" integrity sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w== @@ -12376,7 +12321,7 @@ ansi-styles@^5.0.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== -ansi-styles@^6.0.0, ansi-styles@^6.1.0, ansi-styles@^6.2.1: +ansi-styles@^6.0.0, ansi-styles@^6.2.1: version "6.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== @@ -12414,31 +12359,6 @@ anymatch@^3.0.0, anymatch@^3.0.3, anymatch@^3.1.3, anymatch@~3.1.2: normalize-path "^3.0.0" picomatch "^2.0.4" -apidoc-light@^0.54.0: - version "0.54.0" - resolved "https://registry.yarnpkg.com/apidoc-light/-/apidoc-light-0.54.0.tgz#8d819bcd893ca96a60d754c59b33dcf5f9255b59" - integrity sha512-sOmzxKO3xeMrLDV0e/qjT/hSG4wvRT2QYwaFLiyVbDiU9lbIfWW83yFby9/N/HfPZP8buvNd+rPGL1iVyP9CDQ== - dependencies: - fs-extra "^11.2.0" - glob "^10.3.10" - iconv-lite "^0.6.3" - klaw-sync "^6.0.0" - lodash "^4.17.21" - markdown-it "^14.0.0" - semver "^7.5.4" - winston "^3.11.0" - -apidoc-markdown@^7.3.2: - version "7.3.2" - resolved "https://registry.yarnpkg.com/apidoc-markdown/-/apidoc-markdown-7.3.2.tgz#64c1ad45ba29dd57f376419a900cd59c786624a0" - integrity sha512-0nOfTWSaFfbgJ673ztWiup5CKauuwmhg7hJ0jR7gb0TDK1RX3b0unl6soc8UVhdjYgrvRBRvujMUB/KUF5OG3Q== - dependencies: - apidoc-light "^0.54.0" - ejs "^3.1.9" - semver "^7.5.4" - update-notifier "^7.0.0" - yargs "^17.7.2" - app-module-path@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/app-module-path/-/app-module-path-2.2.0.tgz#641aa55dfb7d6a6f0a8141c4b9c0aa50b6c24dd5" @@ -13463,20 +13383,6 @@ boxen@^5.1.2: widest-line "^3.1.0" wrap-ansi "^7.0.0" -boxen@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/boxen/-/boxen-7.1.1.tgz#f9ba525413c2fec9cdb88987d835c4f7cad9c8f4" - integrity sha512-2hCgjEmP8YLWQ130n2FerGv7rYpfBmnmp9Uy2Le1vge6X3gZIfSmEzP5QTDElFxcvVcXlEn8Aq6MU/PZygIOog== - dependencies: - ansi-align "^3.0.1" - camelcase "^7.0.1" - chalk "^5.2.0" - cli-boxes "^3.0.0" - string-width "^5.1.2" - type-fest "^2.13.0" - widest-line "^4.0.1" - wrap-ansi "^8.1.0" - bplist-parser@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.1.1.tgz#d60d5dcc20cba6dc7e1f299b35d3e1f95dafbae6" @@ -13843,24 +13749,6 @@ cacheable-lookup@^5.0.3: resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-5.0.3.tgz#049fdc59dffdd4fc285e8f4f82936591bd59fec3" integrity sha512-W+JBqF9SWe18A72XFzN/V/CULFzPm7sBXzzR6ekkE+3tLG72wFZrBiBZhrZuDoYexop4PHJVdFAKb/Nj9+tm9w== -cacheable-lookup@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz#3476a8215d046e5a3202a9209dd13fec1f933a27" - integrity sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w== - -cacheable-request@^10.2.8: - version "10.2.14" - resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-10.2.14.tgz#eb915b665fda41b79652782df3f553449c406b9d" - integrity sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ== - dependencies: - "@types/http-cache-semantics" "^4.0.2" - get-stream "^6.0.1" - http-cache-semantics "^4.1.1" - keyv "^4.5.3" - mimic-response "^4.0.0" - normalize-url "^8.0.0" - responselike "^3.0.0" - cacheable-request@^7.0.2: version "7.0.2" resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-7.0.2.tgz#ea0d0b889364a25854757301ca12b2da77f91d27" @@ -13970,11 +13858,6 @@ camelcase@^5.0.0, camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -camelcase@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-7.0.1.tgz#f02e50af9fd7782bc8b88a3558c32fd3a388f048" - integrity sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw== - camelize@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b" @@ -14088,7 +13971,7 @@ chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2, chalk@~4.1 ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^5.1.2, chalk@^5.2.0, chalk@^5.3.0: +chalk@^5.1.2: version "5.3.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== @@ -14310,11 +14193,6 @@ cli-boxes@^2.2.1: resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.1.tgz#ddd5035d25094fce220e9cab40a45840a440318f" integrity sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw== -cli-boxes@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-3.0.0.tgz#71a10c716feeba005e4504f36329ef0b17cf3145" - integrity sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g== - cli-cursor@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" @@ -14761,25 +14639,6 @@ concaveman@*: robust-predicates "^2.0.4" tinyqueue "^2.0.3" -config-chain@^1.1.11: - version "1.1.13" - resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.13.tgz#fad0795aa6a6cdaff9ed1b68e9dff94372c232f4" - integrity sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ== - dependencies: - ini "^1.3.4" - proto-list "~1.2.1" - -configstore@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/configstore/-/configstore-6.0.0.tgz#49eca2ebc80983f77e09394a1a56e0aca8235566" - integrity sha512-cD31W1v3GqUlQvbBCGcXmd2Nj9SvLDOP1oQ0YFuLETufzSPaKp11rYBsSOm7rCsW3OnIRAFM3OxRhceaXNYHkA== - dependencies: - dot-prop "^6.0.1" - graceful-fs "^4.2.6" - unique-string "^3.0.0" - write-file-atomic "^3.0.3" - xdg-basedir "^5.0.1" - connect-history-api-fallback@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz#647264845251a0daf25b97ce87834cace0f5f1c8" @@ -15095,13 +14954,6 @@ crypto-js@^4.0.0: resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.2.0.tgz#4d931639ecdfd12ff80e8186dba6af2c2e856631" integrity sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q== -crypto-random-string@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-4.0.0.tgz#5a3cc53d7dd86183df5da0312816ceeeb5bb1fc2" - integrity sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA== - dependencies: - type-fest "^1.0.1" - css-box-model@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/css-box-model/-/css-box-model-1.2.1.tgz#59951d3b81fd6b2074a62d49444415b0d2b4d7c1" @@ -15964,7 +15816,7 @@ defaults@^1.0.3: dependencies: clone "^1.0.2" -defer-to-connect@^2.0.0, defer-to-connect@^2.0.1: +defer-to-connect@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== @@ -16475,13 +16327,6 @@ dot-case@^3.0.3, dot-case@^3.0.4: no-case "^3.0.4" tslib "^2.0.3" -dot-prop@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-6.0.1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083" - integrity sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA== - dependencies: - is-obj "^2.0.0" - dotenv-expand@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz#3fbaf020bfd794884072ea26b1e9791d45a629f0" @@ -16541,11 +16386,6 @@ earcut@^2.2.4: resolved "https://registry.yarnpkg.com/earcut/-/earcut-2.2.4.tgz#6d02fd4d68160c114825d06890a92ecaae60343a" integrity sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ== -eastasianwidth@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" - integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== - easy-table@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/easy-table/-/easy-table-1.1.0.tgz#86f9ab4c102f0371b7297b92a651d5824bc8cb73" @@ -16573,7 +16413,7 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= -ejs@^3.1.10, ejs@^3.1.9: +ejs@^3.1.10: version "3.1.10" resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.10.tgz#69ab8358b14e896f80cc39e62087b88500c3ac3b" integrity sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA== @@ -17147,11 +16987,6 @@ escalade@^3.1.1: resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== -escape-goat@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/escape-goat/-/escape-goat-4.0.0.tgz#9424820331b510b0666b98f7873fe11ac4aa8081" - integrity sha512-2Sd4ShcWxbx6OY1IHyla/CVNwvg7XwZVoXZHcSu9w9SReNP1EzzD5T8NWKIR38fIqEns9kDWKUQTXXAmlDrdPg== - escape-html@^1.0.3, escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" @@ -18375,14 +18210,6 @@ foreground-child@^2.0.0: cross-spawn "^7.0.0" signal-exit "^3.0.2" -foreground-child@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.1.1.tgz#1d173e776d75d2772fed08efe4a0de1ea1b12d0d" - integrity sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg== - dependencies: - cross-spawn "^7.0.0" - signal-exit "^4.0.1" - forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" @@ -18425,11 +18252,6 @@ form-data-encoder@1.7.2: resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.2.tgz#1f1ae3dccf58ed4690b86d87e4f57c654fbab040" integrity sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A== -form-data-encoder@^2.1.2: - version "2.1.4" - resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-2.1.4.tgz#261ea35d2a70d48d30ec7a9603130fa5515e9cd5" - integrity sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw== - form-data@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" @@ -18570,15 +18392,6 @@ fs-extra@^0.30.0: path-is-absolute "^1.0.0" rimraf "^2.2.8" -fs-extra@^11.2.0: - version "11.2.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b" - integrity sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw== - dependencies: - graceful-fs "^4.2.0" - jsonfile "^6.0.1" - universalify "^2.0.0" - fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" @@ -18999,17 +18812,6 @@ glob@8.1.0: minimatch "^5.0.1" once "^1.3.0" -glob@^10.3.10: - version "10.3.10" - resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.10.tgz#0351ebb809fd187fe421ab96af83d3a70715df4b" - integrity sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g== - dependencies: - foreground-child "^3.1.0" - jackspeak "^2.3.5" - minimatch "^9.0.1" - minipass "^5.0.0 || ^6.0.2 || ^7.0.0" - path-scurry "^1.10.1" - glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.2.0, glob@^7.2.3, glob@~7.2.0: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -19190,23 +18992,6 @@ got@^11.8.2: p-cancelable "^2.0.0" responselike "^2.0.0" -got@^12.1.0: - version "12.6.1" - resolved "https://registry.yarnpkg.com/got/-/got-12.6.1.tgz#8869560d1383353204b5a9435f782df9c091f549" - integrity sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ== - dependencies: - "@sindresorhus/is" "^5.2.0" - "@szmarczak/http-timer" "^5.0.1" - cacheable-lookup "^7.0.0" - cacheable-request "^10.2.8" - decompress-response "^6.0.0" - form-data-encoder "^2.1.2" - get-stream "^6.0.1" - http2-wrapper "^2.1.10" - lowercase-keys "^3.0.0" - p-cancelable "^3.0.0" - responselike "^3.0.0" - gpt-tokenizer@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/gpt-tokenizer/-/gpt-tokenizer-2.1.2.tgz#14f7ce424cf2309fb5be66e112d1836080c2791a" @@ -19214,12 +18999,7 @@ gpt-tokenizer@^2.1.2: dependencies: rfc4648 "^1.5.2" -graceful-fs@4.2.10: - version "4.2.10" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" - integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== - -graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.10, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.8, graceful-fs@^4.2.9: +graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.10, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.8, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== @@ -19812,7 +19592,7 @@ htmlparser2@^8.0.1: domutils "^3.0.1" entities "^4.4.0" -http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.1: +http-cache-semantics@^4.0.0: version "4.1.1" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a" integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ== @@ -19924,7 +19704,7 @@ http2-wrapper@^1.0.0-beta.5.2: quick-lru "^5.1.1" resolve-alpn "^1.0.0" -http2-wrapper@^2.1.10, http2-wrapper@^2.2.1: +http2-wrapper@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.2.1.tgz#310968153dcdedb160d8b72114363ef5fce1f64a" integrity sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ== @@ -20134,7 +19914,7 @@ ini@2.0.0: resolved "https://registry.yarnpkg.com/ini/-/ini-2.0.0.tgz#e5fd556ecdd5726be978fa1001862eacb0a94bc5" integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA== -ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: +ini@^1.3.5, ini@~1.3.0: version "1.3.7" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.7.tgz#a09363e1911972ea16d7a8851005d84cf09a9a84" integrity sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ== @@ -20555,12 +20335,7 @@ is-hexadecimal@^1.0.0: resolved "https://registry.yarnpkg.com/is-hexadecimal/-/is-hexadecimal-1.0.1.tgz#6e084bbc92061fbb0971ec58b6ce6d404e24da69" integrity sha1-bghLvJIGH7sJcexYts5tQE4k2mk= -is-in-ci@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/is-in-ci/-/is-in-ci-0.1.0.tgz#5e07d6a02ec3a8292d3f590973357efa3fceb0d3" - integrity sha512-d9PXLEY0v1iJ64xLiQMJ51J128EYHAaOR4yZqQi8aHGfw6KgifM3/Viw1oZZ1GCVmb3gBuyhLyHj0HgR2DhSXQ== - -is-installed-globally@^0.4.0, is-installed-globally@~0.4.0: +is-installed-globally@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.4.0.tgz#9a0fd407949c30f86eb6959ef1b7994ed0b7b520" integrity sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ== @@ -20613,11 +20388,6 @@ is-node-process@^1.2.0: resolved "https://registry.yarnpkg.com/is-node-process/-/is-node-process-1.2.0.tgz#ea02a1b90ddb3934a19aea414e88edef7e11d134" integrity sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw== -is-npm@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-6.0.0.tgz#b59e75e8915543ca5d881ecff864077cba095261" - integrity sha512-JEjxbSmtPSt1c8XTkVrlujcXdKV1/tvuQ7GwKcAlyiVLeYFQ2VHat8xfrDJsIkhCdF/tZ7CiIR3sy141c6+gPQ== - is-number-object@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.4.tgz#36ac95e741cf18b283fc1ddf5e83da798e3ec197" @@ -20645,11 +20415,6 @@ is-obj@^1.0.1: resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= -is-obj@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" - integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w== - is-object@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-object/-/is-object-1.0.1.tgz#8952688c5ec2ffd6b03ecc85e769e02903083470" @@ -21063,15 +20828,6 @@ iterate-value@^1.0.0: es-get-iterator "^1.0.2" iterate-iterator "^1.0.1" -jackspeak@^2.3.5: - version "2.3.6" - resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-2.3.6.tgz#647ecc472238aee4b06ac0e461acc21a8c505ca8" - integrity sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ== - dependencies: - "@isaacs/cliui" "^8.0.2" - optionalDependencies: - "@pkgjs/parseargs" "^0.11.0" - jake@^10.8.5: version "10.8.5" resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.5.tgz#f2183d2c59382cb274226034543b9c03b8164c46" @@ -22018,7 +21774,7 @@ kea@^2.6.0: resolved "https://registry.yarnpkg.com/kea/-/kea-2.6.0.tgz#774a82188e0fb52cdb18b72843a875ee857f3807" integrity sha512-+yaLyZx8h2v96aL01XIRZjqA8Qk4fIUziznSKnkjDItUU8YnH75xER6+vMHT5EHC3MJeSScxIx5UuqZl30DBdg== -keyv@^4.0.0, keyv@^4.5.3: +keyv@^4.0.0: version "4.5.4" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== @@ -22049,13 +21805,6 @@ kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== -klaw-sync@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c" - integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ== - dependencies: - graceful-fs "^4.1.11" - klaw@^1.0.0: version "1.3.1" resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" @@ -22138,13 +21887,6 @@ language-tags@=1.0.5: dependencies: language-subtag-registry "~0.3.2" -latest-version@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-7.0.0.tgz#843201591ea81a4d404932eeb61240fe04e9e5da" - integrity sha512-KvNT4XqAMzdcL6ka6Tl3i2lYeFDgXNCuIX+xNx6ZMVR1dFq+idXd9FLKNMOIx0t9mJ9/HudyX4oZWXZQ0UJHeg== - dependencies: - package-json "^8.1.0" - launchdarkly-eventsource@1.4.4: version "1.4.4" resolved "https://registry.yarnpkg.com/launchdarkly-eventsource/-/launchdarkly-eventsource-1.4.4.tgz#fa595af8602e487c61520787170376c6a1104459" @@ -22681,11 +22423,6 @@ lowercase-keys@^2.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== -lowercase-keys@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" - integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== - lowlight@^1.14.0: version "1.17.0" resolved "https://registry.yarnpkg.com/lowlight/-/lowlight-1.17.0.tgz#a1143b2fba8239df8cd5893f9fe97aaf8465af4a" @@ -22694,7 +22431,7 @@ lowlight@^1.14.0: fault "^1.0.0" highlight.js "~10.4.0" -lru-cache@10.2.0, "lru-cache@^9.1.1 || ^10.0.0": +lru-cache@10.2.0: version "10.2.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.0.tgz#0bd445ca57363465900f4d1f9bd8db343a4d95c3" integrity sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q== @@ -22871,7 +22608,7 @@ markdown-escapes@^1.0.0: resolved "https://registry.yarnpkg.com/markdown-escapes/-/markdown-escapes-1.0.1.tgz#1994df2d3af4811de59a6714934c2b2292734518" integrity sha1-GZTfLTr0gR3lmmcUk0wrIpJzRRg= -markdown-it@^14.0.0, markdown-it@^14.1.0: +markdown-it@^14.1.0: version "14.1.0" resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-14.1.0.tgz#3c3c5992883c633db4714ccb4d7b5935d98b7d45" integrity sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg== @@ -23334,11 +23071,6 @@ mimic-response@^3.1.0: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== -mimic-response@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-4.0.0.tgz#35468b19e7c75d10f5165ea25e75a5ceea7cf70f" - integrity sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg== - min-document@^2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" @@ -23391,13 +23123,6 @@ minimatch@^5.0.1, minimatch@^5.1.0: dependencies: brace-expansion "^2.0.1" -minimatch@^9.0.1: - version "9.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" - integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== - dependencies: - brace-expansion "^2.0.1" - minimist-options@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" @@ -23452,11 +23177,6 @@ minipass@^5.0.0: resolved "https://registry.yarnpkg.com/minipass/-/minipass-5.0.0.tgz#3e9788ffb90b694a5d0ec94479a45b5d8738133d" integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ== -"minipass@^5.0.0 || ^6.0.2 || ^7.0.0": - version "7.0.4" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" - integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== - minizlib@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" @@ -24326,11 +24046,6 @@ normalize-url@^6.0.1: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== -normalize-url@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-8.0.0.tgz#593dbd284f743e8dcf6a5ddf8fadff149c82701a" - integrity sha512-uVFpKhj5MheNBJRTiMZ9pE/7hD1QTeEvugSJW/OmLzAp78PB5O6adfMNTvmfKhXBkvCzC+rqifWcVYpGFwTjnw== - now-and-later@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/now-and-later/-/now-and-later-3.0.0.tgz#cdc045dc5b894b35793cf276cc3206077bb7302d" @@ -24898,11 +24613,6 @@ p-cancelable@^2.0.0: resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.0.0.tgz#4a3740f5bdaf5ed5d7c3e34882c6fb5d6b266a6e" integrity sha512-wvPXDmbMmu2ksjkB4Z3nZWTSkJEb9lqVdMaCKpZUGJG9TMiNp9XcbG3fn9fPKjem04fJMJnXoyFPk2FmgiaiNg== -p-cancelable@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" - integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== - p-event@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/p-event/-/p-event-4.1.0.tgz#e92bb866d7e8e5b732293b1c8269d38e9982bf8e" @@ -25057,16 +24767,6 @@ package-hash@^4.0.0: lodash.flattendeep "^4.4.0" release-zalgo "^1.0.0" -package-json@^8.1.0: - version "8.1.1" - resolved "https://registry.yarnpkg.com/package-json/-/package-json-8.1.1.tgz#3e9948e43df40d1e8e78a85485f1070bf8f03dc8" - integrity sha512-cbH9IAIJHNj9uXi196JVsRlt7cHKak6u/e6AkL/bkRelZ7rlL3X1YKxsZwa36xipOEKAsdtmaG6aAJoM1fx2zA== - dependencies: - got "^12.1.0" - registry-auth-token "^5.0.1" - registry-url "^6.0.0" - semver "^7.3.7" - pako@^0.2.5: version "0.2.9" resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75" @@ -25256,14 +24956,6 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -path-scurry@^1.10.1: - version "1.10.1" - resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.10.1.tgz#9ba6bf5aa8500fe9fd67df4f0d9483b2b0bfc698" - integrity sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ== - dependencies: - lru-cache "^9.1.1 || ^10.0.0" - minipass "^5.0.0 || ^6.0.2 || ^7.0.0" - path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" @@ -26196,11 +25888,6 @@ property-information@^5.0.0, property-information@^5.0.1, property-information@^ dependencies: xtend "^4.0.0" -proto-list@~1.2.1: - version "1.2.4" - resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" - integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= - protobufjs@6.11.4, protobufjs@6.8.8: version "6.11.4" resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.4.tgz#29a412c38bf70d89e537b6d02d904a6f448173aa" @@ -26355,13 +26042,6 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== -pupa@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/pupa/-/pupa-3.1.0.tgz#f15610274376bbcc70c9a3aa8b505ea23f41c579" - integrity sha512-FLpr4flz5xZTSJxSeaheeMKN/EDzMdK7b8PTOC6a5PYFKTucWbdqjgqaEyH0shFiSJrVB1+Qqi4Tk19ccU6Aug== - dependencies: - escape-goat "^4.0.0" - puppeteer-core@22.13.1: version "22.13.1" resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-22.13.1.tgz#3ba03e5ebd98bbbd86e465864cf00314e07309de" @@ -26575,7 +26255,7 @@ rc-pagination@^1.20.1: prop-types "^15.5.7" react-lifecycles-compat "^3.0.4" -rc@1.2.8, rc@^1.2.7: +rc@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== @@ -27531,20 +27211,6 @@ regexpu-core@^5.3.1: unicode-match-property-ecmascript "^2.0.0" unicode-match-property-value-ecmascript "^2.1.0" -registry-auth-token@^5.0.1: - version "5.0.2" - resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-5.0.2.tgz#8b026cc507c8552ebbe06724136267e63302f756" - integrity sha512-o/3ikDxtXaA59BmZuZrJZDJv8NMDGSj+6j6XaeBmHw8eY1i1qd9+6H+LjVvQXx3HN6aRCGa1cUdJ9RaJZUugnQ== - dependencies: - "@pnpm/npm-conf" "^2.1.0" - -registry-url@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-6.0.1.tgz#056d9343680f2f64400032b1e199faa692286c58" - integrity sha512-+crtS5QjFRqFCoQmvGduwYWEBng99ZvmFvF+cUJkGYF1L1BfU8C6Zp9T7f5vPAwyLkUExpvK+ANVZmGU49qi4Q== - dependencies: - rc "1.2.8" - regjsparser@^0.9.1: version "0.9.1" resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.9.1.tgz#272d05aa10c7c1f67095b1ff0addae8442fc5709" @@ -27950,13 +27616,6 @@ responselike@^2.0.0: dependencies: lowercase-keys "^2.0.0" -responselike@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/responselike/-/responselike-3.0.0.tgz#20decb6c298aff0dbee1c355ca95461d42823626" - integrity sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg== - dependencies: - lowercase-keys "^3.0.0" - restore-cursor@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" @@ -28474,13 +28133,6 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" integrity sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow== -semver-diff@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-4.0.0.tgz#3afcf5ed6d62259f5c72d0d5d50dffbdc9680df5" - integrity sha512-0Ju4+6A8iOnpL/Thra7dZsSlOHYAHIeMxfhWQRI1/VLcT3WDBZKKtQt/QkBOsiIN9ZpuvHE6cGZ0x4glCMmfiA== - dependencies: - semver "^7.3.5" - "semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: version "5.7.2" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" @@ -28801,7 +28453,7 @@ signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -signal-exit@^4.0.1, signal-exit@^4.1.0: +signal-exit@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== @@ -29585,15 +29237,6 @@ string-replace-loader@^2.2.0: loader-utils "^1.2.3" schema-utils "^1.0.0" -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" @@ -29612,15 +29255,6 @@ string-width@^1.0.1: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string-width@^5.0.1, string-width@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" - integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== - dependencies: - eastasianwidth "^0.2.0" - emoji-regex "^9.2.2" - strip-ansi "^7.0.1" - string-width@^7.0.0: version "7.1.0" resolved "https://registry.yarnpkg.com/string-width/-/string-width-7.1.0.tgz#d994252935224729ea3719c49f7206dc9c46550a" @@ -29722,13 +29356,6 @@ stringify-object@^3.2.1: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" @@ -29743,7 +29370,7 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" -strip-ansi@^7.0.1, strip-ansi@^7.1.0: +strip-ansi@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== @@ -30884,16 +30511,11 @@ type-fest@^0.8.0, type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -type-fest@^1.0.1, type-fest@^1.2.1: +type-fest@^1.2.1: version "1.4.0" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1" integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== -type-fest@^2.13.0: - version "2.19.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.19.0.tgz#88068015bb33036a598b952e55e9311a60fd3a9b" - integrity sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA== - type-fest@^4.15.0, type-fest@^4.17.0, type-fest@^4.9.0: version "4.18.3" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.18.3.tgz#5249f96e7c2c3f0f1561625f54050e343f1c8f68" @@ -31191,13 +30813,6 @@ unique-slug@^2.0.0: dependencies: imurmurhash "^0.1.4" -unique-string@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/unique-string/-/unique-string-3.0.0.tgz#84a1c377aff5fd7a8bc6b55d8244b2bd90d75b9a" - integrity sha512-VGXBUVwxKMBUznyffQweQABPRRW1vHZAbadFZud4pLFAqRGvv/96vafgjWFqzourzr8YonlQiPgH0YCJfawoGQ== - dependencies: - crypto-random-string "^4.0.0" - unist-builder@2.0.3, unist-builder@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/unist-builder/-/unist-builder-2.0.3.tgz#77648711b5d86af0942f334397a33c5e91516436" @@ -31335,24 +30950,6 @@ update-browserslist-db@^1.0.13: escalade "^3.1.1" picocolors "^1.0.0" -update-notifier@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-7.0.0.tgz#295aa782dadab784ed4073f7ffaea1fb2123031c" - integrity sha512-Hv25Bh+eAbOLlsjJreVPOs4vd51rrtCrmhyOJtbpAojro34jS4KQaEp4/EvlHJX7jSO42VvEFpkastVyXyIsdQ== - dependencies: - boxen "^7.1.1" - chalk "^5.3.0" - configstore "^6.0.0" - import-lazy "^4.0.0" - is-in-ci "^0.1.0" - is-installed-globally "^0.4.0" - is-npm "^6.0.0" - latest-version "^7.0.0" - pupa "^3.1.0" - semver "^7.5.4" - semver-diff "^4.0.0" - xdg-basedir "^5.1.0" - uri-js@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" @@ -32577,13 +32174,6 @@ widest-line@^3.1.0: dependencies: string-width "^4.0.0" -widest-line@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-4.0.1.tgz#a0fc673aaba1ea6f0a0d35b3c2795c9a9cc2ebf2" - integrity sha512-o0cyEG0e8GPzT4iGHphIOh0cJOV8fivsXxddQasHPHfoZf1ZexrfeA21w2NaEN1RHE+fXlfISmOE8R9N3u3Qig== - dependencies: - string-width "^5.0.1" - wildcard@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" @@ -32610,7 +32200,7 @@ winston-transport@^4.5.0: readable-stream "^3.6.0" triple-beam "^1.3.0" -winston@^3.11.0, winston@^3.8.2: +winston@^3.8.2: version "3.11.0" resolved "https://registry.yarnpkg.com/winston/-/winston-3.11.0.tgz#2d50b0a695a2758bb1c95279f0a88e858163ed91" integrity sha512-L3yR6/MzZAOl0DsysUXHVjOwv8mKZ71TrA/41EIduGpOOV5LQVodqN+QdQ6BS6PJ/RdIshZhq84P/fStEZkk7g== @@ -32661,15 +32251,6 @@ workerpool@6.2.1: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" @@ -32696,15 +32277,6 @@ wrap-ansi@^7.0.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" - integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== - dependencies: - ansi-styles "^6.1.0" - string-width "^5.0.1" - strip-ansi "^7.0.1" - wrap-ansi@^9.0.0: version "9.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-9.0.0.tgz#1a3dc8b70d85eeb8398ddfb1e4a02cd186e58b3e" @@ -32719,7 +32291,7 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -write-file-atomic@^3.0.0, write-file-atomic@^3.0.3: +write-file-atomic@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== @@ -32754,11 +32326,6 @@ x-default-browser@^0.4.0: optionalDependencies: default-browser-id "^1.0.4" -xdg-basedir@^5.0.1, xdg-basedir@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-5.1.0.tgz#1efba19425e73be1bc6f2a6ceb52a3d2c884c0c9" - integrity sha512-GCPAHLvrIH13+c0SuacwvRYj2SxJXQ4kaVTT5xgL3kPrz56XxkF21IGhjSE1+W0aw7gpBWRGXLCPnPby6lSpmQ== - xml-crypto@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/xml-crypto/-/xml-crypto-6.0.0.tgz#9657ce63cbbaacc48b2c74a13d05cf0a9d339d47" From bd9dde8ba749a33a1d5b56dff77d2e47c6e7e17c Mon Sep 17 00:00:00 2001 From: Panos Koutsovasilis Date: Fri, 23 Aug 2024 16:47:49 +0300 Subject: [PATCH 3/5] fix: remove deprecated squid filebeat module tutorial from integrations (#191115) ## Summary This PR removes the deprecated `squid` integration based on the Filebeat module (deprecation issue [here](https://github.com/elastic/beats/issues/37746)). Instead, as of now, a user that wants to use the `squad` integration needs to tick the `Display beta integrations` and install the "new" squid integration ### Risk Matrix N/A ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --- src/plugins/home/server/tutorials/register.ts | 2 - .../home/server/tutorials/squid_logs/index.ts | 61 ------------------- .../apis/custom_integration/integrations.ts | 2 +- .../translations/translations/fr-FR.json | 4 -- .../translations/translations/ja-JP.json | 4 -- .../translations/translations/zh-CN.json | 4 -- 6 files changed, 1 insertion(+), 76 deletions(-) delete mode 100644 src/plugins/home/server/tutorials/squid_logs/index.ts diff --git a/src/plugins/home/server/tutorials/register.ts b/src/plugins/home/server/tutorials/register.ts index bc8c85c43e69..42e1d425cf53 100644 --- a/src/plugins/home/server/tutorials/register.ts +++ b/src/plugins/home/server/tutorials/register.ts @@ -98,7 +98,6 @@ import { redisenterpriseMetricsSpecProvider } from './redisenterprise_metrics'; import { santaLogsSpecProvider } from './santa_logs'; import { sonicwallLogsSpecProvider } from './sonicwall_logs'; import { sophosLogsSpecProvider } from './sophos_logs'; -import { squidLogsSpecProvider } from './squid_logs'; import { stanMetricsSpecProvider } from './stan_metrics'; import { statsdMetricsSpecProvider } from './statsd_metrics'; import { suricataLogsSpecProvider } from './suricata_logs'; @@ -223,7 +222,6 @@ export const builtInTutorials = [ santaLogsSpecProvider, sonicwallLogsSpecProvider, sophosLogsSpecProvider, - squidLogsSpecProvider, tomcatLogsSpecProvider, zscalerLogsSpecProvider, ]; diff --git a/src/plugins/home/server/tutorials/squid_logs/index.ts b/src/plugins/home/server/tutorials/squid_logs/index.ts deleted file mode 100644 index 05b76ab92bcc..000000000000 --- a/src/plugins/home/server/tutorials/squid_logs/index.ts +++ /dev/null @@ -1,61 +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 { i18n } from '@kbn/i18n'; -import { TutorialsCategory } from '../../services/tutorials'; -import { - onPremInstructions, - cloudInstructions, - onPremCloudInstructions, -} from '../instructions/filebeat_instructions'; -import { - TutorialContext, - TutorialSchema, -} from '../../services/tutorials/lib/tutorials_registry_types'; - -export function squidLogsSpecProvider(context: TutorialContext): TutorialSchema { - const moduleName = 'squid'; - const platforms = ['OSX', 'DEB', 'RPM', 'WINDOWS'] as const; - return { - id: 'squidLogs', - name: i18n.translate('home.tutorials.squidLogs.nameTitle', { - defaultMessage: 'Squid Logs', - }), - moduleName, - category: TutorialsCategory.SECURITY_SOLUTION, - shortDescription: i18n.translate('home.tutorials.squidLogs.shortDescription', { - defaultMessage: 'Collect and parse logs from Squid servers with Filebeat.', - }), - longDescription: i18n.translate('home.tutorials.squidLogs.longDescription', { - defaultMessage: - 'This is a module for receiving Squid logs over Syslog or a file. \ -[Learn more]({learnMoreLink}).', - values: { - learnMoreLink: '{config.docs.beats.filebeat}/filebeat-module-squid.html', - }, - }), - euiIconType: 'logoLogging', - artifacts: { - dashboards: [], - application: { - path: '/app/security', - label: i18n.translate('home.tutorials.squidLogs.artifacts.dashboards.linkLabel', { - defaultMessage: 'Security App', - }), - }, - exportedFields: { - documentationUrl: '{config.docs.beats.filebeat}/exported-fields-squid.html', - }, - }, - completionTimeMinutes: 10, - onPrem: onPremInstructions(moduleName, platforms, context), - elasticCloud: cloudInstructions(moduleName, platforms, context), - onPremElasticCloud: onPremCloudInstructions(moduleName, platforms, context), - integrationBrowserCategories: ['security', 'network', 'proxy_security'], - }; -} diff --git a/test/api_integration/apis/custom_integration/integrations.ts b/test/api_integration/apis/custom_integration/integrations.ts index fd974a92adb1..5a5284dd0a63 100644 --- a/test/api_integration/apis/custom_integration/integrations.ts +++ b/test/api_integration/apis/custom_integration/integrations.ts @@ -40,7 +40,7 @@ export default function ({ getService }: FtrProviderContext) { expect(resp.body).to.be.an('array'); - expect(resp.body.length).to.be(109); // the beats + expect(resp.body.length).to.be(108); // the beats }); }); }); diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 2d3c0aacfbd9..beb17be6ca60 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -4540,10 +4540,6 @@ "home.tutorials.sophosLogs.longDescription": "Il s'agit d'un module pour les produits Sophos. Actuellement, il prend en charge les logs XG SFOS envoyés au format Syslog. [En savoir plus]({learnMoreLink}).", "home.tutorials.sophosLogs.nameTitle": "Logs Sophos", "home.tutorials.sophosLogs.shortDescription": "Collectez et analysez les logs à partir de Sophos XG SFOS avec Filebeat.", - "home.tutorials.squidLogs.artifacts.dashboards.linkLabel": "Application Security", - "home.tutorials.squidLogs.longDescription": "Ce module permet de recevoir des logs Squid par le biais de Syslog ou d'un fichier. [En savoir plus]({learnMoreLink}).", - "home.tutorials.squidLogs.nameTitle": "Logs Squid", - "home.tutorials.squidLogs.shortDescription": "Collectez et analysez les logs à partir de serveurs Squid avec Filebeat.", "home.tutorials.stanMetrics.artifacts.dashboards.linkLabel": "Tableau de bord des indicateurs Stan", "home.tutorials.stanMetrics.longDescription": "Le module Metricbeat `stan` récupère des indicateurs depuis STAN. [En savoir plus]({learnMoreLink}).", "home.tutorials.stanMetrics.nameTitle": "Indicateurs STAN", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 72b5ec7d10d8..d1e70e1204cc 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -4536,10 +4536,6 @@ "home.tutorials.sophosLogs.longDescription": "これは Sophos 製品用モジュールであり、Syslog 形式で送信された XG SFOS ログが現在サポートされています。[詳細]({learnMoreLink})。", "home.tutorials.sophosLogs.nameTitle": "Sophosログ", "home.tutorials.sophosLogs.shortDescription": "Filebeatを使用してSophos XG SFOSからログを収集して解析します。", - "home.tutorials.squidLogs.artifacts.dashboards.linkLabel": "セキュリティアプリ", - "home.tutorials.squidLogs.longDescription": "これは、Syslog またはファイルで Squid ログを受信するためのモジュールです。[詳細]({learnMoreLink})。", - "home.tutorials.squidLogs.nameTitle": "Squidログ", - "home.tutorials.squidLogs.shortDescription": "Filebeatを使用してSquidサーバーからログを収集して解析します。", "home.tutorials.stanMetrics.artifacts.dashboards.linkLabel": "Stan メトリックダッシュボード", "home.tutorials.stanMetrics.longDescription": "Metricbeat モジュール「stan」は、STAN からメトリックを取得します。[詳細]({learnMoreLink})。", "home.tutorials.stanMetrics.nameTitle": "STANメトリック", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 82ebf1e2d42e..a9f701c75048 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -4544,10 +4544,6 @@ "home.tutorials.sophosLogs.longDescription": "这是用于 Sophos Products 的模块,当前支持以 syslog 格式发送的 XG SFOS 日志。[了解详情]({learnMoreLink})。", "home.tutorials.sophosLogs.nameTitle": "Sophos 日志", "home.tutorials.sophosLogs.shortDescription": "使用 Filebeat 从 Sophos XG SFOS 收集并解析日志。", - "home.tutorials.squidLogs.artifacts.dashboards.linkLabel": "Security 应用", - "home.tutorials.squidLogs.longDescription": "这是用于通过 Syslog 或文件接收 Squid 日志的模块。[了解详情]({learnMoreLink})。", - "home.tutorials.squidLogs.nameTitle": "Squid 日志", - "home.tutorials.squidLogs.shortDescription": "使用 Filebeat 从 Squid 服务器收集并解析日志。", "home.tutorials.stanMetrics.artifacts.dashboards.linkLabel": "Stan 指标仪表板", "home.tutorials.stanMetrics.longDescription": "Metricbeat 模块 `stan` 从 STAN 提取指标。[了解详情]({learnMoreLink})。", "home.tutorials.stanMetrics.nameTitle": "STAN 指标", From 8f7ea3c34e9c2362e7c3fa7f457b2ba51fafa6b9 Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Fri, 23 Aug 2024 10:07:47 -0400 Subject: [PATCH 4/5] [Fleet] Fix space_ids validation and spaces UI (#191083) --- .../agent_policy_advanced_fields/index.tsx | 12 +++-- .../fleet/server/types/models/agent_policy.ts | 6 +-- .../apis/agent_policy/agent_policy.ts | 50 ++++++++++++++++++- 3 files changed, 57 insertions(+), 11 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx index 28d14b62a575..9e35dc441fa2 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx @@ -77,9 +77,8 @@ export const AgentPolicyAdvancedOptionsContent: React.FunctionComponent = validation, disabled = false, }) => { - const useSpaceAwareness = ExperimentalFeaturesService.get()?.useSpaceAwareness ?? false; const { docLinks } = useStartServices(); - const { spaceId } = useFleetStatus(); + const { spaceId, isSpaceAwarenessEnabled } = useFleetStatus(); const { getAbsolutePath } = useLink(); const AgentTamperProtectionWrapper = useUIExtension( @@ -263,21 +262,21 @@ export const AgentPolicyAdvancedOptionsContent: React.FunctionComponent = /> - {useSpaceAwareness ? ( + {isSpaceAwarenessEnabled ? ( } description={ = : [spaceId || 'default'] } onChange={(newValue) => { + if (newValue.length === 0) { + return; + } updateAgentPolicy({ space_ids: newValue, }); diff --git a/x-pack/plugins/fleet/server/types/models/agent_policy.ts b/x-pack/plugins/fleet/server/types/models/agent_policy.ts index f97739254740..560f6939eedb 100644 --- a/x-pack/plugins/fleet/server/types/models/agent_policy.ts +++ b/x-pack/plugins/fleet/server/types/models/agent_policy.ts @@ -41,11 +41,7 @@ function isInteger(n: number) { export const AgentPolicyBaseSchema = { id: schema.maybe(schema.string()), - space_ids: schema.maybe( - schema.arrayOf(schema.string(), { - minSize: 1, - }) - ), + space_ids: schema.maybe(schema.arrayOf(schema.string())), name: schema.string({ minLength: 1, validate: validateNonEmptyString }), namespace: AgentPolicyNamespaceSchema, description: schema.maybe(schema.string()), diff --git a/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy.ts b/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy.ts index be968e21feb9..80309b890936 100644 --- a/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy.ts +++ b/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy.ts @@ -906,6 +906,7 @@ export default function (providerContext: FtrProviderContext) { describe('PUT /api/fleet/agent_policies/{agentPolicyId}', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/fleet/empty_fleet_server'); + await kibanaServer.savedObjects.cleanStandardList(); }); const createdPolicyIds: string[] = []; after(async () => { @@ -967,6 +968,53 @@ export default function (providerContext: FtrProviderContext) { }); }); + it('should support empty space_ids', async () => { + const { + body: { item: originalPolicy }, + } = await supertest + .post(`/api/fleet/agent_policies`) + .set('kbn-xsrf', 'xxxx') + .send({ + name: 'Initial name 2', + space_ids: [], + description: 'Initial description', + namespace: 'default', + }) + .expect(200); + agentPolicyId = originalPolicy.id; + const { + body: { item: updatedPolicy }, + } = await supertest + .put(`/api/fleet/agent_policies/${agentPolicyId}`) + .set('kbn-xsrf', 'xxxx') + .send({ + name: 'Updated name 2', + space_ids: [], + description: 'Updated description', + namespace: 'default', + is_protected: false, + }) + .expect(200); + createdPolicyIds.push(updatedPolicy.id); + // eslint-disable-next-line @typescript-eslint/naming-convention + const { id, updated_at, version, ...newPolicy } = updatedPolicy; + + expect(newPolicy).to.eql({ + status: 'active', + name: 'Updated name 2', + description: 'Updated description', + namespace: 'default', + is_managed: false, + revision: 2, + schema_version: FLEET_AGENT_POLICIES_SCHEMA_VERSION, + updated_by: 'elastic', + inactivity_timeout: 1209600, + package_policies: [], + is_protected: false, + space_ids: [], + }); + }); + it('should return a 409 if policy already exists with name given', async () => { const sharedBody = { name: 'Initial name', @@ -1053,7 +1101,7 @@ export default function (providerContext: FtrProviderContext) { .put(`/api/fleet/agent_policies/${originalPolicy.id}`) .set('kbn-xsrf', 'xxxx') .send({ - name: 'Updated name', + name: `Updated name ${Date.now()}`, description: 'Initial description', namespace: 'default', }) From db970ffba6a7958e63ee07d9575e41c58ea0d7f9 Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Fri, 23 Aug 2024 15:11:10 +0100 Subject: [PATCH 5/5] [main] Sync bundled packages with Package Storage (#191184) Automated by https://buildkite.com/elastic/package-storage-infra-kibana-discover-release-branches/builds/1155 --- fleet_packages.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fleet_packages.json b/fleet_packages.json index 5c345da5fc02..4ff38b376c6f 100644 --- a/fleet_packages.json +++ b/fleet_packages.json @@ -34,7 +34,7 @@ }, { "name": "endpoint", - "version": "8.15.0" + "version": "8.15.1" }, { "name": "fleet_server",