@vtex/service-filters
Version:
VTEX Service Filters SDK
17 lines (16 loc) • 1.31 kB
TypeScript
import type { IOClients, ParamsContext, RecorderState, ServiceConfig, ServiceContext } from '@vtex/api';
import { Service } from '@vtex/api';
import type { Middleware } from 'koa-compose';
import type { Overwrite } from 'utility-types';
export declare type FilterContext<TClients extends IOClients = IOClients, TState extends RecorderState = RecorderState, TParamsContext extends ParamsContext = ParamsContext> = Overwrite<ServiceContext<TClients, TState, TParamsContext>, {
request: ServiceContext<TClients, TState, TParamsContext>['request'] & {
body: unknown;
};
}>;
export declare type FilterHandler<TClients extends IOClients = IOClients, TState extends RecorderState = RecorderState, TParamsContext extends ParamsContext = ParamsContext> = Middleware<FilterContext<TClients, TState, TParamsContext>>;
export interface FilterServiceConfig<T extends IOClients = IOClients, U extends RecorderState = RecorderState, V extends ParamsContext = ParamsContext> extends ServiceConfig<T, U, V> {
filter: FilterHandler<T, U, V> | Array<FilterHandler<T, U, V>>;
}
export declare class FilterService<T extends IOClients = IOClients, U extends RecorderState = RecorderState, V extends ParamsContext = ParamsContext> extends Service<T, U, V> {
constructor(config: FilterServiceConfig<T, U, V>);
}