UNPKG

@nestjs/core

Version:

The core of NestJS, a TypeScript framework for Node.js backends: modules, dependency injection and the request pipeline, on Express, Fastify or node:http.

19 lines (18 loc) • 1.21 kB
import { RequestMethod } from '@nestjs/common'; import type { pathToRegexp } from 'path-to-regexp'; import { ExcludeRouteMetadata } from '../interfaces/exclude-route-metadata.interface.js'; export declare const isRequestMethodAll: (method: RequestMethod) => boolean; export declare function isRouteExcluded(excludedRoutes: ExcludeRouteMetadata[], path: string, requestMethod?: RequestMethod): boolean; /** * Tells whether the excluded route matches the path: its regular expression * (`pathRegex`, unless another one is given) matches it, and none of its * parameters is longer than the router serves the route with. */ export declare function matchesExcludedPath(route: ExcludeRouteMetadata, path: string, pathRegex?: RegExp): boolean; /** * Turns a route path compiled with `pathToRegexp()` into the matcher of an * excluded route. With the `maxParamLength` of the router (see * `RouteMatchingOptions`), it does not match the paths the router serves * with another route because a parameter is too long for this one. */ export declare function toExcludedPathMatcher({ regexp, keys }: ReturnType<typeof pathToRegexp>, maxParamLength?: number): Pick<ExcludeRouteMetadata, 'pathRegex' | 'paramLimit'>;