@dudousxd/nestjs-codegen 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,61 @@
1
1
  # @dudousxd/nestjs-codegen
2
2
 
3
+ ## 0.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - abe5172: Extensions can declare input files the host's globs don't cover, via `ExtensionContext.trackInput`.
8
+
9
+ The skip-when-unchanged hash is built from `contracts.glob`, `forms.watch` and `pages.glob`. An extension that reads outside them therefore produced output that nothing could invalidate: `@dudousxd/nestjs-filter-codegen` resolves each route's `@ApplyFilter(FilterClass)` target and turns its `@Computed` / `@Filterable({ computed })` declarations into `filterFields` entries, but a filter class matches none of those globs — so editing one left the hash untouched and the next run reported "up to date, skipped" while serving stale types. The only way out was deleting `outDir`.
10
+
11
+ Extensions like that cannot declare their inputs up front (they need the discovered routes to know which files to read), so this works like a compiler depfile instead: paths reported during a run are recorded in the manifest as `extraInputs`, and the next run folds their contents into the hash. A file that becomes a dependency for the first time is picked up on the run after it is first read — in practice not a gap, since wiring a new filter class also edits a controller, which the globs already cover.
12
+
13
+ Deleting a tracked file invalidates too (it hashes as a `missing` marker rather than throwing), and a tracked path a glob already covers is hashed once, not twice.
14
+
15
+ Purely additive for existing extensions. `trackInput` is a no-op on the standalone `emitApi` path, which writes no manifest.
16
+
17
+ ## 0.16.0
18
+
19
+ ### Minor Changes
20
+
21
+ - Discover routes on mixin (factory-produced) controllers.
22
+
23
+ A `@Controller` class whose heritage clause is a factory call now contributes the
24
+ decorated methods of the class that factory returns:
25
+
26
+ ```ts
27
+ @Controller("base/util/search")
28
+ export class SearchUtilController extends createTableController(Util, {
29
+ dto: UtilDTO,
30
+ }) {}
31
+ ```
32
+
33
+ NestJS already routes inherited methods at runtime via the prototype chain; the
34
+ static discovery pass now follows the same link. Each such route carries a new
35
+ `controllerRef.mixin` binding recording the factory and its call-site class
36
+ arguments — the decorator arguments _inside_ a factory reference its own
37
+ parameters, so the concrete entity is only knowable from the call site.
38
+
39
+ That binding drives two things:
40
+
41
+ - **`filterFields`** are derived from the call-site entity, so
42
+ `@ApplyFilter(GeneratedFilter)` works even though the filter class is declared
43
+ inside the factory and its `@Filterable({ entity })` names a parameter. This is
44
+ also what flips these routes from mutation to query in the emitted client.
45
+ - **Response types** are instantiated against the derived class, so
46
+ `Paginated<D>` resolves to the concrete `D`. This needs the type checker, which
47
+ needs lib files — the discovery Project sets `skipLoadingLibFiles` for
48
+ cold-start speed, so mixin response types resolve through a second Project
49
+ built lazily on the first mixin controller.
50
+
51
+ **Behaviour change:** `joinPaths` now always emits a leading slash.
52
+ `@Controller('items')` + `@Post(':id')` previously produced `items/:id` while
53
+ `@Controller('items')` alone produced `/items` — the prefix+suffix branch was the
54
+ only one that did not add it. The client's `buildUrl()` normalises before
55
+ requesting, so no URL was ever broken by this, but the raw value reaches the
56
+ emitted `ROUTES` map and the OpenAPI export, where a path without a leading slash
57
+ is invalid.
58
+
3
59
  ## 0.15.0
4
60
 
5
61
  ### Minor Changes