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 ) , schema . literal ( TRANSFORM_STATE . WAITING ) , ] ) ; export const indexPatternTitleSchema = schema . object ( { /** Title of the data view 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 ; error ? : { type : string ; reason : string ; root_cause : any [ ] ; caused_by : any ; } & { response : any ; } ; } export interface CommonResponseStatusSchema { [ key ] : ResponseStatus ; } export const runtimeMappingsSchema = schema . maybe ( schema . recordOf ( schema . string ( ) , schema . object ( { type : schema . oneOf ( [ schema . literal ( 'keyword' ) , schema . literal ( 'long' ) , schema . literal ( 'double' ) , schema . literal ( 'date' ) , schema . literal ( 'ip' ) , schema . literal ( 'boolean' ) , schema . literal ( 'geo_point' ) , ] ) , script : schema . maybe ( schema . oneOf ( [ schema . string ( ) , schema . object ( { source : schema . string ( ) , } ) , ] ) ) , } ) ) ) ;