@adaptivestone/framework 5.3.3 → 5.4.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.
Files changed (111) hide show
  1. package/AGENTS.md +58 -0
  2. package/CHANGELOG.md +123 -1
  3. package/CLAUDE.md +1 -0
  4. package/README.md +71 -1
  5. package/dist/codegen/astExtract.js +6 -1
  6. package/dist/codegen/astExtract.js.map +1 -1
  7. package/dist/codegen/emit.js +27 -26
  8. package/dist/codegen/emit.js.map +1 -1
  9. package/dist/config/auth.d.ts +4 -0
  10. package/dist/config/auth.js +2 -0
  11. package/dist/config/auth.js.map +1 -1
  12. package/dist/controllers/Auth.js +138 -60
  13. package/dist/controllers/Auth.js.map +1 -1
  14. package/dist/controllers/Auth.routes.gen.d.ts +18 -32
  15. package/dist/controllers/Home.routes.gen.d.ts +2 -4
  16. package/dist/controllers/index.js +4 -4
  17. package/dist/controllers/index.js.map +1 -1
  18. package/dist/helpers/translate.d.ts +11 -0
  19. package/dist/helpers/translate.js +14 -0
  20. package/dist/helpers/translate.js.map +1 -0
  21. package/dist/locales/en/translation.json +1 -27
  22. package/dist/locales/ru/translation.json +3 -7
  23. package/dist/models/User.d.ts +5 -11
  24. package/dist/models/User.js +16 -3
  25. package/dist/models/User.js.map +1 -1
  26. package/dist/models/UserOld.d.ts +3 -9
  27. package/dist/models/UserOld.js +8 -0
  28. package/dist/models/UserOld.js.map +1 -1
  29. package/dist/modules/BaseModel.d.ts +160 -58
  30. package/dist/modules/BaseModel.js.map +1 -1
  31. package/dist/server.d.ts +13 -3
  32. package/dist/server.js +2 -0
  33. package/dist/server.js.map +1 -1
  34. package/dist/services/cache/Cache.js +14 -7
  35. package/dist/services/cache/Cache.js.map +1 -1
  36. package/dist/services/http/HttpServer.d.ts +2 -5
  37. package/dist/services/http/HttpServer.js +9 -4
  38. package/dist/services/http/HttpServer.js.map +1 -1
  39. package/dist/services/http/middleware/AbstractMiddleware.d.ts +8 -0
  40. package/dist/services/http/middleware/AbstractMiddleware.js +11 -0
  41. package/dist/services/http/middleware/AbstractMiddleware.js.map +1 -1
  42. package/dist/services/http/middleware/Auth.js +1 -1
  43. package/dist/services/http/middleware/Auth.js.map +1 -1
  44. package/dist/services/http/middleware/I18n.js +6 -1
  45. package/dist/services/http/middleware/I18n.js.map +1 -1
  46. package/dist/services/http/middleware/RateLimiter.js +12 -2
  47. package/dist/services/http/middleware/RateLimiter.js.map +1 -1
  48. package/dist/services/http/middleware/RequestParser.js +38 -19
  49. package/dist/services/http/middleware/RequestParser.js.map +1 -1
  50. package/dist/services/http/middleware/Role.js +6 -2
  51. package/dist/services/http/middleware/Role.js.map +1 -1
  52. package/dist/services/http/routing/ExpressAdapter.js +17 -1
  53. package/dist/services/http/routing/ExpressAdapter.js.map +1 -1
  54. package/dist/services/http/routing/match.d.ts +1 -0
  55. package/dist/services/http/routing/match.js +9 -1
  56. package/dist/services/http/routing/match.js.map +1 -1
  57. package/dist/services/http/types.d.ts +70 -5
  58. package/dist/services/i18n/I18n.d.ts +16 -10
  59. package/dist/services/i18n/I18n.js +74 -6
  60. package/dist/services/i18n/I18n.js.map +1 -1
  61. package/dist/services/i18n/types.d.ts +44 -0
  62. package/dist/services/i18n/types.js +2 -0
  63. package/dist/services/i18n/types.js.map +1 -0
  64. package/dist/services/messaging/email/escapeHtml.d.ts +6 -0
  65. package/dist/services/messaging/email/escapeHtml.js +12 -0
  66. package/dist/services/messaging/email/escapeHtml.js.map +1 -0
  67. package/dist/services/messaging/email/templates/recovery/html.d.ts +3 -0
  68. package/dist/services/messaging/email/templates/recovery/html.js +20 -0
  69. package/dist/services/messaging/email/templates/recovery/html.js.map +1 -0
  70. package/dist/services/messaging/email/templates/recovery/subject.d.ts +3 -0
  71. package/dist/services/messaging/email/templates/recovery/subject.js +3 -0
  72. package/dist/services/messaging/email/templates/recovery/subject.js.map +1 -0
  73. package/dist/services/messaging/email/templates/recovery/text.d.ts +3 -0
  74. package/dist/services/messaging/email/templates/recovery/text.js +15 -0
  75. package/dist/services/messaging/email/templates/recovery/text.js.map +1 -0
  76. package/dist/services/messaging/email/templates/verification/html.d.ts +3 -0
  77. package/dist/services/messaging/email/templates/verification/html.js +23 -0
  78. package/dist/services/messaging/email/templates/verification/html.js.map +1 -0
  79. package/dist/services/messaging/email/templates/verification/subject.d.ts +3 -0
  80. package/dist/services/messaging/email/templates/verification/subject.js +3 -0
  81. package/dist/services/messaging/email/templates/verification/subject.js.map +1 -0
  82. package/dist/services/messaging/email/templates/verification/text.d.ts +3 -0
  83. package/dist/services/messaging/email/templates/verification/text.js +15 -0
  84. package/dist/services/messaging/email/templates/verification/text.js.map +1 -0
  85. package/dist/services/messaging/email/types.d.ts +28 -0
  86. package/dist/services/messaging/email/types.js +2 -0
  87. package/dist/services/messaging/email/types.js.map +1 -0
  88. package/dist/services/validate/ValidateService.d.ts +2 -2
  89. package/dist/services/validate/ValidateService.js.map +1 -1
  90. package/dist/services/validate/mergeValidatedOutputs.d.ts +19 -0
  91. package/dist/services/validate/mergeValidatedOutputs.js +43 -0
  92. package/dist/services/validate/mergeValidatedOutputs.js.map +1 -0
  93. package/dist/tests/assertions.d.ts +4 -2
  94. package/dist/tests/assertions.js.map +1 -1
  95. package/dist/tests/mocks.d.ts +7 -0
  96. package/dist/tests/mocks.js +9 -0
  97. package/dist/tests/mocks.js.map +1 -1
  98. package/dist/tests/setupNodeTest.js +7 -0
  99. package/dist/tests/setupNodeTest.js.map +1 -1
  100. package/dist/tests/testHelpers.d.ts +4 -12
  101. package/dist/tests/testHelpers.js +3 -1
  102. package/dist/tests/testHelpers.js.map +1 -1
  103. package/package.json +20 -8
  104. package/tsconfig.tests.json +14 -0
  105. package/dist/services/messaging/email/templates/.gitkeep +0 -0
  106. package/dist/services/messaging/email/templates/recovery/html.pug +0 -8
  107. package/dist/services/messaging/email/templates/recovery/subject.pug +0 -2
  108. package/dist/services/messaging/email/templates/recovery/text.pug +0 -3
  109. package/dist/services/messaging/email/templates/verification/html.pug +0 -10
  110. package/dist/services/messaging/email/templates/verification/subject.pug +0 -1
  111. package/dist/services/messaging/email/templates/verification/text.pug +0 -1
