import { Transport , TransportRequestOptions , TransportRequestOptionsWithMeta , TransportRequestOptionsWithOutMeta , TransportResult } from '@elastic/transport' ; import * as T from '../types' ; import * as TB from '../typesWithBodyKey' ; interface That { transport : Transport ; } export default class Eql { transport : Transport ; constructor ( transport ) { this . transport = transport ; } async delete ( this , params , options ? ) ; async delete ( this , params , options ? ) ; async delete ( this , params , options ? ) ; async delete ( this , params , options ? ) { const acceptedPath = [ 'id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'DELETE' ; const path = `/_eql/search/${ encodeURIComponent ( params . id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async get < TEvent = unknown > ( this , params , options ? ) ; async get < TEvent = unknown > ( this , params , options ? ) ; async get < TEvent = unknown > ( this , params , options ? ) ; async get < TEvent = unknown > ( this , params , options ? ) { const acceptedPath = [ 'id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'GET' ; const path = `/_eql/search/${ encodeURIComponent ( params . id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getStatus ( this , params , options ? ) ; async getStatus ( this , params , options ? ) ; async getStatus ( this , params , options ? ) ; async getStatus ( this , params , options ? ) { const acceptedPath = [ 'id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'GET' ; const path = `/_eql/search/status/${ encodeURIComponent ( params . id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async search < TEvent = unknown > ( this , params , options ? ) ; async search < TEvent = unknown > ( this , params , options ? ) ; async search < TEvent = unknown > ( this , params , options ? ) ; async search < TEvent = unknown > ( this , params , options ? ) { const acceptedPath = [ 'index' ] ; const acceptedBody = [ 'query' , 'case_sensitive' , 'event_category_field' , 'tiebreaker_field' , 'timestamp_field' , 'fetch_size' , 'filter' , 'keep_alive' , 'keep_on_completion' , 'wait_for_completion_timeout' , 'size' , 'fields' , 'result_position' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = body != null ? 'POST' : 'GET' ; const path = `/${ encodeURIComponent ( params . index . toString ( ) ) }/_eql/search` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } }