@lenne.tech/nest-server 12.8.6 → 12.8.7

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.
@@ -257,6 +257,7 @@ Full background, failure analysis and the mistakes table: `.claude/rules/better-
257
257
  - `@UnifiedField()` - Single decorator for GraphQL, Swagger, and validation (replaces separate `@Field`, `@ApiProperty`, `@IsOptional`, etc.)
258
258
  - Automatic input property whitelisting — properties without `@UnifiedField` are stripped (default) or rejected
259
259
  - `@UnifiedField({ exclude: true })` — explicitly exclude a property from input (hidden from schema, rejected at runtime)
260
+ - Without `type`, `@UnifiedField` takes the type from `design:type`, and the SWC dev start writes that per file: a union with `null` / `undefined`, a type alias or `boolean | null` become `Object` where the tsc build writes `Number` / `String` / `Boolean` — the dev API then validates the field as a nested object (12.8.7: warning at start). For an enum SWC writes the enum object; `designTypeOf()` reads it as `String` / `Number` like tsc (12.8.7 — before, an enum field with `mongoose` crashed the schema build). Declare `type` for anything but `number`, `string`, `boolean`, `Date`, an enum, a value-imported class or an in-place string literal union. `bin/check-unified-field-types.js` (package bin `nest-check-unified-field-types`; `check:unified-field-types`, part of `check`; `-- --fix` in `check:fix`) finds every such field and writes the declared type — the one tsc uses, except under `strictNullChecks` (marked `[changes the deployed build]`)
260
261
  - `@UnifiedField({ exclude: false })` — explicitly re-enable a property excluded by a parent class
261
262
  - Configurable via `security.mapAndValidatePipe.nonWhitelistedFields`: `'strip'` (default), `'error'`, or `false`
262
263
  - Custom decorator parameters (`@CurrentUser()`, `@RESTServiceOptions()`, etc.) and basic types (`String`, `Number`, etc.) are skipped — no validation or whitelist check
@@ -412,7 +412,7 @@ pnpm run check:mutations -- --id=<id> # one mutation
412
412
  pnpm run check:mutations -- --list # the registry, without running anything
413
413
  pnpm run check:mutations -- --allow-dirty # when the fix and its evidence share a working tree
414
414
  pnpm run check:mutations -- --jobs=4 # N mutations at a time (default: 2, or 4 on >=12 cores)
415
- pnpm run check:mutations -- --no-infra # only the 410 that need no MongoDB
415
+ pnpm run check:mutations -- --no-infra # only the 419 that need no MongoDB
416
416
  pnpm run check:mutations -- --since=<ref> # only mutations touching files changed since <ref>
417
417
  pnpm run check:mutations -- --shard=2/4 # this job's quarter of the selection (CI splits the full run)
418
418
  ```
@@ -432,7 +432,7 @@ when the registry, a vitest config or a setup file changed, since those can move
432
432
  commit, and in CI alongside the publish without blocking it. The price of caching is a cache that
433
433
  has to model each spec's full dependency closure correctly, and getting that wrong produces a stale
434
434
  PASS for a test that has since gone vacuous — exactly what the gate is there to prevent. Bad trade
435
- at 645 mutations.
435
+ at 654 mutations.
436
436
 
437
437
  **Decided 2026-10-03 (repo owner): keep the full run.** Measured at 128 mutations, the CI job for
438
438
  11.41.6 took **14 minutes**. The trigger to revisit is that wall time, not the mutation count —
@@ -505,7 +505,7 @@ exactly the environment where the answer matters.
505
505
 
506
506
  Worth knowing before optimising the wrong thing: the specs behind all 235 e2e mutations add up to
507
507
  **~40 seconds**. The step takes ~740s. The remaining ~700s is paying vitest's startup — process
508
- spawn, transform, module graph, mongod connect, DB create and drop — once per mutation, 645 times.
508
+ spawn, transform, module graph, mongod connect, DB create and drop — once per mutation, 654 times.
509
509
  That work is largely single-threaded I/O and barely scales with cores: the full registry measures
510
510
  **744s on a 12-core laptop and 777s on a 4-vCPU CI runner**.
511
511
 
package/CLAUDE.md CHANGED
@@ -188,6 +188,10 @@ pnpm run check:swc-tdz # SWC→CJS build, loads EVERY module as its own entry p
188
188
  # The only step that catches a temporal-dead-zone crash from an
189
189
  # import cycle — tsc, vitest and oxlint are all blind to it.
190
190
  # See .claude/rules/architecture.md → "DI Token Placement (SWC-Safe)"
191
+ pnpm run check:unified-field-types # Every @UnifiedField without type/isAny/enum whose type the SWC dev start and
192
+ # the tsc build read differently (a union with null, a type alias): the dev API
193
+ # validated it as a nested object. `-- --fix` writes the type tsc uses. Shipped to projects as
194
+ # bin `nest-check-unified-field-types`; see .claude/rules/architecture.md → "Input Validation"
191
195
 
192
196
  # Package Development
193
197
  pnpm run build:dev # Build for local development (use with pnpm link)
package/FRAMEWORK-API.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @lenne.tech/nest-server — Framework API Reference
2
2
 
3
- > Auto-generated from source code as of 2026-11-10 (v12.8.6)
3
+ > Auto-generated from source code as of 2026-11-10 (v12.8.7)
4
4
  > File: `FRAMEWORK-API.md` — compact, machine-readable API surface for Claude Code
5
5
 
6
6
  ## CoreModule.forRoot()