package/AGENTS.md ADDED
@@ -0,0 +1,58 @@
1
+ # AGENTS.md
2
+
3
+ Guidance for AI agents (and humans in a hurry) working on `@adaptivestone/framework`.
4
+
5
+ ## Check the plans first
6
+
7
+ All non-trivial work is tracked in `.plans/refactor/`. Status = directory:
8
+ `done/` shipped · `active/` in flight · `queued/` designed, not started · `later/` v6+ horizon.
9
+ `.plans/refactor/README.md` is the index and dependency map — it can lag the code, so verify its claims against the source before relying on them.
10
+
11
+ Before starting any task:
12
+
13
+ 1. Read `.plans/refactor/README.md`.
14
+ 2. Open every plan whose area overlaps the task (search the folder for the files/terms you are about to touch).
15
+ 3. If a plan covers the task, follow its settled decisions — do not silently re-design them.
16
+ 4. If your change conflicts with a queued/active plan, stop and flag the conflict instead of shipping a competing design.
17
+
18
+ Keep the plans in sync with the work:
19
+
20
+ - Finishing planned work = update the plan file, move it to the right status directory, and fix the README index in the same change.
21
+ - New non-trivial work gets a plan doc in `queued/` before implementation starts.
22
+
23
+ ## Verification
24
+
25
+ Run before claiming anything is done:
26
+
27
+ - `npm test` — full suite (node:test)
28
+ - `npm run check` — biome lint + format
29
+ - `npm run check:types` — codegen + `tsc --noEmit`
30
+ - `npm run check:types:tests` — same, but with the test suite included (`tsconfig.tests.json`)
31
+ - `npm run smoke` — packaging smoke test (pack → install into a scratch consumer)
32
+
33
+ ### TypeScript resource usage
34
+
35
+ Prefer one checker for local TypeScript 7 checks, especially when memory is limited.
36
+ The compiler investigation found substantially lower memory use and fewer generic
37
+ instantiations with `--checkers 1`. This selects one checker, not one Go thread;
38
+ do not set `GOMAXPROCS=1` on that basis. Benchmark CI separately before changing
39
+ its concurrency defaults.
40
+
41
+ Keep code generation in the check and use separate incremental caches for the
42
+ main and test configurations:
43
+
44
+ ```sh
45
+ npm run check:types -- --checkers 1 --incremental --tsBuildInfoFile node_modules/.cache/tsc/framework.tsbuildinfo
46
+ npm run check:types:tests -- --checkers 1 --incremental --tsBuildInfoFile node_modules/.cache/tsc/tests.tsbuildinfo
47
+ ```
48
+
49
+ Run these commands sequentially and retain the caches between local checks.
50
+ For cold measurements, omit `--incremental` and `--tsBuildInfoFile`; add
51
+ `--extendedDiagnostics` to record compiler cost. Keep all verification gates above.
52
+ See [the measurements](.plans/refactor/done/model-type-cost-experiments.md).
53
+
54
+ ## Conventions
55
+
56
+ - Do not commit or push. Leave changes in the working tree — a human reviews every diff and does their own git.
57
+ - Changelog entries go under `Unreleased` in `CHANGELOG.md`.
58
+ - Match the surrounding code style; `biome` is the arbiter. Compact JSDoc, no framework-internals talk in public-facing docs.
package/CHANGELOG.md CHANGED
@@ -4,10 +4,54 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [5.3.3] - 2026-08-08
7
+ ## [Unreleased]
8
+
9
+ ## [5.4.1] - 2026-09-11
10
+
11
+ ### Fixed
12
+
13
+ - **Core TypeScript consumers compile without the optional i18n packages.** Published request, validation, user-mail and i18n-service types now use dependency-free translation interfaces, so importing `helpers/appInstance.js` no longer requires `i18next` with `skipLibCheck: false`. The packed-package smoke test compiles those surfaces with both `i18next` and `i18next-fs-backend` absent. Ordinary string keys, defaults and interpolation remain typed; object/detail results require narrowing. Base-instance methods still return the real i18next object at runtime, but expose a smaller structural type: consumers needing vendor-specific methods or resource-aware types can explicitly assert it as `import('i18next').i18n` after installing the peers. This supersedes the 5.4.0 `skipLibCheck` workaround.
14
+
15
+ - **Request limits cannot be bypassed by Content-Type parameters.** Parser selection uses the normalized media type; JSON with a `multipart` parameter stays bounded, and multipart boundaries containing `json` keep the multipart parser. Oversized streamed bodies cannot reach handlers even when parsing finishes during stream destruction.
16
+ - **Equivalent URLs share rate-limit budgets.** Registry middleware receives the registered route template, and rate keys use method/template instead of the concrete URL. Case, encoding, trailing-slash and parameter variations no longer obtain fresh budgets; implicit HEAD shares GET's budget.
17
+ - **Password rehashing cannot overwrite a concurrent reset.** Opportunistic upgrades compare the hash that was verified; a concurrent password change cancels the stale login.
18
+ - **Cache hits preserve strings and signed BigInts.** Escaped markers replace the ambiguous `123n` encoding. Routine cache logs no longer include cached values or keys.
19
+
20
+ - **Nested model IDs now follow the schema at every depth.** Plain nested objects inside arrays and single subdocuments no longer promise generated IDs; explicitly declared nested `_id` paths are retained, and array-wrapper `_id: false` is honored. Reading a disabled hydrated subdocument ID now has type `undefined` instead of `never`.
21
+ - **Field type overrides work with both array spellings.** `TsTypeOverride` now applies inside `{ type: [...] }` as well as bare arrays, retaining separate stored and hydrated value types, including subdocument `toObject()` results.
22
+ - **Model inference respects schema options.** Custom `typeKey` definitions and top-level `_id: false` now flow through document inference and nested corrections, including array elements and lean queries. Explicitly declared IDs remain available.
23
+ - **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.
24
+ - **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.
25
+
26
+ - **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.
27
+
28
+ - **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.
29
+
30
+ - **Virtuals that are not a plain zero-argument getter no longer type as `never`.** The virtual mapper understood only `get()` with no parameters, so a getter declared with Mongoose's `(value, virtual, doc)` arguments, a set-only virtual, and a populate virtual (`{ options: { ref, localField, foreignField } }`, no getter) all resolved to `never` — which is assignable to anything, so wrong code compiled silently. The rules are now: a getter's return type wins whatever its parameters; a set-only virtual takes its setter's value type plus `undefined` because it has no getter; a virtual with neither (populate virtuals) is `unknown`, because the populated shape is not knowable from the schema — narrow it, or intersect the document type at the call site. Virtuals with setters remain writable even when declared `as const`; getter-only virtuals retain their existing modifiers. Type-level only. Pinned by the new `virtualShapes.ts` fixture.
31
+
32
+ ### Changed
33
+
34
+ - **Code generation now requires `oxc-parser` `^0.149.0`.** Projects that run `npm run gen` should update their optional development peer with `npm i -D oxc-parser@^0.149.0`. Runtime-only consumers do not need it.
35
+
36
+ - **New passwords default to 15–128 Unicode code points.** Built-in registration and reset share `auth.passwordPolicy.minLength` / `maxLength`; spaces and Unicode are allowed. Existing login passwords remain valid. Applications with custom model writes or password endpoints must apply their own validation. New translation keys: `auth.passwordTooShort` and `auth.passwordTooLong` (parameters `min` / `max`).
37
+ - **Deployment note:** rate-key changes reset counters once. The lossless cache codec uses a new `cache-v2` key space and starts cold; old keys expire naturally. Mixed versions maintain separate cache entries/invalidation and rate counters, so complete the rollout across workers promptly.
38
+
39
+ - **Behavior change (types) — a model resolved by runtime name is queryable now, and `AppModel` is a single model type instead of a union.** `AppModel`, the type behind `getModelOrThrow(name)` and behind `getModel()` for the framework's own model names, was the union of the legacy `AbstractModel`-based model type and the `BaseModel`-derived one. TypeScript cannot resolve Mongoose's overloaded finders on such a union, so `find`, `findOne` and `findById` were compile errors on exactly the path meant for names known only at runtime, while `create`, `updateOne`, `deleteMany` and `countDocuments` happened to compile. `AppModel` is now the `BaseModel`-shaped model type; legacy `AbstractModel` models are stored under the same type until v6 removes them. Two things can stop compiling. Because the raw document type is the base shape (`_id` plus timestamps), `create({ … })` with an object literal carrying other fields is now rejected by the excess-property check, where the union let it through — write through a runtime-name model with `new Model(obj)`, a typed value, or a cast to the concrete model type when you know it; `getModel('Name')` with codegen remains the fully typed path. And an `AbstractModel`-based model (`myModel.mongooseModel`) is no longer assignable to `AppModel` — cast at that boundary, as the framework now does internally. Type-level only; runtime resolution is unchanged. Pinned by the `appModelLookup.ts` codegen fixture, which now exercises the finders and asserts the type is not `any`.
40
+
41
+ ## [5.4.0] - 2026-09-01
42
+
43
+ ### Deprecated
44
+
45
+ - **`email.greeating` → `email.greeting`.** The greeting key the shipped email templates emit had carried a typo since it was introduced. The templates now emit the correctly spelled `email.greeting`; a catalog that only translates the old `email.greeating` keeps working — it is honoured as a fallback (new key → old key → the English default) until v6 removes it. Translate the new spelling going forward.
46
+
47
+ ### Fixed
48
+
49
+ - **`configureTestServer` now works in the documented arrangement — the boot no longer beats the preload that declares the options.** node:test runs a root `before()` registered from a `--import` preload immediately, synchronously inside the `before()` call — while the preload's module graph is still evaluating. The shipped setup glue therefore booted the test server, and closed the options window, during its own import; the preload's module body — where the 5.3.3 snippet places the `configureTestServer` call, below its hoisted imports — ran only afterwards, so every test file died on the helper's own "must be called before the test server boots" guard. The glue's `before()` hook now yields one microtask before booting, resuming after the whole preload graph has evaluated, so the documented snippet (setup-glue import above, call at module scope below) works as written. One arrangement remains out of reach: a preload that awaits at top level before calling — deferral cannot outwait arbitrary async work — and the guard's error message now names the fix for it (move the call into a separate module imported before the setup glue). Pinned by a spawned-runner regression test that executes the documented preload arrangement under `--test`.
8
50
 
