@adaptivestone/framework 5.5.1 → 5.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +129 -76
- package/README.md +41 -1
- package/dist/clusterRunner.js +7 -3
- package/dist/clusterRunner.js.map +1 -1
- package/dist/codegen/appTypes.js +9 -6
- package/dist/codegen/appTypes.js.map +1 -1
- package/dist/commands/CreateUser.d.ts +1 -0
- package/dist/commands/CreateUser.js +1 -0
- package/dist/commands/CreateUser.js.map +1 -1
- package/dist/commands/SyncIndexes.js +4 -12
- package/dist/commands/SyncIndexes.js.map +1 -1
- package/dist/commands/migration/Migrate.js +3 -2
- package/dist/commands/migration/Migrate.js.map +1 -1
- package/dist/config/http.d.ts +1 -0
- package/dist/config/http.js +8 -0
- package/dist/config/http.js.map +1 -1
- package/dist/controllers/Auth.js +33 -4
- package/dist/controllers/Auth.js.map +1 -1
- package/dist/controllers/index.js +129 -83
- package/dist/controllers/index.js.map +1 -1
- package/dist/helpers/crypto.js +3 -0
- package/dist/helpers/crypto.js.map +1 -1
- package/dist/models/Lock.d.ts +2 -2
- package/dist/models/Lock.js +64 -15
- package/dist/models/Lock.js.map +1 -1
- package/dist/models/User.d.ts +18 -6
- package/dist/models/User.js +24 -7
- package/dist/models/User.js.map +1 -1
- package/dist/modules/BaseCli.d.ts +5 -0
- package/dist/modules/BaseCli.js +10 -1
- package/dist/modules/BaseCli.js.map +1 -1
- package/dist/server.js +53 -8
- package/dist/server.js.map +1 -1
- package/dist/services/cache/Cache.js +20 -10
- package/dist/services/cache/Cache.js.map +1 -1
- package/dist/services/cache/drivers/MemoryDriver.js +3 -1
- package/dist/services/cache/drivers/MemoryDriver.js.map +1 -1
- package/dist/services/cache/drivers/RedisDriver.js +15 -11
- package/dist/services/cache/drivers/RedisDriver.js.map +1 -1
- package/dist/services/http/HttpServer.d.ts +2 -2
- package/dist/services/http/HttpServer.js.map +1 -1
- package/dist/services/http/builtinErrorHandlers.d.ts +9 -3
- package/dist/services/http/builtinErrorHandlers.js.map +1 -1
- package/dist/services/http/middleware/Cors.js +5 -0
- package/dist/services/http/middleware/Cors.js.map +1 -1
- package/dist/services/http/middleware/IpDetector.js +23 -4
- package/dist/services/http/middleware/IpDetector.js.map +1 -1
- package/dist/services/http/middleware/Pagination.js +4 -2
- package/dist/services/http/middleware/Pagination.js.map +1 -1
- package/dist/services/http/middleware/RateLimiter.js +8 -1
- package/dist/services/http/middleware/RateLimiter.js.map +1 -1
- package/dist/services/http/middleware/RequestParser.d.ts +4 -1
- package/dist/services/http/middleware/RequestParser.js +74 -20
- package/dist/services/http/middleware/RequestParser.js.map +1 -1
- package/dist/services/http/routing/RouteNode.d.ts +4 -3
- package/dist/services/http/routing/RouteRegistry.js +21 -10
- package/dist/services/http/routing/RouteRegistry.js.map +1 -1
- package/dist/services/http/routing/match.d.ts +7 -2
- package/dist/services/http/routing/match.js +58 -41
- package/dist/services/http/routing/match.js.map +1 -1
- package/dist/services/i18n/I18n.js.map +1 -1
- package/dist/services/i18n/types.d.ts +4 -2
- package/dist/services/validate/ValidateService.d.ts +2 -0
- package/dist/services/validate/ValidateService.js +2 -0
- package/dist/services/validate/ValidateService.js.map +1 -1
- package/dist/services/validate/ValidationError.d.ts +12 -1
- package/dist/services/validate/ValidationError.js +16 -3
- package/dist/services/validate/ValidationError.js.map +1 -1
- package/dist/tests/setupFramework.d.ts +4 -1
- package/dist/tests/setupFramework.js +15 -9
- package/dist/tests/setupFramework.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,53 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [5.6.1] - 2026-11-15
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- **The optional `oxc-parser` and `i18next` peers accept their current releases.** `oxc-parser` is now `>=0.156.0 <1` instead of `^0.156.0`, which rejected each new weekly 0.x release with `ERESOLVE`; code generation output with 0.158.0 is byte-identical. `i18next` is now `^26.0.1 || ^27.0.0`. i18next 27 changes defaults that affect an app's own translations (an empty translation falls back instead of rendering blank, `/` is no longer escaped in interpolated values; see its [migration guide](https://www.i18next.com/misc/migration-guide#v26.x.x-to-v27.0.0)). The framework passes `fallbackLng` from `config/i18n.ts`, so i18next 27's new `fallbackLng` default does not apply.
|
|
14
|
+
- **Cache misses now return the same serialized representation as cache hits.** Dates become strings, `toJSON()` is respected, and undefined object properties are omitted on the first call too; BigInts remain supported. A non-positive or `NaN` TTL still bypasses caching and returns the callback's original value.
|
|
15
|
+
- **Middleware schemas inherited from parent controllers are now validated on child routes.** Invalid input that previously bypassed these schemas receives the usual validation 400.
|
|
16
|
+
- **User session token lookups have an index on `sessionTokens.token`.** Existing deployments with automatic index creation enabled build it on startup; plan the index build for large user collections.
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **CLI argument descriptors accept `sensitive: true`.** Such values are replaced with `[REDACTED]` before generating the Mongo application name or its hash; `createuser` marks its password this way. Ordinary arguments, boolean flags, the existing long-name hash format, and an explicit `MONGO_APP_NAME` are preserved.
|
|
21
|
+
- **`http.requestParser.mediaTypes` parses other media types as JSON or urlencoded.** It maps a media type to `'json'` or `'urlencoded'`, on top of `application/json`, any `+json` type and `application/x-www-form-urlencoded`. The default config maps `application/csp-report`, so browser CSP violation reports are parsed instead of answered with 400. An app's own `config/http.ts` replaces the framework's, so add the entry there: `mediaTypes: { 'application/csp-report': 'json' }`. Keys match case-insensitively, and mapped bodies share the `maxFieldsSize` limit.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- **An unavailable Redis no longer stalls cache reads or delays rate limiting.** Cache operations fail softly while the connection is pending, and the rate limiter immediately uses its memory insurance limiter. Redis cache TTLs now use milliseconds, so fractional seconds work.
|
|
26
|
+
- **Cluster workers drain requests when shutdown signals are delivered more than once**, then disconnect their IPC channel. The primary no longer mistakes a signal exit with a null code for a nonzero exit code.
|
|
27
|
+
- **Fatal crashes give Sentry a bounded opportunity to flush before exiting.** The source transport import also resolves correctly when running TypeScript directly, and calling `getModel` before initialization reports the intended diagnostic.
|
|
28
|
+
- **Missing or empty model passwords are no longer hashed as login credentials**, and malformed stored password hashes with an incorrect decoded length are rejected.
|
|
29
|
+
- **Method-scoped middleware runs in declaration order**, including overlapping wildcard and exact scopes.
|
|
30
|
+
- **Mounted routes retain their own parameter names.** Sibling controller mounts that share a parameter position no longer borrow the first controller's name, including handlers without explicit parameter metadata.
|
|
31
|
+
- **Applied migrations remain applied after a `.js`/`.ts` extension change.** `syncindexes` also handles models registered from subdirectories, and type generation supports framework/model files outside the consumer root, including hoisted installations.
|
|
32
|
+
- **Trusted forwarded IP addresses accept validated IPv4/IPv6 addresses with ports.** Binary `application/octet-stream` uploads use the configured file-size limit; CORS regexes with `g`/`y` flags match consistently across requests; pagination accepts numeric exponent notation while retaining integer page and limit values.
|
|
33
|
+
- **Lock waiting recognizes logically expired records**, without requiring MongoDB's TTL cleanup to remove them first.
|
|
34
|
+
- **Test teardown drops its database before closing MongoDB.** The shipped test helpers drain HTTP requests, wait for the models' background collection builds, drop the per-suite database, then emit shutdown and disconnect. A build that finished after the drop used to recreate the database; a failed drop now fails the teardown hook instead of being ignored.
|
|
35
|
+
- **`TranslationFunction` accepts the i18next 27 translator.** i18next 27 types `t(key)` and `t(key, options)` as separate signatures, so assigning an i18next 27 instance or its `t` to `I18nBaseInstance`, `TI18n` or `TranslationFunction` failed to compile (TS2322). `TranslationFunction` makes the same split, which still fits i18next 26. A call that passes an options value that may be `undefined` no longer compiles, as with i18next 27's own types; pass the options only when they are defined.
|
|
36
|
+
- **`ValidationError` compiles under `skipLibCheck: false`.** Importing `ValidationError` (from `services/validate/ValidationError.js`) in an app with `skipLibCheck: false` failed with TS2416 inside the framework's own declaration, because its widened `message` was hidden behind a `@ts-expect-error` that does not reach the `.d.ts`. The class is still an `Error` at runtime. `registerErrorHandler` and `ErrorHandlerFn` now also accept it as an error class.
|
|
37
|
+
- **Dependencies updated within their ranges** (lockfile), including Mongoose 9.12.1, Sentry 11.12.0 and rate-limiter-flexible 11.4.1. The Sentry update removes four moderate audit findings.
|
|
38
|
+
|
|
39
|
+
## [5.6.0] - 2026-10-27
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- **Code generation now requires `oxc-parser` `^0.156.0`.** Projects that run `npm run gen` should update their optional development peer with `npm i -D oxc-parser@^0.156.0`. Runtime-only consumers do not need it.
|
|
44
|
+
- **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`) before `startServer()`, at module scope as documented — a driver registered inside the `bootHttp` hook no longer reaches already-registered routes.
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
|
|
48
|
+
- **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 (`Allow: GET, HEAD`) instead of reaching the `:slug` route, so a slug equal to a sibling static segment could not be deleted or updated. Matching now skips a static (or `:param`) route that lacks the method and 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 (`GET, HEAD, DELETE` for `POST /events/new` above). The same applies to `{*splat}` routes, including the empty-rest match (`PUT /files` reaching `PUT /files/{*path}` next to `GET /files`). Static segments still win for the methods they define.
|
|
49
|
+
- **Password recovery and email verification persist in one write.** `recoverPassword` and `verifyUser` used to consume the token in one `save()` and apply the change in a second, so a failing second save (a validator on a customized `User` model, a transient database error) burned the link without resetting the password or verifying the account. `getUserByPasswordRecoveryToken` and `getUserByVerificationToken` take an optional `{ save: false }` that removes the token from the returned document only; the built-in routes use it and save once, so a failed write leaves the same link usable for a retry. The default call still consumes and saves.
|
|
50
|
+
- **A `NaN` cache TTL no longer stores a never-expiring entry.** `cache.getSetValue(key, fn, NaN)` (for example `(expiresAt - Date.now()) / 1000` with an `undefined` expiry) skips the cache like a zero or negative TTL. Before, the memory driver stored the value, never read it as expired, and re-armed its cleanup timer every millisecond.
|
|
51
|
+
- **A per-mount `RateLimiter` `consumeKeyComponents.request` list replaces the configured one.** The middleware parameters were deep-merged with array concatenation, so `[RateLimiter, { consumeKeyComponents: { request: ['phone'] } }]` on top of a config `['email']` keyed on both fields, and `[]` could not turn the component off. Arrays now replace, as in the config loader.
|
|
52
|
+
- **A Mongoose `ValidationError` thrown inside a request schema is no longer answered as a field-error 400.** `ValidationError.isValidationError` also requires the framework's `issues` array, so a validator that calls `Model.validate()` and lets the Mongoose error escape goes through the error-handler registry (its safety net, or a 500) instead of a 400 whose `errors` was Mongoose's message string, which embeds the submitted values.
|
|
53
|
+
- **`getModel` nudges about a plural name once per name** instead of on every call, so a singular model ending in `s` (`Address`, `Status`) no longer warns on every request.
|
|
54
|
+
- **`TranslationFunction` accepts the i18next 26.5 translator.** i18next 26.5 split its `t(key, defaultValue, options?)` signature into two overloads, so assigning an i18next instance or its `t` to `I18nBaseInstance`, `TI18n` or `TranslationFunction` failed to compile (TS2322). `TranslationFunction` makes the same split. Calls are unchanged, and earlier i18next 26 releases still fit.
|
|
55
|
+
|
|
9
56
|
## [5.5.1] - 2026-10-06
|
|
10
57
|
|
|
11
58
|
### Changed
|
|
@@ -92,7 +139,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
92
139
|
- **Generated request/query types include middleware validation outputs.** Later required fields replace earlier types; optional fields retain the possibility of an earlier value. Array, scalar, and nullable outputs keep their actual types, and content-type branches remain correlated after middleware validation. Nullish route query schemas are treated as absent.
|
|
93
140
|
- **A single validated request/query output retains its shape.** Arrays, scalars, and null are passed to handlers intact. Multiple validation outputs must be plain objects and keep the existing ordered shallow merge; incompatible combinations now produce a configuration error through the normal 500 handler. Content-type maps likewise require object outputs and add their discriminator without mutating the validator's returned object.
|
|
94
141
|
|
|
95
|
-
- **A schema that turns the `id` virtual off, or defines its own `id` path, no longer gets a phantom `id: string` on its documents.** The hydrated document type intersected `{ id: string }` unconditionally — a leftover from before Mongoose added the virtual to its own inference (9.1, refined in 9.4), which now supplies `id: string` itself and honours both a `schemaOptions` `id: false` and a real `id` field. The forced intersection won over both: with `id: false`, `doc.id` was typed `string` while the runtime value is `undefined`; with `id: { type: Number }`, it was `string` while the runtime value is a number. The intersection is gone, so the document follows the schema in both cases and the default case is unchanged (`doc.id` is still `string`). A custom `id`
|
|
142
|
+
- **A schema that turns the `id` virtual off, or defines its own `id` path, no longer gets a phantom `id: string` on its documents.** The hydrated document type intersected `{ id: string }` unconditionally — a leftover from before Mongoose added the virtual to its own inference (9.1, refined in 9.4), which now supplies `id: string` itself and honours both a `schemaOptions` `id: false` and a real `id` field. The forced intersection won over both: with `id: false`, `doc.id` was typed `string` while the runtime value is `undefined`; with `id: { type: Number }`, it was `string` while the runtime value is a number. The intersection is gone, so the document follows the schema in both cases and the default case is unchanged (`doc.id` is still `string`). A custom `id` _virtual_ is a different matter: it is still intersected with Mongoose's default `id: string`, so one that returns anything other than a string collapses to `never` — declare it as a path or rename it. Type-level only. Pinned by the new `idVirtual.ts` fixture in the model-typing compile gate.
|
|
96
143
|
|
|
97
144
|
- **A single-nested subdocument spelled `field: { type: { … }, _id: false }` no longer carries a phantom `_id` on hydrated documents.** Mongoose disables the generated `_id` for both spellings — the `_id: false` beside `type:` and the one inside it — but the hydrated-type correction unwrapped the `type:` wrapper before checking for the marker, so the sibling spelling kept an `_id: Types.ObjectId` the runtime never sets, while the inside spelling was handled. The marker now survives the unwrap. The raw and lean surfaces were already correct and are unchanged; a subdocument without `_id: false` keeps its generated `_id` as before. Type-level only. Pinned in the `nestedPathIds.ts` fixture, which now covers both spellings on both surfaces.
|
|
98
145
|
|
|
@@ -119,7 +166,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
119
166
|
|
|
120
167
|
### Added
|
|
121
168
|
|
|
122
|
-
- **The test suite is type-checked now — `npm run check:types:tests`.** `tsconfig.json` excludes `src/**/*.test.ts` from the build, so no test file had ever been through `tsc`; a first run surfaced 164 errors. The new `tsconfig.tests.json` extends the build config with the tests included (fixtures stay out — they carry deliberate module augmentations and are already checked in isolation by `ModelTyping.typecheck.test.ts` and `routeTypes.golden.test.ts`), and CI runs it alongside `check:types`. Two things it caught, both silent until now: 20 `it()` calls still used Vitest's `it(name, fn, timeout)` signature, which node:test ignores — every one of those per-test timeouts, up to 240s, had quietly been running under the global 10s cap and is now declared as `it(name, { timeout }, fn)`; and `assertThrowsLike` / `assertRejectsLike` in `tests/assertions.js` matched error
|
|
169
|
+
- **The test suite is type-checked now — `npm run check:types:tests`.** `tsconfig.json` excludes `src/**/*.test.ts` from the build, so no test file had ever been through `tsc`; a first run surfaced 164 errors. The new `tsconfig.tests.json` extends the build config with the tests included (fixtures stay out — they carry deliberate module augmentations and are already checked in isolation by `ModelTyping.typecheck.test.ts` and `routeTypes.golden.test.ts`), and CI runs it alongside `check:types`. Two things it caught, both silent until now: 20 `it()` calls still used Vitest's `it(name, fn, timeout)` signature, which node:test ignores — every one of those per-test timeouts, up to 240s, had quietly been running under the global 10s cap and is now declared as `it(name, { timeout }, fn)`; and `assertThrowsLike` / `assertRejectsLike` in `tests/assertions.js` matched error _classes_ at runtime while typing the argument as a plain function, so `assertThrowsLike(fn, MyError)` failed to compile. The parameter now accepts constructors.
|
|
123
170
|
|
|
124
171
|
- **The shipped test bootstrap now accepts project `Server` options, so `bootHttp` runs under test.** `Server` takes exactly two things — `folders` and the `bootHttp` hook — and the test bootstrap passed only the first, hardcoding `new Server({ folders })`. Every project that wires app-wide HTTP behavior in `bootHttp` (error handlers via `registerErrorHandler`, ad-hoc routes, Express middleware) therefore ran its tests against a server that had none of it: a mapped 400 in production showed up as a 500 under test, with nothing reporting the difference. Declare them with `configureTestServer` from `tests/testHelpers.js`, at module scope in the preload that imports the setup glue:
|
|
125
172
|
|
|
@@ -134,23 +181,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
134
181
|
|
|
135
182
|
- **Built-in middleware messages are now translatable — and can no longer leak a raw key.** The six messages the shipped middleware return were hardcoded English with no way for an app to reword or translate them. Each is now emitted with an i18n key **and** the current English text as its in-code default, so responses stay byte-identical unless the app's locale files actually define the key:
|
|
136
183
|
|
|
137
|
-
| Key
|
|
138
|
-
|
|
139
|
-
| `middleware.auth.notLoggedIn`
|
|
140
|
-
| `middleware.role.userRequired`
|
|
141
|
-
| `middleware.role.noAccess`
|
|
142
|
-
| `middleware.rateLimiter.tooManyRequests`
|
|
143
|
-
| `middleware.requestParser.entityTooLarge` | Request entity too large. Your upload exceeds the allowed size or count limits.
|
|
144
|
-
| `middleware.requestParser.parseError`
|
|
184
|
+
| Key | Default (English) |
|
|
185
|
+
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
186
|
+
| `middleware.auth.notLoggedIn` | Please login to application |
|
|
187
|
+
| `middleware.role.userRequired` | User should be provided |
|
|
188
|
+
| `middleware.role.noAccess` | You do not have access |
|
|
189
|
+
| `middleware.rateLimiter.tooManyRequests` | Too Many Requests |
|
|
190
|
+
| `middleware.requestParser.entityTooLarge` | Request entity too large. Your upload exceeds the allowed size or count limits. |
|
|
191
|
+
| `middleware.requestParser.parseError` | Error to parse your request. You provided invalid content type or content-length. Please check your request headers and content type. |
|
|
145
192
|
|
|
146
193
|
Nothing is added to the framework's own locale files — the in-code default is the single English source of truth, and a key present in the app's locales always wins, so existing translations keep working unchanged. The default also holds in every degenerate case: i18n disabled (the fallback translator now honours `defaultValue` instead of handing back the key), a request with no i18n at all, or a `t()` that returns a non-string. Custom middleware get the same behavior from the new protected `translate(req, key, defaultValue)` helper on `AbstractMiddleware`. Machine-readable fields are untouched — the auth 401 still carries `error: 'AUTH001'` — and the rate limiter's 500 `RateLimiter error` stays hardcoded, as it reports a misconfigured limiter to operators rather than something the caller can act on. With `saveMissing: true` in `config/i18n.ts`, a request that hits one of these messages writes the English default into `<lng>/translation.missing.json`, giving translators a ready-made starter file.
|
|
147
194
|
|
|
148
195
|
- **The 404 and 500 fallback responses joined the translatable set.** `HttpServer`'s two sinks — the 404 for a path no route matched, and the generic 500 that finalizes an unhandled error — answered with hardcoded JSON. Both now emit an i18n key with the current English text as its in-code default, exactly like the middleware messages above:
|
|
149
196
|
|
|
150
|
-
| Key
|
|
151
|
-
|
|
152
|
-
| `http.notFound`
|
|
153
|
-
| `http.serverError` | Something broke!
|
|
197
|
+
| Key | Default (English) |
|
|
198
|
+
| ------------------ | ----------------- |
|
|
199
|
+
| `http.notFound` | 404 |
|
|
200
|
+
| `http.serverError` | Something broke! |
|
|
154
201
|
|
|
155
202
|
Same semantics: nothing is added to the framework's locale files, a key present in the app's locales wins, and the English default holds when i18n is disabled, when the request carries no i18n at all, or when `t()` returns a non-string — so untranslated responses stay byte-identical. Status codes are untouched, as is the guard that hands a 500 arriving after the response already started to Express's own finalizer.
|
|
156
203
|
|
|
@@ -162,32 +209,32 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
162
209
|
|
|
163
210
|
- **Behavior change — a framework message whose key is missing now falls back to English instead of leaking the raw key, and `i18next` is optional.** The built-in auth controller, its request validation and the shipped email templates emitted bare i18n keys with no default, so an app whose locale files did not carry the key answered with `auth.messageSome` or `email.registered` in place of a sentence — the example project copied 3 of 26 keys and hit exactly that. Every framework-emitted key now travels with its current English text as an in-code `defaultValue` (validation issues carry it in `params`, which `ValidateService` already forwards to `t()`), so a key present in your locales still wins and existing translations are byte-identical, while a miss reads as English:
|
|
164
211
|
|
|
165
|
-
| Key
|
|
166
|
-
|
|
167
|
-
| `auth.emailProvided`
|
|
168
|
-
| `auth.emailValid`
|
|
169
|
-
| `auth.passwordProvided`
|
|
170
|
-
| `auth.passwordValid`
|
|
171
|
-
| `auth.passwordRecoveryTokenProvided` | Password recovery token must be provided
|
|
172
|
-
| `auth.nickNameValid`
|
|
173
|
-
| `auth.nameValid`
|
|
174
|
-
| `auth.errorUPValid`
|
|
175
|
-
| `auth.nicknameExists`
|
|
176
|
-
| `auth.recoveryEmailSent`
|
|
177
|
-
| `auth.verificationEmailSent`
|
|
178
|
-
| `email.notVerified`
|
|
179
|
-
| `email.registered`
|
|
180
|
-
| `email.alreadyVerifiedOrWrongToken`
|
|
181
|
-
| `email.passwordRecovery`
|
|
182
|
-
| `email.passwordChanged`
|
|
183
|
-
| `email.greeating`
|
|
184
|
-
| `password.wrongToken`
|
|
212
|
+
| Key | Default (English) |
|
|
213
|
+
| ------------------------------------ | -------------------------------------------------------------------------- |
|
|
214
|
+
| `auth.emailProvided` | Email must be provided |
|
|
215
|
+
| `auth.emailValid` | Email is not valid |
|
|
216
|
+
| `auth.passwordProvided` | Password must be provided |
|
|
217
|
+
| `auth.passwordValid` | Password is not valid,only a-z,A-Z,0-9,!,@,#,$,%,ˆ,&,*,(,),_,+,{,},[,],<,> |
|
|
218
|
+
| `auth.passwordRecoveryTokenProvided` | Password recovery token must be provided |
|
|
219
|
+
| `auth.nickNameValid` | Nick name is not valid,only a-z,A-Z,0-9 |
|
|
220
|
+
| `auth.nameValid` | Name is not valid |
|
|
221
|
+
| `auth.errorUPValid` | User/password not valid |
|
|
222
|
+
| `auth.nicknameExists` | User with such nickname already exists |
|
|
223
|
+
| `auth.recoveryEmailSent` | If an account exists for this address, a recovery email has been sent. |
|
|
224
|
+
| `auth.verificationEmailSent` | If an account exists for this address, a verification email has been sent. |
|
|
225
|
+
| `email.notVerified` | Your email is not verified |
|
|
226
|
+
| `email.registered` | User with such an email already registered |
|
|
227
|
+
| `email.alreadyVerifiedOrWrongToken` | Your email is already verified or your verification token is wrong |
|
|
228
|
+
| `email.passwordRecovery` | Recovery password |
|
|
229
|
+
| `email.passwordChanged` | Password changed |
|
|
230
|
+
| `email.greeating` | Dear user |
|
|
231
|
+
| `password.wrongToken` | Password recovery token is not valid |
|
|
185
232
|
|
|
186
233
|
`password.wrongToken` is the one message that never had a catalog entry at all — a wrong recovery token answered with the literal string `password.wrongToken` — so its English text is new. The in-code default is now the single English source of truth: the keys above were removed from the framework's `en/translation.json` (what remains there has no emit site in the framework, so nothing covers it), and `ru/translation.json` still ships in full and still wins for `ru` requests.
|
|
187
234
|
|
|
188
235
|
`i18next` and `i18next-fs-backend` move from dependencies to **optional peer dependencies**, the treatment `@redis/client`, `yup` and `oxc-parser` already got. **Install both only if you actually translate** (`npm i i18next i18next-fs-backend`); the default `i18n.enabled: true` no longer implies they are present. They are still imported lazily and only when i18n is enabled, so a fresh install serves every framework message in English with no translation engine at all; the first request that needs a translator logs one warning — naming both packages and the `enabled` flag — and then falls back for the rest of the process, rather than repeating per request or failing the request. `getI18nBaseInstance()` (the raw i18next instance) still rejects with that message for callers that require the real thing. Consumers who type-check with `skipLibCheck: false` will see `Cannot find module 'i18next'` reported inside the framework's `.d.ts` files if the package is absent — the same trade-off the other optional peers already carry; keep `skipLibCheck: true` (what the project template ships) or install the packages.
|
|
189
236
|
|
|
190
|
-
- **The shipped email templates are now JavaScript template modules, and the built-in auth mails require `@adaptivestone/framework-module-email` >= 2.1.** `recovery` and `verification` shipped as `.pug` files, which rendered only because the email module used to bundle Pug; v2 dropped every bundled engine, so on module v2 an app that triggered password recovery or email verification without registering a Pug engine got a render failure instead of a mail. Each template file is now a small module whose default export turns the render data into the rendered string — `html`, `subject` and `text` per template folder — which module 2.1 renders with its built-in module engine. `tsc` compiles them into `dist`, and `postbuild` no longer copies `src/services/messaging` wholesale: the email module picks its renderer from the on-disk extension, so a raw `.ts` sitting next to the compiled `.js` could be handed to a consumer that cannot run it. A published template folder now holds compiled `.js` only, which the packaging smoke test asserts and renders. `folders.emails` overrides are unchanged — an app still points at its own folder and ships `.ts` (run natively), `.js` (compiled) or any extension it registers an engine for. The `peerDependencies` range narrows from `^1.0.0 || ^2.0.0` to `^2.1.0` to match: **an older module renders the new defaults as an unknown-extension error, exactly the failure the `.pug` defaults already produced there, so no working setup regresses.** The module stays an
|
|
237
|
+
- **The shipped email templates are now JavaScript template modules, and the built-in auth mails require `@adaptivestone/framework-module-email` >= 2.1.** `recovery` and `verification` shipped as `.pug` files, which rendered only because the email module used to bundle Pug; v2 dropped every bundled engine, so on module v2 an app that triggered password recovery or email verification without registering a Pug engine got a render failure instead of a mail. Each template file is now a small module whose default export turns the render data into the rendered string — `html`, `subject` and `text` per template folder — which module 2.1 renders with its built-in module engine. `tsc` compiles them into `dist`, and `postbuild` no longer copies `src/services/messaging` wholesale: the email module picks its renderer from the on-disk extension, so a raw `.ts` sitting next to the compiled `.js` could be handed to a consumer that cannot run it. A published template folder now holds compiled `.js` only, which the packaging smoke test asserts and renders. `folders.emails` overrides are unchanged — an app still points at its own folder and ships `.ts` (run natively), `.js` (compiled) or any extension it registers an engine for. The `peerDependencies` range narrows from `^1.0.0 || ^2.0.0` to `^2.1.0` to match: **an older module renders the new defaults as an unknown-extension error, exactly the failure the `.pug` defaults already produced there, so no working setup regresses.** The module stays an _optional_ peer — an app that never sends the built-in auth mails still needs none of it. The data a template receives is typed by `TEmailTemplateData` (`locale`, `t`, `link`, `editor`, plus anything `globalVariablesToTemplates` adds), which ships compiled in `dist` but is not on the package `exports` map yet.
|
|
191
238
|
|
|
192
239
|
- **The shipped email HTML now declares the language it is written in.** `recovery` and `verification` hardcoded `<html lang="en">` while every sentence inside already followed the request locale, so a Russian mail still announced itself as English to screen readers, mail clients and translation prompts. Both templates now render `lang` from the `locale` the email module passes in — escaped like every other interpolated value — and fall back to `en` when it is absent or empty.
|
|
193
240
|
|
|
@@ -197,12 +244,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
197
244
|
|
|
198
245
|
- **Verification emails were hardcoded Russian.** `verification/{subject,html,text}` carried Russian sentences and not a single `t()` call, so every app sent `Верификаия емейла` to every user whatever their locale — and the HTML greeted `#{username}`, a variable the auth flow never passes, so the greeting rendered empty for everyone. The three templates now mirror `recovery`: English text, every string emitted through `t(key, { defaultValue })` so a key present in your locales wins and a miss reads as English, and the greeting taken from the existing `email.greeating` key instead of a phantom variable.
|
|
199
246
|
|
|
200
|
-
| Key
|
|
201
|
-
|
|
202
|
-
| `email.emailConfirm`
|
|
203
|
-
| `email.verify`
|
|
247
|
+
| Key | Default (English) |
|
|
248
|
+
| -------------------------- | ---------------------------------------------- |
|
|
249
|
+
| `email.emailConfirm` | Email confirmation |
|
|
250
|
+
| `email.verify` | Verify email |
|
|
204
251
|
| `email.verifyInstructions` | To verify your email address, follow the link: |
|
|
205
|
-
| `email.greeating`
|
|
252
|
+
| `email.greeating` | Dear user |
|
|
206
253
|
|
|
207
254
|
`email.emailConfirm` and `email.verify` were already in the locale files with no emit site anywhere; now that they are emitted their English text lives in code like every other framework message, so the two keys were dropped from `en/translation.json`. `ru/translation.json` still wins for `ru` requests and now carries a Russian `email.verifyInstructions` of its own. Values interpolated into the HTML body are escaped, which the template language used to do implicitly.
|
|
208
255
|
|
|
@@ -324,9 +371,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
324
371
|
|
|
325
372
|
- **A non-string body `token` no longer crashes the request with a `500`.** `GetUserByToken` read `req.body.token` and called `.replace()` on it with no type check, and body parsing preserves a JSON number and keeps a repeated form field as an array — so a request carrying `{"token": 123}`, or `token` sent twice as a form field, threw `token.replace is not a function` → `TypeError` → the generic `500` sink, instead of being treated as an unauthenticated request. A non-string token is now treated as **absent**: the middleware falls through to the `Authorization` header (and `postLogout`, which shares the same `GetUserByToken.resolveToken`, treats it as no token and returns `200`). A string token behaves exactly as before.
|
|
326
373
|
|
|
327
|
-
- **Route-type codegen now emits the correct import form for named-export middleware.** The AST resolver classifies each middleware import as `default` or `named` (carrying its original name for an alias), but the emitter discarded that and always rendered a default import (`import type Mw from '…'`). A middleware exported as a **named** export, or a middleware class exported from the controller's own file, therefore produced a `.routes.gen.ts` that either failed to typecheck (`TS2613`: the module has no default export) or silently bound the middleware type to the file's
|
|
374
|
+
- **Route-type codegen now emits the correct import form for named-export middleware.** The AST resolver classifies each middleware import as `default` or `named` (carrying its original name for an alias), but the emitter discarded that and always rendered a default import (`import type Mw from '…'`). A middleware exported as a **named** export, or a middleware class exported from the controller's own file, therefore produced a `.routes.gen.ts` that either failed to typecheck (`TS2613`: the module has no default export) or silently bound the middleware type to the file's _default_ export — a wrong type that surfaced later as a confusing `TS2339` in the handler. The `kind` and original name are now threaded through to emit (via a shared `MiddlewareImport` type), so named and aliased middleware render as `import type { Name } from '…'` / `import type { Orig as Local } from '…'`. Output for default-export middleware — every framework built-in — is byte-identical.
|
|
328
375
|
|
|
329
|
-
- **`Lock.waitForUnlock` no longer races the change stream into an eternal hang.** The change stream opens its server-side cursor lazily on the first `'change'` listener, and its logical start point is fixed only then — but the old code ran the `findOne` existence check
|
|
376
|
+
- **`Lock.waitForUnlock` no longer races the change stream into an eternal hang.** The change stream opens its server-side cursor lazily on the first `'change'` listener, and its logical start point is fixed only then — but the old code ran the `findOne` existence check _before_ attaching the listener, so a `releaseLock` that committed in that window was never observed: the waiter hung forever (or, with `timeoutMs`, surfaced a spurious timeout while the lock was already gone). The `'change'` listener is now attached first, and the code waits for mongoose's forwarded `resumeTokenChanged` signal (which fires only once the stream's start point is fixed) before the authoritative `findOne` re-check — closing the window. The public API is unchanged and no default timeout was added. **Edge note:** on a standalone MongoDB (change streams unsupported — never a working topology for this API), `waitForUnlock` on an absent lock now rejects with the stream error rather than accidentally resolving.
|
|
330
377
|
|
|
331
378
|
- **OpenAPI `operationId`s are now unique and controller-namespaced.** The generator emitted the bare handler name (`getList`) as the `operationId` with no uniqueness guard, so two controllers that both define `getList` — or one handler wired to multiple verbs/paths — produced duplicate ids, which OpenAPI 3.1 forbids: validators (Redocly, Spectral, swagger-cli) reject the document and client generators emit colliding function names. Each `operationId` is now namespaced by its controller (`${controllerName}_${methodName}`, the same derivation already used for `tags`) and de-duplicated against a document-wide set — a residual collision (the same handler on multiple verbs/paths) gets a deterministic verb suffix, then a numeric one. **Behavior change (consumer-visible output):** every emitted `operationId` changes (e.g. `getList` → `Users_getList`); regenerate and re-pin any client SDK or tooling that referenced the old ids.
|
|
332
379
|
|
|
@@ -346,7 +393,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
346
393
|
|
|
347
394
|
- **Controller load order is now a contractual, consistent sort rather than a coincidence of V8's sort internals.** The index-first comparator returned `-1` when `a` was an index file and `0` otherwise — it never returned `1`, so `compare(index, nonIndex)` was `-1` while `compare(nonIndex, index)` was `0`, violating ECMA-262's antisymmetry requirement. Index-first registration (and root `index` before a nested `index`) therefore held only by sort luck, and a V8 sort-strategy change or a longer controller list could have loaded a nested controller before a root index one, shifting middleware accumulation at boot. A new `compareControllerLoadOrder` is antisymmetric and consistent — index files before others, a shallower index before a deeper one — and separator-agnostic (works with `\` paths). Registration order for existing apps is unchanged.
|
|
348
395
|
|
|
349
|
-
- **Route-type codegen no longer truncates non-identifier path-param names, and a literal `*/` in a route path no longer breaks the generated file.** (a) `parsePathParams` matched only `:([a-zA-Z_][a-zA-Z0-9_]*)`, while the runtime router takes the whole segment after `:` — so `'/order/:order-id'` emitted `params: { order: string }` even though the runtime populates `req.params['order-id']`, and `:1st` was dropped entirely; codegen now captures the full segment and quotes any key that isn't a valid identifier (`'order-id': string`). (b) A literal `*/` in a route path (a legal static segment — only a
|
|
396
|
+
- **Route-type codegen no longer truncates non-identifier path-param names, and a literal `*/` in a route path no longer breaks the generated file.** (a) `parsePathParams` matched only `:([a-zA-Z_][a-zA-Z0-9_]*)`, while the runtime router takes the whole segment after `:` — so `'/order/:order-id'` emitted `params: { order: string }` even though the runtime populates `req.params['order-id']`, and `:1st` was dropped entirely; codegen now captures the full segment and quotes any key that isn't a valid identifier (`'order-id': string`). (b) A literal `*/` in a route path (a legal static segment — only a _leading_ `*` is a splat) terminated the generated file's JSDoc comment and broke parsing; the path is now escaped where it's rendered into the comment. Output for normal routes is byte-identical.
|
|
350
397
|
|
|
351
398
|
- **The OpenAPI generator no longer emits duplicate query parameters.** `buildQueryParameters` concatenated the route's own query schema with every middleware's introspectable `relatedQueryParameters` and pushed one parameter per property with no dedup — so a route query key that overlapped a middleware-declared one (e.g. `limit` on both) produced two `{ name: 'limit', in: 'query' }` entries, which OpenAPI 3.1 forbids and validators (Redocly, Spectral, swagger-cli) reject. Parameters are now deduplicated by `(name, in)`, with the route's own schema taking precedence over middleware contributions. A document that had no collision is byte-identical.
|
|
352
399
|
|
|
@@ -356,13 +403,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
356
403
|
|
|
357
404
|
### Fixed
|
|
358
405
|
|
|
359
|
-
- **Route-type codegen emitted an empty middleware chain for sibling param routes with different names.** When two routes on the same controller sat at the same position in the route tree but used param segments with **different** names (e.g. `PUT /:slug` and `POST /:event`), the generated `*.routes.gen.ts` gave the sibling whose param name was
|
|
406
|
+
- **Route-type codegen emitted an empty middleware chain for sibling param routes with different names.** When two routes on the same controller sat at the same position in the route tree but used param segments with **different** names (e.g. `PUT /:slug` and `POST /:event`), the generated `*.routes.gen.ts` gave the sibling whose param name was _not_ registered first an empty `UnionAppInfoProvides<readonly []>` — dropping `req.appInfo.user` (and every other middleware-provided field) from its request type, even though that route runs the controller's full middleware chain at runtime. Root cause: the router keeps a single param child per tree node, so same-depth param siblings collapse onto one node named after the first-registered segment (`:slug`); `flatten()` then reconstructs every sibling's path with that name, while codegen looked each route's chain up by its own **source** path (`:event`) and missed. The middleware-chain lookup is now param-name-insensitive (segment names never affect which node a path resolves to), so all siblings resolve their real chain. **Types-only fix — runtime routing, `req.params` extraction, and middleware execution are unchanged** (they were already correct; only the generated types were wrong).
|
|
360
407
|
|
|
361
408
|
## [5.1.1] - 2026-07-05
|
|
362
409
|
|
|
363
410
|
### Security
|
|
364
411
|
|
|
365
|
-
- **Mongoose validation safety net no longer echoes submitted input.** The safety net (added in 5.1.0) mapped an escaped Mongoose `ValidationError` to `400 { errors: { <path>: message } }` using the **raw** Mongoose message. Those default templates interpolate the rejected value (
|
|
412
|
+
- **Mongoose validation safety net no longer echoes submitted input.** The safety net (added in 5.1.0) mapped an escaped Mongoose `ValidationError` to `400 { errors: { <path>: message } }` using the **raw** Mongoose message. Those default templates interpolate the rejected value (``Path `title` (`<the whole 300-char submission>`) is longer than …``, `Cast to Number failed for value "<PII>" …`), so the offending input — a phone number, a password pasted into the wrong field, any oversized string — rode into both the `400` response body and the `warn`-level log (and thus Sentry). Each per-path message is now **rebuilt from the validation `kind` + the schema constraint only** (`maxlength: 255` → "Must be at most 255 characters", a `Number` cast failure → "Must be a number", an `enum` violation → "Must be one of: …"), and the submitted value is never included, under any kind. The `warn`-level log line for a safety-net-handled error is sanitized the same way — the logged error is rebuilt with those kind-based messages and a fresh, input-free stack — while an error that stays a **500** (internal/renamed paths, or no registry match) still logs the original in full, since that branch is a server-side defect the developer needs complete detail on. This matches the `YupDriver`, which already strips `value`/`originalValue` from route-validation errors. Messages are plain English, not i18n (the route validator owns user-facing wording; this is a last-resort fallback for a route schema that failed to mirror a model constraint). **Trade-off:** a model-defined _custom_ message (`maxlength: [50, 'Name too long']`) is indistinguishable from a templated default that embedded the value, so **all** messages are rebuilt generically — a custom message set on the model is not passed through the safety net. Set user-facing wording on the route `request:`/`query:` schema instead. The `400`/`500` split, the "client actually sent this field" gate, the log levels, and the `{ errors: { path } }` response shape are unchanged.
|
|
366
413
|
|
|
367
414
|
## [5.1.0] - 2026-07-05
|
|
368
415
|
|
|
@@ -378,7 +425,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
378
425
|
- **Cache drivers — `@redis/client` is now optional.** The cache is built on a small `CacheDriver` interface with two first-party drivers: a per-process `MemoryDriver` (new default — needs no external service) and a `RedisDriver` that lazy-imports `@redis/client` only when selected. Choose via `config/cache.ts` (`{ driver: 'memory' | 'redis' }`, or `CACHE_DRIVER` env). A `CacheDriver` instance can be injected directly for a custom backend. The orchestration you rely on — namespacing, in-flight request dedup, JSON/bigint (de)serialization, and fail-soft degradation — is unchanged.
|
|
379
426
|
- **Zero-TTL means "don't cache" (issue #10).** `cache.getSetValue(key, fn, 0)` now skips the cache entirely and recomputes every call, instead of writing a never-expiring entry.
|
|
380
427
|
- **`getAppInstance()` helper.** `helpers/appInstance` now exports a throwing getter alongside the raw `appInstance` binding: it returns the app singleton, or throws a guided error ("construct the Server first"; tests can use `setAppInstance()`/`resetAppInstance()`) when nothing is set. Prefer it in code that may run before the `Server` is constructed (module scope, lazy imports, external modules) — reading the raw binding there fails later with an opaque `TypeError: cannot read properties of undefined` that gives no hint at the cause.
|
|
381
|
-
- **Duplicate-framework-copy diagnostic in the model loader.** When npm fails to dedupe and a model class extends `BaseModel` from a
|
|
428
|
+
- **Duplicate-framework-copy diagnostic in the model loader.** When npm fails to dedupe and a model class extends `BaseModel` from a _different_ installed copy of `@adaptivestone/framework`, `instanceof BaseModel` is false, so the loader used to silently misroute the class into the legacy (`AbstractModel`) branch — surfacing only as a confusing downstream failure. Boot now recognizes the shape (BaseModel's static `initialize` + `modelSchema` surface without the `instanceof`, via the new `isBaseModelSubclassShape` export) and fails with an error naming the model, the cause (duplicate/undeduped install), and the fix (`npm ls @adaptivestone/framework`, then dedupe). Genuinely legacy models still route to the legacy branch unchanged.
|
|
382
429
|
- **Error-handler registry + typed HTTP errors.** Throw `NotFoundError` / `new HttpError(status, message, body?)` (from `services/http/httpErrors.js`) inside a route handler to produce that status (built-in mapper, logged `verbose`), or map error classes you don't own via `app.httpServer.registerErrorHandler(ErrorClass, handler, { logLevel? })` (returns an unregister function) — e.g. from the `bootHttp` hook. Consumer handlers are checked before built-ins; a handler returning `null` passes to the next entry; unmatched errors keep the 500. The Mongoose validation safety net is now a built-in registry entry (semantics unchanged).
|
|
383
430
|
|
|
384
431
|
### Changed
|
|
@@ -441,7 +488,7 @@ Read the `5.0.0-rc.1` entry below for the full text and migration notes; the con
|
|
|
441
488
|
|
|
442
489
|
## [5.0.0-rc.6] - 2026-06-14
|
|
443
490
|
|
|
444
|
-
- **[FIX]** The `User` auth helpers are now reusable on a **customized** `User` model without `this`-binding casts. The statics (`getUserByEmailAndPassword`, `getUserBy{Token,Email,VerificationToken,PasswordRecoveryToken}`) and instance methods (`generateToken`, `getPublic`, `send{Verification,PasswordRecovery}Email`) were typed against the framework's own schema (`this: UserModelLite`), so on a project model with a different shape every call site hit `TS2684` and needed a cast. They're now typed against small structural contracts (`UserAuthDoc` / `UserAuthInstance` / `UserAuthModel`, all newly exported) describing only the fields each helper touches — the framework's `User` and a project's replacement both satisfy them, and return types stay precise. This makes the supported customization paths cast-free: `extends User` to **add** fields, or compose (`extends BaseModel` + spread `User.modelStatics` / `modelInstanceMethods`) to **reshape** them (an i18n `name`, a singular `role`, …) — a field-type
|
|
491
|
+
- **[FIX]** The `User` auth helpers are now reusable on a **customized** `User` model without `this`-binding casts. The statics (`getUserByEmailAndPassword`, `getUserBy{Token,Email,VerificationToken,PasswordRecoveryToken}`) and instance methods (`generateToken`, `getPublic`, `send{Verification,PasswordRecovery}Email`) were typed against the framework's own schema (`this: UserModelLite`), so on a project model with a different shape every call site hit `TS2684` and needed a cast. They're now typed against small structural contracts (`UserAuthDoc` / `UserAuthInstance` / `UserAuthModel`, all newly exported) describing only the fields each helper touches — the framework's `User` and a project's replacement both satisfy them, and return types stay precise. This makes the supported customization paths cast-free: `extends User` to **add** fields, or compose (`extends BaseModel` + spread `User.modelStatics` / `modelInstanceMethods`) to **reshape** them (an i18n `name`, a singular `role`, …) — a field-type _replacement_ can't go through `extends` (static-getter covariance, `TS2417`). Both paths are documented on the `User` class. A `tsc`-gate test pins them.
|
|
445
492
|
|
|
446
493
|
- **[FIX]** Config-type codegen no longer drops env-only keys. A config value read straight from the environment with no default (`saltSecret: process.env.AUTH_SALT`) is `undefined` at gen time, so the value-based pass omitted it from `getConfig('…')`'s type and every read needed an `as` cast. Codegen now reads the config **source** (via `oxc-parser`, no value import) and types a bare `process.env.X` as `string | undefined` (and `process.env.X!` as `string`) — from the source, so the result is the same whether or not the var happened to be set during codegen (deterministic output, no `--check` drift). Keys without an env read (literals, `process.env.X || default`) are still typed from their value as before. Secrets are never serialized (types only). Nested keys and `NODE_ENV`-specific config files are handled.
|
|
447
494
|
|
|
@@ -483,7 +530,7 @@ This is a big release that contains a lot of new features and breaking changes.
|
|
|
483
530
|
- **[NEW]** Test helpers getTestServerURL and serverInstance.
|
|
484
531
|
- **[NEW]** Rate limiter middleware - add consumeResult function to allow user middleware as a regular rate limiter
|
|
485
532
|
- **[NEW]** Ip detector middleware - add getIpAdressFromIncomingMessage function to allow user middleware as a detector of id adresses without middleware
|
|
486
|
-
- **[NEW]**
|
|
533
|
+
- **[NEW]** Introduce i18nService (ability to user i18n not only inside middleware)
|
|
487
534
|
- **[NEW]** [Standard Schema](https://standardschema.dev/) validation. Yup ≥1.7, Zod, Valibot, ArkType supported.
|
|
488
535
|
- **[NEW]** Pluggable `ValidatorDriver` + `ValidateService.register(driver)` for custom validators.
|
|
489
536
|
- **[NEW]** `StandardSchemaV1.InferOutput<typeof schema>` for compile-time handler types.
|
|
@@ -504,7 +551,7 @@ This is a big release that contains a lot of new features and breaking changes.
|
|
|
504
551
|
- **[DEPRECATED]** The **instance** form of those getters (`get relatedRequestParameters()` / `relatedQueryParameters` / `relatedReqParameters`) is deprecated and **will be removed in v6** — migrate to the static form. It still works (the framework detects the override, instantiates as a fallback, and emits a one-per-class `DeprecationWarning`, code `ASF_DEP_MW_INSTANCE_SCHEMA`).
|
|
505
552
|
- **[FIX]** `setupVitest.ts` no longer imports framework-internal fixtures. The test-fixture controller (`SomeController`) is now registered inside its own test file via late `controllerManager.registerController()` (the adapter reads the registry live, so registration after `startServer` works). Consumer projects can use `@adaptivestone/framework/tests/setupVitest.js` without `Cannot find module './fixtures/...'` errors. `frameworkVitestSetup.*` is now `.npmignore`'d as framework-only.
|
|
506
553
|
- **[FIX]** Codegen now walks the `extends` chain when resolving middleware import paths. A child controller that inherits `static get middleware()` from its parent class no longer has those middlewares filtered out of its generated chain — codegen scans the parent's source file for the import line and emits the right `import type` in the child's `.routes.gen.ts`. Bare-package ancestors (e.g. a consumer extending the framework's `AbstractController` via `@adaptivestone/framework/modules/...`) are resolved too (since beta.55): codegen reads the installed package file through the importing file's module resolution (honoring the package `exports` map) and rewrites the ancestor's relative middleware imports into bare specifiers the consumer's gen file can resolve — the public subpath tree mirrors `src/`.
|
|
507
|
-
- **[FIX]** `getConfig()` types in `genTypes.d.ts` are emitted as inline **value-shape** types — each config value's structure rendered with value
|
|
554
|
+
- **[FIX]** `getConfig()` types in `genTypes.d.ts` are emitted as inline **value-shape** types — each config value's structure rendered with value _types_ (`string`, `number`), never the literal values and never an `import()` reference. This avoids baking secret values into the generated file and avoids over-narrow literal types, while staying robust: the type is fully inline (no module resolution, so it can't silently degrade to `any` under stricter or preview TypeScript toolchains), and arrays stay **tuples** so per-element patterns like `Object.values(config.list[0])` keep precise types. (Replaces an earlier `typeof import('./config/foo.ts').default` reference form, which inferred array elements as a union with `?: undefined` keys — breaking `Object.values()` — and could resolve to `any` on some compilers.)
|
|
508
555
|
|
|
509
556
|
### Breaking changes (please read carefully)
|
|
510
557
|
|
|
@@ -544,24 +591,24 @@ This is a big release that contains a lot of new features and breaking changes.
|
|
|
544
591
|
|
|
545
592
|
### Bug Fixes
|
|
546
593
|
|
|
547
|
-
- **[FIX]** Codegen's `extends`-walk now follows the
|
|
594
|
+
- **[FIX]** Codegen's `extends`-walk now follows the _exported_ controller's parent, not the first `class … extends` in the file. A helper or secondary class declared before the controller (e.g. `class Helper extends X` … `export default class Ctrl extends Y`) used to hijack the walk, so middleware inherited from the controller's real parent was silently dropped from the generated `req.appInfo` types. The parent is now resolved from the `export default`/`export class` declaration (falling back to the last `class … extends`).
|
|
548
595
|
- **[FIX]** Codegen's import scanner now parses semicolon-less (ASI) imports. Statements were terminated only at `;` or end-of-file, so under a no-semicolon style (Prettier `semi: false`, StandardJS) consecutive `import` lines collapsed into one and all but the first binding were dropped — quietly losing those middlewares' type narrowing. A statement now also ends at the newline after its specifier string closes; `;`-terminated, multi-line `{ … }`, and side-effect (`import './x'`) imports are unaffected.
|
|
549
596
|
- **[FIX]** The `extends`-walk no longer mistakes a **regex literal** for a class declaration. `parseExtendsParent` scanned the whole file, so a regex such as `/export default class Z extends Wrong/` lexically before the real controller hijacked the walk and dropped the controller's inherited middleware. Regex-literal bodies are now blanked (alongside comments and strings) before the scan.
|
|
550
597
|
- **[FIX]** A controller whose exported class has **no `extends`** (`export default class Ctrl {}`) no longer inherits a helper class's parent. The scan used to fall through to the last `class … extends` in the file — a sibling helper's — and merge its middleware; it now returns "no parent" when the exported class declares none.
|
|
551
598
|
- **[FIX]** A malformed import specifier with a **trailing backslash** (`import X from './a\'`) no longer breaks the generated file or swallows the imports that follow it. Specifiers containing a backslash or a Unicode line separator (U+2028 / U+2029) are now rejected, and the scanner no longer honors `\`-escapes inside a specifier (a real one has none), so the string closes at its quote.
|
|
552
599
|
- **[FIX]** Multi-line import-attributes clauses (`import x from './x.json'` then `with { type: 'json' }` on the next line) no longer end the import prologue early and drop every later import; the clause is folded into the statement.
|
|
553
600
|
- **[FIX]** `req.appInfo.user` is typed as the hydrated **document**, not the Mongoose model class. Codegen's `AppModels` augmentation emitted `User: GetModelTypeFromClass<…>` (the model class) where the runtime assigns `InstanceType<…>`, so after `npm run gen` `user.id` / `user.email` stopped type-checking. The augmentation now wraps the model in `InstanceType<GetModelTypeFromClass<…>>` (while `getModel('User')` correctly keeps returning the class). Verified with a `tsc` probe.
|
|
554
|
-
- **[FIX]** Codegen now skips colocated `.d.ts` / `.gen.d.ts` files when discovering controllers, matching the runtime loader. A capitalized declaration file next to your controllers passed the `.ts`-only filter, reached the AST extractor, parsed as "no controller class," and — since non-analyzable controllers are a hard error — made `npm run gen` throw, blocking route-type generation for
|
|
601
|
+
- **[FIX]** Codegen now skips colocated `.d.ts` / `.gen.d.ts` files when discovering controllers, matching the runtime loader. A capitalized declaration file next to your controllers passed the `.ts`-only filter, reached the AST extractor, parsed as "no controller class," and — since non-analyzable controllers are a hard error — made `npm run gen` throw, blocking route-type generation for _every_ controller.
|
|
555
602
|
- **[FIX]** A non-literal `static get middleware()` in an **ancestor** controller is no longer silently dropped. The `extends`-walk treated "this ancestor builds its middleware Map dynamically" the same as "this ancestor declares no middleware," so it walked past and emitted the child with an empty middleware chain (and `req.appInfo` missing those fields) with no error. It now stops and throws, naming the controller — symmetric with the same getter on the controller itself.
|
|
556
603
|
- **[FIX]** A route entry with no statically identifiable handler — object shorthand (`{ handler }`), an optional-chained handler (`this?.x`), or a spread (`{ ...defaults, handler }`) — now throws instead of silently dropping the route from the generated types.
|
|
557
604
|
- **[FIX]** Codegen's `extends`-walk now also follows the `export { Ctrl as default }` form (including the ES2022 string-literal name `export { Ctrl as "default" }`). Previously only `export default …` was recognized; the `as default` re-export fell through to "last class wins," so a trailing helper class could hijack the walk (wrong `extends` / routes).
|
|
558
|
-
- **[FIX]** Codegen now discovers **`.js` controllers** like the runtime loader does. A plain-JavaScript controller used to be invisible to `npm run gen`: it got no `.routes.gen.ts`, and — since codegen computes cross-controller middleware bleed from all controllers at once — its root-scoped middleware was missing from
|
|
605
|
+
- **[FIX]** Codegen now discovers **`.js` controllers** like the runtime loader does. A plain-JavaScript controller used to be invisible to `npm run gen`: it got no `.routes.gen.ts`, and — since codegen computes cross-controller middleware bleed from all controllers at once — its root-scoped middleware was missing from _other_ controllers' generated `req.appInfo` types. `.js` sources are parsed by the same AST front-end (`.gen.js` / `.test.js` are skipped, mirroring the loader), and the gen file's self-import keeps the controller's real extension.
|
|
559
606
|
- **[FIX]** `RateLimiter` no longer turns a **backing-store outage into a 429 for everyone**. `rate-limiter-flexible` rejects with a `RateLimiterRes` when the limit is hit but with an `Error` when the store (Redis/Mongo) fails; the middleware treated both as "limit hit" and returned `429 Retry-After: 1` on every request during an outage (and logged "Too many requests", misdirecting investigators). Store errors are now distinguished (`instanceof Error`) and **fail open** with an error-level log; the redis/mongo limiters also get a `RateLimiterMemory` **insurance limiter** so brute-force protection degrades to per-process memory instead of vanishing.
|
|
560
607
|
- **[FIX]** `Cache.getSetValue` no longer **deadlocks a key forever** when Redis fails mid-request. The request-coalescing map entry was only cleared on the happy path, so a Redis error after the entry was stored left a permanently-pending promise that every future call for that key awaited — surviving Redis recovery. The whole body is now wrapped so the entry always settles and clears (`finally`); the in-flight promise gets a no-op `.catch` (no `unhandledRejection` when a single caller's `onNotFound` throws), the cache write is best-effort (logged, never fails the request), and an `undefined` result skips the write instead of crashing. A cache **read/connect failure now degrades to computing the value via `onNotFound`** (cache outage ≠ request outage — slow, not broken) rather than throwing; only `onNotFound`'s own errors propagate.
|
|
561
608
|
- **[FIX]** A failed HTTP `listen()` (`EADDRINUSE` / `EACCES`) no longer leaves a **silent zombie process**. The server socket had no `'error'` listener, so a bind failure surfaced as an `uncaughtException` that the global handler only logged — the process kept running, healthy-looking to a supervisor that doesn't probe the port, while serving nothing. The bind error is now caught and the process exits non-zero so a supervisor restarts it with backoff.
|
|
562
|
-
- **[FIX]** Custom (non-console, non-sentry) winston transports now actually load. The constructor check in `#createLogger` was **inverted** — a transport whose default export
|
|
563
|
-
- **[FIX]** Boolean environment variables are no longer coerced backwards. `config/log.ts` read `process.env.LOGGER_SENTRY_ENABLE || false` and `… || true`, but env values are strings — `"false"`/`"0"` are **truthy**, so `LOGGER_SENTRY_ENABLE=false`
|
|
564
|
-
- **[FIX]** The migration runner no longer silently skips **branch-merged migrations**. Pending files were chosen by comparing each filename timestamp against the timestamp of the
|
|
609
|
+
- **[FIX]** Custom (non-console, non-sentry) winston transports now actually load. The constructor check in `#createLogger` was **inverted** — a transport whose default export _is_ the constructor (every normally-published winston transport) failed the guard, got a "not a constructor" log, and was silently dropped; only an unusual CJS double-wrapped shape happened to load. The export is now unwrapped (default export, then the CJS-interop `default.default`) and validated **once** before `new`, and the dynamic `import()` has a `.catch` so a typo'd module name logs a friendly error instead of an unhandled rejection.
|
|
610
|
+
- **[FIX]** Boolean environment variables are no longer coerced backwards. `config/log.ts` read `process.env.LOGGER_SENTRY_ENABLE || false` and `… || true`, but env values are strings — `"false"`/`"0"` are **truthy**, so `LOGGER_SENTRY_ENABLE=false` _enabled_ Sentry and `LOGGER_CONSOLE_ENABLE` could never disable the console. A new `envBool(name, default)` helper (`src/helpers/env.ts`) parses them explicitly (only `"true"`/`"1"` are `true`; unset/empty falls back to the default), and both log flags now use it.
|
|
611
|
+
- **[FIX]** The migration runner no longer silently skips **branch-merged migrations**. Pending files were chosen by comparing each filename timestamp against the timestamp of the _most recently applied_ record — so a migration merged in later but stamped earlier than one already deployed was filtered out and **never ran** (no error, no log). Pending is now a **set difference** against the applied filenames (`distinct('migrationFile')`), so any unapplied file runs regardless of timestamp ordering, executed in filename order (run-then-record preserved). The run is also wrapped in the `Lock` model (`acquireLock('migrations')`) so two simultaneous deploys can't run migrations twice; a run that can't take the lock warns and returns `false`.
|
|
565
612
|
- **[FIX]** `Lock` model correctness. (1) `acquireLock` **steals an expired lock atomically** — `findOneAndUpdate({ _id, expiredAt: { $lt: now } }, …, { upsert: true })` instead of `create`, so a crashed holder's lock is reclaimable immediately rather than after Mongo's TTL-reaper lag (up to ~60s); the unique-`_id` upsert race still yields exactly one winner under contention. (2) `waitForUnlock` registers its change stream **before** re-checking existence (closing a missed-delete window where the promise could hang forever), adds an `'error'` handler (an unhandled stream error — e.g. on a non-replica-set Mongo — would otherwise crash the process), and accepts an optional `timeoutMs`. Locks remain **advisory** — no ownership token, `releaseLock` is unconditional; release only from the flow that acquired it — now documented on the statics.
|
|
566
613
|
- **[FIX]** `RequestParser` (the global multipart/urlencoded/json body parser) now bounds and cleans up file uploads, and normalizes field shapes. **(1) Limits:** it ran on every request with formidable's defaults (~200 MB/file, no total/count cap), so any unauthenticated client could spool large bodies to any path. Conservative limits now come from `config.http.requestParser` (`maxFileSize` 20 MB, `maxTotalFileSize` 50 MB, `maxFiles` 10, `maxFields` 1000, `maxFieldsSize` 2 MB; per-mount params override), and limit-exceeded errors return **413** instead of 400. **(2) Temp-file cleanup:** spooled files were **never deleted** (disk exhaustion over time). Every file formidable opens is now unlinked when the response finishes (`finish`) or aborts (`close`) — a handler that wants to keep an upload must move/copy it before responding. **(3) Field shapes:** multipart/urlencoded fields arrive as arrays while json fields are scalars; a single-value field is now collapsed to a scalar (json untouched, repeated keys stay arrays), fixing consumers like `GetUserByToken` that did `token.replace(...)` and threw a 500 on a urlencoded token.
|
|
567
614
|
- **[DOCS]** The per-route `bodyParsing` option now documents that **only `'parsed'` takes effect** — `'raw'` and `'none'` are reserved for v5.1 and currently do nothing (the parser is mounted globally, so `req.rawBody` is never set and the stream is always consumed). The matcher plumbing for the mode ships in v5; the implementation (parser registry + `req.rawBody`, enabling webhook signature verification) is planned for v5.1. Previously the type/JSDoc advertised `'raw'`/`'none'` as working.
|
|
@@ -583,7 +630,7 @@ This is a big release that contains a lot of new features and breaking changes.
|
|
|
583
630
|
- **[SECURITY]** Resetting a password (`POST /auth/recover-password`) now revokes all of the user's existing session tokens, so any session created before the reset is invalidated.
|
|
584
631
|
- **[CHANGE]** Removed dead code: the unused `src/views/*.pug` templates (no `pug` dependency), the unread `config.validate.controllerValidationAbortEarly`, the no-op `consoleLogger` level filter, and the debug `console.log` on the prod entrypoint.
|
|
585
632
|
- **[CHANGE]** Added a packaging smoke test (`npm run smoke`, CI workflow `packaging.yml`): packs the tarball, installs it into a throwaway consumer, and verifies the **published dist** — public entry points import (catching broken built-import paths, the cluster-bug class) and internal subpaths stay unexported (the exports map). The TS-source test suite can't see dist-only breakage.
|
|
586
|
-
- **[FIX]** Router static-child lookup is now **O(1)** instead of a per-request linear scan. The tree matcher's `lookupStaticChild` walked every static child of every node on the path with a `toLowerCase()` allocation per child — and since `caseSensitive` is always `false` in production, that scan was the
|
|
633
|
+
- **[FIX]** Router static-child lookup is now **O(1)** instead of a per-request linear scan. The tree matcher's `lookupStaticChild` walked every static child of every node on the path with a `toLowerCase()` allocation per child — and since `caseSensitive` is always `false` in production, that scan was the _only_ path requests took (the O(1) branch was dead). Static children are now keyed by lowercase segment at registration time, so the now-always case-insensitive match is a single `Map.get`. Nodes keep their original-cased `segment` (display / `formatTree` / codegen paths unchanged — gen output byte-identical). Segments differing only by case now fold onto one node (case-insensitive matching already treated them as one); a same-method collision surfaces via the existing conflicting-handler error.
|
|
587
634
|
- **[FIX]** Redis connection helper now caches the **connect promise**, not the bare client. A second concurrent caller could get the client before its `connect()` resolved (double-connect on a half-built socket), a failed first connect cached a dead client forever (no retry), and the synchronous accessor fired `connect()` in an uncaught IIFE (process-level `unhandledRejection` when Redis was down at boot). Concurrent callers now await one connect, a failed connect clears the cache so the next call retries, and the sync accessor logs connection failures instead of crashing.
|
|
588
635
|
|
|
589
636
|
### Internal
|
|
@@ -592,31 +639,34 @@ This is a big release that contains a lot of new features and breaking changes.
|
|
|
592
639
|
- **[BREAKING]** Route-type codegen requires **statically analyzable controllers**. A controller whose `routes` / `static get middleware()` / `getHttpPath()` is built dynamically (loops, conditionals, computed values) can no longer be reflected — `npm run gen` now throws and names the controller instead of booting the app to read it. Make those getters return literal structures (the framework's own controllers and the audited consumer projects already do).
|
|
593
640
|
|
|
594
641
|
---
|
|
642
|
+
|
|
595
643
|
## [5.0.0-beta.55] - 2026-06-06
|
|
596
644
|
|
|
597
645
|
- **[FIX]** Codegen no longer emits an empty middleware chain for a controller's root (`/`) route. `chainFor` keyed the flattened-route lookup with a trailing slash for a `/` route under a non-root prefix (e.g. `POST /` on a controller mounted at `/file` was looked up as `POST /file/` while `RouteRegistry.flatten()` emits `POST /file`), so the route's middleware came back empty and the generated `req.appInfo` lost every middleware-provided field. Path joining now mirrors the registry (segment join, no trailing slash).
|
|
598
646
|
- **[FIX]** Codegen resolves middleware whose local import binding differs from its exported class name. The emit step matched chain entries against the controller's imports by class name, but the import map is keyed by the local binding — so a default export imported under another name (e.g. `import Auth from '.../Auth.js'` where the class is `AuthMiddleware`) was dropped from the generated type (and would otherwise have emitted an unbound `typeof AuthMiddleware`). The live class is now carried through and matched by module identity to recover the real binding (`Auth`). Affected the built-in `Auth` and `Role` middlewares.
|
|
599
647
|
- **[FIX]** Codegen resolves inherited default middleware through **bare-package** ancestors. A consumer controller relying on `AbstractController`'s default `static get middleware()` (without re-declaring it) extends the framework via a bare specifier (`@adaptivestone/framework/modules/AbstractController.js`); codegen previously skipped such ancestors, leaving the inherited `[GetUserByToken, Auth]` out of the generated `req.appInfo` type. Codegen now resolves the ancestor through the importing file's module resolution (honoring the package `exports` map) and rewrites the ancestor's relative middleware imports into bare specifiers the consumer's gen file can resolve. Re-declaring the middleware Map is no longer required to get typed `appInfo`.
|
|
600
648
|
- **[FIX]** Codegen rebases inherited middleware import paths when the parent controller lives in a **different directory** than the child. The `extends`-chain walk previously emitted the ancestor's relative import paths verbatim — correct only when parent and child share a folder — so a controller inheriting middleware from a parent elsewhere in the tree got a wrong relative path (and the middleware was then silently dropped from the type when the path failed to resolve). Ancestor relative imports are now rebased to the child's gen-file directory.
|
|
601
|
-
- **[NEW]** Golden-fixture codegen test (`src/codegen/routeTypes.golden.test.ts`): runs the real boot-free `generateRouteTypes` over fixture controllers, then `tsc`-checks the generated types against handlers that read `req.appInfo.user` without a guard. String-level assertions can't catch a wrong
|
|
649
|
+
- **[NEW]** Golden-fixture codegen test (`src/codegen/routeTypes.golden.test.ts`): runs the real boot-free `generateRouteTypes` over fixture controllers, then `tsc`-checks the generated types against handlers that read `req.appInfo.user` without a guard. String-level assertions can't catch a wrong _type_ (e.g. an empty `UnionAppInfoProvides<readonly []>`); this gate type-checks the output and would have caught every codegen bug fixed in this release.
|
|
602
650
|
- **[FIX]** `Auth` middleware now narrows `req.appInfo.user` to **required**. `AuthMiddleware` rejects unauthenticated requests at runtime but declared no `provides`, so behind `[GetUserByToken, Auth]` the user stayed optional (`user?`) and every handler needed an `if (!user)` guard purely to satisfy types. It now declares `static get provides()` returning `{ user: InstanceType<TUser> }`; `UnionAppInfoProvides` intersects it with `GetUserByToken`'s optional `user?` and collapses to a required `user`. Type-only — runtime unchanged.
|
|
603
651
|
- **[FIX]** `req.appInfo.user` now follows a project's OWN `User` model when it replaces the framework's, instead of always typing as the framework `User`. `GetUserByToken`/`Auth` resolve the user type through an augmentable `AppModels` interface (exported from `models/User.ts`), and `npm run gen` emits the binding into `genTypes.d.ts` automatically — the same mechanism that already types `app.getModel('User')`. Falls back to the framework `User` when not replaced; no consumer action needed beyond running codegen. (Previously the middleware `provides` hardcoded the framework `User`, so a replaced model's fields were missing from `appInfo.user` even though `getModel('User')` was correct.)
|
|
604
652
|
- **[CHANGE]** Removed the unused `source` field from `MiddlewareEntry` (`services/http/routing`). It was a write-only placeholder that no code read — codegen resolves middleware import paths from controller source instead — so it and its plumbing through `normalizeMiddleware`/`normalizeMiddlewares` are gone. If you constructed `MiddlewareEntry` objects directly (rare), drop the `source` property.
|
|
605
653
|
- **[BREAKING]** The built-in `Home` controller no longer registers `GetUserByToken` on a root-level `'/{*splat}'` scope. Because `Home` mounts at `/`, that middleware landed on the route-tree root and ran on **every request app-wide** — a hidden global default that couldn't be opted out of (a controller declaring empty middleware still ran it). `Home` now adds no middleware (it's a public route); controllers still parse the user token via their own/inherited `[GetUserByToken, Auth]`. **Impact:** if you relied on `req.appInfo.user` being populated on routes that don't themselves include `GetUserByToken` (e.g. ad-hoc `registerRoute` endpoints), add the middleware explicitly. Re-add `[GetUserByToken]` to your home controller for a token-aware home.
|
|
606
654
|
|
|
607
655
|
---
|
|
656
|
+
|
|
608
657
|
## [5.0.0-beta.54] - 2026-06-05
|
|
609
658
|
|
|
610
|
-
- **[FIX]** `getConfig()` types in `genTypes.d.ts` are now inline **value-shape** types (value
|
|
659
|
+
- **[FIX]** `getConfig()` types in `genTypes.d.ts` are now inline **value-shape** types (value _types_ like `string`, with arrays kept as **tuples**) instead of the `typeof import('./config/foo.ts').default` reference form introduced in beta.52. The reference form inferred array config elements as a union with `?: undefined` keys, which broke `Object.values()` over a config item (it widened to `any`) and could resolve to `any` outright on stricter/preview TypeScript (e.g. older `tsgo` builds) — a regression that surfaced only in CI for projects whose local type-checker differed. The value-shape form keeps `Object.values()` and per-element typing precise and is robust across compilers (it resolves no module), while still never serializing a literal config value into the generated file.
|
|
611
660
|
|
|
612
661
|
---
|
|
662
|
+
|
|
613
663
|
## [5.0.0-beta.53] - 2026-06-05
|
|
614
664
|
|
|
615
665
|
- **[NEW]** Codegen reads controllers without running their constructors. `generatetypes` now introspects each controller via a prototype-only "ghost" (`Object.create(Class.prototype)`) instead of `new Controller(app, prefix)`, so config reads, client construction, and other constructor side effects no longer fire during type generation. Runtime is unchanged — handlers still bind to real instances.
|
|
616
666
|
- **[DEPRECATED]** A controller whose `routes` getter reads **constructor-set state** is deprecated. Codegen transparently falls back to instantiating it (so nothing breaks) and emits a one-per-class `DeprecationWarning`, code `ASF_DEP_CTOR_ROUTES`. Make `routes` independent of constructor state; the instantiation fallback **will be removed in v6**.
|
|
617
667
|
- **[FIX]** Model-using CLI commands now wait for the MongoDB connection before running. Previously `#mongooseConnect()` was fire-and-forget, so a CLI command (`isShouldInitModels`) could fire its first query before the connection was established and rely on mongoose's buffer (default 10s `bufferTimeoutMS`) — causing intermittent "buffering timed out" failures on slow connects. Now `initAllModels({ waitForConnection: true })` (used only by model-using CLI commands) blocks until the connection is ready, with explicit progress logs (`Connecting to MongoDB…`, `MongoDB connection established in Nms`, `waiting … → ready after Nms`). Modelless commands (e.g. `generatetypes`) and the HTTP server are unaffected — the server stays lazy (requests buffer until ready).
|
|
618
|
-
---
|
|
619
668
|
|
|
669
|
+
---
|
|
620
670
|
|
|
621
671
|
## [5.0.0-beta.52] - 2026-06-04
|
|
622
672
|
|
|
@@ -624,9 +674,8 @@ This is a big release that contains a lot of new features and breaking changes.
|
|
|
624
674
|
- **[DEPRECATED]** The **instance** form of those getters (`get relatedRequestParameters()` / `relatedQueryParameters` / `relatedReqParameters`) is deprecated and **will be removed in v6** — migrate to the static form. It still works (the framework detects the override, instantiates as a fallback, and emits a one-per-class `DeprecationWarning`, code `ASF_DEP_MW_INSTANCE_SCHEMA`).
|
|
625
675
|
- **[FIX]** `getConfig()` types in `genTypes.d.ts` are now emitted as references to each config module's type (`typeof import('./config/foo.ts').default`) instead of a serialized snapshot of the resolved runtime value. The old value-based approach had two real problems: env-only fields (e.g. `connectionString: process.env.MONGO_DSN`) **silently vanished** from the type when the env var was unset at gen time (`JSON.stringify` drops `undefined`), and populating the env var to keep them **baked the secret value into the committed file**. Reference-based types keep env-only fields (typed `string | undefined`), never serialize a value, and avoid over-narrow literal types (`port` is `string | number`, not `3300`). _(Superseded in beta.54 — see above.)_
|
|
626
676
|
|
|
627
|
-
|
|
628
|
-
|
|
629
677
|
---
|
|
678
|
+
|
|
630
679
|
## [5.0.0-beta.51] - 2026-05-31
|
|
631
680
|
|
|
632
681
|
- **[NEW]** `KeyValue` model: a minimal persistent key/value store backed by MongoDB for lightweight caching, runtime config, and feature flags.
|
|
@@ -639,17 +688,20 @@ This is a big release that contains a lot of new features and breaking changes.
|
|
|
639
688
|
- **[DEPRECATED]** `YupFile` (`@adaptivestone/framework/helpers/yup.js`) — removed in v6. Validate files via the new `File` export + your validator's `instanceof` idiom instead.
|
|
640
689
|
|
|
641
690
|
---
|
|
691
|
+
|
|
642
692
|
## [5.0.0-beta.50] - 2026-05-25
|
|
643
693
|
|
|
644
694
|
- **[FIX]** Tree-based router: different HTTP methods at the same param position can now use different `:name` segments. Previously, `PUT /:slug` and `POST /:event` on the same controller would either throw at boot ("conflicting param children") or silently use the first-registered name for all methods (`req.params.event` → `undefined`). Each `HandlerEntry` now carries its own `paramNames` array — the tree is structural only, param naming is per-handler.
|
|
645
695
|
|
|
646
696
|
---
|
|
697
|
+
|
|
647
698
|
## [5.0.0-beta.49] - 2026-05-18
|
|
648
699
|
|
|
649
700
|
- **[FIX]** Codegen: fix router name resolution in generated route types.
|
|
650
701
|
- **[UPDATE]** Codegen output improvements.
|
|
651
702
|
|
|
652
703
|
---
|
|
704
|
+
|
|
653
705
|
## [5.0.0-beta.48] - 2026-05-11
|
|
654
706
|
|
|
655
707
|
- **[NEW]** Codegen emits route metadata (`methodName`, `controllerClass`, `sourceFile`) on `HandlerEntry.meta`.
|
|
@@ -658,12 +710,14 @@ This is a big release that contains a lot of new features and breaking changes.
|
|
|
658
710
|
- **[NEW]** Codegen deduplicates identical union branches.
|
|
659
711
|
|
|
660
712
|
---
|
|
713
|
+
|
|
661
714
|
## [5.0.0-beta.47] - 2026-05-11
|
|
662
715
|
|
|
663
716
|
- **[UPDATE]** Tree-based route type generation improvements.
|
|
664
717
|
- **[UPDATE]** Dependencies update.
|
|
665
718
|
|
|
666
719
|
---
|
|
720
|
+
|
|
667
721
|
## [5.0.0-beta.46] - 2026-05-11
|
|
668
722
|
|
|
669
723
|
- **[NEW]** Tree-based `RouteRegistry` replaces Express's hidden router internally. One global tree, walkable by codegen / OpenAPI / MCP emitters.
|
|
@@ -682,68 +736,70 @@ This is a big release that contains a lot of new features and breaking changes.
|
|
|
682
736
|
- **[BREAKING]** OpenAPI / documentation generation removed (will return later).
|
|
683
737
|
|
|
684
738
|
---
|
|
739
|
+
|
|
685
740
|
## [5.0.0-beta.45] - 2026-03-28
|
|
741
|
+
|
|
686
742
|
- **[BREAKING]** rate-limiter-flexible v9->v10
|
|
687
743
|
- **[BREAKING]** typecript v5->v6
|
|
688
744
|
|
|
689
745
|
---
|
|
746
|
+
|
|
690
747
|
## [5.0.0-beta.44] - 2026-02-22
|
|
691
748
|
|
|
692
749
|
- **[NEW]** Logout method
|
|
693
750
|
- **[Update]** set model typing
|
|
694
751
|
|
|
695
|
-
|
|
696
|
-
|
|
697
752
|
---
|
|
753
|
+
|
|
698
754
|
## [5.0.0-beta.43] - 2026-01-24
|
|
699
755
|
|
|
700
756
|
- **[FIX]** Fix typo in peerDeps
|
|
701
757
|
|
|
702
|
-
|
|
703
758
|
---
|
|
759
|
+
|
|
704
760
|
## [5.0.0-beta.42] - 2026-01-24
|
|
705
761
|
|
|
706
762
|
- **[BREAKING]** Mongoose v9. <https://mongoosejs.com/docs/migrating_to_9.html>.
|
|
707
763
|
|
|
708
764
|
---
|
|
765
|
+
|
|
709
766
|
## [5.0.0-beta.41] - 2026-01-17
|
|
710
767
|
|
|
711
768
|
- **[UPDATE]** Update deps
|
|
712
769
|
- **[NEW]** Bearer scheme support
|
|
713
770
|
- **[NEW]** redisConnection helper
|
|
714
771
|
|
|
715
|
-
|
|
716
|
-
|
|
717
772
|
---
|
|
773
|
+
|
|
718
774
|
## [5.0.0-beta.40] - 2025-12-15
|
|
719
775
|
|
|
720
776
|
- **[UPDATE]** Update `rate-limiter-flexible` to v9.
|
|
721
777
|
- **[UPDATE]** Remove 'winston-transport-sentry' and implementcustom logic based on 'sentry' itself (from v9.14 sentry have native winston support)
|
|
722
778
|
|
|
723
|
-
|
|
724
779
|
## [5.0.0-beta.39] - 2025-10-25
|
|
725
780
|
|
|
726
|
-
- **[UPDATE]**
|
|
781
|
+
- **[UPDATE]** rete limiter. Do not create index on mongo if we have "process.env.test === 'true'"
|
|
727
782
|
|
|
728
783
|
---
|
|
729
784
|
|
|
730
785
|
## [5.0.0-beta.38] - 2025-10-25
|
|
731
786
|
|
|
732
|
-
- **[UPDATE]**
|
|
733
|
-
- **[UPDATE]**
|
|
734
|
-
- **[UPDATE]**
|
|
787
|
+
- **[UPDATE]** update dependencies
|
|
788
|
+
- **[UPDATE]** update rate limiter Mongo option to not create an index by default when NODE_ENV=test
|
|
789
|
+
- **[UPDATE]** the default User model now uses roles and permissions with the String type (previously was any, for historical reasons). To avoid changes on Mongoose 8.19 as it affects User model https://github.com/Automattic/mongoose/issues/15699
|
|
735
790
|
- **[BREAKING]** Vitest v4 <https://vitest.dev/guide/migration.html#vitest-4>
|
|
736
791
|
|
|
737
792
|
---
|
|
738
793
|
|
|
739
794
|
## [5.0.0-beta.36] - 2025-08-24
|
|
740
795
|
|
|
741
|
-
- **[UPDATE]**
|
|
796
|
+
- **[UPDATE]** i18nService update loading to avoid race conditions
|
|
797
|
+
|
|
742
798
|
---
|
|
743
799
|
|
|
744
800
|
## [5.0.0-beta.36] - 2025-08-24
|
|
745
801
|
|
|
746
|
-
- **[UPDATE]**
|
|
802
|
+
- **[UPDATE]** i18nService update method names
|
|
747
803
|
|
|
748
804
|
---
|
|
749
805
|
|
|
@@ -775,14 +831,12 @@ This is a big release that contains a lot of new features and breaking changes.
|
|
|
775
831
|
|
|
776
832
|
- **[NEW]** Rate limiter middleware - add consumeResult function to allow user middleware as a regular rate limiter
|
|
777
833
|
|
|
778
|
-
|
|
779
834
|
---
|
|
780
835
|
|
|
781
836
|
## [5.0.0-beta.30] - 2025-08-01
|
|
782
837
|
|
|
783
838
|
- **[FIX]** Fix CLI mongo app name generation (64 symbols limit)
|
|
784
839
|
|
|
785
|
-
|
|
786
840
|
---
|
|
787
841
|
|
|
788
842
|
## [5.0.0-beta.29] - 2025-07-31
|
|
@@ -804,7 +858,6 @@ This is a big release that contains a lot of new features and breaking changes.
|
|
|
804
858
|
- **[UPDATE]** Update types.
|
|
805
859
|
- **[UPDATE]** Update deps.
|
|
806
860
|
|
|
807
|
-
|
|
808
861
|
---
|
|
809
862
|
|
|
810
863
|
## [5.0.0-beta.26] - 2025-06-19
|