@dudousxd/nestjs-codegen 0.9.0 → 0.11.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,45 @@
1
1
  # @dudousxd/nestjs-codegen
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b9efd1c: fix(core): emit a clean prefix `queryKey` when a query handle is called with no input.
8
+
9
+ Previously the generated `queryKey()` was always `[name, input]`, so calling it with
10
+ no argument produced `[name, undefined]` — a two-element key whose trailing `undefined`
11
+ does NOT partial-match the parametrized live queries (`[name, { params, query }]`).
12
+ That made the bare `api.x.y().queryKey()` useless for `invalidateQueries`: it silently
13
+ matched nothing.
14
+
15
+ The key now omits the trailing element when `input === undefined`
16
+ (`input === undefined ? [name] : [name, input]`), so `api.x.y().queryKey()` is a proper
17
+ prefix that partial-matches every parametrized variant. Invalidating a whole route is now
18
+ just `queryClient.invalidateQueries({ queryKey: api.x.y().queryKey() })` — no manual
19
+ key construction or slicing. Passing the real input still yields `[name, input]` for an
20
+ exact match. Keys carrying input are unchanged.
21
+
22
+ ## 0.10.0
23
+
24
+ ### Minor Changes
25
+
26
+ - 152a2ab: Narrow the public `ValidationOption` type to `ValidationAdapter` only. The string
27
+ shortcuts (`'zod'` / `'valibot'` / `'arktype'`) were advertised by the type but
28
+ `resolveAdapter` always threw a `ConfigError` for any string, so they never worked
29
+ at runtime. The type now guides TypeScript users to import and pass an adapter
30
+ instance (e.g. `zodAdapter` from `@dudousxd/nestjs-codegen-zod`).
31
+
32
+ The runtime guard is retained: `resolveAdapter` still accepts a `string` and throws
33
+ the helpful "install + import the adapter package" error, so JS callers and untyped
34
+ configs that pass a removed string shortcut get the same actionable message.
35
+
36
+ This is a compile-time-only breaking change for anyone still typing `validation:
37
+ 'zod'` — it never produced working output at runtime, so the bump is minor.
38
+
39
+ ### Patch Changes
40
+
41
+ - 81ba774: Ship TanStack Intent agent skills (SKILL.md) inside the package.
42
+
3
43
  ## 0.9.0
4
44
 
5
45
  ### Minor Changes
package/README.md CHANGED
@@ -15,6 +15,8 @@ layer.
15
15
 
16
16
  ```bash
17
17
  pnpm add -D @dudousxd/nestjs-codegen
18
+ # a validation adapter (no adapter is bundled in core) — zod shown; or -valibot / -arktype:
19
+ pnpm add -D @dudousxd/nestjs-codegen-zod
18
20
  # the runtime the generated client imports its Fetcher type from:
19
21
  pnpm add @dudousxd/nestjs-client
20
22
  ```
@@ -33,6 +35,7 @@ The watcher is a dev/CI concern, so the module skips itself automatically when
33
35
  ```ts title="src/app.module.ts"
34
36
  import { Module } from '@nestjs/common';
35
37
  import { NestjsCodegenModule } from '@dudousxd/nestjs-codegen/nest';
38
+ import { zodAdapter } from '@dudousxd/nestjs-codegen-zod';
36
39
 
37
40
  @Module({
38
41
  imports: [
@@ -42,7 +45,7 @@ import { NestjsCodegenModule } from '@dudousxd/nestjs-codegen/nest';
42
45
  // output directory for the generated files
43
46
  codegen: { outDir: 'src/generated' },
44
47
 
45
- validation: 'zod', // 'zod' (bundled) | valibotAdapter | arktypeAdapter
48
+ validation: zodAdapter, // zodAdapter | valibotAdapter | arktypeAdapter
46
49
  }),
47
50
  ],
48
51
  })
@@ -87,7 +90,7 @@ import { arktypeAdapter } from '@dudousxd/nestjs-codegen-arktype';
87
90
  NestjsCodegenModule.forRoot({
88
91
  contracts: { glob: 'src/**/*.controller.ts' },
89
92
  codegen: { outDir: 'src/generated' },
90
- validation: arktypeAdapter, // render the IR as arktype instead of the bundled zod
93
+ validation: arktypeAdapter, // render the IR as arktype instead of zod
91
94
  extensions: [tanstackQuery(), nestjsFilterCodegen(), nestjsInertiaCodegen()],
92
95
  });
93
96
  ```
@@ -136,11 +139,12 @@ with `defineConfig` and importing them into `forRoot()`:
136
139
 
137
140
  ```ts title="nestjs-codegen.config.ts"
138
141
  import { defineConfig } from '@dudousxd/nestjs-codegen';
142
+ import { zodAdapter } from '@dudousxd/nestjs-codegen-zod';
139
143
 
140
144
  export default defineConfig({
141
145
  contracts: { glob: 'src/**/*.controller.ts' },
142
146
  codegen: { outDir: 'src/generated' },
143
- validation: 'zod',
147
+ validation: zodAdapter,
144
148
  });
145
149
  ```
146
150
 
package/dist/cli/main.cjs CHANGED
@@ -832,7 +832,11 @@ function buildRequestModel(c) {
832
832
  urlExpr,
833
833
  optsExpr,
834
834
  responseType: `${TA}['response']`,
835
- queryKeyExpr: `[${flat}, input] as const`
835
+ // When no input is supplied the key omits the trailing element entirely
836
+ // (`[name]` rather than `[name, undefined]`) so the bare `.queryKey()` is a
837
+ // clean prefix that partial-matches every parametrized variant — making it
838
+ // directly usable for `invalidateQueries`.
839
+ queryKeyExpr: `(input === undefined ? [${flat}] as const : [${flat}, input] as const)`
836
840
  };
837
841
  }
838
842
  function renderFetcherRequest(req) {
@@ -4511,7 +4515,7 @@ async function watch(config, onChange) {
4511
4515
  }
4512
4516
 
4513
4517
  // src/index.ts
4514
- var VERSION = "0.9.0";
4518
+ var VERSION = "0.11.0";
4515
4519
 
4516
4520
  // src/cli/codegen.ts
4517
4521
  async function runCodegen(opts = {}) {