9
51
  ### Added
10
52
 
53
+ - **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.
54
+
11
55
  - **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:
12
56
 
13
57
  ```ts
@@ -19,10 +63,88 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
19
63
 
20
64
  `folders` stays owned by the bootstrap (it resolves those from the `TEST_FOLDER_*` env vars). Calling it after the server has booted throws rather than silently doing nothing — a late call cannot retroactively wire the running server, and a silent skip is exactly the failure this fixes. Also closes a coverage hole: `bootHttp` shipped in 5.1 with no test exercising it end to end, for the same reason.
21
65
 
66
+ - **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:
67
+
68
+ | Key | Default (English) |
69
+ |---|---|
70
+ | `middleware.auth.notLoggedIn` | Please login to application |
71
+ | `middleware.role.userRequired` | User should be provided |
72
+ | `middleware.role.noAccess` | You do not have access |
73
+ | `middleware.rateLimiter.tooManyRequests` | Too Many Requests |
74
+ | `middleware.requestParser.entityTooLarge` | Request entity too large. Your upload exceeds the allowed size or count limits. |
75
+ | `middleware.requestParser.parseError` | Error to parse your request. You provided invalid content type or content-length. Please check your request headers and content type. |
76
+
77
+ 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.
78
+
79
+ - **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:
80
+
81
+ | Key | Default (English) |
82
+ |---|---|
83
+ | `http.notFound` | 404 |
84
+ | `http.serverError` | Something broke! |
85
+
86
+ 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.
87
+
88
+ - **Bun 1.4+ is now a supported runtime.** The same application code runs on Bun through its Node compatibility layer and the existing Express adapter — no Bun-specific build, no `Bun.serve` path, no dependency pin or override. 1.4.0 is the declared floor because it is the first stable Bun that imports the Mongoose/BSON dependency graph the framework resolves; `engines` now declares `bun: >=1.4.0` alongside `node: >=24.0.0`, which npm and Bun both read as alternative runtime constraints. CI runs two new jobs on the floor and on latest stable Bun: the framework suite (`npm run test:bun`) and a packed-consumer smoke test (`npm run smoke:bun`) that installs the published tarball with `bun install`, imports every public entry point, checks the exports map still blocks internal subpaths, boots a `Server` against a real MongoDB, serves a request, runs Mongoose create/read/update/delete and shuts down clean. Node remains the primary runtime and is unaffected.
89
+
90
+ Two things stay Node-only, and are documented in `README.md`. **`cluster.js` / `runCluster`** imports fine under Bun but only the Node path is tested — run single-process under Bun. **Node's test-runner CLI**: Bun implements the `node:test` API but not `node --test`, so a Bun project runs its suite with `bun test` plus the framework's existing preloads instead of the Node flags. Four framework test files need `mock.module()` (Node's `--experimental-test-module-mocks`), which Bun does not implement ([oven-sh/bun#5090](https://github.com/oven-sh/bun/issues/5090)); they are the only exclusions from the Bun run and are named in the README. Every other test passes on both runtimes. One further Bun quirk worth knowing when writing tests: `assert.deepStrictEqual` reports any `Proxy` — which is what a Mongoose array is — as unequal, so spread it first (`[...doc.tags]`).
91
+
92
+ ### Changed
93
+
94
+ - **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:
95
+
96
+ | Key | Default (English) |
97
+ |---|---|
98
+ | `auth.emailProvided` | Email must be provided |
99
+ | `auth.emailValid` | Email is not valid |
100
+ | `auth.passwordProvided` | Password must be provided |
101
+ | `auth.passwordValid` | Password is not valid,only a-z,A-Z,0-9,!,@,#,$,%,ˆ,&,*,(,),_,+,{,},[,],<,> |
102
+ | `auth.passwordRecoveryTokenProvided` | Password recovery token must be provided |
103
+ | `auth.nickNameValid` | Nick name is not valid,only a-z,A-Z,0-9 |
104
+ | `auth.nameValid` | Name is not valid |
105
+ | `auth.errorUPValid` | User/password not valid |
106
+ | `auth.nicknameExists` | User with such nickname already exists |
107
+ | `auth.recoveryEmailSent` | If an account exists for this address, a recovery email has been sent. |
108
+ | `auth.verificationEmailSent` | If an account exists for this address, a verification email has been sent. |
109
+ | `email.notVerified` | Your email is not verified |
110
+ | `email.registered` | User with such an email already registered |
111
+ | `email.alreadyVerifiedOrWrongToken` | Your email is already verified or your verification token is wrong |
112
+ | `email.passwordRecovery` | Recovery password |
113
+ | `email.passwordChanged` | Password changed |
114
+ | `email.greeating` | Dear user |
115
+ | `password.wrongToken` | Password recovery token is not valid |
116
+
117
+ `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.
118
+
119
+ `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.
120
+
121
+ - **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.
122
+
123
+ - **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.
124
+
22
125
  ### Fixed
23
126
 
24
127
  - **Plain nested paths carried a phantom `_id` on hydrated documents.** Mongoose builds a subdocument, and generates an `_id` for it, only for the `{ type: { … } }` spelling; a plain nested object (`name: { first: String, last: String }`) is a path grouping that never gets an `_id` at runtime. `InferHydratedDocType` types both the same way, intersecting `{ _id: ObjectId }` onto nested paths too — so `doc.name._id` compiled for a value that is always `undefined`, and assigning the real runtime shape (`doc.name = { first: 'Ada' }`) was a type error on a property Mongoose will never persist, pushing consumers to `Omit<…, 'name'>` bridges or `unknown` casts at every nested-path call site. The framework's hydrated correction — which already strips the `_id` Mongoose adds to `_id: false` subdocuments — now also drops it from plain nested paths, at any depth, using the same no-`type`-wrapper discriminator the override pass uses. Real single-nested subdocuments keep their `_id`, and the raw/lean/create surfaces are untouched: those already matched runtime exactly. The framework's own `User.name` was affected.
25
128
 
129
+ - **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.
130
+
131
+ | Key | Default (English) |
132
+ |---|---|
133
+ | `email.emailConfirm` | Email confirmation |
134
+ | `email.verify` | Verify email |
135
+ | `email.verifyInstructions` | To verify your email address, follow the link: |
136
+ | `email.greeating` | Dear user |
137
+
138
+ `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.
139
+
140
+ - **An auth mail for a user with no email address is now a logged `false` instead of a crash or a mail to nobody.** `email` is optional on both `User` and `UserOld`, but `sendVerificationEmail` and `sendPasswordRecoveryEmail` went straight to minting a token and handing `this.email` to the mailer: `User` rejected with `Email is required` from the token helper it calls first, and `UserOld` hashed the literal string `undefined` into a token, saved it on the user, and then called `mail.send(undefined)`. All four methods now check the address first, report `Cannot send <kind> email: user has no email address` through the same logger that already reports a missing mailer module, and return `false` — the value every call site handles.
141
+
142
+ ### Removed
143
+
144
+ - **Three dead framework locale keys.** `auth.errorUExist`, `auth.errorUAlready` and `auth.noAccessRights` had no emit site left anywhere in the framework — nothing could produce them — so they are gone from both `en/translation.json` and `ru/translation.json`. An app that defines the same keys in its own locales is unaffected: the framework never looked them up.
145
+
146
+ - **Two more dead framework locale keys.** `auth.userProvided` and `email.newPassword` had no emit site in the framework either. `auth.userProvided` was quoted only by a benchmark fixture, which now carries its English text as an in-code `defaultValue` like every framework message does, so nothing looks the key up any more. Both are gone from `en/translation.json` and `ru/translation.json` — that leaves `en`'s `email` namespace empty, so it went with them. An app that defines the same keys in its own locales is unaffected.
147
+
26
148
  ## [5.3.2] - 2026-08-08
