@dudousxd/nestjs-inertia-codegen 1.0.7 → 2.0.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,16 @@
1
1
  # Changelog — @dudousxd/nestjs-inertia-codegen
2
2
 
3
+ ## 2.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat(codegen): add queryKey() helper for typed cache invalidation — api.crew.getCrew.queryKey()
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies []:
12
+ - @dudousxd/nestjs-inertia@2.0.0
13
+
3
14
  ## 1.0.7
4
15
 
5
16
  ### Patch Changes
package/dist/cli/main.cjs CHANGED
@@ -324,15 +324,17 @@ function emitApiObjectBlock(tree, indent) {
324
324
  if (method === "GET") {
325
325
  const typeAccess = buildRouterTypeAccess(c.name);
326
326
  lines.push(`${pad}${objKey}: {`);
327
+ lines.push(`${pad} queryKey: (query?: ${typeAccess}['query']) => query !== undefined ? [${flatName}, query] as const : [${flatName}] as const,`);
327
328
  lines.push(`${pad} queryOptions: (query?: ${typeAccess}['query']) =>`);
328
329
  lines.push(`${pad} queryOptions({`);
329
- lines.push(`${pad} queryKey: [${flatName}, query],`);
330
+ lines.push(`${pad} queryKey: query !== undefined ? [${flatName}, query] : [${flatName}],`);
330
331
  lines.push(`${pad} queryFn: () => fetcher.get<${typeAccess}['response']>(route(${flatName} as never) || ${safePath}, { query }),`);
331
332
  lines.push(`${pad} }),`);
332
333
  lines.push(`${pad}},`);
333
334
  } else {
334
335
  const typeAccess = buildRouterTypeAccess(c.name);
335
336
  lines.push(`${pad}${objKey}: {`);
337
+ lines.push(`${pad} queryKey: () => [${flatName}] as const,`);
336
338
  lines.push(`${pad} mutationOptions: () => ({`);
337
339
  lines.push(`${pad} mutationFn: (body: ${typeAccess}['body']) => fetcher.${fetcherMethod}<${typeAccess}['response']>(route(${flatName} as never) || ${safePath}, { body }),`);
338
340
  lines.push(`${pad} }),`);
@@ -1432,7 +1434,7 @@ async function watch(config, onChange) {
1432
1434
  __name(watch, "watch");
1433
1435
 
1434
1436
  // src/index.ts
1435
- var VERSION = "1.0.7";
1437
+ var VERSION = "2.0.0";
1436
1438
 
1437
1439
  // src/cli/codegen.ts
1438
1440
  async function runCodegen(opts = {}) {