Repository navigation
5.6.0
Minor release: route validators are built at boot, so a schema no driver matches fails startServer() instead of answering 500, and a static route no longer hides a :param route that has the request's method. Also fixes password recovery and verification burning the link on a failed save, NaN cache TTLs, per-mount RateLimiter lists and the i18next 26.5 types. Code generation moves to oxc-parser ^0.156.0.
Changes
- Route validators are built at boot, not per request. Each
params:,request:andquery:schema (route-level and middleware-declared) resolves itsValidatorDriveronce when the route is registered. A schema no driver matches now failsstartServer()with the migration message prefixed by the controller and route (before: a 500 on the first request). Register custom drivers (ValidateService.register) at module scope, beforestartServer(); a driver registered inside thebootHttphook no longer reaches already-registered routes. - Code generation requires
oxc-parser^0.156.0. Projects that runnpm run genupdate their optional development peer. Generated output is unchanged.
Fixes
- A static route no longer hides a
:paramroute that has the request's method. WithGET /events/newandDELETE /events/:slug,DELETE /events/newanswered 405 instead of reaching the:slugroute. Matching now tries the next candidate, as in Express. A 405 is answered only when no route matching the path has the method, and itsAllowheader lists the methods of all of them. Static segments still win for the methods they define. - Password recovery and email verification persist in one write. A failing second save (a validator on a customized
Usermodel, a transient database error) used to burn the link without resetting the password or verifying the account.getUserByPasswordRecoveryTokenandgetUserByVerificationTokentake an optional{ save: false }; the built-in routes use it and save once, so a failed write leaves the link usable for a retry. - A
NaNcache TTL no longer stores a never-expiring entry.cache.getSetValue(key, fn, NaN)skips the cache like a zero or negative TTL. - A per-mount
RateLimiterconsumeKeyComponents.requestlist replaces the configured one instead of being concatenated with it, so[]can turn the component off. - A Mongoose
ValidationErrorthrown inside a request schema is no longer answered as a field-error 400 whoseerrorswas Mongoose's message string with the submitted values; it goes through the error-handler registry instead. getModelwarns about a plural name once per name instead of on every call.TranslationFunctionaccepts the i18next 26.5 translator. i18next 26.5 split itst(key, defaultValue, options?)signature, so assigning its translator toI18nBaseInstance,TI18norTranslationFunctionfailed with TS2322. Calls are unchanged, and earlier i18next 26 releases still fit.
Upgrade notes
- Custom validator drivers: register them at module scope, before
startServer(), not insidebootHttp. - Routes: a static route answers only for the methods it defines; a request for another method falls through to a matching
:paramroute. - Rate limits: a per-mount
consumeKeyComponents.requestlist must name every field it keys on; it no longer adds to the configured list. - Code generation:
npm i -D oxc-parser@^0.156.0. Runtime-only consumers do not need it.
Validation
Release checks passed: 948 Node tests (with Redis, no skips), 923 Bun tests, lint/format, both TypeScript configurations, Node and Bun packed-consumer smoke tests, and the documentation build. The Bun packed consumer exercised real MongoDB CRUD, password hashing and shutdown. CI passed on the release commit across Node 24/26 and Bun 1.4.0/latest. All dependencies were updated within their ranges, which closes the open Dependabot alerts; npm audit reports none.