@kubb/agent 5.0.0-alpha.35 → 5.0.0-alpha.36
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/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +1293 -20554
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +16 -14
- package/.output/server/chunks/routes/api/health.get.mjs.map +1 -1
- package/.output/server/index.mjs +16 -14
- package/.output/server/index.mjs.map +1 -1
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/constants.js +18 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/permessage-deflate.js +514 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/sender.js +602 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/stream.js +159 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket-server.js +540 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket.js +1388 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/package.json +69 -0
- package/.output/server/node_modules/.nitro/ws@8.18.0/wrapper.mjs +8 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/buffer-util.js +131 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/event-target.js +292 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/extension.js +203 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/limiter.js +55 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/receiver.js +706 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/subprotocol.js +62 -0
- package/.output/server/node_modules/.nitro/ws@8.20.0/lib/validation.js +152 -0
- package/.output/server/node_modules/@clack/core/dist/index.mjs +11 -0
- package/.output/server/node_modules/@clack/core/package.json +60 -0
- package/.output/server/node_modules/@clack/prompts/dist/index.mjs +137 -0
- package/.output/server/node_modules/@clack/prompts/package.json +65 -0
- package/.output/server/node_modules/@kubb/ast/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/ast/dist/index.js +423 -0
- package/.output/server/node_modules/@kubb/ast/package.json +70 -0
- package/.output/server/node_modules/@kubb/core/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/core/dist/hooks.js +23 -0
- package/.output/server/node_modules/@kubb/core/dist/index.js +2311 -0
- package/.output/server/node_modules/@kubb/core/package.json +109 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/chunk-O_arW02_.js +17 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/defaultParser-iCpMSYCp.js +15 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/getRelativePath-NAm_Y-vp.js +55 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/index.js +653 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/onProcessExit-Cput7j2c.js +742 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/parsers/typescript.js +101 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/parsers.js +17 -0
- package/.output/server/node_modules/@kubb/fabric-core/dist/plugins.js +375 -0
- package/.output/server/node_modules/@kubb/fabric-core/package.json +111 -0
- package/.output/server/node_modules/@kubb/oas/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/oas/dist/index.js +918 -0
- package/.output/server/node_modules/@kubb/oas/package.json +94 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/StaticClassClient-bCe7RG_w.js +636 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/components.js +2 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/generators-BffddRNu.js +723 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/index.js +124 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/templates/clients/axios.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/templates/clients/fetch.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-client/dist/templates/config.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-client/package.json +153 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/components-BK_6GU4v.js +257 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/generators-D5YFtyyC.js +71 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/dist/index.js +79 -0
- package/.output/server/node_modules/@kubb/plugin-cypress/package.json +108 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/components-BkBIov4R.js +419 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/fakerGenerator-BztogaeO.js +200 -0
- package/.output/server/node_modules/@kubb/plugin-faker/dist/index.js +141 -0
- package/.output/server/node_modules/@kubb/plugin-faker/package.json +103 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/Server-H3SwqhwF.js +178 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/generators-BqkMrcs9.js +274 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/dist/index.js +122 -0
- package/.output/server/node_modules/@kubb/plugin-mcp/package.json +107 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/components-DgtTZkWX.js +277 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/generators-C34kqa1L.js +161 -0
- package/.output/server/node_modules/@kubb/plugin-msw/dist/index.js +84 -0
- package/.output/server/node_modules/@kubb/plugin-msw/package.json +109 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/SchemaMapper-CqMkO2T1.js +58 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/generators-D7C3CXsN.js +79 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/generators.js +2 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/getFooter-Pw3tLCiV.js +112 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/hooks.js +200 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/index.js +408 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/requestBody-pRavthCw.js +1336 -0
- package/.output/server/node_modules/@kubb/plugin-oas/dist/utils.js +268 -0
- package/.output/server/node_modules/@kubb/plugin-oas/package.json +122 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/components-CpyHYGOw.js +1520 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/generators-CpiBv5eE.js +1427 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/dist/index.js +166 -0
- package/.output/server/node_modules/@kubb/plugin-react-query/package.json +112 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/dist/index.js +65 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/package.json +85 -0
- package/.output/server/node_modules/@kubb/plugin-redoc/static/redoc.hbs +22 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/components-BhStIi1M.js +665 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/generators-CQClzsST.js +415 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/dist/index.js +145 -0
- package/.output/server/node_modules/@kubb/plugin-solid-query/package.json +113 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/components-DntKBsnB.js +666 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/generators-BtTsGGrM.js +414 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/index.js +145 -0
- package/.output/server/node_modules/@kubb/plugin-svelte-query/package.json +113 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/components-DRDGvgXG.js +702 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/generators-ClWZJ-YG.js +399 -0
- package/.output/server/node_modules/@kubb/plugin-swr/dist/index.js +144 -0
- package/.output/server/node_modules/@kubb/plugin-swr/package.json +115 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/components-C7fu-sK1.js +723 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/index.js +2 -0
- package/.output/server/node_modules/@kubb/plugin-ts/dist/plugin-CYC-FGXe.js +479 -0
- package/.output/server/node_modules/@kubb/plugin-ts/package.json +105 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/components-_AMBl0g-.js +1029 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/generators-Zb1s5Wmb.js +661 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/dist/index.js +157 -0
- package/.output/server/node_modules/@kubb/plugin-vue-query/package.json +114 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/chunk--u3MIqq1.js +8 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/components-eECfXVou.js +842 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/generators-D1R6NNf2.js +290 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/index.js +175 -0
- package/.output/server/node_modules/@kubb/plugin-zod/dist/templates/ToZod.source.js +6 -0
- package/.output/server/node_modules/@kubb/plugin-zod/package.json +112 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/chunk-BGCRLu6H.js +38 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/index.js +525 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime-Bl0DfUmV.js +1448 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime.js +12 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/parsers.js +2 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/plugins.js +4 -0
- package/.output/server/node_modules/@kubb/react-fabric/dist/reactPlugin-QQPrjNuQ.js +17813 -0
- package/.output/server/node_modules/@kubb/react-fabric/package.json +143 -0
- package/.output/server/node_modules/buffer-from/index.js +72 -0
- package/.output/server/node_modules/buffer-from/package.json +19 -0
- package/.output/server/node_modules/empathic/access.js +39 -0
- package/.output/server/node_modules/empathic/access.mjs +34 -0
- package/.output/server/node_modules/empathic/find.js +81 -0
- package/.output/server/node_modules/empathic/find.mjs +76 -0
- package/.output/server/node_modules/empathic/package.json +49 -0
- package/.output/server/node_modules/empathic/package.mjs +52 -0
- package/.output/server/node_modules/empathic/resolve.js +31 -0
- package/.output/server/node_modules/empathic/resolve.mjs +27 -0
- package/.output/server/node_modules/empathic/walk.js +22 -0
- package/.output/server/node_modules/empathic/walk.mjs +20 -0
- package/.output/server/node_modules/fast-string-truncated-width/dist/index.js +171 -0
- package/.output/server/node_modules/fast-string-truncated-width/dist/utils.js +15 -0
- package/.output/server/node_modules/fast-string-truncated-width/package.json +35 -0
- package/.output/server/node_modules/fast-string-width/dist/index.js +14 -0
- package/.output/server/node_modules/fast-string-width/package.json +34 -0
- package/.output/server/node_modules/fast-wrap-ansi/lib/main.js +216 -0
- package/.output/server/node_modules/fast-wrap-ansi/package.json +51 -0
- package/.output/server/node_modules/p-limit/index.js +127 -0
- package/.output/server/node_modules/p-limit/package.json +58 -0
- package/.output/server/node_modules/react-devtools-core/dist/backend.js +18302 -0
- package/.output/server/node_modules/react-devtools-core/package.json +38 -0
- package/.output/server/node_modules/sisteransi/package.json +34 -0
- package/.output/server/node_modules/sisteransi/src/index.js +58 -0
- package/.output/server/node_modules/source-map-support/package.json +31 -0
- package/.output/server/node_modules/source-map-support/source-map-support.js +625 -0
- package/.output/server/node_modules/typescript/lib/typescript.js +200276 -0
- package/.output/server/node_modules/typescript/package.json +120 -0
- package/.output/server/node_modules/yocto-queue/index.js +90 -0
- package/.output/server/node_modules/yocto-queue/package.json +48 -0
- package/.output/server/package.json +34 -2
- package/package.json +20 -20
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/buffer-util.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/event-target.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/extension.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/limiter.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/receiver.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/subprotocol.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/validation.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/constants.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/permessage-deflate.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/sender.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/stream.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket-server.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket.js +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/package.json +0 -0
- /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/wrapper.mjs +0 -0
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
import "./chunk--u3MIqq1.js";
|
|
2
|
+
import { a as InfiniteQuery, i as InfiniteQueryOptions, n as Mutation, o as QueryOptions, r as MutationKey, s as QueryKey, t as Query } from "./components-_AMBl0g-.js";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { pluginClientName } from "@kubb/plugin-client";
|
|
5
|
+
import { pluginTsName } from "@kubb/plugin-ts";
|
|
6
|
+
import { pluginZodName } from "@kubb/plugin-zod";
|
|
7
|
+
import { getBanner, getFooter } from "@kubb/plugin-oas/utils";
|
|
8
|
+
import { File } from "@kubb/react-fabric";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
|
|
10
|
+
import { Client } from "@kubb/plugin-client/components";
|
|
11
|
+
import { usePluginManager } from "@kubb/core/hooks";
|
|
12
|
+
import { createReactGenerator } from "@kubb/plugin-oas/generators";
|
|
13
|
+
import { useOas, useOperationManager } from "@kubb/plugin-oas/hooks";
|
|
14
|
+
import { difference } from "remeda";
|
|
15
|
+
//#region src/generators/infiniteQueryGenerator.tsx
|
|
16
|
+
const infiniteQueryGenerator = createReactGenerator({
|
|
17
|
+
name: "vue-infinite-query",
|
|
18
|
+
Operation({ config, operation, generator, plugin }) {
|
|
19
|
+
const { options, options: { output } } = plugin;
|
|
20
|
+
const pluginManager = usePluginManager();
|
|
21
|
+
const oas = useOas();
|
|
22
|
+
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
23
|
+
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
24
|
+
const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
25
|
+
const isInfinite = isQuery && !!options.infinite;
|
|
26
|
+
const importPath = options.query ? options.query.importPath : "@tanstack/vue-query";
|
|
27
|
+
const query = {
|
|
28
|
+
name: getName(operation, {
|
|
29
|
+
type: "function",
|
|
30
|
+
prefix: "use",
|
|
31
|
+
suffix: "infinite"
|
|
32
|
+
}),
|
|
33
|
+
typeName: getName(operation, { type: "type" }),
|
|
34
|
+
file: getFile(operation, {
|
|
35
|
+
prefix: "use",
|
|
36
|
+
suffix: "infinite"
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) && options.client.clientType !== "class";
|
|
40
|
+
const client = {
|
|
41
|
+
name: shouldUseClientPlugin ? getName(operation, {
|
|
42
|
+
type: "function",
|
|
43
|
+
pluginKey: [pluginClientName]
|
|
44
|
+
}) : getName(operation, {
|
|
45
|
+
type: "function",
|
|
46
|
+
suffix: "infinite"
|
|
47
|
+
}),
|
|
48
|
+
file: getFile(operation, { pluginKey: [pluginClientName] })
|
|
49
|
+
};
|
|
50
|
+
const queryOptions = { name: getName(operation, {
|
|
51
|
+
type: "function",
|
|
52
|
+
suffix: "InfiniteQueryOptions"
|
|
53
|
+
}) };
|
|
54
|
+
const queryKey = {
|
|
55
|
+
name: getName(operation, {
|
|
56
|
+
type: "const",
|
|
57
|
+
suffix: "InfiniteQueryKey"
|
|
58
|
+
}),
|
|
59
|
+
typeName: getName(operation, {
|
|
60
|
+
type: "type",
|
|
61
|
+
suffix: "InfiniteQueryKey"
|
|
62
|
+
})
|
|
63
|
+
};
|
|
64
|
+
const type = {
|
|
65
|
+
file: getFile(operation, { pluginKey: [pluginTsName] }),
|
|
66
|
+
schemas: getSchemas(operation, {
|
|
67
|
+
pluginKey: [pluginTsName],
|
|
68
|
+
type: "type"
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
const zod = {
|
|
72
|
+
file: getFile(operation, { pluginKey: [pluginZodName] }),
|
|
73
|
+
schemas: getSchemas(operation, {
|
|
74
|
+
pluginKey: [pluginZodName],
|
|
75
|
+
type: "function"
|
|
76
|
+
})
|
|
77
|
+
};
|
|
78
|
+
if (!isQuery || isMutation || !isInfinite) return null;
|
|
79
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
80
|
+
baseName: query.file.baseName,
|
|
81
|
+
path: query.file.path,
|
|
82
|
+
meta: query.file.meta,
|
|
83
|
+
banner: getBanner({
|
|
84
|
+
oas,
|
|
85
|
+
output,
|
|
86
|
+
config: pluginManager.config
|
|
87
|
+
}),
|
|
88
|
+
footer: getFooter({
|
|
89
|
+
oas,
|
|
90
|
+
output
|
|
91
|
+
}),
|
|
92
|
+
children: [
|
|
93
|
+
options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
|
|
94
|
+
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
95
|
+
root: query.file.path,
|
|
96
|
+
path: zod.file.path
|
|
97
|
+
}),
|
|
98
|
+
options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
99
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
100
|
+
name: "fetch",
|
|
101
|
+
path: options.client.importPath
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
104
|
+
name: [
|
|
105
|
+
"Client",
|
|
106
|
+
"RequestConfig",
|
|
107
|
+
"ResponseErrorConfig"
|
|
108
|
+
],
|
|
109
|
+
path: options.client.importPath,
|
|
110
|
+
isTypeOnly: true
|
|
111
|
+
}),
|
|
112
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
113
|
+
name: ["ResponseConfig"],
|
|
114
|
+
path: options.client.importPath,
|
|
115
|
+
isTypeOnly: true
|
|
116
|
+
})
|
|
117
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
118
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
119
|
+
name: ["fetch"],
|
|
120
|
+
root: query.file.path,
|
|
121
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
124
|
+
name: [
|
|
125
|
+
"Client",
|
|
126
|
+
"RequestConfig",
|
|
127
|
+
"ResponseErrorConfig"
|
|
128
|
+
],
|
|
129
|
+
root: query.file.path,
|
|
130
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
131
|
+
isTypeOnly: true
|
|
132
|
+
}),
|
|
133
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
134
|
+
name: ["ResponseConfig"],
|
|
135
|
+
root: query.file.path,
|
|
136
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
137
|
+
isTypeOnly: true
|
|
138
|
+
})
|
|
139
|
+
] }),
|
|
140
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
141
|
+
name: ["toValue"],
|
|
142
|
+
path: "vue"
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
145
|
+
name: ["MaybeRefOrGetter"],
|
|
146
|
+
path: "vue",
|
|
147
|
+
isTypeOnly: true
|
|
148
|
+
}),
|
|
149
|
+
shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
150
|
+
name: [client.name],
|
|
151
|
+
root: query.file.path,
|
|
152
|
+
path: client.file.path
|
|
153
|
+
}),
|
|
154
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
155
|
+
name: ["buildFormData"],
|
|
156
|
+
root: query.file.path,
|
|
157
|
+
path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
160
|
+
name: [
|
|
161
|
+
type.schemas.request?.name,
|
|
162
|
+
type.schemas.response.name,
|
|
163
|
+
type.schemas.pathParams?.name,
|
|
164
|
+
type.schemas.queryParams?.name,
|
|
165
|
+
type.schemas.headerParams?.name,
|
|
166
|
+
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
167
|
+
].filter(Boolean),
|
|
168
|
+
root: query.file.path,
|
|
169
|
+
path: type.file.path,
|
|
170
|
+
isTypeOnly: true
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ jsx(QueryKey, {
|
|
173
|
+
name: queryKey.name,
|
|
174
|
+
typeName: queryKey.typeName,
|
|
175
|
+
operation,
|
|
176
|
+
paramsCasing: options.paramsCasing,
|
|
177
|
+
pathParamsType: options.pathParamsType,
|
|
178
|
+
typeSchemas: type.schemas,
|
|
179
|
+
transformer: options.queryKey
|
|
180
|
+
}),
|
|
181
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
|
|
182
|
+
name: client.name,
|
|
183
|
+
baseURL: options.client.baseURL,
|
|
184
|
+
operation,
|
|
185
|
+
typeSchemas: type.schemas,
|
|
186
|
+
zodSchemas: zod.schemas,
|
|
187
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
188
|
+
paramsCasing: options.client?.paramsCasing || options.paramsCasing,
|
|
189
|
+
paramsType: options.paramsType,
|
|
190
|
+
pathParamsType: options.pathParamsType,
|
|
191
|
+
parser: options.parser
|
|
192
|
+
}),
|
|
193
|
+
options.infinite && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
194
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
195
|
+
name: ["InfiniteData"],
|
|
196
|
+
isTypeOnly: true,
|
|
197
|
+
path: importPath
|
|
198
|
+
}),
|
|
199
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
200
|
+
name: ["infiniteQueryOptions"],
|
|
201
|
+
path: importPath
|
|
202
|
+
}),
|
|
203
|
+
/* @__PURE__ */ jsx(InfiniteQueryOptions, {
|
|
204
|
+
name: queryOptions.name,
|
|
205
|
+
clientName: client.name,
|
|
206
|
+
queryKeyName: queryKey.name,
|
|
207
|
+
typeSchemas: type.schemas,
|
|
208
|
+
paramsType: options.paramsType,
|
|
209
|
+
paramsCasing: options.paramsCasing,
|
|
210
|
+
pathParamsType: options.pathParamsType,
|
|
211
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
212
|
+
cursorParam: options.infinite.cursorParam,
|
|
213
|
+
nextParam: options.infinite.nextParam,
|
|
214
|
+
previousParam: options.infinite.previousParam,
|
|
215
|
+
initialPageParam: options.infinite.initialPageParam,
|
|
216
|
+
queryParam: options.infinite.queryParam
|
|
217
|
+
})
|
|
218
|
+
] }),
|
|
219
|
+
options.infinite && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
220
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
221
|
+
name: ["useInfiniteQuery"],
|
|
222
|
+
path: importPath
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
225
|
+
name: [
|
|
226
|
+
"QueryKey",
|
|
227
|
+
"QueryClient",
|
|
228
|
+
"UseInfiniteQueryOptions",
|
|
229
|
+
"UseInfiniteQueryReturnType"
|
|
230
|
+
],
|
|
231
|
+
path: importPath,
|
|
232
|
+
isTypeOnly: true
|
|
233
|
+
}),
|
|
234
|
+
/* @__PURE__ */ jsx(InfiniteQuery, {
|
|
235
|
+
name: query.name,
|
|
236
|
+
queryOptionsName: queryOptions.name,
|
|
237
|
+
typeSchemas: type.schemas,
|
|
238
|
+
paramsCasing: options.paramsCasing,
|
|
239
|
+
paramsType: options.paramsType,
|
|
240
|
+
pathParamsType: options.pathParamsType,
|
|
241
|
+
operation,
|
|
242
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
243
|
+
queryKeyName: queryKey.name,
|
|
244
|
+
queryKeyTypeName: queryKey.typeName
|
|
245
|
+
})
|
|
246
|
+
] })
|
|
247
|
+
]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/generators/mutationGenerator.tsx
|
|
253
|
+
const mutationGenerator = createReactGenerator({
|
|
254
|
+
name: "vue-query",
|
|
255
|
+
Operation({ config, operation, generator, plugin }) {
|
|
256
|
+
const { options, options: { output } } = plugin;
|
|
257
|
+
const pluginManager = usePluginManager();
|
|
258
|
+
const oas = useOas();
|
|
259
|
+
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
260
|
+
const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method);
|
|
261
|
+
const isMutation = options.mutation !== false && !isQuery && difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
262
|
+
const importPath = options.mutation ? options.mutation.importPath : "@tanstack/vue-query";
|
|
263
|
+
const mutation = {
|
|
264
|
+
name: getName(operation, {
|
|
265
|
+
type: "function",
|
|
266
|
+
prefix: "use"
|
|
267
|
+
}),
|
|
268
|
+
typeName: getName(operation, { type: "type" }),
|
|
269
|
+
file: getFile(operation, { prefix: "use" })
|
|
270
|
+
};
|
|
271
|
+
const type = {
|
|
272
|
+
file: getFile(operation, { pluginKey: [pluginTsName] }),
|
|
273
|
+
schemas: getSchemas(operation, {
|
|
274
|
+
pluginKey: [pluginTsName],
|
|
275
|
+
type: "type"
|
|
276
|
+
})
|
|
277
|
+
};
|
|
278
|
+
const zod = {
|
|
279
|
+
file: getFile(operation, { pluginKey: [pluginZodName] }),
|
|
280
|
+
schemas: getSchemas(operation, {
|
|
281
|
+
pluginKey: [pluginZodName],
|
|
282
|
+
type: "function"
|
|
283
|
+
})
|
|
284
|
+
};
|
|
285
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) && options.client.clientType !== "class";
|
|
286
|
+
const client = {
|
|
287
|
+
name: shouldUseClientPlugin ? getName(operation, {
|
|
288
|
+
type: "function",
|
|
289
|
+
pluginKey: [pluginClientName]
|
|
290
|
+
}) : getName(operation, { type: "function" }),
|
|
291
|
+
file: getFile(operation, { pluginKey: [pluginClientName] })
|
|
292
|
+
};
|
|
293
|
+
const mutationKey = {
|
|
294
|
+
name: getName(operation, {
|
|
295
|
+
type: "const",
|
|
296
|
+
suffix: "MutationKey"
|
|
297
|
+
}),
|
|
298
|
+
typeName: getName(operation, {
|
|
299
|
+
type: "type",
|
|
300
|
+
suffix: "MutationKey"
|
|
301
|
+
})
|
|
302
|
+
};
|
|
303
|
+
if (!isMutation) return null;
|
|
304
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
305
|
+
baseName: mutation.file.baseName,
|
|
306
|
+
path: mutation.file.path,
|
|
307
|
+
meta: mutation.file.meta,
|
|
308
|
+
banner: getBanner({
|
|
309
|
+
oas,
|
|
310
|
+
output,
|
|
311
|
+
config: pluginManager.config
|
|
312
|
+
}),
|
|
313
|
+
footer: getFooter({
|
|
314
|
+
oas,
|
|
315
|
+
output
|
|
316
|
+
}),
|
|
317
|
+
children: [
|
|
318
|
+
options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
|
|
319
|
+
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
320
|
+
root: mutation.file.path,
|
|
321
|
+
path: zod.file.path
|
|
322
|
+
}),
|
|
323
|
+
options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
324
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
325
|
+
name: "fetch",
|
|
326
|
+
path: options.client.importPath
|
|
327
|
+
}),
|
|
328
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
329
|
+
name: [
|
|
330
|
+
"Client",
|
|
331
|
+
"RequestConfig",
|
|
332
|
+
"ResponseErrorConfig"
|
|
333
|
+
],
|
|
334
|
+
path: options.client.importPath,
|
|
335
|
+
isTypeOnly: true
|
|
336
|
+
}),
|
|
337
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
338
|
+
name: ["ResponseConfig"],
|
|
339
|
+
path: options.client.importPath,
|
|
340
|
+
isTypeOnly: true
|
|
341
|
+
})
|
|
342
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
343
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
344
|
+
name: ["fetch"],
|
|
345
|
+
root: mutation.file.path,
|
|
346
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
347
|
+
}),
|
|
348
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
349
|
+
name: [
|
|
350
|
+
"Client",
|
|
351
|
+
"RequestConfig",
|
|
352
|
+
"ResponseErrorConfig"
|
|
353
|
+
],
|
|
354
|
+
root: mutation.file.path,
|
|
355
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
356
|
+
isTypeOnly: true
|
|
357
|
+
}),
|
|
358
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
359
|
+
name: ["ResponseConfig"],
|
|
360
|
+
root: mutation.file.path,
|
|
361
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
362
|
+
isTypeOnly: true
|
|
363
|
+
})
|
|
364
|
+
] }),
|
|
365
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
366
|
+
name: ["MaybeRefOrGetter"],
|
|
367
|
+
path: "vue",
|
|
368
|
+
isTypeOnly: true
|
|
369
|
+
}),
|
|
370
|
+
shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
371
|
+
name: [client.name],
|
|
372
|
+
root: mutation.file.path,
|
|
373
|
+
path: client.file.path
|
|
374
|
+
}),
|
|
375
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
376
|
+
name: ["buildFormData"],
|
|
377
|
+
root: mutation.file.path,
|
|
378
|
+
path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
379
|
+
}),
|
|
380
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
381
|
+
name: [
|
|
382
|
+
type.schemas.request?.name,
|
|
383
|
+
type.schemas.response.name,
|
|
384
|
+
type.schemas.pathParams?.name,
|
|
385
|
+
type.schemas.queryParams?.name,
|
|
386
|
+
type.schemas.headerParams?.name,
|
|
387
|
+
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
388
|
+
].filter(Boolean),
|
|
389
|
+
root: mutation.file.path,
|
|
390
|
+
path: type.file.path,
|
|
391
|
+
isTypeOnly: true
|
|
392
|
+
}),
|
|
393
|
+
/* @__PURE__ */ jsx(MutationKey, {
|
|
394
|
+
name: mutationKey.name,
|
|
395
|
+
typeName: mutationKey.typeName,
|
|
396
|
+
operation,
|
|
397
|
+
pathParamsType: options.pathParamsType,
|
|
398
|
+
paramsCasing: options.paramsCasing,
|
|
399
|
+
typeSchemas: type.schemas,
|
|
400
|
+
transformer: options.mutationKey
|
|
401
|
+
}),
|
|
402
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
|
|
403
|
+
name: client.name,
|
|
404
|
+
baseURL: options.client.baseURL,
|
|
405
|
+
operation,
|
|
406
|
+
typeSchemas: type.schemas,
|
|
407
|
+
zodSchemas: zod.schemas,
|
|
408
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
409
|
+
paramsCasing: options.client?.paramsCasing || options.paramsCasing,
|
|
410
|
+
paramsType: options.paramsType,
|
|
411
|
+
pathParamsType: options.pathParamsType,
|
|
412
|
+
parser: options.parser
|
|
413
|
+
}),
|
|
414
|
+
options.mutation && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
415
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
416
|
+
name: ["useMutation"],
|
|
417
|
+
path: importPath
|
|
418
|
+
}),
|
|
419
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
420
|
+
name: ["MutationObserverOptions", "QueryClient"],
|
|
421
|
+
path: importPath,
|
|
422
|
+
isTypeOnly: true
|
|
423
|
+
}),
|
|
424
|
+
/* @__PURE__ */ jsx(Mutation, {
|
|
425
|
+
name: mutation.name,
|
|
426
|
+
clientName: client.name,
|
|
427
|
+
typeName: mutation.typeName,
|
|
428
|
+
typeSchemas: type.schemas,
|
|
429
|
+
operation,
|
|
430
|
+
paramsCasing: options.paramsCasing,
|
|
431
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
432
|
+
paramsType: options.paramsType,
|
|
433
|
+
pathParamsType: options.pathParamsType,
|
|
434
|
+
mutationKeyName: mutationKey.name
|
|
435
|
+
})
|
|
436
|
+
] })
|
|
437
|
+
]
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region src/generators/queryGenerator.tsx
|
|
443
|
+
const queryGenerator = createReactGenerator({
|
|
444
|
+
name: "vue-query",
|
|
445
|
+
Operation({ config, operation, generator, plugin }) {
|
|
446
|
+
const { options, options: { output } } = plugin;
|
|
447
|
+
const pluginManager = usePluginManager();
|
|
448
|
+
const oas = useOas();
|
|
449
|
+
const { getSchemas, getName, getFile } = useOperationManager(generator);
|
|
450
|
+
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
451
|
+
const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
452
|
+
const importPath = options.query ? options.query.importPath : "@tanstack/vue-query";
|
|
453
|
+
const query = {
|
|
454
|
+
name: getName(operation, {
|
|
455
|
+
type: "function",
|
|
456
|
+
prefix: "use"
|
|
457
|
+
}),
|
|
458
|
+
typeName: getName(operation, { type: "type" }),
|
|
459
|
+
file: getFile(operation, { prefix: "use" })
|
|
460
|
+
};
|
|
461
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) && options.client.clientType !== "class";
|
|
462
|
+
const client = {
|
|
463
|
+
name: shouldUseClientPlugin ? getName(operation, {
|
|
464
|
+
type: "function",
|
|
465
|
+
pluginKey: [pluginClientName]
|
|
466
|
+
}) : getName(operation, { type: "function" }),
|
|
467
|
+
file: getFile(operation, { pluginKey: [pluginClientName] })
|
|
468
|
+
};
|
|
469
|
+
const queryOptions = { name: getName(operation, {
|
|
470
|
+
type: "function",
|
|
471
|
+
suffix: "QueryOptions"
|
|
472
|
+
}) };
|
|
473
|
+
const queryKey = {
|
|
474
|
+
name: getName(operation, {
|
|
475
|
+
type: "const",
|
|
476
|
+
suffix: "QueryKey"
|
|
477
|
+
}),
|
|
478
|
+
typeName: getName(operation, {
|
|
479
|
+
type: "type",
|
|
480
|
+
suffix: "QueryKey"
|
|
481
|
+
})
|
|
482
|
+
};
|
|
483
|
+
const type = {
|
|
484
|
+
file: getFile(operation, { pluginKey: [pluginTsName] }),
|
|
485
|
+
schemas: getSchemas(operation, {
|
|
486
|
+
pluginKey: [pluginTsName],
|
|
487
|
+
type: "type"
|
|
488
|
+
})
|
|
489
|
+
};
|
|
490
|
+
const zod = {
|
|
491
|
+
file: getFile(operation, { pluginKey: [pluginZodName] }),
|
|
492
|
+
schemas: getSchemas(operation, {
|
|
493
|
+
pluginKey: [pluginZodName],
|
|
494
|
+
type: "function"
|
|
495
|
+
})
|
|
496
|
+
};
|
|
497
|
+
if (!isQuery || isMutation) return null;
|
|
498
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
499
|
+
baseName: query.file.baseName,
|
|
500
|
+
path: query.file.path,
|
|
501
|
+
meta: query.file.meta,
|
|
502
|
+
banner: getBanner({
|
|
503
|
+
oas,
|
|
504
|
+
output,
|
|
505
|
+
config: pluginManager.config
|
|
506
|
+
}),
|
|
507
|
+
footer: getFooter({
|
|
508
|
+
oas,
|
|
509
|
+
output
|
|
510
|
+
}),
|
|
511
|
+
children: [
|
|
512
|
+
options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
|
|
513
|
+
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
514
|
+
root: query.file.path,
|
|
515
|
+
path: zod.file.path
|
|
516
|
+
}),
|
|
517
|
+
options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
518
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
519
|
+
name: "fetch",
|
|
520
|
+
path: options.client.importPath
|
|
521
|
+
}),
|
|
522
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
523
|
+
name: [
|
|
524
|
+
"Client",
|
|
525
|
+
"RequestConfig",
|
|
526
|
+
"ResponseErrorConfig"
|
|
527
|
+
],
|
|
528
|
+
path: options.client.importPath,
|
|
529
|
+
isTypeOnly: true
|
|
530
|
+
}),
|
|
531
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
532
|
+
name: ["ResponseConfig"],
|
|
533
|
+
path: options.client.importPath,
|
|
534
|
+
isTypeOnly: true
|
|
535
|
+
})
|
|
536
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
537
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
538
|
+
name: ["fetch"],
|
|
539
|
+
root: query.file.path,
|
|
540
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
541
|
+
}),
|
|
542
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
543
|
+
name: [
|
|
544
|
+
"Client",
|
|
545
|
+
"RequestConfig",
|
|
546
|
+
"ResponseErrorConfig"
|
|
547
|
+
],
|
|
548
|
+
root: query.file.path,
|
|
549
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
550
|
+
isTypeOnly: true
|
|
551
|
+
}),
|
|
552
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
553
|
+
name: ["ResponseConfig"],
|
|
554
|
+
root: query.file.path,
|
|
555
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
556
|
+
isTypeOnly: true
|
|
557
|
+
})
|
|
558
|
+
] }),
|
|
559
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
560
|
+
name: ["toValue"],
|
|
561
|
+
path: "vue"
|
|
562
|
+
}),
|
|
563
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
564
|
+
name: ["MaybeRefOrGetter"],
|
|
565
|
+
path: "vue",
|
|
566
|
+
isTypeOnly: true
|
|
567
|
+
}),
|
|
568
|
+
shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
569
|
+
name: [client.name],
|
|
570
|
+
root: query.file.path,
|
|
571
|
+
path: client.file.path
|
|
572
|
+
}),
|
|
573
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
574
|
+
name: ["buildFormData"],
|
|
575
|
+
root: query.file.path,
|
|
576
|
+
path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
577
|
+
}),
|
|
578
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
579
|
+
name: [
|
|
580
|
+
type.schemas.request?.name,
|
|
581
|
+
type.schemas.response.name,
|
|
582
|
+
type.schemas.pathParams?.name,
|
|
583
|
+
type.schemas.queryParams?.name,
|
|
584
|
+
type.schemas.headerParams?.name,
|
|
585
|
+
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
586
|
+
].filter(Boolean),
|
|
587
|
+
root: query.file.path,
|
|
588
|
+
path: type.file.path,
|
|
589
|
+
isTypeOnly: true
|
|
590
|
+
}),
|
|
591
|
+
/* @__PURE__ */ jsx(QueryKey, {
|
|
592
|
+
name: queryKey.name,
|
|
593
|
+
typeName: queryKey.typeName,
|
|
594
|
+
operation,
|
|
595
|
+
paramsCasing: options.paramsCasing,
|
|
596
|
+
pathParamsType: options.pathParamsType,
|
|
597
|
+
typeSchemas: type.schemas,
|
|
598
|
+
transformer: options.queryKey
|
|
599
|
+
}),
|
|
600
|
+
!shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
|
|
601
|
+
name: client.name,
|
|
602
|
+
baseURL: options.client.baseURL,
|
|
603
|
+
operation,
|
|
604
|
+
typeSchemas: type.schemas,
|
|
605
|
+
zodSchemas: zod.schemas,
|
|
606
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
607
|
+
paramsCasing: options.client?.paramsCasing || options.paramsCasing,
|
|
608
|
+
paramsType: options.paramsType,
|
|
609
|
+
pathParamsType: options.pathParamsType,
|
|
610
|
+
parser: options.parser
|
|
611
|
+
}),
|
|
612
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
613
|
+
name: ["queryOptions"],
|
|
614
|
+
path: importPath
|
|
615
|
+
}),
|
|
616
|
+
/* @__PURE__ */ jsx(QueryOptions, {
|
|
617
|
+
name: queryOptions.name,
|
|
618
|
+
clientName: client.name,
|
|
619
|
+
queryKeyName: queryKey.name,
|
|
620
|
+
paramsCasing: options.paramsCasing,
|
|
621
|
+
typeSchemas: type.schemas,
|
|
622
|
+
paramsType: options.paramsType,
|
|
623
|
+
pathParamsType: options.pathParamsType,
|
|
624
|
+
dataReturnType: options.client.dataReturnType || "data"
|
|
625
|
+
}),
|
|
626
|
+
options.query && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
627
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
628
|
+
name: ["useQuery"],
|
|
629
|
+
path: importPath
|
|
630
|
+
}),
|
|
631
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
632
|
+
name: [
|
|
633
|
+
"QueryKey",
|
|
634
|
+
"QueryClient",
|
|
635
|
+
"UseQueryOptions",
|
|
636
|
+
"UseQueryReturnType"
|
|
637
|
+
],
|
|
638
|
+
path: importPath,
|
|
639
|
+
isTypeOnly: true
|
|
640
|
+
}),
|
|
641
|
+
/* @__PURE__ */ jsx(Query, {
|
|
642
|
+
name: query.name,
|
|
643
|
+
queryOptionsName: queryOptions.name,
|
|
644
|
+
typeSchemas: type.schemas,
|
|
645
|
+
paramsCasing: options.paramsCasing,
|
|
646
|
+
paramsType: options.paramsType,
|
|
647
|
+
pathParamsType: options.pathParamsType,
|
|
648
|
+
operation,
|
|
649
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
650
|
+
queryKeyName: queryKey.name,
|
|
651
|
+
queryKeyTypeName: queryKey.typeName
|
|
652
|
+
})
|
|
653
|
+
] })
|
|
654
|
+
]
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
//#endregion
|
|
659
|
+
export { mutationGenerator as n, infiniteQueryGenerator as r, queryGenerator as t };
|
|
660
|
+
|
|
661
|
+
//# sourceMappingURL=generators-Zb1s5Wmb.js.map
|