Skip to content

v1.8.0

Choose a tag to compare

@Fcmam5 Fcmam5 released this 12 May 09:48
· 17 commits to develop since this release
Immutable release. Only release title and notes can be modified.

What's Changed

This release introduces the dynamic module pattern for NestProblemDetailsModule (done in #39), so configuration no longer requires manually overriding DI provider tokens. Static module imports remain fully supported. The release also tightens response-body construction, refreshes the README with a Quick start, and ships an .npmrc that hardens contributor and CI installs against supply-chain attacks.

Features

  • NestProblemDetailsModule.register() — typed, synchronous configuration. Pass baseUri, httpErrorsMap, and suppressDetail as a single options object:

    @Module({
      imports: [
        NestProblemDetailsModule.register({
          baseUri: 'https://example.org/problems',
          suppressDetail: ({ status }) => status >= 500,
        }),
      ],
      providers: [{ provide: APP_FILTER, useExisting: HTTP_EXCEPTION_FILTER_KEY }],
    })
    export class AppModule {}
  • NestProblemDetailsModule.registerAsync() — resolve options from an injectable factory (e.g. ConfigService):

    NestProblemDetailsModule.registerAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: (cfg: ConfigService) => ({
        baseUri: cfg.get('PROBLEMS_BASE_URI'),
        suppressDetail: cfg.get('NODE_ENV') === 'production',
      }),
    });
  • NestProblemDetailsModuleOptions and NestProblemDetailsModuleAsyncOptions types — exported from nest-problem-details-filter for consumers building wrapper modules.

Changes

  • detail field is now omitted entirely when absent or suppressedHttpExceptionFilter previously set detail: undefined and relied on JSON.stringify to drop it. The key is now never assigned at all, mirroring how errors is handled. The wire format is unchanged, but interceptors and schema validators that inspect the response body before serialization see a cleaner object.

  • suppressDetail documentation now leads with register() — the docs/usage.md section recommends NestProblemDetailsModule.register({ suppressDetail }) as the primary configuration path; the legacy SUPPRESS_DETAIL_KEY token override is documented as a fallback for static-module users.

  • Backward compatibility — importing NestProblemDetailsModule statically (without calling register()) and overriding provider tokens directly still works exactly as before.

Documentation

  • README "Quick start" — copy-paste install + useGlobalFilters snippet plus a before/after diff, so consumers can ship Problem Details responses in under 30 seconds.
  • Install-size badge — replaces the unreliable bundlephobia badge with packagephobia, which reflects the actual on-disk impact for users.
  • Older changelog entries backfilledCHANGELOG.md now covers every release from 1.1.0 through 1.8.0 with a link back to GitHub Releases for the long-form notes.

Security

  • Supply-chain hardening via minimum-release-age — repo ships a committed .npmrc that sets minimum-release-age=4320 (3 days). Installs reject any dependency version published less than 3 days ago, so a freshly-compromised npm release can't land in node_modules immediately. Honored by npm ≥ 11.5 and pnpm ≥ 10. The escape hatch and rationale are documented in CONTRIBUTING.md.

Full Changelog: v1.7.0...v1.8.0