@lenne.tech/nest-server 11.42.14 → 11.42.15

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.
@@ -0,0 +1,117 @@
1
+ # Migration Guide: 11.42.14 → 11.42.15
2
+
3
+ ## Overview
4
+
5
+ | Category | Details |
6
+ | -------------------- | -------------------------------------------------------------------------------------------------------- |
7
+ | **Bugfixes** | No framework code changes; security release of the runtime dependency `undici` (§3) |
8
+ | **New Features** | None |
9
+ | **Framework API** | Unchanged — no new exports, no changed signatures |
10
+ | **Dependencies** | `mongoose` 9.10.4 → 9.11.2 and `mongodb` 7.6.0 → 7.7.0 (both `dependencies`, raised together, §1); **`undici` 7.30.0 → 7.30.1 (security release, §3)**; `nodemailer` 10.1.0 → 10.1.2; `@getbrevo/brevo` 6.0.3 → 6.2.0; overrides `@graphql-tools/utils` → 12.0.4, `undici` → 7.30.1, `qs` → 6.16.1 |
11
+ | **Breaking Changes** | None |
12
+ | **Migration Effort** | Low, but **one step is required**: a project that keeps `mongodb` in `devDependencies` (the starter default) MUST raise it to 7.7.0 — by hand, or with the starter's new update script — or sign-in fails with 401 (§1). Typed `lean()` / `bulkWrite()` code may need a type adjustment (§2) |
13
+
14
+ ## Quick Migration
15
+
16
+ ```bash
17
+ pnpm run update # starter-based projects: raises every pin the framework raised
18
+ pnpm why mongodb # must show ONE version: 7.7.0
19
+ ```
20
+
21
+ If `pnpm why mongodb` lists 7.6.0 next to 7.7.0, raise the project's own `mongodb` entry to `7.7.0` (§1). If your
22
+ project has its own `undici` override, raise it to 7.30.1 (§3) — `pnpm audit` does not flag this one yet.
23
+
24
+ Vendor-mode projects pick up the core with `/lt-dev:backend:update-nest-server-core`; raise `mongoose` and `mongodb`
25
+ in the project's `package.json` to the versions above in the same step.
26
+
27
+ ## 1. mongoose 9.11 and mongodb 7.7 move together
28
+
29
+ mongoose 9.11.x requires `mongodb ~7.7`, so both are raised in this release. nest-server declares `mongodb` under
30
+ `dependencies`. nest-server-starter keeps it under `devDependencies` — and that pin is **not test-only**: Better-Auth's
31
+ MongoDB adapter (`@better-auth/mongo-adapter`, used by nest-server's IAM module) resolves its `mongodb` peer from the
32
+ project's own `mongodb` entry, in the production image too.
33
+
34
+ Until this release, `pnpm run update` (the starter's `extras/sync-packages.mjs`) raised a pin only when the framework
35
+ declared it **in the same section**. A project with `mongodb` in `devDependencies` therefore stayed on 7.6.0 while the
36
+ framework's mongoose brought 7.7.0: two driver copies. Where the project's lockfile still holds the older `bson` for
37
+ the old driver (any lockfile not refreshed since bson 7.3), there are two `bson` copies as well. The adapter checks ids
38
+ with `instanceof ObjectId` against ITS driver's bson, the ids come from the framework's — so the check fails, the
39
+ adapter throws `MongoAdapterError: Invalid id value`, and authenticated requests answer **401**. With a single shared
40
+ bson it stays a typing problem in tests (`Db` / `MongoClient` from the test helpers no longer match the project's own
41
+ import). Neither is acceptable, and which one a project gets depends on its lockfile history, so raise the pin.
42
+
43
+ The starter's update script now raises a package the framework **ships** (`dependencies`) in whichever section the
44
+ project keeps it. A package the framework only develops and tests with (`devDependencies`) still raises only the
45
+ project's own `devDependencies` — never a runtime pin. That keeps the better-auth trio where it belongs: the framework
46
+ holds it as devDependencies (its test versions, with a peer range as the contract), the project holds it as
47
+ dependencies and owns that version, because its api and app must resolve the same better-auth. The rule lives in
48
+ `extras/align-package-versions.mjs`, and nest-server's consumer gate (`pnpm run check:consumer`) applies the identical
49
+ rule before every release.
50
+
51
+ **What to do:**
52
+
53
+ - **Your project still has the old `extras/sync-packages.mjs`:** raise `mongodb` to `7.7.0` by hand (also
54
+ `json-to-graphql-query`, if you keep it in `devDependencies` and it lags), or copy `extras/sync-packages.mjs` and
55
+ `extras/align-package-versions.mjs` from nest-server-starter. **This step is required** — skipping it breaks sign-in.
56
+ - **Your project has `mongodb` in `dependencies`:** `pnpm run update` already raised it; nothing to do.
57
+ - **Check either way:** `pnpm why mongodb` must list exactly one version.
58
+
59
+ ## 2. mongoose 9.11 type changes
60
+
61
+ No runtime behaviour your code relies on changed, but two typing changes can surface in a project's own code:
62
+
63
+ - `lean()` now passes its result type into the query, so a `lean<T>()` result is narrowed to `T`. Code that assigned
64
+ the result to an incompatible type now gets a compile error instead of a silent mismatch.
65
+ - `UpdateOneModel` / `UpdateManyModel` (`bulkWrite()` operations) are typed like `UpdateQuery`. An update document that
66
+ was accepted by the looser type may now need its operators spelled out (`$set`, `$push`, …).
67
+
68
+ Runtime fixes that come along (no action needed): validators on document arrays under nested paths no longer run
69
+ twice, `bulkWrite()` casts array filter values, cursors await driver cleanup on destroy. The mongodb 7.7 driver
70
+ recovers from a failed OIDC token fetch instead of failing every later operation on that client.
71
+
72
+ ## 3. undici 7.30.1 is a security release
73
+
74
+ undici 7.30.1 fixes four high and four medium advisories (GHSA-qrxm-fqhp-jwvm, GHSA-2m5v-pch6-74hx,
75
+ GHSA-4w7w-5xrc-9h26, GHSA-xjj6-f33q-929c high; GHSA-55wc-3pg8-jfw6, GHSA-f72v-6w45-q472, GHSA-4qv8-2p9j-2685,
76
+ GHSA-9fm3-97px-rjf6 medium). They were published as repository advisories, so **`pnpm audit` does not report them
77
+ yet** — a green audit says nothing about this release. nest-server uses undici at runtime for `outboundFetch()` (the
78
+ SSRF-guarded fetch for user-entered URLs), and one of the fixes concerns function-valued Agent options, which that
79
+ helper's guarded connector is.
80
+
81
+ **What to do:**
82
+
83
+ - **Nothing for nest-server's own dependency** — `pnpm run update` raises it.
84
+ - **Your project carries its own `undici` override** (starter-derived projects do, for the
85
+ `@compodoc/compodoc > cheerio > undici` path): raise key and target together, e.g.
86
+ `'undici@>=7.0.0 <7.30.0': 7.30.0` → `'undici@>=7.0.0 <7.30.1': 7.30.1`. The old entry would otherwise keep that path
87
+ on the vulnerable 7.30.0, because cheerio's `^7.19.0` intersects the old key.
88
+ - **Check:** `pnpm why undici` lists only 7.30.1.
89
+
90
+ Also raised in the same way (no advisory, removes a hold-back): `qs` override `<6.16.0` → `<6.16.1` (6.16.1), and
91
+ `nodemailer` 10.1.2, which strips credentials on a cross-origin redirect.
92
+
93
+ ## Compatibility Notes
94
+
95
+ | Pattern | Status |
96
+ | ------- | ------ |
97
+ | `mongodb` in `dependencies` of the project | Raised by `pnpm run update` as before |
98
+ | `mongodb` in `devDependencies` of the project (starter default) | Raised only by the new update script — otherwise raise by hand, **required** (§1) |
99
+ | better-auth / `@better-auth/*` in the project's `dependencies` | Never raised from the framework's devDependencies — the project owns that version, as before |
100
+ | `lean<T>()` with an explicit result type | May need a type adjustment (§2) |
101
+ | `bulkWrite()` with typed `updateOne` / `updateMany` operations | May need operators spelled out (§2) |
102
+ | Routes with `@Roles()` + `@UseGuards(AuthGuard(BETTER_AUTH))` | Unchanged. nest-server-starter dropped these redundant guards from its `UserController`; removing them in your project is optional |
103
+
104
+ ## Troubleshooting
105
+
106
+ **Sign-in or every authenticated request answers 401, the log shows `MongoAdapterError: Invalid id value`**
107
+ Two mongodb (and bson) versions are installed, and Better-Auth's MongoDB adapter uses the project's older one.
108
+ `pnpm why mongodb` shows both; raise the project's own `mongodb` entry to 7.7.0, run `pnpm install`, and rebuild the
109
+ image (§1).
110
+
111
+ **Type errors around `Db`, `MongoClient` or `Collection` in tests after the update**
112
+ Same cause, same fix: two mongodb versions are installed. Raise the project's own entry to 7.7.0 and run
113
+ `pnpm install`.
114
+
115
+ ## Module Documentation
116
+
117
+ - [nest-server-starter `extras/align-package-versions.mjs`](https://github.com/lenneTech/nest-server-starter/blob/main/extras/align-package-versions.mjs)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nest-server",
3
- "version": "11.42.14",
3
+ "version": "11.42.15",
4
4
  "description": "Modern, fast, powerful Node.js web framework in TypeScript based on Nest with a GraphQL API and a connection to MongoDB (or other databases).",
5
5
  "keywords": [
6
6
  "node",
@@ -91,7 +91,7 @@
91
91
  "dependencies": {
92
92
  "@apollo/server": "5.5.1",
93
93
  "@as-integrations/express5": "1.1.2",
94
- "@getbrevo/brevo": "6.0.3",
94
+ "@getbrevo/brevo": "6.2.0",
95
95
  "@modelcontextprotocol/sdk": "1.32.1",
96
96
  "@nestjs/apollo": "13.4.5",
97
97
  "@nestjs/common": "11.2.7",
@@ -125,11 +125,11 @@
125
125
  "js-sha256": "1.0.0",
126
126
  "json-to-graphql-query": "2.3.0",
127
127
  "lodash": "4.18.1",
128
- "mongodb": "7.6.0",
129
- "mongoose": "9.10.4",
128
+ "mongodb": "7.7.0",
129
+ "mongoose": "9.11.2",
130
130
  "multer": "2.4.0",
131
131
  "node-mailjet": "6.0.11",
132
- "nodemailer": "10.1.0",
132
+ "nodemailer": "10.1.2",
133
133
  "passport": "0.7.0",
134
134
  "passport-jwt": "4.0.1",
135
135
  "reflect-metadata": "0.2.2",
@@ -137,7 +137,7 @@
137
137
  "rxjs": "7.8.2",
138
138
  "supertest": "7.3.1",
139
139
  "ts-morph": "28.0.0",
140
- "undici": "7.30.0",
140
+ "undici": "7.30.1",
141
141
  "ws": "8.21.3",
142
142
  "yuml-diagram": "1.2.0"
143
143
  },
@@ -182,9 +182,9 @@
182
182
  }
183
183
  },
184
184
  "devDependencies": {
185
- "@aws-sdk/client-s3": "3.1149.0",
186
- "@aws-sdk/lib-storage": "3.1149.0",
187
- "@aws-sdk/s3-request-presigner": "3.1149.0",
185
+ "@aws-sdk/client-s3": "3.1152.0",
186
+ "@aws-sdk/lib-storage": "3.1152.0",
187
+ "@aws-sdk/s3-request-presigner": "3.1152.0",
188
188
  "@better-auth/core": "1.7.7",
189
189
  "@better-auth/passkey": "1.7.7",
190
190
  "@compodoc/compodoc": "2.0.0",
@@ -204,16 +204,16 @@
204
204
  "@types/passport": "1.0.17",
205
205
  "@vitest/coverage-v8": "4.1.11",
206
206
  "better-auth": "1.7.7",
207
- "bullmq": "6.3.12",
207
+ "bullmq": "6.3.15",
208
208
  "cross-env": "10.1.0",
209
209
  "ioredis": "6.0.0",
210
210
  "nodemon": "3.1.14",
211
211
  "npm-watch": "0.13.0",
212
212
  "otpauth": "9.5.2",
213
- "oxfmt": "0.71.0",
214
- "oxlint": "1.87.0",
213
+ "oxfmt": "0.72.0",
214
+ "oxlint": "1.88.0",
215
215
  "rimraf": "6.1.3",
216
- "smtp-server": "3.19.21",
216
+ "smtp-server": "3.19.23",
217
217
  "ts-node": "10.9.2",
218
218
  "tsconfig-paths": "4.2.0",
219
219
  "tsx": "4.23.15",
@@ -1040,7 +1040,7 @@ better-auth 1.7.0–1.7.2 keyed accounts by `(issuer, accountId)`; 1.7.3 restore
1040
1040
  recognised by shape, so a renamed collection or field is covered. Existing `issuer` values stay;
1041
1041
  they are inert. The backfill marker is deleted, so a rollback to a better-auth that needs the
1042
1042
  issuer runs the backfill again. Log line: `Dropped the unique index "…" on account(issuer,
1043
- accountId)`. A failure is logged at `error` and the boot continues.
1043
+ accountId)`. A failure is logged at `error` and the boot continues.
1044
1044
  - **better-auth 1.7.0–1.7.2: `backfillAccountIssuers()`, described below.** Kept for a project that
1045
1045
  has not raised its better-auth pin yet.
1046
1046
 
@@ -121,7 +121,7 @@ Every action writes an audit line: `[HUB-ACTION] <action> by user <id>`.
121
121
  whose `env` is not `local`/`development`/`test`/`ci`/`e2e`) — it suppresses outgoing mail.
122
122
  - **Public-access guard**: `roles: false` (no auth check — public config viewer, logs and destructive
123
123
  actions) throws at startup in any **reachable** environment unless `hub.allowPublicAccessInProduction:
124
- true` is set explicitly. This closes the single most dangerous Hub misconfiguration (a `roles: false`
124
+ true` is set explicitly. This closes the single most dangerous Hub misconfiguration (a `roles: false`
125
125
  copied from a local config into a reachable environment). The reachable check is fail-safe: it treats
126
126
  every env name except the known local/test set as reachable, so a custom name (`prod`, `preprod`,
127
127
  `staging-2`, …) cannot bypass it. Only acknowledge public access behind a fully-controlled network