-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[ML] @kbn/ml-common-types & @kbn/ml-server-schemas
#238060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
a788a5b
@kbn/ml-common-types
walterra a3e50c2
update imports
walterra 1f1f4cb
update imports
walterra 6f2a9c1
fix imports
walterra cd767b1
linting
walterra f664929
linting
walterra b0d3f28
linting
walterra 7c48b16
linting
walterra 6f62802
fix imports
walterra 794e223
fix import
walterra 8b65de2
fix import
walterra 6d4682a
Merge branch 'main' into 237808-ml-common-types
elasticmachine 4df566a
Merge remote-tracking branch 'upstream/main' into 237808-ml-common-types
walterra f6bedfb
Merge remote-tracking branch 'upstream/main' into 237808-ml-common-types
walterra 2146836
Merge remote-tracking branch 'upstream/main' into 237808-ml-common-types
walterra 74a1c83
Changes from node scripts/lint_ts_projects --fix
kibanamachine a78e0a2
Merge remote-tracking branch 'upstream/main' into 237808-ml-common-types
rbrtj 59a900c
resolve remaining conflicts
rbrtj 97cfe74
Changes from node scripts/lint_ts_projects --fix
kibanamachine 16293c2
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine e8865c5
move embeddable schemas to a new kbn/ml-common-api-schemas package
rbrtj bce0d82
Changes from node scripts/lint_ts_projects --fix
kibanamachine ef090ae
Changes from node scripts/generate codeowners
kibanamachine a715214
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine 35ebeb0
fix import in ml locator
rbrtj 411220a
make common-api-schemas server-side
rbrtj 323932c
Changes from node scripts/lint_ts_projects --fix
kibanamachine b79917d
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine b29f41c
update remaining imports
rbrtj 9f0aea0
export AnomalySwimLaneProps
rbrtj 7010872
fix remaining imports
rbrtj e7d37f8
Changes from node scripts/lint_ts_projects --fix
kibanamachine a22c8aa
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine 4975dc8
update common-types to use kebab-case
rbrtj d515d86
rename ml-common-api-schemas to server-schemas
rbrtj e4201b4
Changes from node scripts/lint.js --fix
kibanamachine f1b2e3a
TO FIX: Run node 'scripts/yarn_deduplicate && yarn kbn bootstrap' loc…
kibanamachine fabab6a
Changes from node scripts/generate codeowners
kibanamachine 2821b67
Merge branch 'main' into 237808-ml-common-types
rbrtj 8b832ca
remove CloudInfo re-export
rbrtj 8d57b76
Merge remote-tracking branch 'upstream/main' into 237808-ml-common-types
rbrtj 6307559
Merge branch 'main' into 237808-ml-common-types
rbrtj 320a196
Merge branch 'main' into 237808-ml-common-types
rbrtj 8b4ced4
Merge branch 'main' into 237808-ml-common-types
rbrtj 52eedb2
Merge branch 'main' into 237808-ml-common-types
rbrtj c9fb256
update commented import code
rbrtj ab87fb2
Merge branch 'main' into 237808-ml-common-types
rbrtj 342f909
Merge branch 'main' into 237808-ml-common-types
rbrtj ec0efb2
Merge branch 'main' into 237808-ml-common-types
rbrtj fa41889
Merge remote-tracking branch 'upstream/main' into 237808-ml-common-types
rbrtj 0a0b16c
Merge remote-tracking branch 'upstream/main' into 237808-ml-common-types
rbrtj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # @kbn/ml-common-types | ||
|
|
||
| This package contains TypeScript type definitions for ML-related data structures, including anomaly detection jobs, datafeeds, trained models, annotations, and more. |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
x-pack/platform/packages/shared/ml/common_types/anomaly_swim_lane.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* | ||
| * 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 type { ForwardRefExoticComponent, RefAttributes } from 'react'; | ||
|
|
||
| import type { KibanaExecutionContext } from '@kbn/core/public'; | ||
| import type { Filter, Query, TimeRange } from '@kbn/es-query'; | ||
| import type { RefreshInterval } from '@kbn/data-plugin/common'; | ||
|
|
||
| import type { JobId } from './anomaly_detection_jobs/job'; | ||
|
|
||
| // local definition to avoid circular dependency | ||
| // import type { SwimlaneType } from '@kbn/ml-common-constants/explorer'; | ||
| type SwimlaneType = 'overall' | 'viewBy'; | ||
|
|
||
| /** Manual input by the user */ | ||
| export interface AnomalySwimlaneEmbeddableUserInput { | ||
| jobIds: JobId[]; | ||
| panelTitle?: string; | ||
| swimlaneType: SwimlaneType; | ||
| viewBy?: string; | ||
| } | ||
|
|
||
| export interface AnomalySwimlaneEmbeddableCustomInput | ||
| extends Omit<AnomalySwimlaneEmbeddableUserInput, 'panelTitle'> { | ||
| id?: string; | ||
| perPage?: number; | ||
|
|
||
| // Embeddable inputs which are not included in the default interface | ||
| filters?: Filter[]; | ||
| query?: Query; | ||
| refreshConfig?: RefreshInterval; | ||
| timeRange: TimeRange | undefined; | ||
| } | ||
|
|
||
| export interface AnomalySwimLaneProps extends AnomalySwimlaneEmbeddableCustomInput { | ||
| id?: string; | ||
| executionContext: KibanaExecutionContext; | ||
| } | ||
|
|
||
| export type AnomalySwimLaneComponentType = ForwardRefExoticComponent< | ||
| AnomalySwimLaneProps & RefAttributes<{}> | ||
| >; |
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
141 changes: 141 additions & 0 deletions
141
x-pack/platform/packages/shared/ml/common_types/errors.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| /* | ||
| * 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 type Boom from '@hapi/boom'; | ||
|
|
||
| import type { estypes } from '@elastic/elasticsearch'; | ||
|
|
||
| import type { IHttpFetchError } from '@kbn/core-http-browser'; | ||
|
|
||
| /** | ||
| * Short hand type of estypes.ErrorCause. | ||
| * @typedef {EsErrorRootCause} | ||
| */ | ||
| export type EsErrorRootCause = estypes.ErrorCause; | ||
|
|
||
| /** | ||
| * Short hand type of estypes.ErrorResponseBase. | ||
| * @typedef {EsErrorBody} | ||
| */ | ||
| export type EsErrorBody = estypes.ErrorResponseBase; | ||
|
|
||
| /** | ||
| * ML Response error | ||
| * @export | ||
| * @interface MLResponseError | ||
| * @typedef {MLResponseError} | ||
| */ | ||
| export interface MLResponseError { | ||
| /** | ||
| * statusCode | ||
| * @type {number} | ||
| */ | ||
| statusCode: number; | ||
| /** | ||
| * error | ||
| * @type {string} | ||
| */ | ||
| error: string; | ||
| /** | ||
| * message | ||
| * @type {string} | ||
| */ | ||
| message: string; | ||
| /** | ||
| * Optional attributes | ||
| * @type {?{ | ||
| body: EsErrorBody; | ||
| }} | ||
| */ | ||
| attributes?: { | ||
| body: EsErrorBody; | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
| * Interface holding error message | ||
| * @export | ||
| * @interface ErrorMessage | ||
| * @typedef {ErrorMessage} | ||
| */ | ||
| export interface ErrorMessage { | ||
| /** | ||
| * message | ||
| * @type {string} | ||
| */ | ||
| message: string; | ||
| } | ||
|
|
||
| /** | ||
| * To be used for client side errors related to search query bars. | ||
| */ | ||
| export interface QueryErrorMessage extends ErrorMessage { | ||
| /** | ||
| * query | ||
| * @type {string} | ||
| */ | ||
| query: string; | ||
| } | ||
|
|
||
| /** | ||
| * ML Error Object | ||
| * @export | ||
| * @interface MLErrorObject | ||
| * @typedef {MLErrorObject} | ||
| */ | ||
| export interface MLErrorObject { | ||
| /** | ||
| * Optional causedBy | ||
| * @type {?string} | ||
| */ | ||
| causedBy?: string; | ||
| /** | ||
| * message | ||
| * @type {string} | ||
| */ | ||
| message: string; | ||
| /** | ||
| * Optional statusCode | ||
| * @type {?number} | ||
| */ | ||
| statusCode?: number; | ||
| /** | ||
| * Optional fullError | ||
| * @type {?EsErrorBody} | ||
| */ | ||
| fullError?: EsErrorBody; | ||
| } | ||
|
|
||
| /** | ||
| * MLHttpFetchErrorBase | ||
| * @export | ||
| * @interface MLHttpFetchErrorBase | ||
| * @typedef {MLHttpFetchErrorBase} | ||
| * @template T | ||
| * @extends {IHttpFetchError<T>} | ||
| */ | ||
| export interface MLHttpFetchErrorBase<T> extends IHttpFetchError<T> { | ||
| /** | ||
| * body | ||
| * @type {T} | ||
| */ | ||
| body: T; | ||
| } | ||
|
|
||
| /** | ||
| * MLHttpFetchError | ||
| * @export | ||
| * @typedef {MLHttpFetchError} | ||
| */ | ||
| export type MLHttpFetchError = MLHttpFetchErrorBase<MLResponseError>; | ||
|
|
||
| /** | ||
| * Union type of error types | ||
| * @export | ||
| * @typedef {ErrorType} | ||
| */ | ||
| export type ErrorType = MLHttpFetchError | EsErrorBody | Boom.Boom | string | undefined; |
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "type": "shared-common", | ||
| "id": "@kbn/ml-common-types", | ||
| "owner": [ | ||
| "@elastic/ml-ui" | ||
| ], | ||
| "group": "platform", | ||
| "visibility": "shared" | ||
| } |
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the three errors from
x-pack/platform/plugins/shared/ml/server/lib/capabilities/errors.tscould also be moved to live along side this fileThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These errors are used only on the server side path, I'm not sure if it is worth extracting them to the common package.