@kubb/plugin-react-query 4.4.1 → 4.5.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/{components-CbVTS6aF.js → components-By3fyxDp.js} +2 -2
- package/dist/{components-CbVTS6aF.js.map → components-By3fyxDp.js.map} +1 -1
- package/dist/{components-B_-p18Ak.cjs → components-DtLglQ1w.cjs} +3 -3
- package/dist/{components-B_-p18Ak.cjs.map → components-DtLglQ1w.cjs.map} +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +1 -1
- package/dist/{generators-hTZEzfNP.cjs → generators-BIuKpozF.cjs} +260 -182
- package/dist/generators-BIuKpozF.cjs.map +1 -0
- package/dist/{generators-egdl4EOg.js → generators-BTb-fJYl.js} +257 -180
- package/dist/generators-BTb-fJYl.js.map +1 -0
- package/dist/generators.cjs +2 -2
- package/dist/generators.d.cts +5 -5
- package/dist/generators.d.ts +5 -5
- package/dist/generators.js +2 -2
- package/dist/index.cjs +17 -3
- 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 +15 -3
- package/dist/index.js.map +1 -1
- package/dist/{types-CLcavQWE.d.ts → types-DgN61fGy.d.ts} +174 -182
- package/dist/{types-x2_6F962.d.cts → types-XOFOCTil.d.cts} +174 -182
- package/package.json +9 -9
- package/src/generators/index.ts +2 -2
- package/src/generators/infiniteQueryGenerator.tsx +36 -11
- package/src/generators/mutationGenerator.tsx +35 -10
- package/src/generators/queryGenerator.tsx +36 -11
- package/src/generators/suspenseQueryGenerator.tsx +34 -11
- package/src/plugin.ts +22 -1
- package/src/types.ts +4 -3
- package/dist/generators-egdl4EOg.js.map +0 -1
- package/dist/generators-hTZEzfNP.cjs.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
const require_components = require('./components-
|
|
2
|
-
let
|
|
3
|
-
|
|
1
|
+
const require_components = require('./components-DtLglQ1w.cjs');
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
node_path = require_components.__toESM(node_path);
|
|
4
|
+
let __kubb_plugin_client = require("@kubb/plugin-client");
|
|
5
|
+
__kubb_plugin_client = require_components.__toESM(__kubb_plugin_client);
|
|
4
6
|
let __kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
5
7
|
__kubb_plugin_ts = require_components.__toESM(__kubb_plugin_ts);
|
|
6
8
|
let __kubb_plugin_zod = require("@kubb/plugin-zod");
|
|
@@ -15,52 +17,60 @@ let __kubb_plugin_client_components = require("@kubb/plugin-client/components");
|
|
|
15
17
|
__kubb_plugin_client_components = require_components.__toESM(__kubb_plugin_client_components);
|
|
16
18
|
let __kubb_core_hooks = require("@kubb/core/hooks");
|
|
17
19
|
__kubb_core_hooks = require_components.__toESM(__kubb_core_hooks);
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
+
let __kubb_plugin_oas_generators = require("@kubb/plugin-oas/generators");
|
|
21
|
+
__kubb_plugin_oas_generators = require_components.__toESM(__kubb_plugin_oas_generators);
|
|
20
22
|
let __kubb_plugin_oas_hooks = require("@kubb/plugin-oas/hooks");
|
|
21
23
|
__kubb_plugin_oas_hooks = require_components.__toESM(__kubb_plugin_oas_hooks);
|
|
22
24
|
let remeda = require("remeda");
|
|
23
25
|
remeda = require_components.__toESM(remeda);
|
|
24
26
|
|
|
25
|
-
//#region src/generators/
|
|
26
|
-
const
|
|
27
|
-
name: "react-query",
|
|
28
|
-
Operation({
|
|
29
|
-
const { options: { output } } =
|
|
27
|
+
//#region src/generators/infiniteQueryGenerator.tsx
|
|
28
|
+
const infiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
29
|
+
name: "react-infinite-query",
|
|
30
|
+
Operation({ config, operation, generator, plugin }) {
|
|
31
|
+
const { options, options: { output } } = plugin;
|
|
30
32
|
const pluginManager = (0, __kubb_core_hooks.usePluginManager)();
|
|
31
33
|
const oas = (0, __kubb_plugin_oas_hooks.useOas)();
|
|
32
|
-
const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)();
|
|
34
|
+
const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
33
35
|
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
34
36
|
const isMutation = (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
37
|
+
const infiniteOptions = options.infinite && typeof options.infinite === "object" ? options.infinite : void 0;
|
|
35
38
|
const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
|
|
36
39
|
const query = {
|
|
37
40
|
name: getName(operation, {
|
|
38
41
|
type: "function",
|
|
39
|
-
prefix: "use"
|
|
42
|
+
prefix: "use",
|
|
43
|
+
suffix: "infinite"
|
|
40
44
|
}),
|
|
41
45
|
typeName: getName(operation, { type: "type" }),
|
|
42
|
-
file: getFile(operation, {
|
|
46
|
+
file: getFile(operation, {
|
|
47
|
+
prefix: "use",
|
|
48
|
+
suffix: "infinite"
|
|
49
|
+
})
|
|
43
50
|
};
|
|
44
51
|
const hasClientPlugin = !!pluginManager.getPluginByKey([__kubb_plugin_client.pluginClientName]);
|
|
45
52
|
const client = {
|
|
46
53
|
name: hasClientPlugin ? getName(operation, {
|
|
47
54
|
type: "function",
|
|
48
55
|
pluginKey: [__kubb_plugin_client.pluginClientName]
|
|
49
|
-
}) : getName(operation, {
|
|
56
|
+
}) : getName(operation, {
|
|
57
|
+
type: "function",
|
|
58
|
+
suffix: "infinite"
|
|
59
|
+
}),
|
|
50
60
|
file: getFile(operation, { pluginKey: [__kubb_plugin_client.pluginClientName] })
|
|
51
61
|
};
|
|
52
62
|
const queryOptions = { name: getName(operation, {
|
|
53
63
|
type: "function",
|
|
54
|
-
suffix: "
|
|
64
|
+
suffix: "InfiniteQueryOptions"
|
|
55
65
|
}) };
|
|
56
66
|
const queryKey = {
|
|
57
67
|
name: getName(operation, {
|
|
58
68
|
type: "const",
|
|
59
|
-
suffix: "
|
|
69
|
+
suffix: "InfiniteQueryKey"
|
|
60
70
|
}),
|
|
61
71
|
typeName: getName(operation, {
|
|
62
72
|
type: "type",
|
|
63
|
-
suffix: "
|
|
73
|
+
suffix: "InfiniteQueryKey"
|
|
64
74
|
})
|
|
65
75
|
};
|
|
66
76
|
const type = {
|
|
@@ -77,7 +87,15 @@ const queryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
77
87
|
type: "function"
|
|
78
88
|
})
|
|
79
89
|
};
|
|
80
|
-
if (!isQuery || isMutation) return null;
|
|
90
|
+
if (!isQuery || isMutation || !infiniteOptions) return null;
|
|
91
|
+
const normalizeKey = (key) => (key ?? "").replace(/\?$/, "");
|
|
92
|
+
const queryParam = infiniteOptions.queryParam;
|
|
93
|
+
const cursorParam = infiniteOptions.cursorParam;
|
|
94
|
+
const queryParamKeys = type.schemas.queryParams?.keys ?? [];
|
|
95
|
+
const responseKeys = [...type.schemas.responses?.flatMap((item) => item.keys ?? []) ?? [], ...type.schemas.response?.keys ?? []];
|
|
96
|
+
const hasQueryParam = queryParam ? queryParamKeys.some((key) => normalizeKey(key) === queryParam) : false;
|
|
97
|
+
const hasCursorParam = cursorParam ? responseKeys.some((key) => normalizeKey(key) === cursorParam) : true;
|
|
98
|
+
if (!hasQueryParam || !hasCursorParam) return null;
|
|
81
99
|
return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric.File, {
|
|
82
100
|
baseName: query.file.baseName,
|
|
83
101
|
path: query.file.path,
|
|
@@ -97,25 +115,45 @@ const queryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
97
115
|
root: query.file.path,
|
|
98
116
|
path: zod.file.path
|
|
99
117
|
}),
|
|
100
|
-
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
118
|
+
options.client.importPath ? /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
119
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
120
|
+
name: "fetch",
|
|
121
|
+
path: options.client.importPath
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
124
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
125
|
+
path: options.client.importPath,
|
|
126
|
+
isTypeOnly: true
|
|
127
|
+
}),
|
|
128
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
129
|
+
name: ["ResponseConfig"],
|
|
130
|
+
path: options.client.importPath,
|
|
131
|
+
isTypeOnly: true
|
|
132
|
+
})
|
|
133
|
+
] }) : /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
134
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
135
|
+
name: "fetch",
|
|
136
|
+
root: query.file.path,
|
|
137
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetcher.ts")
|
|
138
|
+
}),
|
|
139
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
140
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
141
|
+
root: query.file.path,
|
|
142
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetcher.ts"),
|
|
143
|
+
isTypeOnly: true
|
|
144
|
+
}),
|
|
145
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
146
|
+
name: ["ResponseConfig"],
|
|
147
|
+
root: query.file.path,
|
|
148
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetcher.ts"),
|
|
149
|
+
isTypeOnly: true
|
|
150
|
+
})
|
|
151
|
+
] }),
|
|
104
152
|
hasClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
105
153
|
name: [client.name],
|
|
106
154
|
root: query.file.path,
|
|
107
155
|
path: client.file.path
|
|
108
156
|
}),
|
|
109
|
-
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
110
|
-
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
111
|
-
path: options.client.importPath,
|
|
112
|
-
isTypeOnly: true
|
|
113
|
-
}),
|
|
114
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
115
|
-
name: ["ResponseConfig"],
|
|
116
|
-
path: options.client.importPath,
|
|
117
|
-
isTypeOnly: true
|
|
118
|
-
}),
|
|
119
157
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
120
158
|
name: [
|
|
121
159
|
type.schemas.request?.name,
|
|
@@ -133,9 +171,9 @@ const queryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
133
171
|
name: queryKey.name,
|
|
134
172
|
typeName: queryKey.typeName,
|
|
135
173
|
operation,
|
|
174
|
+
paramsCasing: options.paramsCasing,
|
|
136
175
|
pathParamsType: options.pathParamsType,
|
|
137
176
|
typeSchemas: type.schemas,
|
|
138
|
-
paramsCasing: options.paramsCasing,
|
|
139
177
|
transformer: options.queryKey
|
|
140
178
|
}),
|
|
141
179
|
!hasClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_plugin_client_components.Client, {
|
|
@@ -144,43 +182,52 @@ const queryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
144
182
|
operation,
|
|
145
183
|
typeSchemas: type.schemas,
|
|
146
184
|
zodSchemas: zod.schemas,
|
|
147
|
-
dataReturnType: options.client.dataReturnType,
|
|
148
|
-
paramsType: options.paramsType,
|
|
149
|
-
paramsCasing: options.paramsCasing,
|
|
150
|
-
pathParamsType: options.pathParamsType,
|
|
151
|
-
parser: options.parser
|
|
152
|
-
}),
|
|
153
|
-
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
154
|
-
name: ["queryOptions"],
|
|
155
|
-
path: importPath
|
|
156
|
-
}),
|
|
157
|
-
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryOptions, {
|
|
158
|
-
name: queryOptions.name,
|
|
159
|
-
clientName: client.name,
|
|
160
|
-
queryKeyName: queryKey.name,
|
|
161
|
-
typeSchemas: type.schemas,
|
|
185
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
162
186
|
paramsCasing: options.paramsCasing,
|
|
163
187
|
paramsType: options.paramsType,
|
|
164
188
|
pathParamsType: options.pathParamsType,
|
|
165
|
-
|
|
189
|
+
parser: options.parser
|
|
166
190
|
}),
|
|
167
|
-
|
|
191
|
+
infiniteOptions && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
168
192
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
169
|
-
name: ["
|
|
193
|
+
name: ["InfiniteData"],
|
|
194
|
+
isTypeOnly: true,
|
|
195
|
+
path: importPath
|
|
196
|
+
}),
|
|
197
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
198
|
+
name: ["infiniteQueryOptions"],
|
|
199
|
+
path: importPath
|
|
200
|
+
}),
|
|
201
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.InfiniteQueryOptions, {
|
|
202
|
+
name: queryOptions.name,
|
|
203
|
+
clientName: client.name,
|
|
204
|
+
queryKeyName: queryKey.name,
|
|
205
|
+
typeSchemas: type.schemas,
|
|
206
|
+
paramsCasing: options.paramsCasing,
|
|
207
|
+
paramsType: options.paramsType,
|
|
208
|
+
pathParamsType: options.pathParamsType,
|
|
209
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
210
|
+
cursorParam: infiniteOptions.cursorParam,
|
|
211
|
+
initialPageParam: infiniteOptions.initialPageParam,
|
|
212
|
+
queryParam: infiniteOptions.queryParam
|
|
213
|
+
})
|
|
214
|
+
] }),
|
|
215
|
+
infiniteOptions && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
216
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
217
|
+
name: ["useInfiniteQuery"],
|
|
170
218
|
path: importPath
|
|
171
219
|
}),
|
|
172
220
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
173
221
|
name: [
|
|
174
222
|
"QueryKey",
|
|
175
223
|
"QueryClient",
|
|
176
|
-
"
|
|
177
|
-
"
|
|
178
|
-
"QueryClient"
|
|
224
|
+
"InfiniteQueryObserverOptions",
|
|
225
|
+
"UseInfiniteQueryResult"
|
|
179
226
|
],
|
|
180
227
|
path: importPath,
|
|
181
228
|
isTypeOnly: true
|
|
182
229
|
}),
|
|
183
|
-
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.
|
|
230
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.InfiniteQuery, {
|
|
184
231
|
name: query.name,
|
|
185
232
|
queryOptionsName: queryOptions.name,
|
|
186
233
|
typeSchemas: type.schemas,
|
|
@@ -188,9 +235,11 @@ const queryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
188
235
|
paramsType: options.paramsType,
|
|
189
236
|
pathParamsType: options.pathParamsType,
|
|
190
237
|
operation,
|
|
191
|
-
dataReturnType: options.client.dataReturnType,
|
|
238
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
192
239
|
queryKeyName: queryKey.name,
|
|
193
|
-
queryKeyTypeName: queryKey.typeName
|
|
240
|
+
queryKeyTypeName: queryKey.typeName,
|
|
241
|
+
initialPageParam: infiniteOptions.initialPageParam,
|
|
242
|
+
queryParam: infiniteOptions.queryParam
|
|
194
243
|
})
|
|
195
244
|
] })
|
|
196
245
|
]
|
|
@@ -200,13 +249,13 @@ const queryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
200
249
|
|
|
201
250
|
//#endregion
|
|
202
251
|
//#region src/generators/mutationGenerator.tsx
|
|
203
|
-
const mutationGenerator = (0,
|
|
252
|
+
const mutationGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
204
253
|
name: "react-query",
|
|
205
|
-
Operation({
|
|
206
|
-
const { options: { output } } =
|
|
254
|
+
Operation({ config, plugin, operation, generator }) {
|
|
255
|
+
const { options, options: { output } } = plugin;
|
|
207
256
|
const pluginManager = (0, __kubb_core_hooks.usePluginManager)();
|
|
208
257
|
const oas = (0, __kubb_plugin_oas_hooks.useOas)();
|
|
209
|
-
const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)();
|
|
258
|
+
const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
210
259
|
const isMutation = !(!!options.query && options.query?.methods.some((method) => operation.method === method)) && (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
211
260
|
const importPath = options.mutation ? options.mutation.importPath : "@tanstack/react-query";
|
|
212
261
|
const mutation = {
|
|
@@ -273,24 +322,45 @@ const mutationGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
273
322
|
root: mutation.file.path,
|
|
274
323
|
path: zod.file.path
|
|
275
324
|
}),
|
|
276
|
-
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
325
|
+
options.client.importPath ? /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
326
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
327
|
+
name: "fetch",
|
|
328
|
+
path: options.client.importPath
|
|
329
|
+
}),
|
|
330
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
331
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
332
|
+
path: options.client.importPath,
|
|
333
|
+
isTypeOnly: true
|
|
334
|
+
}),
|
|
335
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
336
|
+
name: ["ResponseConfig"],
|
|
337
|
+
path: options.client.importPath,
|
|
338
|
+
isTypeOnly: true
|
|
339
|
+
})
|
|
340
|
+
] }) : /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
341
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
342
|
+
name: "fetch",
|
|
343
|
+
root: mutation.file.path,
|
|
344
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetcher.ts")
|
|
345
|
+
}),
|
|
346
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
347
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
348
|
+
root: mutation.file.path,
|
|
349
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetcher.ts"),
|
|
350
|
+
isTypeOnly: true
|
|
351
|
+
}),
|
|
352
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
353
|
+
name: ["ResponseConfig"],
|
|
354
|
+
root: mutation.file.path,
|
|
355
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetcher.ts"),
|
|
356
|
+
isTypeOnly: true
|
|
357
|
+
})
|
|
358
|
+
] }),
|
|
280
359
|
!!hasClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
281
360
|
name: [client.name],
|
|
282
361
|
root: mutation.file.path,
|
|
283
362
|
path: client.file.path
|
|
284
363
|
}),
|
|
285
|
-
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
286
|
-
name: [
|
|
287
|
-
"RequestConfig",
|
|
288
|
-
"ResponseConfig",
|
|
289
|
-
"ResponseErrorConfig"
|
|
290
|
-
],
|
|
291
|
-
path: options.client.importPath,
|
|
292
|
-
isTypeOnly: true
|
|
293
|
-
}),
|
|
294
364
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
295
365
|
name: [
|
|
296
366
|
type.schemas.request?.name,
|
|
@@ -319,7 +389,7 @@ const mutationGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
319
389
|
operation,
|
|
320
390
|
typeSchemas: type.schemas,
|
|
321
391
|
zodSchemas: zod.schemas,
|
|
322
|
-
dataReturnType: options.client.dataReturnType,
|
|
392
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
323
393
|
paramsCasing: options.paramsCasing,
|
|
324
394
|
paramsType: options.paramsType,
|
|
325
395
|
pathParamsType: options.pathParamsType,
|
|
@@ -337,7 +407,7 @@ const mutationGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
337
407
|
paramsCasing: options.paramsCasing,
|
|
338
408
|
paramsType: options.paramsType,
|
|
339
409
|
pathParamsType: options.pathParamsType,
|
|
340
|
-
dataReturnType: options.client.dataReturnType
|
|
410
|
+
dataReturnType: options.client.dataReturnType || "data"
|
|
341
411
|
}),
|
|
342
412
|
options.mutation && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
343
413
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
@@ -359,7 +429,7 @@ const mutationGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
359
429
|
typeName: mutation.typeName,
|
|
360
430
|
typeSchemas: type.schemas,
|
|
361
431
|
operation,
|
|
362
|
-
dataReturnType: options.client.dataReturnType,
|
|
432
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
363
433
|
paramsCasing: options.paramsCasing,
|
|
364
434
|
pathParamsType: options.pathParamsType,
|
|
365
435
|
mutationKeyName: mutationKey.name
|
|
@@ -371,53 +441,45 @@ const mutationGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
371
441
|
});
|
|
372
442
|
|
|
373
443
|
//#endregion
|
|
374
|
-
//#region src/generators/
|
|
375
|
-
const
|
|
376
|
-
name: "react-
|
|
377
|
-
Operation({
|
|
378
|
-
const { options: { output } } =
|
|
444
|
+
//#region src/generators/queryGenerator.tsx
|
|
445
|
+
const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
446
|
+
name: "react-query",
|
|
447
|
+
Operation({ config, plugin, operation, generator }) {
|
|
448
|
+
const { options, options: { output } } = plugin;
|
|
379
449
|
const pluginManager = (0, __kubb_core_hooks.usePluginManager)();
|
|
380
450
|
const oas = (0, __kubb_plugin_oas_hooks.useOas)();
|
|
381
|
-
const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)();
|
|
451
|
+
const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
382
452
|
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
383
453
|
const isMutation = (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
384
|
-
const infiniteOptions = options.infinite && typeof options.infinite === "object" ? options.infinite : void 0;
|
|
385
454
|
const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
|
|
386
455
|
const query = {
|
|
387
456
|
name: getName(operation, {
|
|
388
457
|
type: "function",
|
|
389
|
-
prefix: "use"
|
|
390
|
-
suffix: "infinite"
|
|
458
|
+
prefix: "use"
|
|
391
459
|
}),
|
|
392
460
|
typeName: getName(operation, { type: "type" }),
|
|
393
|
-
file: getFile(operation, {
|
|
394
|
-
prefix: "use",
|
|
395
|
-
suffix: "infinite"
|
|
396
|
-
})
|
|
461
|
+
file: getFile(operation, { prefix: "use" })
|
|
397
462
|
};
|
|
398
463
|
const hasClientPlugin = !!pluginManager.getPluginByKey([__kubb_plugin_client.pluginClientName]);
|
|
399
464
|
const client = {
|
|
400
465
|
name: hasClientPlugin ? getName(operation, {
|
|
401
466
|
type: "function",
|
|
402
467
|
pluginKey: [__kubb_plugin_client.pluginClientName]
|
|
403
|
-
}) : getName(operation, {
|
|
404
|
-
type: "function",
|
|
405
|
-
suffix: "infinite"
|
|
406
|
-
}),
|
|
468
|
+
}) : getName(operation, { type: "function" }),
|
|
407
469
|
file: getFile(operation, { pluginKey: [__kubb_plugin_client.pluginClientName] })
|
|
408
470
|
};
|
|
409
471
|
const queryOptions = { name: getName(operation, {
|
|
410
472
|
type: "function",
|
|
411
|
-
suffix: "
|
|
473
|
+
suffix: "QueryOptions"
|
|
412
474
|
}) };
|
|
413
475
|
const queryKey = {
|
|
414
476
|
name: getName(operation, {
|
|
415
477
|
type: "const",
|
|
416
|
-
suffix: "
|
|
478
|
+
suffix: "QueryKey"
|
|
417
479
|
}),
|
|
418
480
|
typeName: getName(operation, {
|
|
419
481
|
type: "type",
|
|
420
|
-
suffix: "
|
|
482
|
+
suffix: "QueryKey"
|
|
421
483
|
})
|
|
422
484
|
};
|
|
423
485
|
const type = {
|
|
@@ -434,15 +496,7 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
434
496
|
type: "function"
|
|
435
497
|
})
|
|
436
498
|
};
|
|
437
|
-
if (!isQuery || isMutation
|
|
438
|
-
const normalizeKey = (key) => (key ?? "").replace(/\?$/, "");
|
|
439
|
-
const queryParam = infiniteOptions.queryParam;
|
|
440
|
-
const cursorParam = infiniteOptions.cursorParam;
|
|
441
|
-
const queryParamKeys = type.schemas.queryParams?.keys ?? [];
|
|
442
|
-
const responseKeys = [...type.schemas.responses?.flatMap((item) => item.keys ?? []) ?? [], ...type.schemas.response?.keys ?? []];
|
|
443
|
-
const hasQueryParam = queryParam ? queryParamKeys.some((key) => normalizeKey(key) === queryParam) : false;
|
|
444
|
-
const hasCursorParam = cursorParam ? responseKeys.some((key) => normalizeKey(key) === cursorParam) : true;
|
|
445
|
-
if (!hasQueryParam || !hasCursorParam) return null;
|
|
499
|
+
if (!isQuery || isMutation) return null;
|
|
446
500
|
return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric.File, {
|
|
447
501
|
baseName: query.file.baseName,
|
|
448
502
|
path: query.file.path,
|
|
@@ -462,25 +516,45 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
462
516
|
root: query.file.path,
|
|
463
517
|
path: zod.file.path
|
|
464
518
|
}),
|
|
465
|
-
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
519
|
+
options.client.importPath ? /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
520
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
521
|
+
name: "fetch",
|
|
522
|
+
path: options.client.importPath
|
|
523
|
+
}),
|
|
524
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
525
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
526
|
+
path: options.client.importPath,
|
|
527
|
+
isTypeOnly: true
|
|
528
|
+
}),
|
|
529
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
530
|
+
name: ["ResponseConfig"],
|
|
531
|
+
path: options.client.importPath,
|
|
532
|
+
isTypeOnly: true
|
|
533
|
+
})
|
|
534
|
+
] }) : /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
535
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
536
|
+
name: "fetch",
|
|
537
|
+
root: query.file.path,
|
|
538
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetcher.ts")
|
|
539
|
+
}),
|
|
540
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
541
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
542
|
+
root: query.file.path,
|
|
543
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetcher.ts"),
|
|
544
|
+
isTypeOnly: true
|
|
545
|
+
}),
|
|
546
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
547
|
+
name: ["ResponseConfig"],
|
|
548
|
+
root: query.file.path,
|
|
549
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetcher.ts"),
|
|
550
|
+
isTypeOnly: true
|
|
551
|
+
})
|
|
552
|
+
] }),
|
|
469
553
|
hasClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
470
554
|
name: [client.name],
|
|
471
555
|
root: query.file.path,
|
|
472
556
|
path: client.file.path
|
|
473
557
|
}),
|
|
474
|
-
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
475
|
-
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
476
|
-
path: options.client.importPath,
|
|
477
|
-
isTypeOnly: true
|
|
478
|
-
}),
|
|
479
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
480
|
-
name: ["ResponseConfig"],
|
|
481
|
-
path: options.client.importPath,
|
|
482
|
-
isTypeOnly: true
|
|
483
|
-
}),
|
|
484
558
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
485
559
|
name: [
|
|
486
560
|
type.schemas.request?.name,
|
|
@@ -498,9 +572,9 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
498
572
|
name: queryKey.name,
|
|
499
573
|
typeName: queryKey.typeName,
|
|
500
574
|
operation,
|
|
501
|
-
paramsCasing: options.paramsCasing,
|
|
502
575
|
pathParamsType: options.pathParamsType,
|
|
503
576
|
typeSchemas: type.schemas,
|
|
577
|
+
paramsCasing: options.paramsCasing,
|
|
504
578
|
transformer: options.queryKey
|
|
505
579
|
}),
|
|
506
580
|
!hasClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_plugin_client_components.Client, {
|
|
@@ -509,52 +583,43 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
509
583
|
operation,
|
|
510
584
|
typeSchemas: type.schemas,
|
|
511
585
|
zodSchemas: zod.schemas,
|
|
512
|
-
dataReturnType: options.client.dataReturnType,
|
|
513
|
-
paramsCasing: options.paramsCasing,
|
|
586
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
514
587
|
paramsType: options.paramsType,
|
|
588
|
+
paramsCasing: options.paramsCasing,
|
|
515
589
|
pathParamsType: options.pathParamsType,
|
|
516
590
|
parser: options.parser
|
|
517
591
|
}),
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
paramsCasing: options.paramsCasing,
|
|
534
|
-
paramsType: options.paramsType,
|
|
535
|
-
pathParamsType: options.pathParamsType,
|
|
536
|
-
dataReturnType: options.client.dataReturnType,
|
|
537
|
-
cursorParam: infiniteOptions.cursorParam,
|
|
538
|
-
initialPageParam: infiniteOptions.initialPageParam,
|
|
539
|
-
queryParam: infiniteOptions.queryParam
|
|
540
|
-
})
|
|
541
|
-
] }),
|
|
542
|
-
infiniteOptions && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
592
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
593
|
+
name: ["queryOptions"],
|
|
594
|
+
path: importPath
|
|
595
|
+
}),
|
|
596
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryOptions, {
|
|
597
|
+
name: queryOptions.name,
|
|
598
|
+
clientName: client.name,
|
|
599
|
+
queryKeyName: queryKey.name,
|
|
600
|
+
typeSchemas: type.schemas,
|
|
601
|
+
paramsCasing: options.paramsCasing,
|
|
602
|
+
paramsType: options.paramsType,
|
|
603
|
+
pathParamsType: options.pathParamsType,
|
|
604
|
+
dataReturnType: options.client.dataReturnType || "data"
|
|
605
|
+
}),
|
|
606
|
+
options.query && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
543
607
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
544
|
-
name: ["
|
|
608
|
+
name: ["useQuery"],
|
|
545
609
|
path: importPath
|
|
546
610
|
}),
|
|
547
611
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
548
612
|
name: [
|
|
549
613
|
"QueryKey",
|
|
550
614
|
"QueryClient",
|
|
551
|
-
"
|
|
552
|
-
"
|
|
615
|
+
"QueryObserverOptions",
|
|
616
|
+
"UseQueryResult",
|
|
617
|
+
"QueryClient"
|
|
553
618
|
],
|
|
554
619
|
path: importPath,
|
|
555
620
|
isTypeOnly: true
|
|
556
621
|
}),
|
|
557
|
-
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.
|
|
622
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.Query, {
|
|
558
623
|
name: query.name,
|
|
559
624
|
queryOptionsName: queryOptions.name,
|
|
560
625
|
typeSchemas: type.schemas,
|
|
@@ -562,11 +627,9 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
562
627
|
paramsType: options.paramsType,
|
|
563
628
|
pathParamsType: options.pathParamsType,
|
|
564
629
|
operation,
|
|
565
|
-
dataReturnType: options.client.dataReturnType,
|
|
630
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
566
631
|
queryKeyName: queryKey.name,
|
|
567
|
-
queryKeyTypeName: queryKey.typeName
|
|
568
|
-
initialPageParam: infiniteOptions.initialPageParam,
|
|
569
|
-
queryParam: infiniteOptions.queryParam
|
|
632
|
+
queryKeyTypeName: queryKey.typeName
|
|
570
633
|
})
|
|
571
634
|
] })
|
|
572
635
|
]
|
|
@@ -576,13 +639,13 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
576
639
|
|
|
577
640
|
//#endregion
|
|
578
641
|
//#region src/generators/suspenseQueryGenerator.tsx
|
|
579
|
-
const suspenseQueryGenerator = (0,
|
|
642
|
+
const suspenseQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
580
643
|
name: "react-suspense-query",
|
|
581
|
-
Operation({
|
|
582
|
-
const { options: { output } } =
|
|
644
|
+
Operation({ config, operation, generator, plugin }) {
|
|
645
|
+
const { options, options: { output } } = plugin;
|
|
583
646
|
const pluginManager = (0, __kubb_core_hooks.usePluginManager)();
|
|
584
647
|
const oas = (0, __kubb_plugin_oas_hooks.useOas)();
|
|
585
|
-
const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)();
|
|
648
|
+
const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
586
649
|
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
587
650
|
const isMutation = (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
588
651
|
const isSuspense = !!options.suspense;
|
|
@@ -658,25 +721,45 @@ const suspenseQueryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
658
721
|
root: query.file.path,
|
|
659
722
|
path: zod.file.path
|
|
660
723
|
}),
|
|
661
|
-
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
724
|
+
options.client.importPath ? /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
725
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
726
|
+
name: "fetch",
|
|
727
|
+
path: options.client.importPath
|
|
728
|
+
}),
|
|
729
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
730
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
731
|
+
path: options.client.importPath,
|
|
732
|
+
isTypeOnly: true
|
|
733
|
+
}),
|
|
734
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
735
|
+
name: ["ResponseConfig"],
|
|
736
|
+
path: options.client.importPath,
|
|
737
|
+
isTypeOnly: true
|
|
738
|
+
})
|
|
739
|
+
] }) : /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
740
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
741
|
+
name: "fetch",
|
|
742
|
+
root: query.file.path,
|
|
743
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetcher.ts")
|
|
744
|
+
}),
|
|
745
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
746
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
747
|
+
root: query.file.path,
|
|
748
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetcher.ts"),
|
|
749
|
+
isTypeOnly: true
|
|
750
|
+
}),
|
|
751
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
752
|
+
name: ["ResponseConfig"],
|
|
753
|
+
root: query.file.path,
|
|
754
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetcher.ts"),
|
|
755
|
+
isTypeOnly: true
|
|
756
|
+
})
|
|
757
|
+
] }),
|
|
665
758
|
hasClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
666
759
|
name: [client.name],
|
|
667
760
|
root: query.file.path,
|
|
668
761
|
path: client.file.path
|
|
669
762
|
}),
|
|
670
|
-
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
671
|
-
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
672
|
-
path: options.client.importPath,
|
|
673
|
-
isTypeOnly: true
|
|
674
|
-
}),
|
|
675
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
676
|
-
name: ["ResponseConfig"],
|
|
677
|
-
path: options.client.importPath,
|
|
678
|
-
isTypeOnly: true
|
|
679
|
-
}),
|
|
680
763
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
681
764
|
name: [
|
|
682
765
|
type.schemas.request?.name,
|
|
@@ -705,7 +788,7 @@ const suspenseQueryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
705
788
|
operation,
|
|
706
789
|
typeSchemas: type.schemas,
|
|
707
790
|
zodSchemas: zod.schemas,
|
|
708
|
-
dataReturnType: options.client.dataReturnType,
|
|
791
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
709
792
|
paramsCasing: options.paramsCasing,
|
|
710
793
|
paramsType: options.paramsType,
|
|
711
794
|
pathParamsType: options.pathParamsType,
|
|
@@ -740,11 +823,6 @@ const suspenseQueryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
740
823
|
path: importPath,
|
|
741
824
|
isTypeOnly: true
|
|
742
825
|
}),
|
|
743
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
744
|
-
name: ["ResponseConfig"],
|
|
745
|
-
path: options.client.importPath,
|
|
746
|
-
isTypeOnly: true
|
|
747
|
-
}),
|
|
748
826
|
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.SuspenseQuery, {
|
|
749
827
|
name: query.name,
|
|
750
828
|
queryOptionsName: queryOptions.name,
|
|
@@ -753,7 +831,7 @@ const suspenseQueryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
753
831
|
paramsCasing: options.paramsCasing,
|
|
754
832
|
pathParamsType: options.pathParamsType,
|
|
755
833
|
operation,
|
|
756
|
-
dataReturnType: options.client.dataReturnType,
|
|
834
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
757
835
|
queryKeyName: queryKey.name,
|
|
758
836
|
queryKeyTypeName: queryKey.typeName
|
|
759
837
|
})
|
|
@@ -788,4 +866,4 @@ Object.defineProperty(exports, 'suspenseQueryGenerator', {
|
|
|
788
866
|
return suspenseQueryGenerator;
|
|
789
867
|
}
|
|
790
868
|
});
|
|
791
|
-
//# sourceMappingURL=generators-
|
|
869
|
+
//# sourceMappingURL=generators-BIuKpozF.cjs.map
|