Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump the nest-js-core group with 4 updates #2277

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
"@aws-sdk/client-s3": "^3.731.1",
"@fingerprintjs/fingerprintjs-pro-server-api": "^6.1.0",
"@nestjs/cli": "^10.4.9",
"@nestjs/common": "^10.4.15",
"@nestjs/common": "^11.0.3",
"@nestjs/config": "^4.0.0",
"@nestjs/core": "^10.4.15",
"@nestjs/platform-express": "^10.4.15",
"@nestjs/core": "^11.0.3",
"@nestjs/platform-express": "^11.0.3",
"@nestjs/schedule": "^4.1.2",
"@nestjs/serve-static": "^4.0.2",
"@nestjs/serve-static": "^5.0.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update this here as the package otherwise prevents startup. Internally, it has an unexpected * path, which goes against the new path-to-regexp requirements. This stems from Express v5.

"@nestjs/swagger": "^8.1.1",
"@nestjs/typeorm": "^11.0.0",
"@safe-global/safe-deployments": "^1.37.22",
Expand All @@ -63,7 +63,7 @@
"devDependencies": {
"@faker-js/faker": "^9.3.0",
"@nestjs/schematics": "^11.0.0",
"@nestjs/testing": "^10.4.15",
"@nestjs/testing": "^11.0.3",
"@smithy/util-stream": "^4.0.1",
"@types/amqplib": "^0",
"@types/cookie-parser": "^1.4.8",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/test-app.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
*
* If the module provided is not a {@link TestingModule}, an error is thrown
*/
export class TestAppProvider<T> extends AppProvider<T> {
export class TestAppProvider<T extends TestingModule> extends AppProvider<T> {
// Disables shutdown hooks for tests (they are not required)
// Enabling this in the tests might result in a MaxListenersExceededWarning
// as the number of listeners that this adds exceed the default
Expand Down
4 changes: 2 additions & 2 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class AppModule implements NestModule {
// Excludes the paths under '/' (base url) from being served as static content
// If we do not exclude these paths, the service will try to find the file and
// return 500 for files that do not exist instead of a 404
exclude: ['/(.*)'],
exclude: ['{*any}'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The excluded paths are passed to path-to-regexp, which no longer accepts certain unexpected characters. This stems from Express v5.

}),
TypeOrmModule.forRootAsync({
imports: [ConfigModule],
Expand Down Expand Up @@ -181,6 +181,6 @@ export class AppModule implements NestModule {
// The ClsMiddleware needs to be applied before the LoggerMiddleware
// in order to generate the request ids that will be logged afterward
.apply(ClsMiddleware, NotFoundLoggerMiddleware)
.forRoutes({ path: '*', method: RequestMethod.ALL });
.forRoutes({ path: '{*any}', method: RequestMethod.ALL });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path-to-regexp no longer accpets unexpected * paths. This stems from Express v5.

}
}
9 changes: 6 additions & 3 deletions src/app.provider.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type { INestApplication } from '@nestjs/common';
import type { DynamicModule, INestApplication } from '@nestjs/common';
import { VersioningType } from '@nestjs/common';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { NestFactory } from '@nestjs/core';
import { IConfigurationService } from '@/config/configuration.service.interface';
import { json } from 'express';
import cookieParser from 'cookie-parser';
import type { TestingModule } from '@nestjs/testing';

function configureVersioning(app: INestApplication): void {
app.enableVersioning({
Expand Down Expand Up @@ -68,7 +69,7 @@ export const DEFAULT_CONFIGURATION: Array<(app: INestApplication) => void> = [
* Each provider should have a {@link configuration} which specifies
* the steps taken to configure the application
*/
export abstract class AppProvider<T> {
export abstract class AppProvider<T extends DynamicModule | TestingModule> {
protected abstract readonly configuration: Array<
(app: INestApplication) => void
>;
Expand All @@ -88,7 +89,9 @@ export abstract class AppProvider<T> {
* This provider should be used to retrieve the actual implementation of the
* service
*/
export class DefaultAppProvider<T> extends AppProvider<T> {
export class DefaultAppProvider<
T extends DynamicModule,
> extends AppProvider<T> {
protected readonly configuration: Array<(app: INestApplication) => void> =
DEFAULT_CONFIGURATION;

Expand Down
Loading
Loading