@lenne.tech/nest-server 12.9.4 → 12.10.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 (152) hide show
  1. package/.claude/rules/configurable-features.md +5 -1
  2. package/.claude/rules/package-management.md +38 -12
  3. package/.claude/rules/role-system.md +12 -0
  4. package/.claude/rules/testing.md +4 -4
  5. package/CLAUDE.md +10 -1
  6. package/FRAMEWORK-API.md +2 -1
  7. package/dist/core/common/decorators/rest-user.decorator.js +4 -0
  8. package/dist/core/common/decorators/rest-user.decorator.js.map +1 -1
  9. package/dist/core/common/filters/http-exception-log.filter.js +3 -0
  10. package/dist/core/common/filters/http-exception-log.filter.js.map +1 -1
  11. package/dist/core/common/helpers/context.helper.js +9 -0
  12. package/dist/core/common/helpers/context.helper.js.map +1 -1
  13. package/dist/core/common/helpers/decorator.helper.js +4 -0
  14. package/dist/core/common/helpers/decorator.helper.js.map +1 -1
  15. package/dist/core/common/helpers/execution-context-request.helper.d.ts +14 -1
  16. package/dist/core/common/helpers/execution-context-request.helper.js +36 -0
  17. package/dist/core/common/helpers/execution-context-request.helper.js.map +1 -1
  18. package/dist/core/common/helpers/graphql-upload.helper.d.ts +10 -0
  19. package/dist/core/common/helpers/graphql-upload.helper.js +237 -0
  20. package/dist/core/common/helpers/graphql-upload.helper.js.map +1 -0
  21. package/dist/core/common/helpers/redact-secrets.helper.js +7 -2
  22. package/dist/core/common/helpers/redact-secrets.helper.js.map +1 -1
  23. package/dist/core/common/interceptors/translate-response.interceptor.js +4 -0
  24. package/dist/core/common/interceptors/translate-response.interceptor.js.map +1 -1
  25. package/dist/core/common/interfaces/server-options.interface.d.ts +11 -0
  26. package/dist/core/common/middleware/request-context.middleware.js +3 -0
  27. package/dist/core/common/middleware/request-context.middleware.js.map +1 -1
  28. package/dist/core/common/plugins/complexity.plugin.js +73 -9
  29. package/dist/core/common/plugins/complexity.plugin.js.map +1 -1
  30. package/dist/core/common/services/request-context.service.d.ts +2 -0
  31. package/dist/core/common/services/request-context.service.js +3 -0
  32. package/dist/core/common/services/request-context.service.js.map +1 -1
  33. package/dist/core/modules/ai/core-ai-mcp.controller.js +4 -2
  34. package/dist/core/modules/ai/core-ai-mcp.controller.js.map +1 -1
  35. package/dist/core/modules/ai/core-ai.constants.d.ts +1 -0
  36. package/dist/core/modules/ai/core-ai.constants.js +1 -0
  37. package/dist/core/modules/ai/core-ai.constants.js.map +1 -1
  38. package/dist/core/modules/ai/core-ai.module.js +2 -0
  39. package/dist/core/modules/ai/core-ai.module.js.map +1 -1
  40. package/dist/core/modules/ai/decorators/ai-agent-function.decorator.d.ts +8 -0
  41. package/dist/core/modules/ai/decorators/ai-agent-function.decorator.js +8 -0
  42. package/dist/core/modules/ai/decorators/ai-agent-function.decorator.js.map +1 -0
  43. package/dist/core/modules/ai/helpers/ai-verified-user.helper.d.ts +12 -0
  44. package/dist/core/modules/ai/helpers/ai-verified-user.helper.js +23 -0
  45. package/dist/core/modules/ai/helpers/ai-verified-user.helper.js.map +1 -0
  46. package/dist/core/modules/ai/index.d.ts +8 -0
  47. package/dist/core/modules/ai/index.js +8 -0
  48. package/dist/core/modules/ai/index.js.map +1 -1
  49. package/dist/core/modules/ai/interfaces/llm-provider.interface.d.ts +1 -0
  50. package/dist/core/modules/ai/models/core-ai-mcp-oauth.models.js +2 -0
  51. package/dist/core/modules/ai/models/core-ai-mcp-oauth.models.js.map +1 -1
  52. package/dist/core/modules/ai/providers/ai-egress.helper.d.ts +6 -0
  53. package/dist/core/modules/ai/providers/ai-egress.helper.js +58 -0
  54. package/dist/core/modules/ai/providers/ai-egress.helper.js.map +1 -0
  55. package/dist/core/modules/ai/providers/ai-sdk.packages.d.ts +16 -0
  56. package/dist/core/modules/ai/providers/ai-sdk.packages.js +99 -0
  57. package/dist/core/modules/ai/providers/ai-sdk.packages.js.map +1 -0
  58. package/dist/core/modules/ai/providers/ai-sdk.provider.d.ts +51 -0
  59. package/dist/core/modules/ai/providers/ai-sdk.provider.js +244 -0
  60. package/dist/core/modules/ai/providers/ai-sdk.provider.js.map +1 -0
  61. package/dist/core/modules/ai/providers/llm-provider.factory.d.ts +11 -1
  62. package/dist/core/modules/ai/providers/llm-provider.factory.js +44 -3
  63. package/dist/core/modules/ai/providers/llm-provider.factory.js.map +1 -1
  64. package/dist/core/modules/ai/providers/openai-compatible.provider.js +4 -21
  65. package/dist/core/modules/ai/providers/openai-compatible.provider.js.map +1 -1
  66. package/dist/core/modules/ai/services/core-ai-agent-function.bridge.d.ts +34 -0
  67. package/dist/core/modules/ai/services/core-ai-agent-function.bridge.js +130 -0
  68. package/dist/core/modules/ai/services/core-ai-agent-function.bridge.js.map +1 -0
  69. package/dist/core/modules/ai/services/core-ai-mcp-oauth.service.d.ts +28 -3
  70. package/dist/core/modules/ai/services/core-ai-mcp-oauth.service.js +141 -15
  71. package/dist/core/modules/ai/services/core-ai-mcp-oauth.service.js.map +1 -1
  72. package/dist/core/modules/ai/services/core-ai-mcp.service.js +2 -1
  73. package/dist/core/modules/ai/services/core-ai-mcp.service.js.map +1 -1
  74. package/dist/core/modules/ai/services/core-ai.service.js +2 -7
  75. package/dist/core/modules/ai/services/core-ai.service.js.map +1 -1
  76. package/dist/core/modules/ai/tools/ai-tool-result.helper.d.ts +2 -0
  77. package/dist/core/modules/ai/tools/ai-tool-result.helper.js +117 -0
  78. package/dist/core/modules/ai/tools/ai-tool-result.helper.js.map +1 -0
  79. package/dist/core/modules/ai/tools/ai-tool-schema.helper.d.ts +36 -0
  80. package/dist/core/modules/ai/tools/ai-tool-schema.helper.js +81 -0
  81. package/dist/core/modules/ai/tools/ai-tool-schema.helper.js.map +1 -0
  82. package/dist/core/modules/ai/tools/ai-tool.registry.js +2 -1
  83. package/dist/core/modules/ai/tools/ai-tool.registry.js.map +1 -1
  84. package/dist/core/modules/auth/guards/auth.guard.js +10 -2
  85. package/dist/core/modules/auth/guards/auth.guard.js.map +1 -1
  86. package/dist/core/modules/auth/guards/legacy-auth-rate-limit.guard.js +4 -1
  87. package/dist/core/modules/auth/guards/legacy-auth-rate-limit.guard.js.map +1 -1
  88. package/dist/core/modules/auth/guards/roles.guard.js +11 -1
  89. package/dist/core/modules/auth/guards/roles.guard.js.map +1 -1
  90. package/dist/core/modules/better-auth/better-auth-roles.guard.js +15 -1
  91. package/dist/core/modules/better-auth/better-auth-roles.guard.js.map +1 -1
  92. package/dist/core/modules/better-auth/better-auth.config.js +78 -0
  93. package/dist/core/modules/better-auth/better-auth.config.js.map +1 -1
  94. package/dist/core/modules/tenant/core-tenant.guard.js +9 -1
  95. package/dist/core/modules/tenant/core-tenant.guard.js.map +1 -1
  96. package/dist/core.module.js +2 -1
  97. package/dist/core.module.js.map +1 -1
  98. package/dist/index.d.ts +1 -0
  99. package/dist/index.js +1 -0
  100. package/dist/index.js.map +1 -1
  101. package/dist/types/graphql-upload.d.ts +34 -2
  102. package/docs/REQUEST-LIFECYCLE.md +59 -10
  103. package/migration-guides/12.10.0-to-12.10.1.md +182 -0
  104. package/migration-guides/12.9.3-to-12.9.4.md +3 -1
  105. package/migration-guides/12.9.x-to-12.10.x.md +271 -0
  106. package/package.json +46 -21
  107. package/src/core/common/decorators/rest-user.decorator.ts +6 -0
  108. package/src/core/common/filters/http-exception-log.filter.ts +8 -0
  109. package/src/core/common/helpers/context.helper.ts +14 -0
  110. package/src/core/common/helpers/decorator.helper.ts +5 -0
  111. package/src/core/common/helpers/execution-context-request.helper.ts +97 -1
  112. package/src/core/common/helpers/graphql-upload.helper.ts +520 -0
  113. package/src/core/common/helpers/redact-secrets.helper.ts +22 -3
  114. package/src/core/common/interceptors/translate-response.interceptor.ts +8 -0
  115. package/src/core/common/interfaces/server-options.interface.ts +98 -0
  116. package/src/core/common/middleware/request-context.middleware.ts +3 -0
  117. package/src/core/common/plugins/complexity.plugin.ts +150 -9
  118. package/src/core/common/services/request-context.service.ts +11 -0
  119. package/src/core/modules/ai/INTEGRATION-CHECKLIST.md +16 -0
  120. package/src/core/modules/ai/README.md +101 -0
  121. package/src/core/modules/ai/core-ai-mcp.controller.ts +7 -2
  122. package/src/core/modules/ai/core-ai.constants.ts +4 -0
  123. package/src/core/modules/ai/core-ai.module.ts +3 -0
  124. package/src/core/modules/ai/decorators/ai-agent-function.decorator.ts +44 -0
  125. package/src/core/modules/ai/helpers/ai-verified-user.helper.ts +47 -0
  126. package/src/core/modules/ai/index.ts +8 -0
  127. package/src/core/modules/ai/interfaces/ai-tool.interface.ts +5 -1
  128. package/src/core/modules/ai/interfaces/llm-provider.interface.ts +6 -0
  129. package/src/core/modules/ai/models/core-ai-mcp-oauth.models.ts +4 -0
  130. package/src/core/modules/ai/providers/ai-egress.helper.ts +98 -0
  131. package/src/core/modules/ai/providers/ai-sdk.packages.ts +153 -0
  132. package/src/core/modules/ai/providers/ai-sdk.provider.ts +383 -0
  133. package/src/core/modules/ai/providers/llm-provider.factory.ts +93 -2
  134. package/src/core/modules/ai/providers/openai-compatible.provider.ts +5 -23
  135. package/src/core/modules/ai/services/core-ai-agent-function.bridge.ts +170 -0
  136. package/src/core/modules/ai/services/core-ai-mcp-oauth.service.ts +240 -20
  137. package/src/core/modules/ai/services/core-ai-mcp.service.ts +3 -1
  138. package/src/core/modules/ai/services/core-ai.service.ts +5 -7
  139. package/src/core/modules/ai/tools/ai-tool-result.helper.ts +153 -0
  140. package/src/core/modules/ai/tools/ai-tool-schema.helper.ts +134 -0
  141. package/src/core/modules/ai/tools/ai-tool.registry.ts +6 -1
  142. package/src/core/modules/auth/guards/auth.guard.ts +19 -2
  143. package/src/core/modules/auth/guards/legacy-auth-rate-limit.guard.ts +9 -2
  144. package/src/core/modules/auth/guards/roles.guard.ts +23 -1
  145. package/src/core/modules/better-auth/INTEGRATION-CHECKLIST.md +11 -0
  146. package/src/core/modules/better-auth/README.md +204 -0
  147. package/src/core/modules/better-auth/better-auth-roles.guard.ts +29 -1
  148. package/src/core/modules/better-auth/better-auth.config.ts +138 -1
  149. package/src/core/modules/tenant/core-tenant.guard.ts +13 -1
  150. package/src/core.module.ts +5 -1
  151. package/src/index.ts +1 -0
  152. package/src/types/graphql-upload.d.ts +34 -2