@@ -0,0 +1,615 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * check-unified-field-types — every `@UnifiedField` gets a runtime type both compilers agree on.
4
+ *
5
+ * `@UnifiedField` reads a field's type from the `design:type` metadata when no `type` is given. tsc
6
+ * (the build) writes that metadata with the type checker; the SWC loader of the dev start writes it
7
+ * syntactically, file by file. Where the two disagree, the dev API validates, documents and
8
+ * generates client types differently from the deployed one:
9
+ *
10
+ * field SWC (dev start) tsc (build, strict: false)
11
+ * max?: null | number Object Number
12
+ * kind?: Kind (type alias) Object String
13
+ * status?: Status | null (enum) Object String / Number
14
+ * flag?: boolean | null Object Boolean
15
+ * meta?: Record<string, unknown> Object Object
16
+ * state?: 'ok' | 'error' (in place) String String
17
+ *
18
+ * A plain enum (`status?: Status`) is no finding: SWC writes the enum object there, and @UnifiedField reads it as
19
+ * String / Number like tsc since 12.8.7.
20
+ *
21
+ * `Object` makes `@UnifiedField` validate the field as a nested object, so the dev API refuses
22
+ * `max: 5` while the build accepts it. This script finds every `@UnifiedField` without `type`,
23
+ * `isAny` or `enum` whose declared type is not one both compilers emit the same way (`number`,
24
+ * `string`, `boolean`, `Date`, a class imported as a value, an enum, a union of string literals
25
+ * written in place), and resolves with the type checker the runtime type the tsc build uses.
26
+ * `--fix` writes exactly that as `type: () => X`, so the deployed behaviour stays as it is and the
27
+ * dev start matches it. Where the tsc build writes something else today — Object for a union with
28
+ * null / undefined under strictNullChecks, for a generic alias, for a field without a type
29
+ * annotation — the field is marked "[changes the deployed build]": the type written for it (the one
30
+ * the field declares) changes its deployed validation. The comparison reads tsc's own emit. A field whose type has no
31
+ * runtime class (an interface, a `Record`, a mixed union, `any`) is reported with what to declare
32
+ * instead.
33
+ *
34
+ * Usage:
35
+ * node <nest-server>/bin/check-unified-field-types.js [--fix] [--project tsconfig.json] [--include src]
36
+ * (npm mode: the package bin `nest-check-unified-field-types`)
37
+ *
38
+ * Exit codes: 0 nothing to do, 1 findings left (without --fix: any; with --fix: the ones it cannot
39
+ * fix), 2 usage or configuration error.
40
+ */
41
+ 'use strict';
42
+
43
+ const fs = require('node:fs');
44
+ const path = require('node:path');
45
+ const { createRequire } = require('node:module');
46
+
47
+ const PREFIX = '[unified-field-types]';
48
+
49
+ function usage() {
50
+ return [
51
+ 'Usage: check-unified-field-types [--fix] [--project <tsconfig>] [--include <dir>]...',
52
+ '',
53
+ ' --fix write `type: () => X` into every field the checker can resolve',
54
+ ' --project, -p tsconfig to build the program from (default: tsconfig.json)',
55
+ ' --include directory to check, repeatable (default: src)',
56
+ ].join('\n');
57
+ }
58
+
59
+ function parseArgs(argv) {
60
+ const args = { fix: false, help: false, include: [], project: 'tsconfig.json' };
61
+ for (let i = 0; i < argv.length; i++) {
62
+ const arg = argv[i];
63
+ if (arg === '--') {
64
+ // `pnpm run <script> -- --fix` passes the separator through (npm and yarn drop it)
65
+ continue;
66
+ }
67
+ if (arg === '--fix') {
68
+ args.fix = true;
69
+ } else if (arg === '--help' || arg === '-h') {
70
+ args.help = true;
71
+ } else if (arg === '--project' || arg === '-p') {
72
+ args.project = argv[++i];
73
+ } else if (arg.startsWith('--project=')) {
74
+ args.project = arg.slice('--project='.length);
75
+ } else if (arg === '--include') {
76
+ args.include.push(argv[++i]);
77
+ } else if (arg.startsWith('--include=')) {
78
+ args.include.push(arg.slice('--include='.length));
79
+ } else {
80
+ throw new UsageError(`Unknown argument: ${arg}`);
81
+ }
82
+ }
83
+ if (!args.project) {
84
+ throw new UsageError('--project needs a path');
85
+ }
86
+ if (args.include.length === 0) {
87
+ args.include.push('src');
88
+ }
89
+ return args;
90
+ }
91
+
92
+ class UsageError extends Error {}
93
+
94
+ /** The project's own TypeScript, so the checker resolves types exactly as its build does. */
95
+ function loadTypeScript(cwd) {
96
+ try {
97
+ return createRequire(path.join(cwd, 'package.json'))('typescript');
98
+ } catch {
99
+ return require('typescript');
100
+ }
101
+ }
102
+
103
+ function createProgram(ts, cwd, project) {
104
+ const configPath = path.resolve(cwd, project);
105
+ if (!fs.existsSync(configPath)) {
106
+ throw new UsageError(`tsconfig not found: ${configPath}`);
107
+ }
108
+ const host = {
109
+ ...ts.sys,
110
+ onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
111
+ throw new UsageError(ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'));
112
+ },
113
+ };
114
+ const parsed = ts.getParsedCommandLineOfConfigFile(configPath, {}, host);
115
+ // Emit is only ever called with a writeFile callback (see emittedDesignTypes), so nothing reaches the disk
116
+ const options = {
117
+ ...parsed.options,
118
+ composite: false,
119
+ declaration: false,
120
+ declarationMap: false,
121
+ emitDeclarationOnly: false,
122
+ incremental: false,
123
+ inlineSourceMap: false,
124
+ noEmit: false,
125
+ noEmitOnError: false,
126
+ sourceMap: false,
127
+ };
128
+ return ts.createProgram({ options, rootNames: parsed.fileNames });
129
+ }
130
+
131
+ /** `UnifiedField` as `@UnifiedField(...)` or `@ns.UnifiedField(...)`. */
132
+ function unifiedFieldCall(ts, decorator) {
133
+ const expression = decorator.expression;
134
+ if (!ts.isCallExpression(expression)) {
135
+ return undefined;
136
+ }
137
+ const callee = expression.expression;
138
+ const name = ts.isIdentifier(callee)
139
+ ? callee.text
140
+ : ts.isPropertyAccessExpression(callee)
141
+ ? callee.name.text
142
+ : undefined;
143
+ return name === 'UnifiedField' ? expression : undefined;
144
+ }
145
+
146
+ function propertyName(ts, property) {
147
+ const name = property.name;
148
+ return name && (ts.isIdentifier(name) || ts.isStringLiteral(name)) ? name.text : undefined;
149
+ }
150
+
151
+ /**
152
+ * Whether the options already decide the type: `type`, `enum`, `isAny: true`. Options the script
153
+ * cannot read (a variable, a spread, `isAny: someFlag`) count as deciding — it never guesses.
154
+ */
155
+ function optionsDecideType(ts, options) {
156
+ if (!options) {
157
+ return false;
158
+ }
159
+ if (!ts.isObjectLiteralExpression(options)) {
160
+ return true;
161
+ }
162
+ for (const property of options.properties) {
163
+ if (ts.isSpreadAssignment(property)) {
164
+ return true;
165
+ }
166
+ const name = propertyName(ts, property);
167
+ if (name === 'type' || name === 'enum') {
168
+ return true;
169
+ }
170
+ if (
171
+ name === 'isAny' &&
172
+ !(ts.isPropertyAssignment(property) && property.initializer.kind === ts.SyntaxKind.FalseKeyword)
173
+ ) {
174
+ return true;
175
+ }
176
+ }
177
+ return false;
178
+ }
179
+
180
+ function isArrayTypeNode(ts, node) {
181
+ if (ts.isArrayTypeNode(node) || ts.isTupleTypeNode(node)) {
182
+ return true;
183
+ }
184
+ if (ts.isTypeOperatorNode(node)) {
185
+ return isArrayTypeNode(ts, node.type);
186
+ }
187
+ return (
188
+ ts.isTypeReferenceNode(node) &&
189
+ ts.isIdentifier(node.typeName) &&
190
+ (node.typeName.text === 'Array' || node.typeName.text === 'ReadonlyArray')
191
+ );
192
+ }
193
+
194
+ /** The import declaration that brings `symbol` into the file, or undefined for a local declaration. */
195
+ function importOf(ts, symbol) {
196
+ const declaration = symbol.declarations?.[0];
197
+ if (!declaration) {
198
+ return undefined;
199
+ }
200
+ if (ts.isImportSpecifier(declaration)) {
201
+ return { typeOnly: declaration.isTypeOnly || declaration.parent.parent.isTypeOnly };
202
+ }
203
+ if (ts.isImportClause(declaration)) {
204
+ return { typeOnly: declaration.isTypeOnly };
205
+ }
206
+ if (ts.isNamespaceImport(declaration)) {
207
+ return { typeOnly: declaration.parent.isTypeOnly };
208
+ }
209
+ return undefined;
210
+ }
211
+
212
+ function isLibDate(symbol) {
213
+ return (
214
+ symbol?.getName() === 'Date' &&
215
+ (symbol.declarations ?? []).some((d) => /[\\/]typescript[\\/]lib[\\/]lib\./.test(d.getSourceFile().fileName))
216
+ );
217
+ }
218
+
219
+ /**
220
+ * Whether both compilers emit the same runtime type for this annotation: a primitive keyword,
221
+ * `Date`, or a class the file has as a value (declared here, or imported without `type`).
222
+ */
223
+ function emitsTheSameType(ts, checker, node) {
224
+ if (
225
+ node.kind === ts.SyntaxKind.NumberKeyword ||
226
+ node.kind === ts.SyntaxKind.StringKeyword ||
227
+ node.kind === ts.SyntaxKind.BooleanKeyword
228
+ ) {
229
+ return true;
230
+ }
231
+ // `'a' | 'b'` written out in place: SWC emits String like tsc (measured). Not so with null/undefined in the union
232
+ if (
233
+ ts.isUnionTypeNode(node) &&
234
+ node.types.every((member) => ts.isLiteralTypeNode(member) && ts.isStringLiteral(member.literal))
235
+ ) {
236
+ return true;
237
+ }
238
+ if (!ts.isTypeReferenceNode(node) || node.typeArguments || !ts.isIdentifier(node.typeName)) {
239
+ return false;
240
+ }
241
+ const symbol = checker.getSymbolAtLocation(node.typeName);
242
+ if (!symbol) {
243
+ return false;
244
+ }
245
+ const imported = importOf(ts, symbol);
246
+ if (imported?.typeOnly) {
247
+ return false;
248
+ }
249
+ const target = symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
250
+ // An enum: SWC writes the enum object, which @UnifiedField reads as String / Number like tsc does (12.8.7)
251
+ if (target.flags & ts.SymbolFlags.Enum) {
252
+ return true;
253
+ }
254
+ return isLibDate(target) || (target.flags & ts.SymbolFlags.Class) !== 0;
255
+ }
256
+
257
+ function everyMember(type, predicate) {
258
+ return type.isUnion() ? type.types.every(predicate) : predicate(type);
259
+ }
260
+
261
+ /**
262
+ * The runtime type the tsc build emits for this field (null and undefined dropped), as the name to
263
+ * put into `type: () => X` — or a reason why there is no such class.
264
+ */
265
+ function resolveRuntimeType(ts, checker, property) {
266
+ const declared = checker.getTypeAtLocation(property);
267
+ const type = checker.getNonNullableType(declared);
268
+ const flags = ts.TypeFlags;
269
+ if (type.flags & (flags.Any | flags.Unknown)) {
270
+ return { reason: 'any / unknown' };
271
+ }
272
+ if (everyMember(type, (t) => (t.flags & flags.NumberLike) !== 0)) {
273
+ return { name: 'Number' };
274
+ }
275
+ if (everyMember(type, (t) => (t.flags & flags.StringLike) !== 0)) {
276
+ return { name: 'String' };
277
+ }
278
+ if (everyMember(type, (t) => (t.flags & flags.BooleanLike) !== 0)) {
279
+ return { name: 'Boolean' };
280
+ }
281
+ if (type.isUnion()) {
282
+ return { reason: 'a union of different types' };
283
+ }
284
+ const symbol = type.getSymbol();
285
+ if (isLibDate(symbol)) {
286
+ return { name: 'Date' };
287
+ }
288
+ if (symbol && symbol.flags & ts.SymbolFlags.Class) {
289
+ const reference = classValueReference(ts, checker, property, symbol);
290
+ return reference
291
+ ? { name: reference }
292
+ : {
293
+ reason:
294
+ `no value in this file refers to class ${symbol.getName()} (imported only as a type, or its name means ` +
295
+ 'something else here): import it as a value, then write type: () => <that name> yourself',
296
+ };
297
+ }
298
+ if (symbol && symbol.flags & ts.SymbolFlags.Interface) {
299
+ return { reason: `interface ${symbol.getName()}` };
300
+ }
301
+ return { reason: 'an object type without a runtime class (Record, object literal type, …)' };
302
+ }
303
+
304
+ /**
305
+ * The text that refers to `classSymbol` as a value at this field — what `--fix` may write into `type: () => …` — or
306
+ * undefined. Matched by symbol, never by name: a class imported under another name (`import { Settings as Tenant }`,
307
+ * `import * as tenant`) next to a local class of the original name must get `Tenant` / `tenant.Settings`, not the local
308
+ * class — writing that would change which class the deployed build validates and restricts the field with.
309
+ *
310
+ * 1. The reference the annotation itself writes (`Foo`, `Alias`, `ns.Foo`), when it resolves to the class and is not
311
+ * a type-only import.
312
+ * 2. Otherwise the class's own name, when it resolves to that very class as a value here (`resolveName`).
313
+ */
314
+ function classValueReference(ts, checker, property, classSymbol) {
315
+ const target = (symbol) =>
316
+ symbol && symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
317
+ const typeOnly = (symbol) => importOf(ts, symbol)?.typeOnly === true;
318
+ const names = [];
319
+ const collect = (node) => {
320
+ if (ts.isTypeReferenceNode(node)) {
321
+ names.push(node.typeName);
322
+ }
323
+ ts.forEachChild(node, collect);
324
+ };
325
+ if (property.type) {
326
+ collect(property.type);
327
+ }
328
+ for (const name of names) {
329
+ if (target(checker.getSymbolAtLocation(name)) !== classSymbol) {
330
+ continue;
331
+ }
332
+ let head = name;
333
+ while (ts.isQualifiedName(head)) {
334
+ head = head.left;
335
+ }
336
+ const headSymbol = checker.getSymbolAtLocation(head);
337
+ if (headSymbol && typeOnly(headSymbol)) {
338
+ continue;
339
+ }
340
+ return name.getText();
341
+ }
342
+ if (typeof checker.resolveName === 'function') {
343
+ const own = checker.resolveName(classSymbol.getName(), property, ts.SymbolFlags.Value, false);
344
+ if (own && !typeOnly(own) && target(own) === classSymbol) {
345
+ return classSymbol.getName();
346
+ }
347
+ }
348
+ return undefined;
349
+ }
350
+
351
+ /** Why the SWC dev start cannot read this annotation like tsc does — for the report. */
352
+ function describeAnnotation(ts, checker, node) {
353
+ if (!node) {
354
+ return 'no type annotation';
355
+ }
356
+ if (ts.isUnionTypeNode(node)) {
357
+ return 'a union';
358
+ }
359
+ if (ts.isLiteralTypeNode(node)) {
360
+ return 'a literal type';
361
+ }
362
+ if (ts.isTypeReferenceNode(node)) {
363
+ const symbol = ts.isIdentifier(node.typeName) ? checker.getSymbolAtLocation(node.typeName) : undefined;
364
+ if (symbol && importOf(ts, symbol)?.typeOnly) {
365
+ return 'a type-only import';
366
+ }
367
+ const target = symbol && symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
368
+ if (target && target.flags & ts.SymbolFlags.Enum) {
369
+ return 'an enum';
370
+ }
371
+ if (target && target.flags & ts.SymbolFlags.TypeAlias) {
372
+ return 'a type alias';
373
+ }
374
+ if (target && target.flags & ts.SymbolFlags.Interface) {
375
+ return 'an interface';
376
+ }
377
+ return node.typeArguments ? 'a generic type' : 'a type reference';
378
+ }
379
+ return 'a type expression';
380
+ }
381
+
382
+ /** The edit that adds `type: () => <name>` to the decorator call's options. */
383
+ function typeOptionEdit(ts, sourceFile, call, name) {
384
+ const insertion = `type: () => ${name}`;
385
+ const text = sourceFile.text;
386
+ const options = call.arguments[0];
387
+ if (!options) {
388
+ return { end: call.arguments.pos, start: call.arguments.pos, text: `{ ${insertion} }` };
389
+ }
390
+ const properties = options.properties;
391
+ if (properties.length === 0) {
392
+ return { end: options.end, start: options.getStart(sourceFile), text: `{ ${insertion} }` };
393
+ }
394
+ // What precedes a property on its line: only its indentation when it starts the line, code otherwise
395
+ const linePrefix = (node) => {
396
+ const start = node.getStart(sourceFile);
397
+ return text.slice(text.lastIndexOf('\n', start - 1) + 1, start);
398
+ };
399
+ const ownLine = (node) => /^[ \t]*$/.test(linePrefix(node));
400
+ // Keys are kept in alphabetical order in the stack's code; insert before the first one after `type`
401
+ const next = properties.find((property) => (propertyName(ts, property) ?? '') > 'type');
402
+ if (next) {
403
+ const start = next.getStart(sourceFile);
404
+ return { end: start, start, text: ownLine(next) ? `${insertion},\n${linePrefix(next)}` : `${insertion}, ` };
405
+ }
406
+ const last = properties[properties.length - 1];
407
+ const between = text.slice(last.end, options.end - 1);
408
+ const comma = between.trimStart().startsWith(',') ? last.end + between.indexOf(',') + 1 : undefined;
409
+ if (ownLine(last)) {
410
+ const indentOf = linePrefix;
411
+ return comma === undefined
412
+ ? { end: last.end, start: last.end, text: `,\n${indentOf(last)}${insertion}` }
413
+ : { end: comma, start: comma, text: `\n${indentOf(last)}${insertion},` };
414
+ }
415
+ return comma === undefined
416
+ ? { end: last.end, start: last.end, text: `, ${insertion}` }
417
+ : { end: comma, start: comma, text: ` ${insertion}` };
418
+ }
419
+
420
+ /**
421
+ * The `design:type` expression tsc writes for each decorated property of these files, read from an in-memory emit
422
+ * (the writeFile callback keeps it off the disk): Map<sourceFile, Map<"Class.property", expression>>.
423
+ */
424
+ function emittedDesignTypes(program, sourceFiles) {
425
+ const result = new Map();
426
+ for (const sourceFile of sourceFiles) {
427
+ let js = '';
428
+ program.emit(sourceFile, (name, text) => {
429
+ if (/\.[cm]?js$/.test(name)) {
430
+ js = text;
431
+ }
432
+ });
433
+ const types = new Map();
434
+ // `__decorate([` / `(0, tslib_1.__decorate)([` (importHelpers), the same for `__metadata`
435
+ for (const match of js.matchAll(/__decorate\)?\(\[([\s\S]*?)\],\s*([\w$]+)\.prototype,\s*"([^"]+)"/g)) {
436
+ const metadata = /__metadata\)?\("design:type",\s*([\s\S]*?)\)\s*(?:,|$)/.exec(match[1]);
437
+ if (metadata) {
438
+ types.set(`${match[2]}.${match[3]}`, metadata[1].trim());
439
+ }
440
+ }
441
+ result.set(sourceFile, types);
442
+ }
443
+ return result;
444
+ }
445
+
446
+ /** A design:type as a comparable kind: the primitive constructor's name, `class` for a class reference, or undefined. */
447
+ function designTypeKind(expression) {
448
+ if (!expression) {
449
+ return undefined;
450
+ }
451
+ const primitive = /^(Number|String|Boolean|Date|Object|Array|Function)$/.exec(expression);
452
+ return primitive ? primitive[1] : 'class';
453
+ }
454
+
455
+ function analyze(ts, program, cwd, include) {
456
+ const checker = program.getTypeChecker();
457
+ const roots = include.map((dir) => path.resolve(cwd, dir) + path.sep);
458
+ const findings = [];
459
+ for (const sourceFile of program.getSourceFiles()) {
460
+ const fileName = path.resolve(sourceFile.fileName);
461
+ if (
462
+ sourceFile.isDeclarationFile ||
463
+ fileName.includes(`${path.sep}node_modules${path.sep}`) ||
464
+ /\.(spec|test)\.[cm]?tsx?$/.test(fileName) ||
465
+ !roots.some((root) => fileName.startsWith(root))
466
+ ) {
467
+ continue;
468
+ }
469
+ const visit = (node) => {
470
+ if (ts.isPropertyDeclaration(node) && ts.canHaveDecorators(node)) {
471
+ for (const decorator of ts.getDecorators(node) ?? []) {
472
+ const call = unifiedFieldCall(ts, decorator);
473
+ if (!call || optionsDecideType(ts, call.arguments[0])) {
474
+ continue;
475
+ }
476
+ if (node.type && (isArrayTypeNode(ts, node.type) || emitsTheSameType(ts, checker, node.type))) {
477
+ continue;
478
+ }
479
+ const owner = node.parent && ts.isClassLike(node.parent) && node.parent.name ? node.parent.name.text : '?';
480
+ const resolved = resolveRuntimeType(ts, checker, node);
481
+ findings.push({
482
+ call,
483
+ field: `${owner}.${propertyName(ts, node) ?? '?'}`,
484
+ owner,
485
+ property: propertyName(ts, node),
486
+ fileName,
487
+ line: sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1,
488
+ hint: resolved.reason,
489
+ name: resolved.name,
490
+ reason: describeAnnotation(ts, checker, node.type),
491
+ sourceFile,
492
+ });
493
+ }
494
+ }
495
+ ts.forEachChild(node, visit);
496
+ };
497
+ visit(sourceFile);
498
+ }
499
+ // Whether a written type changes the deployed build: compare it with what tsc's own emit writes for the field
500
+ const files = [...new Set(findings.filter((f) => f.name).map((f) => f.sourceFile))];
501
+ const emitted = emittedDesignTypes(program, files);
502
+ for (const finding of findings.filter((f) => f.name)) {
503
+ const deployed = emitted.get(finding.sourceFile)?.get(`${finding.owner}.${finding.property}`);
504
+ finding.changesDeployed = designTypeKind(deployed) !== designTypeKind(finding.name);
505
+ }
506
+ return findings;
507
+ }
508
+
509
+ /**
510
+ * Writes the edits. Their positions refer to the text TypeScript parsed, which has a leading UTF-8 BOM stripped — so
511
+ * they are shifted by the BOM, which stays in the file. A file whose text no longer matches what was parsed (changed
512
+ * since) is left untouched and returned in `skipped`.
513
+ */
514
+ function applyFixes(ts, findings) {
515
+ const byFile = new Map();
516
+ for (const finding of findings.filter((f) => f.name)) {
517
+ const entry = byFile.get(finding.fileName) ?? { edits: [], sourceFile: finding.sourceFile };
518
+ entry.edits.push(typeOptionEdit(ts, finding.sourceFile, finding.call, finding.name));
519
+ byFile.set(finding.fileName, entry);
520
+ }
521
+ const written = [];
522
+ const skipped = [];
523
+ for (const [fileName, { edits, sourceFile }] of byFile) {
524
+ let text = fs.readFileSync(fileName, 'utf8');
525
+ const offset = text.charCodeAt(0) === 0xfeff ? 1 : 0;
526
+ if (text.slice(offset) !== sourceFile.text) {
527
+ skipped.push(fileName);
528
+ continue;
529
+ }
530
+ for (const edit of edits.sort((a, b) => b.start - a.start)) {
531
+ text = text.slice(0, edit.start + offset) + edit.text + text.slice(edit.end + offset);
532
+ }
533
+ fs.writeFileSync(fileName, text);
534
+ written.push(fileName);
535
+ }
536
+ return { skipped, written };
537
+ }
538
+
539
+ function main(argv, cwd = process.cwd(), out = console) {
540
+ let args;
541
+ try {
542
+ args = parseArgs(argv);
543
+ } catch (error) {
544
+ out.error(`${PREFIX} ${error.message}\n${usage()}`);
545
+ return 2;
546
+ }
547
+ if (args.help) {
548
+ out.log(usage());
549
+ return 0;
550
+ }
551
+ let findings;
552
+ const ts = loadTypeScript(cwd);
553
+ try {
554
+ findings = analyze(ts, createProgram(ts, cwd, args.project), cwd, args.include);
555
+ } catch (error) {
556
+ if (error instanceof UsageError) {
557
+ out.error(`${PREFIX} ${error.message}`);
558
+ return 2;
559
+ }
560
+ throw error;
561
+ }
562
+ if (findings.length === 0) {
563
+ out.log(`${PREFIX} OK — every @UnifiedField has a runtime type both compilers agree on.`);
564
+ return 0;
565
+ }
566
+ const fixable = findings.filter((f) => f.name);
567
+ const manual = findings.filter((f) => !f.name);
568
+ if (args.fix && fixable.length > 0) {
569
+ const { skipped, written } = applyFixes(ts, fixable);
570
+ if (skipped.length > 0) {
571
+ for (const fileName of skipped) {
572
+ out.error(`${PREFIX} ${path.relative(cwd, fileName)} changed while the check ran — left untouched, run again`);
573
+ }
574
+ return 1;
575
+ }
576
+ out.log(`${PREFIX} fixed ${fixable.length} field(s) in ${written.length} file(s):`);
577
+ } else if (fixable.length > 0) {
578
+ out.log(`${PREFIX} ${fixable.length} field(s) need an explicit type (\`--fix\` writes it):`);
579
+ }
580
+ for (const f of fixable) {
581
+ const marker = f.changesDeployed ? ' [changes the deployed build]' : '';
582
+ out.log(` ${path.relative(cwd, f.fileName)}:${f.line} ${f.field} (${f.reason}) → type: () => ${f.name}${marker}`);
583
+ }
584
+ if (fixable.some((f) => f.changesDeployed)) {
585
+ out.log(
586
+ ' [changes the deployed build]: the tsc build writes a different type for this field today — Object for a ' +
587
+ 'union with null / undefined under strictNullChecks (the default without a `strict` key since TypeScript 6), ' +
588
+ 'for a generic alias, for a field without a type annotation. The written type is the one the field declares, ' +
589
+ 'so the deployed API validates it differently from now on. Review those fields.',
590
+ );
591
+ }
592
+ if (manual.length > 0) {
593
+ out.log(`${PREFIX} ${manual.length} field(s) to declare by hand — no runtime class to write automatically:`);
594
+ for (const f of manual) {
595
+ out.log(` ${path.relative(cwd, f.fileName)}:${f.line} ${f.field} (${f.reason}) — ${f.hint}`);
596
+ }
597
+ out.log(
598
+ ' Declare `type: () => Object` for a free-form object, `isAny: true` for any value, or a class for a nested ' +
599
+ 'structure (its @UnifiedField fields are then validated and @Restricted is enforced on them).',
600
+ );
601
+ }
602
+ out.log(
603
+ `${PREFIX} Why: without \`type\`, @UnifiedField reads the compiler's design:type, which the SWC dev start writes ` +
604
+ 'as Object for a union with null / undefined, a type alias or an interface — the dev API then validates such a ' +
605
+ 'field as a nested object. For every field not marked, --fix writes exactly the type the tsc build writes ' +
606
+ '(read from its emit), so the deployed API keeps its behaviour.',
607
+ );
608
+ return args.fix ? (manual.length > 0 ? 1 : 0) : 1;
609
+ }
610
+
611
+ if (require.main === module) {
612
+ process.exitCode = main(process.argv.slice(2));
613
+ }
614
+
615
+ module.exports = { main };
@@ -74,6 +74,38 @@ function warnIfLikelyMisconfiguredEnumOptions(value, propertyHint) {
74
74
  `The object will be treated as the enum itself (shortcut form), which is likely wrong.`);
