UNPKG

@n1k1t/mock-server

Version:

The ultimate toolkit to intercept, transform, and simulate HTTP/WS traffic with type-safe expectations

27 lines 1.83 kB
import { ExpectationOperator } from '../models/operator'; import { TFunction } from '../../../types'; import { CompileExpectationOperatorValue, IExpectationSchemaContext, IExpectationExecUtils, IExpectationOperatorsSchema, TExpectationOperatorLocation, IExpectationMeta } from '../types'; export default class SwitchExpectationOperator<TContext extends IExpectationSchemaContext, TPickLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation, TPickValue = void, TForwardLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation, TForwardValue = void> extends ExpectationOperator<TContext, { [K in TPickLocation]: { $location: K; $cases: Partial<Record<Extract<CompileExpectationOperatorValue<TContext, K, TPickValue>, number | string> extends never ? (number | string) : Extract<CompileExpectationOperatorValue<TContext, K, TPickValue>, number | string>, IExpectationOperatorsSchema<TContext, TForwardLocation, TForwardValue>>>; $default?: IExpectationOperatorsSchema<TContext, TForwardLocation, TForwardValue>; $path?: string; $exec?: string | TFunction<unknown, [ CompileExpectationOperatorValue<TContext, K, TPickValue>, IExpectationExecUtils<TContext> ]>; }; }[TPickLocation]> { compiled: { exec?: TFunction<Promise<unknown>, [import("../types").IExpectationExecMode, TContext, ...unknown[]]> | undefined; default?: ExpectationOperator<TContext, any> | null | undefined; cases: Record<string | number, ExpectationOperator<any, any>>; }; get tags(): IExpectationMeta['tags']; match(context: TContext): Promise<boolean>; manipulate<T extends TContext>(context: T): Promise<T>; private handle; private extractValue; } //# sourceMappingURL=switch.operator.d.ts.map