27
149
 
28
150
  ### Fixed
package/CLAUDE.md ADDED
@@ -0,0 +1 @@
1
+ @AGENTS.md
package/README.md CHANGED
@@ -10,10 +10,43 @@ types, and batteries-included auth, rate limiting, i18n, and caching.
10
10
 
11
11
  ## Requirements
12
12
 
13
- - **Node ≥ 24** (ESM-only, runs `.ts` sources natively)
13
+ - **Node ≥ 24** (ESM-only, runs `.ts` sources natively) — or **Bun ≥ 1.4.0**, see [Runtimes](#runtimes)
14
14
  - **MongoDB** — required; boot fails fast without `MONGO_DSN`
15
15
  - **`AUTH_SALT`** — required; generate one with `node src/cli.ts generateRandomBytes`
16
16
 
17
+ ## Runtimes
18
+
19
+ Node is the primary runtime. **Bun ≥ 1.4.0** is supported as an additional one:
20
+ the same application code, the same Express adapter, running on Bun's Node
21
+ compatibility layer — there is no Bun-specific build, no `Bun.serve` path, and
22
+ no dependency pin or override needed. 1.4.0 is the floor because it is the first
23
+ stable Bun that imports the Mongoose/BSON graph the framework resolves.
24
+
25
+ Certified on every release, on both the floor and the latest stable Bun: the
26
+ framework test suite; and a consumer that installs the published tarball with
27
+ `bun install`, imports the public entry points, boots a `Server`, serves a
28
+ request, runs Mongoose create/read/update/delete against MongoDB and shuts down.
29
+
30
+ Node-only, as of Bun 1.4:
31
+
32
+ - **`cluster.js` / `runCluster`** — the multi-process production entry point. It
33
+ imports fine under Bun, but only the Node path is tested; run single-process
34
+ under Bun (or put the process manager outside the app).
35
+ - **Node's test-runner CLI.** Bun implements the `node:test` *API* but not
36
+ `node --test`, so a Bun project runs its suite with `bun test` and the
37
+ framework preloads rather than the flags the Node docs show. Four framework
38
+ test files need `mock.module()` (Node's `--experimental-test-module-mocks`),
39
+ which Bun does not implement ([oven-sh/bun#5090][bun-5090]), and are the only
40
+ thing excluded from the Bun run: `cluster.test.ts`, `models/UserOld.test.ts`,
41
+ `helpers/redis/redisConnection.failure.test.ts`,
42
+ `services/i18n/I18n.missing.test.ts`. Everything else passes on both runtimes.
43
+ - **`assert.deepStrictEqual` against a Mongoose array.** Bun 1.4 reports any
44
+ `Proxy` — which is what a Mongoose array is — as unequal. Spread it first
45
+ (`[...doc.tags]`). This is a test-assertion quirk; the values themselves are
46
+ correct.
47
+
48
+ [bun-5090]: https://github.com/oven-sh/bun/issues/5090
49
+
17
50
  ## Quickstart
18
51
 
19
52
  The fastest way to start is to clone the example project and use it as a
@@ -37,6 +70,43 @@ To add the framework to an existing project instead:
37
70
  npm install @adaptivestone/framework
38
71
  ```
39
72
 
73
+ ## Authentication and cache upgrade notes (5.4.1)
74
+
75
+ See the [5.4.1 release notes](CHANGELOG.md) for all fixes, including model/validation
76
+ typing corrections and the optional-i18next declaration change.
77
+
78
+ The built-in registration and password-reset routes accept passwords of 15–128
79
+ Unicode code points, including spaces. Existing passwords remain usable at login.
80
+ To customize the length limits, extend the default in your application's
81
+ `src/config/auth.ts`:
82
+
83
+ ```ts
84
+ import auth from '@adaptivestone/framework/config/auth.js';
85
+
86
+ export default {
87
+ ...auth,
88
+ passwordPolicy: { minLength: 15, maxLength: 128 },
89
+ };
90
+ ```
91
+
92
+ The policy applies to the built-in HTTP routes; direct model writes and custom
93
+ password-change endpoints must enforce their own policy. Translate
94
+ `auth.passwordTooShort` and `auth.passwordTooLong` to customize the validation
95
+ messages (`min` and `max` are available as interpolation parameters).
96
+
97
+ With `consumeKeyComponents.route` enabled, rate limits use the registered route
98
+ and method. Case variants, encoded spellings, trailing slashes and different
99
+ parameter values share the same budget; implicit HEAD shares GET's budget.
100
+ A limiter mounted before routing shares one bucket per method, without splitting
101
+ by the requested URL. Upgrading resets existing rate-limit counters once; roll
102
+ out to all workers promptly so older workers cannot keep separate alias buckets.
103
+
104
+ Cache keys now include a `cache-v2` marker so strings and signed BigInts round-trip
105
+ without collisions. The upgrade starts with a cold cache; older keys expire under
106
+ their original TTLs. During mixed-version deployment, each version invalidates
107
+ only its own key space, so complete the rollout before relying on cross-worker
108
+ cache invalidation. Cache hit/miss logs no longer include keys or values.
109
+
40
110
  ## Generated types
41
111
 
42
112
  The framework generates `genTypes.d.ts` (typed `getConfig`/`getModel`) and
@@ -396,7 +396,12 @@ function readRouteEntry(method, path, init) {
396
396
  }
397
397
  }
398
398
  else if (key === 'query') {
399
- out.hasQuery = true;
399
+ // A nullish query schema is skipped by the runtime. Keep it out of
400
+ // the generated `InferOutput<…>` navigation just like request/params;
401
+ // otherwise `query: null` produces an invalid type argument.
402
+ if (!isNullishLiteral(prop.value)) {
403
+ out.hasQuery = true;
404
+ }
400
405
  }
401
406
  else if (key === 'params') {
402
407
  if (!isNullishLiteral(prop.value)) {
@@ -1 +1 @@
1
- {"version":3,"file":"astExtract.js","sourceRoot":"","sources":["../../src/codegen/astExtract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;qDAEqD;AACrD,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;AA2D/D,2EAA2E;AAC3E,MAAM,UAAU,iBAAiB,CAC/B,GAAW,EACX,QAAgB;IAEhB,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACvD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO;YACL,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,gBAAgB,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,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C;QAC9B,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;QAChD,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,IAAI,CAAC,CAAC,yBAAyB;AACxC,CAAC"}
@@ -81,7 +81,7 @@ export function renderGenFile(input) {
81
81
  }
82
82
  const importLines = [];
83
83
  importLines.push(...middlewareImports);
84
- importLines.push(`import type {`, ` BaseRequestContext,`, ` UnionAppInfoProvides,`, `} from '${typesPath}';`);
84
+ importLines.push(`import type { ValidatedRequest } from '${typesPath}';`);
85
85
  if (navigateSchema) {
86
86
  importLines.push(`import type { StandardSchemaV1 } from '${validateTypesPath}';`);
87
87
  importLines.push(`import type ${controller.className} from '${ctrlImportPath}';`);
@@ -136,7 +136,7 @@ export type ${typeName} = ${shapes[0]};`;
136
136
  export type ${typeName} =
137
137
  | ${shapes.join('\n | ')};`;
138
138
  }
139
- /** Render the BaseRequestContext intersection for one route. */
139
+ /** Render a handler context using the same ordered validation outputs as runtime. */
140
140
  function renderShape(route, chain, routesAlias, navigateSchema) {
141
141
  const tupleInner = chain.length === 0
142
142
  ? 'readonly []'
@@ -148,37 +148,38 @@ function renderShape(route, chain, routesAlias, navigateSchema) {
148
148
  const paramsOverride = pathParams.length > 0
149
149
  ? ` & { params: { ${pathParams.map((p) => `${paramKey(p)}: string`).join('; ')} } }`
150
150
  : '';
151
- // appInfo overrides for body/query when their schema is declared inline
152
- // on the route entry.
153
- const appInfoOverrides = [];
154
- if (route.hasSchema && navigateSchema) {
155
- if (route.requestContentTypes?.length) {
156
- // Content-type map → discriminated union keyed by `contentType`. Each
157
- // branch reads InferOutput of that media type's schema.
158
- const base = `${routesAlias}[${sq(route.method)}][${sq(route.path)}]['request']`;
159
- // Discriminant literal is lower-cased to match the runtime-injected
160
- // value (the parser normalizes `Content-Type` to lower case); the type
161
- // navigation keeps the author's original key so the schema resolves.
162
- const union = route.requestContentTypes
163
- .map((ct) => `({ contentType: ${sq(ct.toLowerCase())} } & StandardSchemaV1.InferOutput<${base}[${sq(ct)}]>)`)
164
- .join(' | ');
165
- appInfoOverrides.push(`request: ${union}`);
166
- }
167
- else {
168
- appInfoOverrides.push(`request: StandardSchemaV1.InferOutput<${routesAlias}[${sq(route.method)}][${sq(route.path)}]['request']>`);
169
- }
170
- }
151
+ const otherOutputs = [];
171
152
  if (route.hasQuerySchema && navigateSchema) {
172
- appInfoOverrides.push(`query: StandardSchemaV1.InferOutput<${routesAlias}[${sq(route.method)}][${sq(route.path)}]['query']>`);
153
+ otherOutputs.push(`query: StandardSchemaV1.InferOutput<${routesAlias}[${sq(route.method)}][${sq(route.path)}]['query']>`);
173
154
  }
174
155
  // A `params:` schema types the VALIDATED surface (`appInfo.params`) only. The
175
156
  // raw `params` override above stays `string`-valued — the runtime never
176
157
  // rewrites `req.params`, so the two surfaces are deliberately different types.
177
158
  if (route.hasParamsSchema && navigateSchema) {
178
- appInfoOverrides.push(`params: StandardSchemaV1.InferOutput<${routesAlias}[${sq(route.method)}][${sq(route.path)}]['params']>`);
159
+ otherOutputs.push(`params: StandardSchemaV1.InferOutput<${routesAlias}[${sq(route.method)}][${sq(route.path)}]['params']>`);
160
+ }
161
+ const variant = (request, contentType) => {
162
+ const outputs = request
163
+ ? [`request: ${request}`, ...otherOutputs]
164
+ : otherOutputs;
165
+ const outputArg = outputs.length ? `, { ${outputs.join('; ')} }` : '';
166
+ const contentTypeArg = contentType
167
+ ? `, ${sq(contentType.toLowerCase())}`
168
+ : '';
169
+ return `ValidatedRequest<${tupleInner}${outputArg}${contentTypeArg}>${paramsOverride}`;
170
+ };
171
+ if (route.hasSchema && navigateSchema) {
172
+ const base = `${routesAlias}[${sq(route.method)}][${sq(route.path)}]['request']`;
173
+ if (route.requestContentTypes?.length) {
174
+ // Each media type stays correlated with its output. The discriminator
175
+ // is applied AFTER middleware outputs, just as it is at runtime.
176
+ return `(${route.requestContentTypes
177
+ .map((ct) => variant(`StandardSchemaV1.InferOutput<${base}[${sq(ct)}]>`, ct))
178
+ .join(' | ')})`;
179
+ }
180
+ return variant(`StandardSchemaV1.InferOutput<${base}>`);
179
181
  }
180
- const appInfoOverride = appInfoOverrides.length > 0 ? ` & { ${appInfoOverrides.join('; ')} }` : '';
181
- return `BaseRequestContext & { appInfo: UnionAppInfoProvides<${tupleInner}>${appInfoOverride} }${paramsOverride}`;
182
+ return variant();
182
183
  }
183
184
  /**
184
185
  * Pull path-param names out of a route path string. Handles `:name` (single
@@ -1 +1 @@
1
- {"version":3,"file":"emit.js","sourceRoot":"","sources":["../../src/codegen/emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAOzC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA2B5C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAkB;IAC9C,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACjE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,cAAc,CAAC,CAAC;IAEnE,MAAM,aAAa,GAAG,oBAAoB,EAAE,CAAC;IAC7C,MAAM,wBAAwB,GAAG,OAAO,CAAC,UAAU,CACjD,GAAG,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,CAC9B,CAAC;IACF,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAExE,iEAAiE;IACjE,uEAAuE;IACvE,oEAAoE;IACpE,+DAA+D;IAC/D,kEAAkE;IAClE,MAAM,SAAS,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;IAC9E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC"}
@@ -2,6 +2,10 @@ declare const _default: {
2
2
  hashRounds: number;
3
3
  saltSecret: string | undefined;
4
4
  isAuthWithVerificationFlow: boolean;
5
+ passwordPolicy: {
6
+ minLength: number;
7
+ maxLength: number;
8
+ };
5
9
  scrypt: {
6
10
  ln: number;
7
11
  r: number;
@@ -9,6 +9,8 @@ export default {
9
9
  // and throws with the `generateRandomBytes` hint if it's missing.
10
10
  saltSecret: process.env.AUTH_SALT,
11
11
  isAuthWithVerificationFlow: true,
12
+ // Registration/reset only. Existing passwords remain valid at login.
13
+ passwordPolicy: { minLength: 15, maxLength: 128 },
12
14
  // Password hashing cost for the v2 scrypt scheme. `ln` = log2(N). Raise over
13
15
  // time to harden — existing hashes upgrade to the new cost on next login.
14
16
  // Tests lower this for speed; scrypt is memory-hard, so the production value
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/config/auth.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,2EAA2E;IAC3E,6EAA6E;IAC7E,2EAA2E;IAC3E,6BAA6B;IAC7B,UAAU,EAAE,EAAE;IACd,6EAA6E;IAC7E,6EAA6E;IAC7E,kEAAkE;IAClE,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS;IACjC,0BAA0B,EAAE,IAAI;IAChC,6EAA6E;IAC7E,0EAA0E;IAC1E,6EAA6E;IAC7E,+CAA+C;IAC/C,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;CAC/B,CAAC"}
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/config/auth.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,2EAA2E;IAC3E,6EAA6E;IAC7E,2EAA2E;IAC3E,6BAA6B;IAC7B,UAAU,EAAE,EAAE;IACd,6EAA6E;IAC7E,6EAA6E;IAC7E,kEAAkE;IAClE,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS;IACjC,0BAA0B,EAAE,IAAI;IAChC,qEAAqE;IACrE,cAAc,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE;IACjD,6EAA6E;IAC7E,0EAA0E;IAC1E,6EAA6E;IAC7E,+CAA+C;IAC/C,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;CAC/B,CAAC"}