@@ -0,0 +1,182 @@
1
+ # Migration Guide: 12.10.0 → 12.10.1
2
+
3
+ ## Overview
4
+
5
+ | Category | Details |
6
+ |---|---|
7
+ | **Breaking Changes** | None |
8
+ | **New Features** | None. Two exported constants name the new limits: `GRAPHQL_UPLOAD_MAX_PATH_KEYS`, `GRAPHQL_UPLOAD_MAX_MAP_KEYS` |
9
+ | **Bugfixes** | None |
10
+ | **Security** | Unauthenticated denial of service, every one fixed in the framework — no action needed: GraphQL multipart requests with a deep `map` path, with many `map` entries or with a numeric path key like `4294967294` (§1); the GraphQL complexity check on invalid variables, documents of many operations, fragments spread thousands of times and tens of thousands of variables, a plain JSON POST included (§2). A PEM private key under a key such as `certificate` is masked in `GET /config`, the Hub config panel and the `ConfigService` debug output (§3) |
11
+ | **Migration Effort** | Package update |
12
+
13
+ ## Quick Migration
14
+
15
+ ```bash
16
+ pnpm add @lenne.tech/nest-server@12.10.1
17
+ pnpm run update # nest-server-starter based projects
18
+ pnpm run build
19
+ pnpm test
20
+ ```
21
+
22
+ **Vendor mode**: run `/lt-dev:backend:update-nest-server-core` as usual.
23
+
24
+ ## 1. Security: a bounded `map` in GraphQL multipart uploads
25
+
26
+ **No action needed** unless the project registers `graphqlUploadExpress()` itself with graphql-upload's default parser
27
+ (below).
28
+
29
+ `CoreModule` registers graphql-upload's `graphqlUploadExpress()` for `/graphql`, in front of every guard, and since
30
+ 12.10.0 passes it the framework's `processGraphQlUploadRequest` (see the 12.9.x → 12.10.x guide, "Security: GraphQL
31
+ multipart uploads"). That parser creates an upload for every entry of the multipart `map` field and places it at each
32
+ path the entry names, with object-path's `set()`. Nothing bounded what that builds:
33
+
34
+ - `set()` recurses once per key and copies the remaining keys each time, so a path of n keys costs O(n²) memory and
35
+ time, all of it in one synchronous call.
36
+ - An entry whose file never arrives is rejected at the end of the request with an error of its own, stack trace
37
+ included — a `map` can name tens of thousands of entries without a single path.
38
+ - object-path reads a key like `4294967294` as a NUMBER and sets that index of an array it creates. The 258-byte
39
+ request `map={"1":["variables.f.4294967294"]}` handed GraphQL an array of 4,294,967,295 elements, and GraphQL's list
40
+ coercion walks every hole: the complexity plugin did, before any guard, until the heap ran out. With a nullable
41
+ list item (`[Upload]`) every hole is a valid `null`, so execution would walk them too.
42
+
43
+ Measured on Node 24, one anonymous request each:
44
+
45
+ | `map` | Before 12.10.1 | 12.10.1 |
46
+ |---|---|---|
47
+ | one path of 8,000 keys (16 KB) | +310 MB, event loop blocked 0.5 s | 400, ~10 ms |
48
+ | one path of 40,000 keys (80 KB), 1 GB heap | heap exhausted, the process ends | 400, ~15 ms |
49
+ | one path of 400,000 keys (800 KB, inside the default 1 MB `maxFieldSize`) | heap exhausted after ~13 s (default heap) | 400, ~20 ms |
50
+ | 1 MB of 64-key paths | event loop blocked 150–640 ms | 400, ~20 ms |
51
+ | 1 MB of entries without a path (83,000 entries) | +230 MB, event loop blocked 410 ms | 400, +50 MB, ~35 ms |
52
+ | `{"1":["variables.f.4294967294"]}` (258 bytes), 1 GB heap | heap exhausted after 9 s, the process ends | 400, +2 MB, ~12 ms |
53
+
54
+ graphql-upload's own parser has the same flaws, 17.1.0 as well as 18.0.2.
55
+
56
+ Since 12.10.1 `processGraphQlUploadRequest` refuses with 400:
57
+
58
+ - a path with more than `GRAPHQL_UPLOAD_MAX_PATH_KEYS` (64) keys — "Invalid object path",
59
+ - a `map` with more than `GRAPHQL_UPLOAD_MAX_MAP_KEYS` (10,000) units. Every entry counts one, every key of its paths
60
+ one more, and every array element a numeric key creates one more, holes included: `{"1":["variables.files.0"]}`
61
+ counts 5, or 4 when the operations already hold `files: [null]`; `variables.f.4294967294` counts more than four
62
+ billion. The path that goes over the bound is answered with "Invalid object path", an entry with "Invalid ‘map’
63
+ multipart field entry key …" before its upload is created.
64
+
65
+ A path a client library builds has a handful of keys: `variables.file` has 2, `variables.input.files.3` has 4, a
66
+ batched `0.variables.file` has 3. 10,000 units are at least 2,000 files at `variables.files.N`. The most expensive
67
+ request the bounds still accept — 10,000 entries without a path — blocks the event loop for about 60 ms with +45 MB.
68
+
69
+ **A project that registers `graphqlUploadExpress()` itself** already passes `processRequest: processGraphQlUploadRequest`
70
+ since 12.10.0 and gets the bounds with the update. One that still passes graphql-upload's default has neither these
71
+ bounds nor the 12.10.0 fixes:
72
+
73
+ ```typescript
74
+ import { processGraphQlUploadRequest } from '@lenne.tech/nest-server';
75
+ import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
76
+
77
+ consumer
78
+ .apply(graphqlUploadExpress({ maxFiles: 10, maxFileSize: 10_000_000, processRequest: processGraphQlUploadRequest }))
79
+ .forRoutes('my-upload-route');
80
+ ```
81
+
82
+ Find such registrations with `grep -rn "graphqlUploadExpress(" src/`. `maxFiles` stays graphql-upload's option: it
83
+ limits the files of a request, which the `map` bound does not replace.
84
+
85
+ ## 2. Security: the complexity check is bounded
86
+
87
+ `ComplexityPlugin` (registered by `CoreModule` whenever GraphQL is on) computes every operation's cost in Apollo's
88
+ `didResolveOperation`, after parsing and validation, before any guard. It called graphql-query-complexity's
89
+ `getComplexity()`, and these requests made that call itself the denial of service — each one anonymous, a plain JSON
90
+ POST to `/graphql` included:
91
+
92
+ - **Invalid variables.** `getComplexity()` coerces the variables with graphql's `getVariableValues()` without an error
93
+ cap, so a list of invalid items (`"variables":{"f":[0,0,…]}` for `$f: [Upload!]!`) created one `GraphQLError` per item.
94
+ - **Many operations, no `operationName`.** Apollo resolves no operation and still calls the hook. `getComplexity()`
95
+ then evaluated EVERY operation of the document and coerced the variables for each.
96
+ - **Fragment spreads.** graphql-query-complexity evaluates a fragment again at every spread, coercing its literal
97
+ arguments each time. Its node cap (10,000 visits) bounds the visits, not what one costs:
98
+ `{...F …×3300} fragment F on Query { findUsers(filter: { singleFilter: { …, value: [0,0,…] } }) { __typename } }`.
99
+ - **Many declared variables.** At every field it visits, the library walks every declared variable.
100
+ - **Many failing arguments.** The library catches the coercion error of every field's arguments and goes on, and every
101
+ error locates itself by scanning the query up to its field: `query($x: String = "a") { a: getUser(id: $x) { id } … }`
102
+ with `{"x": null}` is valid and fails at every field.
103
+
104
+ | Request | Before 12.10.1 | 12.10.1 |
105
+ |---|---|---|
106
+ | 100 KB of invalid list items | event loop blocked 1.5 s, +300 MB | ~5 ms, +1 MB |
107
+ | 1 MB of invalid list items | event loop blocked 15 s, +2 GB | ~10 ms, +13 MB |
108
+ | 860 operations sharing one 16,000-item variable (100 KB) | event loop blocked 5.9 s | < 1 ms, refused by execution |
109
+ | the same with 1,720 operations (200 KB multipart) | event loop blocked 25.5 s | < 1 ms, refused by execution |
110
+ | a 41,667-item literal in a fragment spread 3,300 times (100 KB) | event loop blocked 2.2 s | ~15 ms, "Query is too complex" |
111
+ | the same with a 490,000-item literal (990 KB multipart) | event loop blocked 22.5 s | ~100 ms, "Query is too complex" |
112
+ | 38,000 declared variables and 4,900 spreads (1.2 MB) | event loop blocked 17 s | ~100 ms, "Query is too complex" |
113
+ | 2,300 fields failing their argument, after 25,000 line breaks (98 KiB) | event loop blocked 1.4 s | ~6 ms, refused with the first error |
114
+ | 9,999 such fields after 395,000 line breaks (993 KiB multipart) | event loop blocked 86 s | ~16 ms, refused with the first error |
115
+
116
+ What is left for the large literal and the many variables is linear in the request: graphql's validation and
117
+ execution walk the same literal and the same variables once themselves.
118
+
119
+ Since 12.10.1 the plugin:
120
+
121
+ 1. does nothing when Apollo resolved no operation — graphql's `execute()` then refuses the request ("Must provide
122
+ operation name…") before it coerces a single variable;
123
+ 2. coerces the resolved operation's variables, stopping at the first error, and skips the complexity check when they
124
+ do not coerce: `execute()` refuses such variables itself, with graphql's cap of 50, before any resolver runs, so
125
+ there is no operation whose cost could matter;
126
+ 3. refuses an operation whose fields (and `@skip` / `@include`) times declared variables exceed 250,000, with
127
+ `Query is too complex: too many fields for its number of variables` — measured at most about 23 ms of analysis.
128
+ With the default cost of 1 per field, a query `maxComplexity: 1000` accepts has at most 1,000 fields; with 30
129
+ variables that is at most 30,000;
130
+ 4. computes graphql-query-complexity's number with each fragment evaluated once and reused at every further spread.
131
+ The number is the one `getComplexity()` returns, and the 10,000-node cap still counts every spread. A field's
132
+ `complexity` extension that is a function runs once per fragment instead of once per spread, so it must depend only
133
+ on its arguments and `childComplexity`;
134
+ 5. stops the analysis at its first error and refuses the request with it — `getComplexity()` collected every error and
135
+ threw the last one.
136
+
137
+ For valid variables the result is what it was: `Query is too complex: …` above `graphQl.maxComplexity`, and
138
+ `Query exceeds the maximum allowed number of nodes.` above 10,000 nodes.
139
+
140
+ **What clients see:** a request with invalid variables gets execution's errors (up to 50 messages, then "Too many
141
+ errors processing variables, error limit reached. Execution aborted.") instead of the single coercion error the plugin
142
+ threw before. The status changes with it: HTTP 400 with the code `BAD_USER_INPUT` (Apollo 5 default
143
+ `status400ForVariableCoercionErrors`) instead of HTTP 500 with `INTERNAL_SERVER_ERROR`.
144
+
145
+ ## 3. Security: PEM private keys are masked by their value
146
+
147
+ `redactSecrets()` — behind `GET /config`, the Hub config panel and the `ConfigService` output with `warn: true` —
148
+ decided by the key name alone. A certificate login usually keeps certificate and private key in one PEM under a name
149
+ such as `certificate`, which no name rule may treat as secret, so the private key reached an administrator's response
150
+ and the debug output in clear text. Since 12.10.1 every string and `Buffer` that holds a PEM private key
151
+ (`-----BEGIN … PRIVATE KEY-----`, PGP's `PRIVATE KEY BLOCK` included) is masked as a whole, whatever its key is called.
152
+ A certificate without a key stays readable. Keys named `pfx` or `pkcs12` are masked too: a PKCS#12 container carries
153
+ no text marker.
154
+
155
+ No action needed. A project that worked around it with `security.secretFields: ['certificate']` can keep that entry.
156
+
157
+ ## Compatibility Notes
158
+
159
+ | Pattern | Status |
160
+ |---|---|
161
+ | Uploads through `CoreModule`'s `/graphql` registration | Bounded with the update |
162
+ | `graphqlUploadExpress()` registered by the project with `processRequest: processGraphQlUploadRequest` | Bounded with the update |
163
+ | `graphqlUploadExpress()` registered by the project without `processRequest` | Not protected — pass `processGraphQlUploadRequest` (§1) |
164
+ | A project's own Apollo plugin that calls `getComplexity()` with the request's variables | Same flaws as §2 — skip a request without a resolved operation, check the variables with `getVariableValues(…, { maxErrors: 50 })` first, and bound fragment spreads and variables, or rely on the framework's plugin |
165
+
166
+ ## Troubleshooting
167
+
168
+ | Symptom | Cause | Fix |
169
+ |---|---|---|
170
+ | An upload answers 400 `Invalid object path for the ‘map’ multipart field …` for a path with many keys | The path has more than 64 keys | Place the file at a flatter variable (`variables.input.files.3`) |
171
+ | An upload answers 400 `Invalid object path …` for a path with a large number in it | The index creates more array elements than the bound allows | Number the files from 0 (`variables.files.0`, `variables.files.1`) |
172
+ | An upload of very many files answers 400 `Invalid object path …` or `Invalid ‘map’ multipart field entry key …` | The `map` has more than 10,000 units | Split the upload into several requests |
173
+ | A request with invalid variables answers with several variable errors instead of one | Execution reports them now (§2) | Fix the variables; the messages are graphql's own |
174
+ | A query answers `Query is too complex: too many fields for its number of variables` | Its fields × declared variables exceed 250,000 (§2) | Split the query, or pass related values as one input-object variable |
175
+
176
+ ## Module Documentation
177
+
178
+ - `docs/REQUEST-LIFECYCLE.md` — "3. graphqlUploadExpress", feature table "Complexity Analysis"
179
+ - `src/core/common/helpers/graphql-upload.helper.ts` — the parser, the two constants and why they exist
180
+ - `src/core/common/plugins/complexity.plugin.ts` — the bounds and why they exist
181
+ - `src/core/common/helpers/redact-secrets.helper.ts` — the masker and its rules
182
+ - `migration-guides/12.9.x-to-12.10.x.md` — "Security: GraphQL multipart uploads" (the 12.10.0 fixes)
@@ -108,7 +108,9 @@ needs no authentication, and every application with GraphQL subscriptions accept
108
108
  exact-pins at 8.22.1. nest-server's own `overrides:` do not reach your install (`docs/security-overrides.md`), so put the
109
109
  entry into your project's `pnpm-workspace.yaml` and run `pnpm install`. A nest-server-starter based project already has
110
110
  an 8.x entry, `'ws@>=8.0.0 <8.22.1': 8.22.1`: **replace** it, do not only raise its target — its key does not match
111
- the exact `8.22.1` that `@nestjs/graphql` requests, so the vulnerable copy would stay. The 7.x entry stays as it is.
111
+ the exact `8.22.1` that `@nestjs/graphql` requests, so the vulnerable copy would stay. Its 7.x entry
112
+ `'ws@>=7.0.0 <7.5.13': 7.5.13` is a pre-emptive floor for projects that add `subscriptions-transport-ws`; 7.5.13 is
113
+ covered by the same advisory (patched 7.5.14), so raise it to `'ws@>=7.0.0 <7.5.14': '7.5.14'` as well.
112
114
 
113
115
  ```yaml
114
116
  overrides:
@@ -0,0 +1,271 @@
1
+ # Migration Guide: 12.9.x → 12.10.x
2
+
3
+ > **This minor contains breaking changes** (see "Breaking Changes"): secret fields no longer reach the model, the client
4
+ > or an MCP client through an AI tool result; a failed OAuth sign-in without its own error URL lands on the app's login
5
+ > page instead of Better-Auth's error page; a `socialProviders.<name>.scope` that is neither a string nor a list is
6
+ > ignored. The MAJOR digit follows NestJS, so a breaking change ships as a minor here — read this guide before updating.
7
+
8
+ ## Overview
9
+
10
+ | Category | Details |
11
+ |----------|---------|
12
+ | **Breaking Changes** | (1) Failed OAuth sign-ins without their own error URL, and `GET /iam/error`, now land on `<appUrl>/auth/login?error=<code>` (`betterAuth.errorUrl`, `false` restores Better-Auth's page). (2) A `socialProviders.<name>.scope` that is neither a string nor a list is ignored with an error at boot. (3) AI tool results lose every secret field (`password`, `verificationToken`, `passwordResetToken`, `passwordResetTokenExpiresAt`, `refreshTokens`, `tempTokens`, `apiKeyEncrypted`, `security.secretFields`, each also as its SQL column) — in the chat loop, in `actions[].result` and in `/ai/mcp` `tools/call` |
13
+ | **Security fixes** | GraphQL multipart uploads: one anonymous request to `/graphql` could crash the process (graphql-upload GHSA-5vm7-vc2x-p3w2, high), and duplicate file fields leaked temporary files (GHSA-qwwm-252j-9whw, medium) — fixed by the framework's own parser, no action needed (see "Security: GraphQL multipart uploads"). MCP OAuth tokens are bound to their resource (RFC 8707). With `@nestjs/ai` or `@nestjs/mcp` installed, the framework's global guards decided agent function / MCP tool calls on the tool ARGUMENTS (`switchToHttp()` is index 0 there): `{ "user": { "roles": ["admin"] } }` in a model's tool call was the authenticated caller. Now the request the call runs in decides; a request-less caller is anonymous |
14
+ | **New Features** | Social provider options reach Better-Auth (`tenantId`, `scope`, `prompt`, `mapProfileToUser`, …), `scope` from an environment variable, `betterAuth.errorUrl`; AI SDK transport (`providerType: 'nestjs-ai'`, `LlmProviderFactory.registerAiSdkModel()`), `@AgentFunction()` methods as AI tools (`ai.agentFunctions`, `@AiAgentFunction()`), Standard Schema tool parameters, `CoreAiMcpOAuthService.createMcpTokenVerifier()` for a `@nestjs/mcp` endpoint, `RequestContext.getRequest()`, `LlmCompletionOptions.abortSignal` |
15
+ | **Bugfixes** | `HttpExceptionLogFilter` no longer throws on non-HTTP transports (the model read "Internal server error" for every refusal of an agent function) |
16
+ | **Migration Effort** | ~5 minutes: check that the app has `/auth/login` (or set `betterAuth.errorUrl`), and that no AI tool returns a secret-named field on purpose |
17
+
18
+ ## Quick Migration
19
+
20
+ ```bash
21
+ pnpm add @lenne.tech/nest-server@12.10.x
22
+ pnpm run update # only if you use the starter's update script
23
+ pnpm run build
24
+ pnpm test
25
+ ```
26
+
27
+ No new dependency is required. `ai`, `@nestjs/ai` and `@nestjs/resilience` are new **optional** peers — install them
28
+ only for the integrations below.
29
+
30
+ ## Security: GraphQL multipart uploads (graphql-upload GHSA-5vm7-vc2x-p3w2, GHSA-qwwm-252j-9whw)
31
+
32
+ **No action needed** unless the project registers `graphqlUploadExpress()` itself (below).
33
+
34
+ `CoreModule` registers graphql-upload's `graphqlUploadExpress()` for `/graphql`, in front of every guard. Up to 12.9.x
35
+ it ran graphql-upload's own `processRequest`, which accepted any object path in the multipart `map` field:
36
+
37
+ - **GHSA-5vm7-vc2x-p3w2 (high):** a path into an upload placed by an earlier entry replaced one of its methods. A
38
+ request with `map={"1":["variables.file"],"2":["variables.file.reject"]}` and no file fields made the parser throw
39
+ `TypeError: upload.reject is not a function` outside any request — an uncaught exception, on which the process
40
+ exits (`installProcessDiagnostics()` exits 1, as Node does without it). **One anonymous request took the server
41
+ down.** A path with a `__proto__` key let a client-supplied object pass the `GraphQLUpload` scalar's check.
42
+ - **GHSA-qwwm-252j-9whw (medium):** a second file field with the name of an already resolved upload created another
43
+ temporary file and dropped the reference to the first, which was never deleted — temporary files and file
44
+ descriptors leaked per request.
45
+
46
+ graphql-upload fixed both in 18.0.2, which requires graphql 17; this framework runs graphql 16. 12.10.0 therefore
47
+ ships `processGraphQlUploadRequest` (`common/helpers/graphql-upload.helper.ts`): graphql-upload 17.1.0's parser with
48
+ both upstream fixes, and `CoreModule` passes it to `graphqlUploadExpress()`. Such a `map` path is answered with 400
49
+ "Invalid object path", a duplicate file field is ignored. graphql-upload stays at 17.1.0 for its scalar and middleware.
50
+
51
+ **A project that registers `graphqlUploadExpress()` itself** (its own route, its own limits) passes the framework's
52
+ parser — graphql-upload's default is the vulnerable one:
53
+
54
+ ```typescript
55
+ import { processGraphQlUploadRequest } from '@lenne.tech/nest-server';
56
+ import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
57
+
58
+ consumer
59
+ .apply(graphqlUploadExpress({ maxFiles: 10, maxFileSize: 10_000_000, processRequest: processGraphQlUploadRequest }))
60
+ .forRoutes('graphql');
61
+ ```
62
+
63
+ Find such registrations with `grep -rn "graphqlUploadExpress(" src/`. A project that calls graphql-upload's
64
+ `processRequest` directly switches to `processGraphQlUploadRequest` (same signature and options).
65
+
66
+ **Behaviour change:** a GraphQL variable literally named `__proto__` that receives a file is refused with 400 (input
67
+ object fields cannot use that name; names starting with `__` are reserved).
68
+
69
+ ## What's New in 12.10.x
70
+
71
+ ### 0. Social sign-in: provider options and the error page (Better-Auth)
72
+
73
+ - **Provider options reach Better-Auth.** Until 12.9.4 `buildSocialProviders()` handed a provider only `clientId`,
74
+ `clientSecret` and `disableSignUp`; `tenantId`, `scope` and every other option were dropped without a word (a Microsoft
75
+ sign-in ran against `common` with Better-Auth's default scopes). Every option on `betterAuth.socialProviders.<name>`
76
+ except `enabled` is now passed on; the computed `clientId` / `clientSecret` / `disableSignUp` are written last, so a
77
+ string `disableSignUp` from `NEST_SERVER_CONFIG` still cannot open a closed registration.
78
+ - **`scope` from an environment variable works.** `NSC__…__SCOPE=openid,profile,email` is split on commas or spaces.
79
+ - **`betterAuth.errorUrl`** (`string | false`, default `<appUrl>/auth/login`; a path is resolved against the app URL)
80
+ becomes Better-Auth's `onAPIError.errorURL`. `options.onAPIError` is merged; its own `errorURL` wins.
81
+
82
+ ```typescript
83
+ betterAuth: {
84
+ errorUrl: '/auth/login', // default; false keeps Better-Auth's page on the API host
85
+ socialProviders: {
86
+ microsoft: { clientId, clientSecret, tenantId: '<tenant-id>', scope: 'openid,profile,email' },
87
+ },
88
+ },
89
+ ```
90
+
91
+ A login page maps the `error` query code to its own text and never renders `error_description` — anyone can set it
92
+ through a link to `/iam/error`. Details: [Better-Auth README](../src/core/modules/better-auth/README.md), "Social
93
+ providers".
94
+
95
+ ### 1. Global guards on `@nestjs/ai` and `@nestjs/mcp` calls
96
+
97
+ `@nestjs/ai` (`@AgentFunction()`) and `@nestjs/mcp` (`@Tool()`, `@Resource()`, `@Prompt()`) run every global guard,
98
+ interceptor and filter around their methods with the context types `'ai'` / `'mcp'`. The framework now resolves the
99
+ request of such a call from the call object (`caller.request`, `McpContext.request`):
100
+
101
+ - `@Roles()` on an agent function or MCP tool is decided against the request's user exactly as over HTTP, tenant
102
+ header included.
103
+ - A **request-less** caller — `caller: { user, scopes }` (a queue job), a durable run, MCP over stdio — is
104
+ **anonymous**: public methods run, every other one is refused with 401. To run a role-gated agent function from a job,
105
+ authenticate there and pass a request (`caller: { request }`).
106
+ - `@Restricted` and secret-field filtering apply to the result for the request's user.
107
+
108
+ Nothing to do unless you relied on the old behaviour (which read the tool arguments).
109
+
110
+ ### 2. AI SDK transport
111
+
112
+ ```typescript
113
+ // A model of @nestjs/ai's AiModule.forRoot({ models }): create a connection with
114
+ // providerType 'nestjs-ai', model 'default' (the registered name), baseUrl 'nestjs-ai:default'.
115
+
116
+ // Or any AI SDK provider for database-managed connections:
117
+ await llmProviderFactory.registerAiSdkModel('anthropic', (connection, { fetch }) =>
118
+ createAnthropic({ apiKey: connection.apiKey, fetch })(connection.model),
119
+ );
120
+ ```
121
+
122
+ Requires `ai` (`>=7.0.0 <8`); `nestjs-ai` additionally `@nestjs/ai` (`>=0.0.2 <0.0.3`) and `@nestjs/resilience`
123
+ (`>=0.0.3 <0.0.4`). Outside these ranges the call / boot fails with `AiSdkPackageError` naming the range. Hand the
124
+ provider the `fetch` from the builder context, or `ai.allowedBaseUrlHosts` does not cover it.
125
+
126
+ ### 3. Agent functions as AI tools
127
+
128
+ ```typescript
129
+ // config.env.ts
130
+ ai: { agentFunctions: true }, // or { include: ['cancel_booking'] } / { exclude: [...] }
131
+
132
+ // on the method
133
+ @AgentFunction({ name: 'cancel_booking', description: 'Cancel a booking', inputSchema: z.object({ id: z.string() }) })
134
+ @AiAgentFunction({ destructive: true })
135
+ @Roles(RoleEnum.S_USER)
136
+ cancel({ id }: { id: string }) { ... }
137
+ ```
138
+
139
+ The AI module's gates run first (role filter, policies and grants, `authorize()`, confirmation, plan mode, budgets),
140
+ then `@nestjs/ai`'s pipeline with the run's HTTP request. Roles default to the method's `@Roles()`, else `S_USER`.
141
+
142
+ ### 4. Standard Schema tool parameters
143
+
144
+ ```typescript
145
+ readonly parameters = z.object({ id: z.string() }) as any; // Zod 4.2+, ArkType, Valibot via toStandardJsonSchema()
146
+ ```
147
+
148
+ The registry stores the JSON Schema and validates the arguments before `authorize()` and `execute()`.
149
+
150
+ ### 5. A `@nestjs/mcp` endpoint with the framework's MCP OAuth server
151
+
152
+ `CoreAiMcpOAuthService.createMcpTokenVerifier({ resource })` returns a verifier for `McpModule`'s `auth.verifier`
153
+ (module README → "Your own `@nestjs/mcp` endpoint").
154
+
155
+ ### 6. MCP OAuth tokens are bound to their resource (RFC 8707)
156
+
157
+ The authorization server honours `resource` at `/authorize` and `/token` (code and refresh grant) and binds it into the
158
+ code, the refresh token and the access token (`aud`). `/ai/mcp` accepts only tokens for itself, a
159
+ `createMcpTokenVerifier()` only tokens for its `resource`; an unknown `resource` is `invalid_target`. Nothing changes for
160
+ today's clients: one that names no `resource` gets a token for `/ai/mcp`, and tokens and refresh tokens issued before
161
+ 12.10.0 stay valid at `/ai/mcp` (a refresh binds them to it). **SQL projects:** the tables of the MCP OAuth codes and refresh
162
+ tokens (collections `aiMcpOAuthCodes` / `aiMcpOAuthRefreshTokens` on MongoDB) gain a nullable `resource` column, which the boot adds as the owner role (`ownerUrl`);
163
+ without an owner connection add it with a migration.
164
+
165
+ ### 7. Dependencies
166
+
167
+ 12.10.0 declares NestJS 12.5.1. `pnpm run update` raises these pins where a nest-server-starter based project already
168
+ declares them:
169
+
170
+ | Package | From | To |
171
+ |---|---|---|
172
+ | `@nestjs/common`, `@nestjs/core`, `@nestjs/platform-express`, `@nestjs/testing` | 12.5.0 | 12.5.1 |
173
+ | `@nestjs/terminus` | 12.1.0 | 12.2.0 |
174
+ | `graphql-subscriptions` | 3.0.0 | 3.1.0 |
175
+ | `js-sha256` | 1.0.0 | 1.1.0 |
176
+ | `nodemailer` | 10.5.0 | 10.6.0 |
177
+ | `mongoose` (MongoDB projects) | 9.12.1 | 9.12.2 |
178
+
179
+ Where declared, also the optional peers `bullmq` 6.7.7, `@aws-sdk/*` 3.1171.0 and `ai` 7.0.176, and `vitest` /
180
+ `@vitest/coverage-v8` 5.1.1. `js-sha256` 1.1.0 now hashes multi-byte typed arrays (`Uint16Array`, `Float32Array`, …) by
181
+ their bytes, as Node's `crypto` does; string input — what the framework hashes — gives the same digests as before.
182
+
183
+ New direct `dependencies` for the multipart parser (see "Security: GraphQL multipart uploads"): `busboy` 1.6.0,
184
+ `fs-capacitor` 8.0.0, `http-errors` 2.0.1 and `object-path` 0.11.8 — the versions graphql-upload 17.1.0 already
185
+ installed, so an npm-mode project gets no new package. A vendor-mode project declares them (the core imports them
186
+ directly).
187
+
188
+ ## Breaking Changes
189
+
190
+ ### Failed OAuth sign-ins land on the app's login page
191
+
192
+ **Before:** a failed OAuth sign-in without an error URL of its own (state expired after ten minutes, missing or tampered;
193
+ a flow started without `errorCallbackURL`) and every `GET /iam/error` showed Better-Auth's English error page on the API
194
+ host.
195
+
196
+ **After:** they land on `<appUrl>/auth/login?error=<code>`.
197
+
198
+ **Action:** make sure the app has an `/auth/login` route that reads `error`, or set `betterAuth.errorUrl` to another
199
+ page (an absolute URL or a path). A project that customized Better-Auth's page
200
+ (`options.onAPIError.customizeDefaultErrorPage`) sets `betterAuth.errorUrl: false`. An explicit
201
+ `options.onAPIError.errorURL` still wins.
202
+
203
+ ### A `scope` that is neither a string nor a list is ignored
204
+
205
+ **Before:** an object (indexed `NSC__…__SCOPE__0` variables) made every `/iam/sign-in/social` throw a `TypeError`.
206
+
207
+ **After:** it is dropped with one error at boot, and the provider asks for its default scopes — with
208
+ `disableDefaultScope: true` for none, which the provider refuses.
209
+
210
+ **Action:** write one comma-separated `NSC__…__SCOPE` variable.
211
+
212
+ ### Secret fields leave AI tool results
213
+
214
+ **Before:** `CoreAiService.sanitizeResult()` ran `securityCheck()` on model instances only, and `/ai/mcp` sent
215
+ `JSON.stringify(result)`. A tool returning a lean document or a plain object handed its secret fields to the model, to
216
+ `actions[].result` and to the MCP client.
217
+
218
+ **After:** both paths use `sanitizeToolResultForModel()`: `securityCheck(user)` on every model instance at any depth —
219
+ also inside the `{ success, data }` wrapper, which `/ai/mcp` never looked into — then every field named in
220
+ `security.secretFields` or the framework defaults (also as SQL column, `password_reset_token`) is removed, at any depth.
221
+ A Mongoose document is replaced by its stripped `toJSON()`; a class instance becomes a plain copy of its own enumerable
222
+ fields (what `JSON.stringify` read anyway). An MCP OAuth user now carries `hasRole()` (string or array, as Better-Auth
223
+ users do) and `_authenticatedViaBetterAuth`, so a `securityCheck()` calling `user.hasRole()` works on that path.
224
+
225
+ **Action:** if a tool returns a field with such a name ON PURPOSE (it should not — the model and the client read it),
226
+ rename it. Over `/ai/mcp`, a result now loses what its models' `securityCheck()` hides from the caller, as it already did
227
+ in the chat. An override of `sanitizeResult()` keeps working.
228
+
229
+ ## Compatibility Notes
230
+
231
+ | Pattern | Status |
232
+ |---------|--------|
233
+ | `LlmProviderFactory` subclass with its own constructor | Compatible — the new `ModuleRef` parameter is optional |
234
+ | Builder registered under `'nestjs-ai'` by the project | Compatible — `registerBuilder()` replaces the built-in one |
235
+ | Override of `OpenAiCompatibleProvider.resolveAllowedBaseUrlHosts()` / `normaliseHostEntry()` | Compatible — same contract; the default bodies now delegate to `ai-egress.helper` |
236
+ | `/ai/mcp` and the MCP OAuth server | Unchanged — still `@modelcontextprotocol/sdk` 1.x (see below) |
237
+ | Projects without `ai` / `@nestjs/ai` / `@nestjs/mcp` | Unchanged — nothing new is loaded |
238
+ | Vendor mode | The core names `ai`, `@nestjs/ai` and `@nestjs/resilience` in literal `import()` calls: the project declares them (the lt CLI adds them) |
239
+ | Vendor mode, GraphQL uploads | The core imports `busboy`, `fs-capacitor`, `http-errors` and `object-path` itself (`common/helpers/graphql-upload.helper.ts`): add them to `dependencies` at the versions in §7 — a pnpm project does not see graphql-upload's own copies |
240
+ | `graphqlUploadExpress()` registered by the project | Pass `processRequest: processGraphQlUploadRequest` (see "Security: GraphQL multipart uploads") |
241
+
242
+ **Why `/ai/mcp` stays on MCP SDK v1:** `@modelcontextprotocol/server` 2.x ships no OAuth authorization-server router
243
+ (only resource-server helpers), and `@nestjs/mcp` serves every request statelessly — no sessions, no server-initiated
244
+ elicitation for 2025 clients, which the clients in use today need for the confirmation of destructive tools. A migration
245
+ that keeps every current behaviour is a release of its own.
246
+
247
+ ## Troubleshooting
248
+
249
+ | Symptom | Cause | Fix |
250
+ |---------|-------|-----|
251
+ | `AiSdkPackageError: @nestjs/ai@0.0.3 is installed, but … tested with >=0.0.2 <0.0.3` | an untested 0.x release | install a version in the range, or update `@lenne.tech/nest-server` |
252
+ | `ai.agentFunctions is set, but the application imports no AiModule.forRoot()` | the bridge needs `@nestjs/ai`'s module | import `AiModule.forRoot({ models })` or remove `ai.agentFunctions` |
253
+ | An agent function is missing from the tools | it requires `scopes` | remove `scopes`, gate it with `@Roles()` |
254
+ | A role-gated agent function answers 401 from a queue job | request-less callers are anonymous | authenticate in the job and pass `caller: { request }` |
255
+ | A `@nestjs/mcp` tool answers 401 with an MCP OAuth token | the verifier refused it (expired, `ai.mcp.roles`, unknown user) | check `ai.mcp.roles`; obtain a new token |
256
+ | A file upload answers 400 `Invalid object path for the ‘map’ multipart field …` | the `map` names a path into another upload or with a `__proto__` key | send each file at its own variable path (`variables.files.0`, `variables.files.1`) |
257
+ | Vendor mode: `Cannot find package 'busboy'` (or `fs-capacitor`, `http-errors`, `object-path`) at start | the core imports them since 12.10.0 | add them to `dependencies` (§7) |
258
+
259
+ ## Module Documentation
260
+
261
+ - [Better-Auth README](../src/core/modules/better-auth/README.md) — "Social providers", OAuth error URL
262
+ - [Better-Auth INTEGRATION-CHECKLIST](../src/core/modules/better-auth/INTEGRATION-CHECKLIST.md) — "Social provider with its own options"
263
+ - [AI module README](../src/core/modules/ai/README.md) — "NestJS AI and the AI SDK", "Your own `@nestjs/mcp` endpoint"
264
+ - [AI INTEGRATION-CHECKLIST](../src/core/modules/ai/INTEGRATION-CHECKLIST.md) — "NestJS AI / AI SDK"
265
+ - [Request lifecycle](../docs/REQUEST-LIFECYCLE.md) — "Agent function and MCP calls"
266
+
267
+ ## References
268
+
269
+ - `@nestjs/ai`: https://www.npmjs.com/package/@nestjs/ai
270
+ - `@nestjs/mcp`: https://www.npmjs.com/package/@nestjs/mcp
271
+ - AI SDK: https://ai-sdk.dev
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nest-server",
3
- "version": "12.9.4",
3
+ "version": "12.10.1",
4
4
  "type": "module",
5
5
  "description": "Server framework in TypeScript on top of NestJS: GraphQL and REST APIs on MongoDB, PostgreSQL, MySQL or MariaDB, with authentication, field-level permissions, multi-tenancy, offline sync and an AI assistant.",
6
6
  "keywords": [
@@ -100,26 +100,27 @@
100
100
  "node": ">= 22.15",
101
101
  "pnpm": "^11.0.0"
102
102
  },
103
- "packageManager": "pnpm@11.28.10+sha512.672216f06e15c109b85471d49d3fbed17e6f03ead258df08c2bf5b4a5c33321ebfbf59476bce81325efada16ace0ac78548fd0bfcd7a51369e939182a3dd50e4",
103
+ "packageManager": "pnpm@11.28.13+sha512.d5caa9cdcd6067ac2902f9f44daa00b1288a73babf1e98f4f375b3a7583b1894b4d49f7527da8f5e1530198bb10e03adba321a1f015429dc2946ce8a7a9a8c65",
104
104
  "dependencies": {
105
105
  "@apollo/server": "5.5.1",
106
106
  "@as-integrations/express5": "1.1.2",
107
107
  "@getbrevo/brevo": "6.2.0",
108
108
  "@modelcontextprotocol/sdk": "1.32.2",
109
109
  "@nestjs/apollo": "14.2.1",
110
- "@nestjs/common": "12.5.0",
111
- "@nestjs/core": "12.5.0",
110
+ "@nestjs/common": "12.5.1",
111
+ "@nestjs/core": "12.5.1",
112
112
  "@nestjs/graphql": "14.2.1",
113
113
  "@nestjs/jwt": "12.0.5",
114
114
  "@nestjs/passport": "12.0.2",
115
- "@nestjs/platform-express": "12.5.0",
115
+ "@nestjs/platform-express": "12.5.1",
116
116
  "@nestjs/schedule": "12.0.4",
117
117
  "@nestjs/swagger": "12.1.2",
118
- "@nestjs/terminus": "12.1.0",
118
+ "@nestjs/terminus": "12.2.0",
119
119
  "@tus/file-store": "2.1.2",
120
120
  "@tus/server": "2.4.7",
121
121
  "@types/supertest": "7.2.1",
122
122
  "bcrypt": "6.0.0",
123
+ "busboy": "1.6.0",
123
124
  "class-transformer": "0.5.1",
124
125
  "class-validator": "0.15.1",
125
126
  "compression": "1.8.2",
@@ -128,18 +129,21 @@
128
129
  "dotenv": "18.0.10",
129
130
  "ejs": "7.0.2",
130
131
  "express": "5.3.0",
132
+ "fs-capacitor": "8.0.0",
131
133
  "graphql": "16.15.0",
132
134
  "graphql-query-complexity": "2.0.0",
133
- "graphql-subscriptions": "3.0.0",
135
+ "graphql-subscriptions": "3.1.0",
134
136
  "graphql-upload": "17.1.0",
135
137
  "graphql-ws": "6.4.1",
138
+ "http-errors": "2.0.1",
136
139
  "jose": "6.2.17",
137
- "js-sha256": "1.0.0",
140
+ "js-sha256": "1.1.0",
138
141
  "json-to-graphql-query": "2.3.0",
139
142
  "lodash": "4.18.1",
140
143
  "multer": "2.5.0",
141
144
  "node-mailjet": "6.0.11",
142
- "nodemailer": "10.5.0",
145
+ "nodemailer": "10.6.0",
146
+ "object-path": "0.11.8",
143
147
  "passport": "0.7.0",
144
148
  "passport-jwt": "4.0.1",
145
149
  "reflect-metadata": "0.2.2",
@@ -157,9 +161,12 @@
157
161
  "@aws-sdk/s3-request-presigner": ">=3.1045.0 <4",
158
162
  "@better-auth/core": ">=1.7.16 <1.8.0",
159
163
  "@better-auth/passkey": ">=1.7.16 <1.8.0",
164
+ "@nestjs/ai": ">=0.0.2 <0.0.3",
160
165
  "@nestjs/mongoose": ">=12.0.0 <13",
166
+ "@nestjs/resilience": ">=0.0.3 <0.0.4",
161
167
  "@swc/core": ">=1.10.0 <2",
162
168
  "@tus/s3-store": ">=2.0.5 <3",
169
+ "ai": ">=7.0.0 <8",
163
170
  "better-auth": ">=1.7.16 <1.8.0",
164
171
  "bullmq": ">=5.16.0 <7",
165
172
  "drizzle-orm": "1.0.0-rc.5",
@@ -187,15 +194,24 @@
187
194
  "@better-auth/passkey": {
188
195
  "optional": false
189
196
  },
197
+ "@nestjs/ai": {
198
+ "optional": true
199
+ },
190
200
  "@nestjs/mongoose": {
191
201
  "optional": true
192
202
  },
203
+ "@nestjs/resilience": {
204
+ "optional": true
205
+ },
193
206
  "@swc/core": {
194
207
  "optional": true
195
208
  },
196
209
  "@tus/s3-store": {
197
210
  "optional": true
198
211
  },
212
+ "ai": {
213
+ "optional": true
214
+ },
199
215
  "better-auth": {
200
216
  "optional": false
201
217
  },
@@ -228,54 +244,63 @@
228
244
  }
229
245
  },
230
246
  "devDependencies": {
231
- "@aws-sdk/client-s3": "3.1168.0",
232
- "@aws-sdk/lib-storage": "3.1168.0",
233
- "@aws-sdk/s3-request-presigner": "3.1168.0",
247
+ "@aws-sdk/client-s3": "3.1171.0",
248
+ "@aws-sdk/lib-storage": "3.1171.0",
249
+ "@aws-sdk/s3-request-presigner": "3.1171.0",
234
250
  "@better-auth/core": "1.7.23",
235
251
  "@better-auth/passkey": "1.7.23",
236
252
  "@compodoc/compodoc": "2.0.0",
253
+ "@modelcontextprotocol/server": "2.4.0",
254
+ "@nestjs/ai": "0.0.2",
237
255
  "@nestjs/cli": "12.0.13",
256
+ "@nestjs/mcp": "0.0.4",
238
257
  "@nestjs/mongoose": "12.0.1",
258
+ "@nestjs/resilience": "0.0.3",
239
259
  "@nestjs/schematics": "12.0.13",
240
- "@nestjs/testing": "12.5.0",
260
+ "@nestjs/testing": "12.5.1",
241
261
  "@swc/cli": "0.8.2",
242
262
  "@swc/core": "1.16.22",
243
263
  "@tus/s3-store": "2.1.0",
264
+ "@types/busboy": "1.5.5",
244
265
  "@types/compression": "1.8.1",
245
266
  "@types/cookie-parser": "1.4.10",
246
267
  "@types/ejs": "3.1.5",
247
268
  "@types/express": "5.0.6",
269
+ "@types/http-errors": "2.0.5",
248
270
  "@types/lodash": "4.17.27",
249
271
  "@types/multer": "2.3.0",
250
272
  "@types/node": "26.6.6",
273
+ "@types/object-path": "0.11.4",
251
274
  "@types/passport": "1.0.17",
252
275
  "@types/pg": "8.23.1",
253
- "@vitest/coverage-v8": "5.1.0",
276
+ "@vitest/coverage-v8": "5.1.1",
277
+ "ai": "7.0.176",
254
278
  "better-auth": "1.7.23",
255
- "bullmq": "6.7.6",
279
+ "bullmq": "6.7.7",
256
280
  "cross-env": "10.1.0",
257
281
  "drizzle-orm": "1.0.0-rc.5",
258
282
  "ioredis": "6.0.0",
259
283
  "kysely": "0.29.9",
260
284
  "mongodb": "7.8.0",
261
- "mongoose": "9.12.1",
285
+ "mongoose": "9.12.2",
262
286
  "mysql2": "3.24.6",
263
287
  "nodemon": "3.1.14",
264
288
  "otpauth": "9.6.0",
265
- "oxfmt": "0.78.0",
266
- "oxlint": "1.93.0",
289
+ "oxfmt": "0.79.0",
290
+ "oxlint": "1.94.0",
267
291
  "oxlint-tsgolint": "7.0.2007",
268
292
  "pg": "8.23.1",
269
- "playwright-core": "1.65.0",
293
+ "playwright-core": "1.65.1",
270
294
  "rimraf": "6.1.4",
271
- "smtp-server": "3.21.4",
295
+ "smtp-server": "3.21.6",
272
296
  "tsx": "4.23.15",
273
297
  "tus-js-client": "4.3.1",
274
298
  "typeorm": "1.1.3",
275
299
  "typescript": "6.0.3",
276
300
  "unplugin-swc": "2.0.0",
277
301
  "vite": "8.3.8",
278
- "vitest": "5.1.0"
302
+ "vitest": "5.1.1",
303
+ "zod": "4.6.7"
279
304
  },
280
305
  "main": "dist/index.js",
281
306
  "types": "dist/index.d.ts",