v1.8.0
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. PassbaseUri,httpErrorsMap, andsuppressDetailas 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', }), });
-
NestProblemDetailsModuleOptionsandNestProblemDetailsModuleAsyncOptionstypes — exported fromnest-problem-details-filterfor consumers building wrapper modules.
Changes
-
detailfield is now omitted entirely when absent or suppressed —HttpExceptionFilterpreviously setdetail: undefinedand relied onJSON.stringifyto drop it. The key is now never assigned at all, mirroring howerrorsis handled. The wire format is unchanged, but interceptors and schema validators that inspect the response body before serialization see a cleaner object. -
suppressDetaildocumentation now leads withregister()— the docs/usage.md section recommendsNestProblemDetailsModule.register({ suppressDetail })as the primary configuration path; the legacySUPPRESS_DETAIL_KEYtoken override is documented as a fallback for static-module users. -
Backward compatibility — importing
NestProblemDetailsModulestatically (without callingregister()) and overriding provider tokens directly still works exactly as before.
Documentation
- README "Quick start" — copy-paste install +
useGlobalFilterssnippet 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 backfilled — CHANGELOG.md now covers every release from
1.1.0through1.8.0with 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 setsminimum-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 innode_modulesimmediately. 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