@dudousxd/nestjs-inertia-codegen 2.0.0 → 2.0.1

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/cli/main.js CHANGED
@@ -293,11 +293,10 @@ function emitApiObjectBlock(tree, indent) {
293
293
  const typeAccess = buildRouterTypeAccess(c.name);
294
294
  lines.push(`${pad}${objKey}: {`);
295
295
  lines.push(`${pad} queryKey: (query?: ${typeAccess}['query']) => query !== undefined ? [${flatName}, query] as const : [${flatName}] as const,`);
296
- lines.push(`${pad} queryOptions: (query?: ${typeAccess}['query']) =>`);
297
- lines.push(`${pad} queryOptions({`);
298
- lines.push(`${pad} queryKey: query !== undefined ? [${flatName}, query] : [${flatName}],`);
299
- lines.push(`${pad} queryFn: () => fetcher.get<${typeAccess}['response']>(route(${flatName} as never) || ${safePath}, { query }),`);
300
- lines.push(`${pad} }),`);
296
+ lines.push(`${pad} queryOptions: (query?: ${typeAccess}['query']) => ({`);
297
+ lines.push(`${pad} queryKey: query !== undefined ? [${flatName}, query] as const : [${flatName}] as const,`);
298
+ lines.push(`${pad} queryFn: () => fetcher.get<${typeAccess}['response']>(route(${flatName} as never) || ${safePath}, { query }),`);
299
+ lines.push(`${pad} }),`);
301
300
  lines.push(`${pad}},`);
302
301
  } else {
303
302
  const typeAccess = buildRouterTypeAccess(c.name);
@@ -324,14 +323,10 @@ function buildRouterTypeAccess(name) {
324
323
  __name(buildRouterTypeAccess, "buildRouterTypeAccess");
325
324
  function buildApiFile(routes) {
326
325
  const contracted = routes.filter((r) => r.contract);
327
- const hasGetRoutes = contracted.some((r) => r.method === "GET");
328
326
  const lines = [
329
327
  "// Generated by @dudousxd/nestjs-inertia-codegen. Do not edit.",
330
328
  ""
331
329
  ];
332
- if (hasGetRoutes) {
333
- lines.push("import { queryOptions } from '@tanstack/query-core';");
334
- }
335
330
  lines.push("import { route } from './routes.js';");
336
331
  lines.push("import { createFetcher } from '@dudousxd/nestjs-inertia-client';");
337
332
  lines.push("");
@@ -1402,7 +1397,7 @@ async function watch(config, onChange) {
1402
1397
  __name(watch, "watch");
1403
1398
 
1404
1399
  // src/index.ts
1405
- var VERSION = "2.0.0";
1400
+ var VERSION = "2.0.1";
1406
1401
 
1407
1402
  // src/cli/codegen.ts
1408
1403
  async function runCodegen(opts = {}) {