Socket
Socket
Sign inDemoInstall

@nestjs/core

Package Overview
Dependencies
198
Maintainers
1
Versions
365
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 10.3.2 to 10.3.3

13

middleware/builder.js

@@ -37,6 +37,11 @@ "use strict";

exclude(...routes) {
this.excludedRoutes = this.getRoutesFlatList(routes).map(route => ({
...route,
path: this.routeInfoPathExtractor.extractPathFrom(route),
}));
this.excludedRoutes = this.getRoutesFlatList(routes).reduce((excludedRoutes, route) => {
for (const routePath of this.routeInfoPathExtractor.extractPathFrom(route)) {
excludedRoutes.push({
...route,
path: routePath,
});
}
return excludedRoutes;
}, []);
return this;

@@ -43,0 +48,0 @@ }

@@ -5,3 +5,3 @@ import { RouteInfo } from '@nestjs/common/interfaces';

private readonly applicationConfig;
private routePathFactory;
private readonly routePathFactory;
private readonly prefixPath;

@@ -12,6 +12,6 @@ private readonly excludedGlobalPrefixRoutes;

extractPathsFrom({ path, method, version }: RouteInfo): string[];
extractPathFrom(route: RouteInfo): string;
extractPathFrom(route: RouteInfo): string[];
private isAWildcard;
private extractNonWildcardPathFrom;
private extractNonWildcardPathsFrom;
private extractVersionPathFrom;
}

@@ -18,18 +18,21 @@ "use strict";

extractPathsFrom({ path, method, version }) {
const versionPath = this.extractVersionPathFrom(version);
const versionPaths = this.extractVersionPathFrom(version);
if (this.isAWildcard(path)) {
const entries = versionPaths.length > 0
? versionPaths.map(versionPath => this.prefixPath + versionPath + (0, shared_utils_1.addLeadingSlash)(path))
: [this.prefixPath + (0, shared_utils_1.addLeadingSlash)(path)];
return Array.isArray(this.excludedGlobalPrefixRoutes)
? [
this.prefixPath + versionPath + (0, shared_utils_1.addLeadingSlash)(path),
...this.excludedGlobalPrefixRoutes.map(route => versionPath + (0, shared_utils_1.addLeadingSlash)(route.path)),
...entries,
...this.excludedGlobalPrefixRoutes.map(route => versionPaths + (0, shared_utils_1.addLeadingSlash)(route.path)),
]
: [this.prefixPath + versionPath + (0, shared_utils_1.addLeadingSlash)(path)];
: entries;
}
return [this.extractNonWildcardPathFrom({ path, method, version })];
return this.extractNonWildcardPathsFrom({ path, method, version });
}
extractPathFrom(route) {
if (this.isAWildcard(route.path) && !route.version) {
return (0, shared_utils_1.addLeadingSlash)(route.path);
return [(0, shared_utils_1.addLeadingSlash)(route.path)];
}
return this.extractNonWildcardPathFrom(route);
return this.extractNonWildcardPathsFrom(route);
}

@@ -39,17 +42,26 @@ isAWildcard(path) {

}
extractNonWildcardPathFrom({ path, method, version, }) {
const versionPath = this.extractVersionPathFrom(version);
extractNonWildcardPathsFrom({ path, method, version, }) {
const versionPaths = this.extractVersionPathFrom(version);
if (Array.isArray(this.excludedGlobalPrefixRoutes) &&
(0, utils_1.isRouteExcluded)(this.excludedGlobalPrefixRoutes, path, method)) {
return versionPath + (0, shared_utils_1.addLeadingSlash)(path);
if (!versionPaths.length) {
return [(0, shared_utils_1.addLeadingSlash)(path)];
}
return versionPaths.map(versionPath => versionPath + (0, shared_utils_1.addLeadingSlash)(path));
}
return this.prefixPath + versionPath + (0, shared_utils_1.addLeadingSlash)(path);
if (!versionPaths.length) {
return [this.prefixPath + (0, shared_utils_1.addLeadingSlash)(path)];
}
return versionPaths.map(versionPath => this.prefixPath + versionPath + (0, shared_utils_1.addLeadingSlash)(path));
}
extractVersionPathFrom(version) {
if (!version || this.versioningConfig?.type !== common_1.VersioningType.URI)
return '';
extractVersionPathFrom(versionValue) {
if (!versionValue || this.versioningConfig?.type !== common_1.VersioningType.URI)
return [];
const versionPrefix = this.routePathFactory.getVersionPrefix(this.versioningConfig);
return (0, shared_utils_1.addLeadingSlash)(versionPrefix + version.toString());
if (Array.isArray(versionValue)) {
return versionValue.map(version => (0, shared_utils_1.addLeadingSlash)(versionPrefix + version.toString()));
}
return [(0, shared_utils_1.addLeadingSlash)(versionPrefix + versionValue.toString())];
}
}
exports.RouteInfoPathExtractor = RouteInfoPathExtractor;
{
"name": "@nestjs/core",
"version": "10.3.2",
"version": "10.3.3",
"description": "Nest - modern, fast, powerful node.js web framework (@core)",

@@ -39,3 +39,3 @@ "author": "Kamil Mysliwiec",

"devDependencies": {
"@nestjs/common": "10.3.2"
"@nestjs/common": "10.3.3"
},

@@ -42,0 +42,0 @@ "peerDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc