kibana/x-pack/plugins/transform/common/api_schemas/common.ts
Dima Arnautov e17cd65196
[Transform] Add support for latest function (#85784)
* [Transform] add latest to the schema definition

* [ML] update interfaces, add guards

* [Transform] WIP support latest function

* [Transform] fix request with missing_bucket after merge

* [Transform] fix error in useDeleteTransforms

* [Transform] fix types and fields sorting for pivot

* [Transform] fix types and jest tests

* [Transform] fix error shape

* [Transform] fixed card width, change description

* [Transform] fixed API integration tests

* [Transform] fix config mapper

* [Transform] improve wizard performance
2020-12-15 22:40:13 +01:00

54 lines
1.5 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { schema, TypeOf } from '@kbn/config-schema';
import { TRANSFORM_STATE } from '../constants';
export const transformIdsSchema = schema.arrayOf(
schema.object({
id: schema.string(),
})
);
export type TransformIdsSchema = TypeOf<typeof transformIdsSchema>;
export const transformStateSchema = schema.oneOf([
schema.literal(TRANSFORM_STATE.ABORTING),
schema.literal(TRANSFORM_STATE.FAILED),
schema.literal(TRANSFORM_STATE.INDEXING),
schema.literal(TRANSFORM_STATE.STARTED),
schema.literal(TRANSFORM_STATE.STOPPED),
schema.literal(TRANSFORM_STATE.STOPPING),
]);
export const indexPatternTitleSchema = schema.object({
/** Title of the index pattern for which to return stats. */
indexPatternTitle: schema.string(),
});
export type IndexPatternTitleSchema = TypeOf<typeof indexPatternTitleSchema>;
export const transformIdParamSchema = schema.object({
transformId: schema.string(),
});
export type TransformIdParamSchema = TypeOf<typeof transformIdParamSchema>;
export interface ResponseStatus {
success: boolean;
// FIXME error response should have unified shape
error?: {
type: string;
reason: string;
root_cause: any[];
caused_by: any;
} & { response: any };
}
export interface CommonResponseStatusSchema {
[key: string]: ResponseStatus;
}