import { map } from 'rxjs/operators' ; import { ISearchStrategy , PluginStart } from '../../../src/plugins/data/server' ; import { IMyStrategyRequest , IMyStrategyResponse } from '../common/types' ; export const mySearchStrategyProvider = ( data ) : ISearchStrategy < IMyStrategyRequest , IMyStrategyResponse > => { const es = data . search . getSearchStrategy ( ) ; return { search : ( request , options , deps ) => es . search ( request , options , deps ) . pipe ( map ( ( esSearchRes ) => ( { ... esSearchRes , cool : request . get_cool ? 'YES' : 'NOPE' , executed_at : new Date ( ) . getTime ( ) , } ) ) ) , cancel : async ( id , options , deps ) => { if ( es . cancel ) { await es . cancel ( id , options , deps ) ; } } , } ; } ;