Skip to content

5.6.0

Choose a tag to compare

@Systerr Systerr released this 27 Oct 21:16
· 29 commits to main since this release

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: and query: schema (route-level and middleware-declared) resolves its ValidatorDriver once when the route is registered. A schema no driver matches now fails startServer() 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, before startServer(); a driver registered inside the bootHttp hook no longer reaches already-registered routes.
  • Code generation requires oxc-parser ^0.156.0. Projects that run npm run gen update their optional development peer. Generated output is unchanged.

Fixes

  • A static route no longer hides a :param route that has the request's method. With GET /events/new and DELETE /events/:slug, DELETE /events/new answered 405 instead of reaching the :slug route. Matching now tries the next candidate, as in Express. A 405 is answered only when no route matching the path has the method, and its Allow header 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 User model, a transient database error) used to burn the link without resetting the password or verifying the account. getUserByPasswordRecoveryToken and getUserByVerificationToken take 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 NaN cache 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 RateLimiter consumeKeyComponents.request list replaces the configured one instead of being concatenated with it, so [] can turn the component off.
  • A Mongoose ValidationError thrown inside a request schema is no longer answered as a field-error 400 whose errors was Mongoose's message string with the submitted values; it goes through the error-handler registry instead.
  • getModel warns about a plural name once per name instead of on every call.
  • TranslationFunction accepts the i18next 26.5 translator. i18next 26.5 split its t(key, defaultValue, options?) signature, so assigning its translator to I18nBaseInstance, TI18n or TranslationFunction failed 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 inside bootHttp.
  • Routes: a static route answers only for the methods it defines; a request for another method falls through to a matching :param route.
  • Rate limits: a per-mount consumeKeyComponents.request list 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.

Full changelog · Changes since 5.5.1 · npm package