import { Environment, ProcessedDatabucket, Route, RouteResponse } from '@mockoon/commons'; import { ServerRequest } from './requests'; /** * Interpretor for the route response rules. * Extract the rules targets from the request (body, headers, etc). * Get the first route response for which at least one rule is fulfilled. * * For CRUD routes: * - default response is the one linked to CRUD operations * - SEQUENTIAL, RANDOM and DISABLE_RULES modes are still working * - default response shouldn't have rules */ export declare class ResponseRulesInterpreter { private routeResponses; private request; private responseMode; private environment; private processedDatabuckets; private globalVariables; private envVarsPrefix; private publicBaseUrl?; private targets; constructor(routeResponses: RouteResponse[], request: ServerRequest, responseMode: Route['responseMode'], environment: Environment, processedDatabuckets: ProcessedDatabucket[], globalVariables: Record, envVarsPrefix: string, publicBaseUrl?: string | undefined); /** * Choose the route response depending on the first fulfilled rule. * If no rule has been fulfilled get the first route response. * If in FALLBACK mode, return null if no rule is fulfilled. */ chooseResponse(requestNumber: number, requestMessage?: string): RouteResponse | null; /** * Check a rule validity and invert it if invert is at true * * @param rule * @param requestNumber * @returns */ private isValid; /** * Check if a rule is valid by comparing the value extracted from the target to the rule value */ private isValidRule; /** * Extract rules targets from the request (body, headers, etc) */ private extractTargets; /** * Parse the value using the template parser allowing data helpers. * * @param value the value to parse * @param requestMessage the message sent by client. Only defined for websockets. For http requests, this is undefined. * @returns the parsed value or the unparsed input value if parsing fails */ private templateParse; }