75
75
  }
76
76
  }
77
+ function designTypeOf(metadataType) {
78
+ if (typeof metadataType !== 'object' || metadataType === null || Array.isArray(metadataType)) {
79
+ return metadataType;
80
+ }
81
+ const values = Object.values(metadataType);
82
+ if (values.length === 0) {
83
+ return metadataType;
84
+ }
85
+ const numbers = values.filter((value) => typeof value === 'number');
86
+ const strings = values.filter((value) => typeof value === 'string');
87
+ if (numbers.length === 0 && strings.length === values.length) {
88
+ return String;
89
+ }
90
+ if (numbers.length > 0 &&
91
+ strings.every((name) => typeof metadataType[name] === 'number')) {
92
+ return Number;
93
+ }
94
+ return metadataType;
95
+ }
96
+ const ambiguousTypeWarned = new Set();
97
+ function warnIfAmbiguousMetadataType(metadataType, propertyHint) {
98
+ const ambiguous = metadataType === Object || (typeof metadataType === 'object' && metadataType !== null);
99
+ if (!ambiguous || ambiguousTypeWarned.has(propertyHint))
100
+ return;
101
+ ambiguousTypeWarned.add(propertyHint);
102
+ console.warn(`[@UnifiedField] "${propertyHint}" has no explicit type, and the compiler metadata says only "Object". The SWC ` +
103
+ 'dev start and the tsc build can disagree here (a union with null/undefined, a type alias, an interface), so ' +
104
+ 'the dev API may validate it as a nested object. Declare it: type: () => Number / String / Boolean / ' +
105
+ 'Date / <Class>, type: () => Object for a free-form object, or isAny: true. `nest-check-unified-field-types ' +
106
+ '--fix` (vendor mode: `node ./bin/check-unified-field-types.js --fix`) writes the declared type; a later ' +
107
+ 'release refuses such a field at boot.');
108
+ }
77
109
  export function UnifiedField(opts = {}) {
78
110
  const isLongForm = opts.enum ? isEnumOptionsObject(opts.enum) : false;
79
111
  const normalizedEnum = opts.enum
@@ -133,12 +165,15 @@ export function UnifiedField(opts = {}) {
133
165
  if (!existingKeys.includes(key)) {
134
166
  Reflect.defineMetadata(UNIFIED_FIELD_KEYS, [...existingKeys, key], target);
135
167
  }
136
- const metadataType = Reflect.getMetadata('design:type', target, propertyKey);
168
+ const metadataType = designTypeOf(Reflect.getMetadata('design:type', target, propertyKey));
137
169
  const userType = opts.type;
138
170
  const isArrayField = opts.isArray === true || metadataType === Array;
139
171
  if (metadataType === Array && !userType) {
140
172
  throw new Error(`Array field '${String(propertyKey)}' of '${String(target)}' must have an explicit type`);
141
173
  }
174
+ if (!userType && !opts.isAny && !normalizedEnum) {
175
+ warnIfAmbiguousMetadataType(metadataType, `${target.constructor?.name || '?'}.${key}`);
176
+ }
142
177
  const resolvedTypeFn = () => {
143
178
  if (userType) {
144
179
  if (userType instanceof GraphQLScalarType) {
@@ -1 +1 @@
1
- {"version":3,"file":"unified-field.decorator.js","sourceRoot":"","sources":["../../../../src/core/common/decorators/unified-field.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAgB,SAAS,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtF,OAAO,EAAE,IAAI,EAAE,MAAM,yCAAyC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAsB,MAAM,iBAAiB,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,SAAS,EACT,MAAM,EACN,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,UAAU,EACV,cAAc,GAEf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAkB,MAAM,2BAA2B,CAAC;AASvE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAMlF,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAe,CAAC;AAGvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAe7E,MAAM,UAAU,mBAAmB,CAAC,QAAkB;IACpD,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC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AAQ,EAAE,CAAC;YAC7F,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,eAAe,CAAC,IAAS;IAEhC,OAAO,CACL,CAAC,IAAI;QACH,OAAO,IAAI,KAAK,UAAU;QAC1B,OAAO,IAAI,CAAC,SAAS,EAAE,SAAS,KAAK,UAAU;QAC/C,OAAO,IAAI,CAAC,SAAS,EAAE,UAAU,KAAK,UAAU;QAChD,OAAO,IAAI,CAAC,SAAS,EAAE,YAAY,KAAK,UAAU,CAAC;QACrD,IAAI,YAAY,iBAAiB,CAClC,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,EAAO;IAC1B,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACtD,CAAC"}
1
+ {"version":3,"file":"unified-field.decorator.js","sourceRoot":"","sources":["../../../../src/core/common/decorators/unified-field.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAgB,SAAS,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtF,OAAO,EAAE,IAAI,EAAE,MAAM,yCAAyC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAsB,MAAM,iBAAiB,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,SAAS,EACT,MAAM,EACN,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,UAAU,EACV,cAAc,GAEf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,UAAU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AK,UAAU;QAC/C,OAAO,IAAI,CAAC,SAAS,EAAE,UAAU,KAAK,UAAU;QAChD,OAAO,IAAI,CAAC,SAAS,EAAE,YAAY,KAAK,UAAU,CAAC;QACrD,IAAI,YAAY,iBAAiB,CAClC,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,EAAO;IAC1B,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACtD,CAAC"}
@@ -920,6 +920,14 @@ export class CreateUserInput extends CoreInput {
920
920
  }
921
921
  ```
922
922
 
923
+ **Where the type comes from.** `type` when given; otherwise the compiler's `design:type`. The SWC dev start writes that
924
+ per file and turns a union with `null` / `undefined`, a type alias or `boolean | null` into `Object` where the tsc build
925
+ writes `Number` / `String` / `Boolean` — the field is then validated as a nested object in the dev API only. For an enum
926
+ SWC writes the enum object, which the decorator reads as `String` / `Number` like tsc (12.8.7). Since 12.8.7 the
927
+ decorator also warns at start for every other such field, and the package bin `nest-check-unified-field-types --fix`
928
+ writes the declared type. An array field without `type` is refused at
929
+ boot, as before.
930
+
923
931
  > **NestJS docs:** [Pipes](https://docs.nestjs.com/pipes), [Validation](https://docs.nestjs.com/techniques/validation)
924
932
 
925
933
  ---
@@ -474,8 +474,9 @@ longer imports `graphql-upload` anywhere can drop it from its own `package.json`
474
474
 
475
475
  `dist/core/modules/migrate/helpers/ts-compiler.js` — the file every `migrate:*` script names in
476
476
  `--compiler ts:…` — no longer registers ts-node. It is now a small CommonJS `require` hook that compiles `.ts` /
477
- `.cts` with **SWC** (`@swc/core`), with the options of the `tsc` build: target `es2022`, legacy decorators with
478
- `design:*` metadata, define semantics for class fields, class names kept. Path, file name and the
477
+ `.cts` with **SWC** (`@swc/core`), with the options of the `tsc` build but without its type checker: target
478
+ `es2022`, legacy decorators with `design:*` metadata (written per file — see "Decorator metadata" below), define
479
+ semantics for class fields, class names kept. Path, file name and the
479
480
  `--compiler ts:<file>` contract are unchanged, so **the scripts need no edit**. nest-server's own dev start,
480
481
  `docs:ci` and the migrate CLI's source fallback run through the same file, and ts-node left its devDependencies.
481
482
 
@@ -500,6 +501,25 @@ defaults use `useDefineForClassFields: false`, unlike the `tsc` build and this l
500
501
  supported through Node module hooks the loader registers (§17). Not supported: tsconfig `paths` (the starter has
501
502
  none) and a project `.swcrc` (ignored on purpose).
502
503
 
504
+ **Decorator metadata (corrected in 12.8.7).** Until 12.8.6 this section said the loader matches the `tsc` build. For
505
+ `design:type` it does not: SWC writes it per file, without the type checker, so it cannot resolve what `tsc` resolves.
506
+
507
+ | Field | SWC (dev start) | `tsc` (build, `strict: false`) |
508
+ |---|---|---|
509
+ | `max?: null \| number`, `count?: number \| undefined` | `Object` | `Number` |
510
+ | `kind?: Kind` (a type alias, local or imported) | `Object` | `String` / `Number` |
511
+ | `status?: Status` (an enum) | the enum object (read as `String` / `Number` since 12.8.7) | `String` / `Number` |
512
+ | `flag?: boolean \| null` | `Object` | `Boolean` |
513
+ | `state?: 'ok' \| 'error'` (written in place), `number`, `Date`, a class | same as `tsc` | |
514
+
515
+ `@UnifiedField` without `type` takes its type from this metadata, so the dev API validated such a field as a nested
516
+ object — `max: 5` refused — while the deployed build accepted it, and Swagger and the generated app client showed
517
+ `object`; an enum field with `mongoose` crashed the schema build. Since 12.8.7 `@UnifiedField` reads the enum object
518
+ like `tsc`, warns at start for every other such field, and the package bin `nest-check-unified-field-types --fix`
519
+ (`check:unified-field-types` in nest-server-starter projects) writes the declared type into each of them — the type
520
+ `tsc` uses, except under `strictNullChecks`, where `tsc` writes `Object` for a union with `null` too. See
521
+ `migration-guides/12.8.6-to-12.8.7.md`.
522
+
503
523
  **The dev start: REQUIRED in vendor mode, optional in npm mode.** The 12.0.0 core writes every relative import as
504
524
  `./x.js` (§17), and ts-node does not map `./x.js` to `x.ts` — not even with `TS_NODE_EXPERIMENTAL_RESOLVER`. A
505
525
  vendor-mode project, which runs the core from source, therefore fails at `pnpm start` with
@@ -43,6 +43,12 @@ build fails with TS2307 — `mysql2` is new in this release:
43
43
  pnpm add -D pg@8.23.1 @types/pg@8.23.1 mysql2@3.24.6 typeorm@1.1.2 kysely@0.29.7 drizzle-orm@1.0.0-rc.5
44
44
  ```
45
45
 
46
+ **On pnpm 10 this pulls `typeorm` into a production deploy.** `@nestjs/terminus` declares `typeorm` as an optional
47
+ peer, and pnpm binds it to the project's `typeorm` devDependency. Under pnpm 10, `pnpm deploy --legacy --prod` then
48
+ carries `typeorm` — with `ts-node`, `@swc/core` and their dependencies — into the image. pnpm 11 leaves it out
49
+ (verified with pnpm 11.28.10: the lockfile still binds the peer, the deploy contains none of the three). Move the
50
+ project to pnpm 11 (the starter's `packageManager`) rather than dropping the devDependency.
51
+
46
52
  A starter-based project already declares `mongoose` and `@nestjs/mongoose` in `dependencies`; **move `mongodb` from
47
53
  `devDependencies` to `dependencies`**, because Better-Auth's MongoDB adapter loads it at runtime.
48
54
 
@@ -0,0 +1,112 @@
1
+ # Migration Guide: 12.8.6 → 12.8.7
2
+
3
+ ## Overview
4
+
5
+ | Category | Details |
6
+ |---|---|
7
+ | **Breaking Changes** | None. The deployed behaviour does not change |
8
+ | **New Features** | `@UnifiedField` warns at start for a field whose type the SWC dev start and the tsc build read differently; the package bin `nest-check-unified-field-types` finds those fields and with `--fix` writes the declared type (§1, §2) |
9
+ | **Bugfixes** | Under the SWC dev start an enum field took the enum object as its type — `@UnifiedField({ enum: Status, mongoose: true })` crashed the schema build; it is now read as `String` / `Number` like in the tsc build (§1). Documentation: §14 of the 12.0 guide no longer claims the TypeScript loader matches the tsc build for decorator metadata. The 12.1 guide names the pnpm 10 deploy effect of the `typeorm` devDependency |
10
+ | **Migration Effort** | Recommended: run `nest-check-unified-field-types --fix` once and add it to `check` / `check:fix` (§2). A later minor release refuses such fields at boot |
11
+
12
+ ## Quick Migration
13
+
14
+ ```bash
15
+ pnpm add @lenne.tech/nest-server@12.8.7
16
+ pnpm run update # nest-server-starter based projects
17
+ pnpm exec nest-check-unified-field-types --fix # npm mode; vendor mode: §2
18
+ pnpm run format
19
+ pnpm run build
20
+ pnpm test
21
+ ```
22
+
23
+ ## 1. The dev start and the build can read a field's type differently
24
+
25
+ Without `type`, `@UnifiedField` takes a field's type from the `design:type` metadata the compiler writes. The tsc
26
+ build writes it with the type checker. The TypeScript loader of the dev start (`ts-compiler.js`, SWC) writes it per
27
+ file, without type information:
28
+
29
+ | Field | SWC (dev start) | tsc (build, `strict: false`) |
30
+ |---|---|---|
31
+ | `max?: null \| number`, `count?: number \| undefined` | `Object` | `Number` |
32
+ | `kind?: Kind` (a type alias, local or imported) | `Object` | `String` / `Number` |
33
+ | `status?: Status` (an enum) | the enum object — read as `String` / `Number` since 12.8.7 | `String` / `Number` |
34
+ | `status?: Status \| null` | `Object` | `String` / `Number` |
35
+ | `flag?: boolean \| null` | `Object` | `Boolean` |
36
+ | `state?: 'ok' \| 'error'` (written in place), `number`, `string`, `boolean`, `Date`, a class imported as a value | same as tsc | |
37
+ | `meta?: Record<string, unknown>`, an interface, `string \| number` | `Object` | `Object` |
38
+
39
+ `Object` makes `@UnifiedField` validate the field as a nested object. In the dev API `max: 5` is refused, Swagger
40
+ documents the field as `type: object` and the generated app client types it `{ [key: string]: unknown }` — while the
41
+ deployed build accepts `max: 5`. Projects in strict mode (`strictNullChecks`) get `Object` for `null | number` from
42
+ tsc too, so there the deployed API refuses it as well.
43
+
44
+ **What is new:**
45
+
46
+ - `@UnifiedField` reads the enum object SWC writes for an enum field as `String` / `Number`, like the tsc build. Until
47
+ 12.8.6 it became the field's type: the Mongoose path type of `@UnifiedField({ enum: Status, mongoose: true })`, which
48
+ `SchemaFactory` refused — the dev start crashed while the build booted.
49
+ - `@UnifiedField` warns once per field at start when the type comes only from metadata that says `Object` and neither
50
+ `type`, `isAny` nor `enum` is set:
51
+ `[@UnifiedField] "InputRequestCreateInput.max" has no explicit type, and the compiler metadata says only "Object". …`
52
+ - The package bin `nest-check-unified-field-types` (file `bin/check-unified-field-types.js`) uses the project's
53
+ TypeScript type checker to find every such field. With `--fix` it writes the type the field declares —
54
+ `type: () => Number`, `String`, `Boolean`, `Date` or the class, referenced the way the file imports it. Without
55
+ `strictNullChecks` that is the type the tsc build already uses, so the deployed behaviour stays as it is and the dev
56
+ start matches it. **With `strictNullChecks`** the tsc build writes `Object` for a union with `null` / `undefined`
57
+ too: the check marks such a field `[changes the deployed build]`, because the written type changes how the deployed
58
+ API validates it (as the declared type instead of as an object) — review those fields. Fields without a runtime class (an interface, a `Record`, a mixed union, `any`, a class imported
59
+ only as a type) are reported with what to declare: `type: () => Object` for a free-form object, `isAny: true` for
60
+ any value, or a class for a nested structure.
61
+
62
+ ```typescript
63
+ // Before: the dev start reads Object, the build reads Number
64
+ @UnifiedField({ description: 'Upper limit', isOptional: true })
65
+ max?: null | number;
66
+
67
+ // After `nest-check-unified-field-types --fix`
68
+ @UnifiedField({ description: 'Upper limit', isOptional: true, type: () => Number })
69
+ max?: null | number;
70
+ ```
71
+
72
+ ## 2. Running the check
73
+
74
+ | Mode | Command |
75
+ |---|---|
76
+ | npm mode | `nest-check-unified-field-types` (package bin, e.g. `pnpm exec nest-check-unified-field-types --fix`) |
77
+ | vendor mode | `node ./bin/check-unified-field-types.js` once the lt CLI copies the file next to `bin/migrate.js`; until then a one-off `npx -p @lenne.tech/nest-server@12.8.7 nest-check-unified-field-types --fix` in the API project |
78
+
79
+ Options: `--fix` writes the types, `--project <tsconfig>` (default `tsconfig.json`), `--include <dir>` (default `src`,
80
+ repeatable). Exit code 1 when fields remain (with `--fix`: the ones it cannot fix), 2 on a usage error. Spec and test
81
+ files are skipped.
82
+
83
+ nest-server-starter adds it as `check:unified-field-types` to `check` (fails on a finding) and with `--fix` to
84
+ `check:fix`, before `format`, so `lt fullstack update` brings it to every starter-based project. A project of its own:
85
+
86
+ ```jsonc
87
+ "check:unified-field-types": "nest-check-unified-field-types",
88
+ // in "check": … && pnpm run check:unified-field-types && …
89
+ // in "check:fix": … && pnpm run check:unified-field-types -- --fix && pnpm run format && …
90
+ ```
91
+
92
+ ## 3. Outlook
93
+
94
+ A later minor release turns the warning of §1 into an error at boot, as `@UnifiedField` already refuses an array field
95
+ without `type`. A project that runs `check:unified-field-types` in its `check` is ready for it.
96
+
97
+ ## Troubleshooting
98
+
99
+ | Symptom | Cause | Fix |
100
+ |---|---|---|
101
+ | `[@UnifiedField] "X.y" has no explicit type …` at start | §1 | `nest-check-unified-field-types --fix` (vendor mode: `node ./bin/check-unified-field-types.js --fix`), or declare `type` / `isAny` / `enum` by hand |
102
+ | The dev API refuses `max: 5` with "must be an object", the deployed API accepts it | §1 | as above |
103
+ | The check reports `(a type-only import)` | the class is imported with `import type` | import it as a value, then `type: () => X` |
104
+ | A fixed field is marked `[changes the deployed build]` | `strictNullChecks`: the build validated it as an object until now | review it; the written type is the one the field declares |
105
+ | `tsconfig not found` (exit code 2) | the check runs outside the API project | run it in the API project, or pass `--project` |
106
+
107
+ ## References
108
+
109
+ - `bin/check-unified-field-types.js`
110
+ - `src/core/common/decorators/unified-field.decorator.ts` — `warnIfAmbiguousMetadataType()`
111
+ - `tests/unit/check-unified-field-types.spec.ts`, `tests/unit/unified-field-ambiguous-type.spec.ts`
112
+ - `migration-guides/11.43.x-to-12.0.x.md` §14 — decorator metadata of the TypeScript loader
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nest-server",
3
- "version": "12.8.6",
3
+ "version": "12.8.7",
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": [
@@ -34,14 +34,15 @@
34
34
  "check": "node scripts/check.mjs",
35
35
  "check:consumer": "node scripts/check-consumer.mjs",
36
36
  "check:esm": "node scripts/check-esm-core.mjs",
37
- "check:fix": "pnpm install && pnpm run spectaql:sync && pnpm audit --fix && pnpm run check:overrides && pnpm peers check && pnpm run format && pnpm run lint:fix && pnpm run typecheck:tests && pnpm run typecheck:vendor && pnpm run check:vendor-lint && pnpm run check:esm && pnpm run check:swc-tdz && pnpm test && pnpm run build && pnpm run check:manifest && pnpm run check:without-mongodb && pnpm run check:server-start",
37
+ "check:fix": "pnpm install && pnpm run spectaql:sync && pnpm audit --fix && pnpm run check:overrides && pnpm peers check && pnpm run check:unified-field-types -- --fix && pnpm run format && pnpm run lint:fix && pnpm run typecheck:tests && pnpm run typecheck:vendor && pnpm run check:vendor-lint && pnpm run check:esm && pnpm run check:swc-tdz && pnpm test && pnpm run build && pnpm run check:manifest && pnpm run check:without-mongodb && pnpm run check:server-start",
38
38
  "check:manifest": "node scripts/check-package-manifest.mjs",
39
39
  "check:mutations": "node scripts/check-mutations.mjs",
40
- "check:naf": "pnpm install && pnpm run spectaql:sync && pnpm run check:overrides && pnpm peers check && pnpm run format && pnpm run lint:fix && pnpm run typecheck:tests && pnpm run typecheck:vendor && pnpm run check:vendor-lint && pnpm run check:esm && pnpm run check:swc-tdz && pnpm test && pnpm run build && pnpm run check:manifest && pnpm run check:without-mongodb && pnpm run check:server-start",
40
+ "check:naf": "pnpm install && pnpm run spectaql:sync && pnpm run check:overrides && pnpm peers check && pnpm run check:unified-field-types -- --fix && pnpm run format && pnpm run lint:fix && pnpm run typecheck:tests && pnpm run typecheck:vendor && pnpm run check:vendor-lint && pnpm run check:esm && pnpm run check:swc-tdz && pnpm test && pnpm run build && pnpm run check:manifest && pnpm run check:without-mongodb && pnpm run check:server-start",
41
41
  "check:overrides": "node scripts/check-overrides.mjs",
42
- "check:raw": "pnpm install --frozen-lockfile && pnpm run spectaql:sync && pnpm audit && pnpm run check:overrides && pnpm peers check && pnpm run format:check && pnpm run lint && pnpm run typecheck:tests && pnpm run typecheck:vendor && pnpm run check:vendor-lint && pnpm run check:esm && pnpm run check:swc-tdz && pnpm test && pnpm run build && pnpm run check:manifest && pnpm run check:without-mongodb && pnpm run check:server-start",
42
+ "check:raw": "pnpm install --frozen-lockfile && pnpm run spectaql:sync && pnpm audit && pnpm run check:overrides && pnpm peers check && pnpm run format:check && pnpm run lint && pnpm run typecheck:tests && pnpm run typecheck:vendor && pnpm run check:vendor-lint && pnpm run check:esm && pnpm run check:swc-tdz && pnpm run check:unified-field-types && pnpm test && pnpm run build && pnpm run check:manifest && pnpm run check:without-mongodb && pnpm run check:server-start",
43
43
  "check:server-start": "cross-env NODE_ENV=local node scripts/check-server-start.mjs --entry=dist/main.js --port-env=NSC__PORT --ready=\"Server starte[dt] at\" --path=/",
44
44
  "check:swc-tdz": "nest build -b swc -p tsconfig.swc-tdz.json && node scripts/check-swc-tdz.mjs",
45
+ "check:unified-field-types": "node bin/check-unified-field-types.js",
45
46
  "check:vendor-lint": "node scripts/check-vendor-lint.mjs",
46
47
  "check:without-mongodb": "node scripts/check-without-mongodb.mjs --dist",
47
48
  "check:without-mongodb:package": "node scripts/check-without-mongodb.mjs --package",
@@ -106,12 +107,12 @@
106
107
  "@getbrevo/brevo": "6.2.0",
107
108
  "@modelcontextprotocol/sdk": "1.32.2",
108
109
  "@nestjs/apollo": "14.2.0",
109
- "@nestjs/common": "12.4.0",
110
- "@nestjs/core": "12.4.0",
110
+ "@nestjs/common": "12.4.2",
111
+ "@nestjs/core": "12.4.2",
111
112
  "@nestjs/graphql": "14.2.0",
112
113
  "@nestjs/jwt": "12.0.4",
113
114
  "@nestjs/passport": "12.0.1",
114
- "@nestjs/platform-express": "12.4.0",
115
+ "@nestjs/platform-express": "12.4.2",
115
116
  "@nestjs/schedule": "12.0.3",
116
117
  "@nestjs/swagger": "12.1.1",
117
118
  "@nestjs/terminus": "12.1.0",
@@ -124,7 +125,7 @@
124
125
  "compression": "1.8.2",
125
126
  "cookie-parser": "1.4.7",
126
127
  "cron": "4.4.0",
127
- "dotenv": "18.0.9",
128
+ "dotenv": "18.0.10",
128
129
  "ejs": "7.0.2",
129
130
  "express": "5.3.0",
130
131
  "graphql": "16.14.2",
@@ -132,7 +133,7 @@
132
133
  "graphql-subscriptions": "3.0.0",
133
134
  "graphql-upload": "17.1.0",
134
135
  "graphql-ws": "6.4.1",
135
- "jose": "6.2.15",
136
+ "jose": "6.2.17",
136
137
  "js-sha256": "1.0.0",
137
138
  "json-to-graphql-query": "2.3.0",
138
139
  "lodash": "4.18.1",
@@ -227,16 +228,16 @@
227
228
  }
228
229
  },
229
230
  "devDependencies": {
230
- "@aws-sdk/client-s3": "3.1164.0",
231
- "@aws-sdk/lib-storage": "3.1164.0",
232
- "@aws-sdk/s3-request-presigner": "3.1164.0",
231
+ "@aws-sdk/client-s3": "3.1165.0",
232
+ "@aws-sdk/lib-storage": "3.1165.0",
233
+ "@aws-sdk/s3-request-presigner": "3.1165.0",
233
234
  "@better-auth/core": "1.7.18",
234
235
  "@better-auth/passkey": "1.7.18",
235
236
  "@compodoc/compodoc": "2.0.0",
236
237
  "@nestjs/cli": "12.0.12",
237
238
  "@nestjs/mongoose": "12.0.1",
238
239
  "@nestjs/schematics": "12.0.13",
239
- "@nestjs/testing": "12.4.0",
240
+ "@nestjs/testing": "12.4.2",
240
241
  "@swc/cli": "0.8.2",
241
242
  "@swc/core": "1.16.22",
242
243
  "@tus/s3-store": "2.1.0",
@@ -257,12 +258,12 @@
257
258
  "ioredis": "6.0.0",
258
259
  "kysely": "0.29.8",
259
260
  "mongodb": "7.8.0",
260
- "mongoose": "9.12.0",
261
+ "mongoose": "9.12.1",
261
262
  "mysql2": "3.24.6",
262
263
  "nodemon": "3.1.14",
263
264
  "otpauth": "9.6.0",
264
- "oxfmt": "0.77.0",
265
- "oxlint": "1.92.0",
265
+ "oxfmt": "0.78.0",
266
+ "oxlint": "1.93.0",
266
267
  "oxlint-tsgolint": "7.0.2006",
267
268
  "pg": "8.23.1",
268
269
  "playwright-core": "1.65.0",
@@ -273,14 +274,15 @@
273
274
  "typeorm": "1.1.2",
274
275
  "typescript": "6.0.3",
275
276
  "unplugin-swc": "2.0.0",
276
- "vite": "8.3.6",
277
+ "vite": "8.3.7",
277
278
  "vitest": "5.1.0"
278
279
  },
279
280
  "main": "dist/index.js",
280
281
  "types": "dist/index.d.ts",
281
282
  "bin": {
282
283
  "nest-migrate": "./bin/migrate.js",
283
- "migrate": "./bin/migrate.js"
284
+ "migrate": "./bin/migrate.js",
285
+ "nest-check-unified-field-types": "./bin/check-unified-field-types.js"
284
286
  },
285
287
  "files": [
286
288
  "dist/**/*",
@@ -270,6 +270,64 @@ function warnIfLikelyMisconfiguredEnumOptions(value: unknown, propertyHint: stri
270
270
  }
271
271
  }
272
272
 
273
+ /**
274
+ * `design:type` as the tsc build writes it. For a field typed with an enum, tsc writes `String` (string enum) or
275
+ * `Number` (numeric enum); the SWC loader of the dev start writes the enum OBJECT. Read as is, that object became the
276
+ * Mongoose path type (`SchemaFactory` refused it: "'active' is not a valid type") and a nested-object validation target.
277
+ * tsc never writes a plain object here, so only the dev start is affected; a heterogeneous enum stays as it is.
278
+ */
279
+ function designTypeOf(metadataType: unknown): unknown {
280
+ if (typeof metadataType !== 'object' || metadataType === null || Array.isArray(metadataType)) {
281
+ return metadataType;
282
+ }
283
+ const values = Object.values(metadataType);
284
+ if (values.length === 0) {
285
+ return metadataType;
286
+ }
287
+ const numbers = values.filter((value) => typeof value === 'number');
288
+ const strings = values.filter((value) => typeof value === 'string') as string[];
289
+ if (numbers.length === 0 && strings.length === values.length) {
290
+ return String;
291
+ }
292
+ // A numeric enum carries its reverse mapping: every string value is the name of a numeric member
293
+ if (
294
+ numbers.length > 0 &&
295
+ strings.every((name) => typeof (metadataType as Record<string, unknown>)[name] === 'number')
296
+ ) {
297
+ return Number;
298
+ }
299
+ return metadataType;
300
+ }
301
+
302
+ /** Fields already warned about by {@link warnIfAmbiguousMetadataType}: one line per field, not per decoration. */
303
+ const ambiguousTypeWarned = new Set<string>();
304
+
305
+ /**
306
+ * Warn when a field without `type` / `isAny` / `enum` takes its type from compiler metadata that is only `Object`. The
307
+ * SWC loader of the dev start writes `design:type` syntactically, file by file: a union with `null` / `undefined` (also
308
+ * with an enum), a type alias or an interface become `Object` there, where the tsc build writes `Number`, `String` or
309
+ * the class — a plain enum is read like tsc does, see {@link designTypeOf}. The dev API then validates the field as a
310
+ * nested object while the deployed one does not — `max: 5` refused in development, accepted in production.
311
+ *
312
+ * The package bin `nest-check-unified-field-types --fix` (`check:unified-field-types` in nest-server-starter
313
+ * projects; vendor mode: `node ./bin/check-unified-field-types.js --fix`) writes the declared type into every such
314
+ * field; a later release refuses them at boot.
315
+ */
316
+ function warnIfAmbiguousMetadataType(metadataType: unknown, propertyHint: string): void {
317
+ const ambiguous = metadataType === Object || (typeof metadataType === 'object' && metadataType !== null);
318
+ if (!ambiguous || ambiguousTypeWarned.has(propertyHint)) return;
319
+ ambiguousTypeWarned.add(propertyHint);
320
+ // eslint-disable-next-line no-console
321
+ console.warn(
322
+ `[@UnifiedField] "${propertyHint}" has no explicit type, and the compiler metadata says only "Object". The SWC ` +
323
+ 'dev start and the tsc build can disagree here (a union with null/undefined, a type alias, an interface), so ' +
324
+ 'the dev API may validate it as a nested object. Declare it: type: () => Number / String / Boolean / ' +
325
+ 'Date / <Class>, type: () => Object for a free-form object, or isAny: true. `nest-check-unified-field-types ' +
326
+ '--fix` (vendor mode: `node ./bin/check-unified-field-types.js --fix`) writes the declared type; a later ' +
327
+ 'release refuses such a field at boot.',
328
+ );
329
+ }
330
+
273
331
  export function UnifiedField(opts: UnifiedFieldOptions = {}): PropertyDecorator {
274
332
  // Normalize the shortcut form `enum: MyEnum` into the long form
275
333
  // `enum: { enum: MyEnum }` so the rest of the decorator can assume a uniform
@@ -353,7 +411,7 @@ export function UnifiedField(opts: UnifiedFieldOptions = {}): PropertyDecorator
353
411
  Reflect.defineMetadata(UNIFIED_FIELD_KEYS, [...existingKeys, key], target);
354
412
  }
355
413
 
356
- const metadataType = Reflect.getMetadata('design:type', target, propertyKey);
414
+ const metadataType = designTypeOf(Reflect.getMetadata('design:type', target, propertyKey));
357
415
  const userType = opts.type;
358
416
  const isArrayField = opts.isArray === true || metadataType === Array;
359
417
 
@@ -362,6 +420,10 @@ export function UnifiedField(opts: UnifiedFieldOptions = {}): PropertyDecorator
362
420
  throw new Error(`Array field '${String(propertyKey)}' of '${String(target)}' must have an explicit type`);
363
421
  }
364
422
 
423
+ if (!userType && !opts.isAny && !normalizedEnum) {
424
+ warnIfAmbiguousMetadataType(metadataType, `${target.constructor?.name || '?'}.${key}`);
425
+ }
426
+
365
427
  const resolvedTypeFn = (): any => {
366
428
  if (userType) {
367
429
  if (userType instanceof GraphQLScalarType) {