@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/CHANGELOG.md +9 -0
- package/dist/cli/main.cjs +5 -10
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +5 -10
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +5 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -10
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -305,11 +305,10 @@ function emitApiObjectBlock(tree, indent) {
|
|
|
305
305
|
const typeAccess = buildRouterTypeAccess(c.name);
|
|
306
306
|
lines.push(`${pad}${objKey}: {`);
|
|
307
307
|
lines.push(`${pad} queryKey: (query?: ${typeAccess}['query']) => query !== undefined ? [${flatName}, query] as const : [${flatName}] as const,`);
|
|
308
|
-
lines.push(`${pad} queryOptions: (query?: ${typeAccess}['query'])
|
|
309
|
-
lines.push(`${pad}
|
|
310
|
-
lines.push(`${pad}
|
|
311
|
-
lines.push(`${pad}
|
|
312
|
-
lines.push(`${pad} }),`);
|
|
308
|
+
lines.push(`${pad} queryOptions: (query?: ${typeAccess}['query']) => ({`);
|
|
309
|
+
lines.push(`${pad} queryKey: query !== undefined ? [${flatName}, query] as const : [${flatName}] as const,`);
|
|
310
|
+
lines.push(`${pad} queryFn: () => fetcher.get<${typeAccess}['response']>(route(${flatName} as never) || ${safePath}, { query }),`);
|
|
311
|
+
lines.push(`${pad} }),`);
|
|
313
312
|
lines.push(`${pad}},`);
|
|
314
313
|
} else {
|
|
315
314
|
const typeAccess = buildRouterTypeAccess(c.name);
|
|
@@ -336,14 +335,10 @@ function buildRouterTypeAccess(name) {
|
|
|
336
335
|
__name(buildRouterTypeAccess, "buildRouterTypeAccess");
|
|
337
336
|
function buildApiFile(routes) {
|
|
338
337
|
const contracted = routes.filter((r) => r.contract);
|
|
339
|
-
const hasGetRoutes = contracted.some((r) => r.method === "GET");
|
|
340
338
|
const lines = [
|
|
341
339
|
"// Generated by @dudousxd/nestjs-inertia-codegen. Do not edit.",
|
|
342
340
|
""
|
|
343
341
|
];
|
|
344
|
-
if (hasGetRoutes) {
|
|
345
|
-
lines.push("import { queryOptions } from '@tanstack/query-core';");
|
|
346
|
-
}
|
|
347
342
|
lines.push("import { route } from './routes.js';");
|
|
348
343
|
lines.push("import { createFetcher } from '@dudousxd/nestjs-inertia-client';");
|
|
349
344
|
lines.push("");
|
|
@@ -1414,7 +1409,7 @@ async function watch(config, onChange) {
|
|
|
1414
1409
|
__name(watch, "watch");
|
|
1415
1410
|
|
|
1416
1411
|
// src/index.ts
|
|
1417
|
-
var VERSION = "2.0.
|
|
1412
|
+
var VERSION = "2.0.1";
|
|
1418
1413
|
export {
|
|
1419
1414
|
CodegenError,
|
|
1420
1415
|
ConfigError,
|