import { ParamsContext , RecorderState , RouteHandler , ServiceContext , } from '../service/worker/runtime/typings' ; import { IOClients } from './../clients/IOClients' ; export function cancel < T extends IOClients , U extends RecorderState , V extends ParamsContext > ( middleware ) { return async ( ctx , next ) => { if ( ctx . vtex ?. cancellation ?. cancelled ) { return ; } await middleware ( ctx , next ) ; } ; }