@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/dist/index.cjs CHANGED
@@ -345,15 +345,17 @@ function emitApiObjectBlock(tree, indent) {
345
345
  if (method === "GET") {
346
346
  const typeAccess = buildRouterTypeAccess(c.name);
347
347
  lines.push(`${pad}${objKey}: {`);
348
+ lines.push(`${pad} queryKey: (query?: ${typeAccess}['query']) => query !== undefined ? [${flatName}, query] as const : [${flatName}] as const,`);
348
349
  lines.push(`${pad} queryOptions: (query?: ${typeAccess}['query']) =>`);
349
350
  lines.push(`${pad} queryOptions({`);
350
- lines.push(`${pad} queryKey: [${flatName}, query],`);
351
+ lines.push(`${pad} queryKey: query !== undefined ? [${flatName}, query] : [${flatName}],`);
351
352
  lines.push(`${pad} queryFn: () => fetcher.get<${typeAccess}['response']>(route(${flatName} as never) || ${safePath}, { query }),`);
352
353
  lines.push(`${pad} }),`);
353
354
  lines.push(`${pad}},`);
354
355
  } else {
355
356
  const typeAccess = buildRouterTypeAccess(c.name);
356
357
  lines.push(`${pad}${objKey}: {`);
358
+ lines.push(`${pad} queryKey: () => [${flatName}] as const,`);
357
359
  lines.push(`${pad} mutationOptions: () => ({`);
358
360
  lines.push(`${pad} mutationFn: (body: ${typeAccess}['body']) => fetcher.${fetcherMethod}<${typeAccess}['response']>(route(${flatName} as never) || ${safePath}, { body }),`);
359
361
  lines.push(`${pad} }),`);
@@ -1453,7 +1455,7 @@ async function watch(config, onChange) {
1453
1455
  __name(watch, "watch");
1454
1456
 
1455
1457
  // src/index.ts
1456
- var VERSION = "1.0.7";
1458
+ var VERSION = "2.0.0";
1457
1459
  // Annotate the CommonJS export names for ESM import in node:
1458
1460
  0 && (module.exports = {
1459
1461
  CodegenError,