@dudousxd/nestjs-codegen 0.10.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,24 @@
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
+
3
22
  ## 0.10.0
4
23
 
5
24
  ### Minor Changes
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.10.0";
4518
+ var VERSION = "0.11.0";
4515
4519
 
4516
4520
  // src/cli/codegen.ts
4517
4521
  async function runCodegen(opts = {}) {