@kubb/plugin-react-query 4.12.3 → 4.12.4
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-BI1cqI0Q.cjs → components-CO636qn3.cjs} +153 -153
- package/dist/{components-BI1cqI0Q.cjs.map → components-CO636qn3.cjs.map} +1 -1
- package/dist/components.cjs +1 -1
- package/dist/{generators-72yCvzWQ.cjs → generators-BNtUetHy.cjs} +186 -186
- package/dist/{generators-72yCvzWQ.cjs.map → generators-BNtUetHy.cjs.map} +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/index.cjs +24 -24
- package/dist/index.cjs.map +1 -1
- package/package.json +8 -8
|
@@ -25,29 +25,29 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
const require_components = require('./components-
|
|
28
|
+
const require_components = require('./components-CO636qn3.cjs');
|
|
29
29
|
let node_path = require("node:path");
|
|
30
30
|
node_path = __toESM(node_path);
|
|
31
|
-
let
|
|
32
|
-
let
|
|
33
|
-
let
|
|
34
|
-
let
|
|
35
|
-
let
|
|
36
|
-
let
|
|
37
|
-
let
|
|
38
|
-
let
|
|
39
|
-
let
|
|
40
|
-
let
|
|
31
|
+
let _kubb_plugin_client = require("@kubb/plugin-client");
|
|
32
|
+
let _kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
33
|
+
let _kubb_plugin_zod = require("@kubb/plugin-zod");
|
|
34
|
+
let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
|
|
35
|
+
let _kubb_react_fabric = require("@kubb/react-fabric");
|
|
36
|
+
let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
|
|
37
|
+
let _kubb_plugin_client_components = require("@kubb/plugin-client/components");
|
|
38
|
+
let _kubb_core_hooks = require("@kubb/core/hooks");
|
|
39
|
+
let _kubb_plugin_oas_generators = require("@kubb/plugin-oas/generators");
|
|
40
|
+
let _kubb_plugin_oas_hooks = require("@kubb/plugin-oas/hooks");
|
|
41
41
|
let remeda = require("remeda");
|
|
42
42
|
|
|
43
43
|
//#region src/generators/infiniteQueryGenerator.tsx
|
|
44
|
-
const infiniteQueryGenerator = (0,
|
|
44
|
+
const infiniteQueryGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
|
|
45
45
|
name: "react-infinite-query",
|
|
46
46
|
Operation({ config, operation, generator, plugin }) {
|
|
47
47
|
const { options, options: { output } } = plugin;
|
|
48
|
-
const pluginManager = (0,
|
|
49
|
-
const oas = (0,
|
|
50
|
-
const { getSchemas, getName, getFile } = (0,
|
|
48
|
+
const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
|
|
49
|
+
const oas = (0, _kubb_plugin_oas_hooks.useOas)();
|
|
50
|
+
const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
51
51
|
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
52
52
|
const isMutation = (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
53
53
|
const infiniteOptions = options.infinite && typeof options.infinite === "object" ? options.infinite : void 0;
|
|
@@ -64,16 +64,16 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
64
64
|
suffix: "infinite"
|
|
65
65
|
})
|
|
66
66
|
};
|
|
67
|
-
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([
|
|
67
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([_kubb_plugin_client.pluginClientName]) && options.client.clientType !== "class";
|
|
68
68
|
const client = {
|
|
69
69
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
70
70
|
type: "function",
|
|
71
|
-
pluginKey: [
|
|
71
|
+
pluginKey: [_kubb_plugin_client.pluginClientName]
|
|
72
72
|
}) : getName(operation, {
|
|
73
73
|
type: "function",
|
|
74
74
|
suffix: "infinite"
|
|
75
75
|
}),
|
|
76
|
-
file: getFile(operation, { pluginKey: [
|
|
76
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_client.pluginClientName] })
|
|
77
77
|
};
|
|
78
78
|
const queryOptions = { name: getName(operation, {
|
|
79
79
|
type: "function",
|
|
@@ -90,16 +90,16 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
90
90
|
})
|
|
91
91
|
};
|
|
92
92
|
const type = {
|
|
93
|
-
file: getFile(operation, { pluginKey: [
|
|
93
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_ts.pluginTsName] }),
|
|
94
94
|
schemas: getSchemas(operation, {
|
|
95
|
-
pluginKey: [
|
|
95
|
+
pluginKey: [_kubb_plugin_ts.pluginTsName],
|
|
96
96
|
type: "type"
|
|
97
97
|
})
|
|
98
98
|
};
|
|
99
99
|
const zod = {
|
|
100
|
-
file: getFile(operation, { pluginKey: [
|
|
100
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_zod.pluginZodName] }),
|
|
101
101
|
schemas: getSchemas(operation, {
|
|
102
|
-
pluginKey: [
|
|
102
|
+
pluginKey: [_kubb_plugin_zod.pluginZodName],
|
|
103
103
|
type: "function"
|
|
104
104
|
})
|
|
105
105
|
};
|
|
@@ -112,70 +112,70 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
112
112
|
const hasQueryParam = queryParam ? queryParamKeys.some((key) => normalizeKey(key) === queryParam) : false;
|
|
113
113
|
const hasCursorParam = cursorParam ? responseKeys.some((key) => normalizeKey(key) === cursorParam) : true;
|
|
114
114
|
if (!hasQueryParam || !hasCursorParam) return null;
|
|
115
|
-
return /* @__PURE__ */ (0,
|
|
115
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
|
|
116
116
|
baseName: query.file.baseName,
|
|
117
117
|
path: query.file.path,
|
|
118
118
|
meta: query.file.meta,
|
|
119
|
-
banner: (0,
|
|
119
|
+
banner: (0, _kubb_plugin_oas_utils.getBanner)({
|
|
120
120
|
oas,
|
|
121
121
|
output,
|
|
122
122
|
config: pluginManager.config
|
|
123
123
|
}),
|
|
124
|
-
footer: (0,
|
|
124
|
+
footer: (0, _kubb_plugin_oas_utils.getFooter)({
|
|
125
125
|
oas,
|
|
126
126
|
output
|
|
127
127
|
}),
|
|
128
128
|
children: [
|
|
129
|
-
options.parser === "zod" && /* @__PURE__ */ (0,
|
|
129
|
+
options.parser === "zod" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
130
130
|
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
131
131
|
root: query.file.path,
|
|
132
132
|
path: zod.file.path
|
|
133
133
|
}),
|
|
134
|
-
options.client.importPath ? /* @__PURE__ */ (0,
|
|
135
|
-
/* @__PURE__ */ (0,
|
|
134
|
+
options.client.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
135
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
136
136
|
name: "fetch",
|
|
137
137
|
path: options.client.importPath
|
|
138
138
|
}),
|
|
139
|
-
/* @__PURE__ */ (0,
|
|
139
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
140
140
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
141
141
|
path: options.client.importPath,
|
|
142
142
|
isTypeOnly: true
|
|
143
143
|
}),
|
|
144
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0,
|
|
144
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
145
145
|
name: ["ResponseConfig"],
|
|
146
146
|
path: options.client.importPath,
|
|
147
147
|
isTypeOnly: true
|
|
148
148
|
})
|
|
149
|
-
] }) : /* @__PURE__ */ (0,
|
|
150
|
-
/* @__PURE__ */ (0,
|
|
149
|
+
] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
150
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
151
151
|
name: ["fetch"],
|
|
152
152
|
root: query.file.path,
|
|
153
153
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
154
154
|
}),
|
|
155
|
-
/* @__PURE__ */ (0,
|
|
155
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
156
156
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
157
157
|
root: query.file.path,
|
|
158
158
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
159
159
|
isTypeOnly: true
|
|
160
160
|
}),
|
|
161
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0,
|
|
161
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
162
162
|
name: ["ResponseConfig"],
|
|
163
163
|
root: query.file.path,
|
|
164
164
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
165
165
|
isTypeOnly: true
|
|
166
166
|
})
|
|
167
167
|
] }),
|
|
168
|
-
shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
168
|
+
shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
169
169
|
name: [client.name],
|
|
170
170
|
root: query.file.path,
|
|
171
171
|
path: client.file.path
|
|
172
172
|
}),
|
|
173
|
-
!shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
173
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
174
174
|
name: ["buildFormData"],
|
|
175
175
|
root: query.file.path,
|
|
176
176
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
177
177
|
}),
|
|
178
|
-
/* @__PURE__ */ (0,
|
|
178
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
179
179
|
name: [
|
|
180
180
|
type.schemas.request?.name,
|
|
181
181
|
type.schemas.response.name,
|
|
@@ -188,7 +188,7 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
188
188
|
path: type.file.path,
|
|
189
189
|
isTypeOnly: true
|
|
190
190
|
}),
|
|
191
|
-
/* @__PURE__ */ (0,
|
|
191
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryKey, {
|
|
192
192
|
name: queryKey.name,
|
|
193
193
|
typeName: queryKey.typeName,
|
|
194
194
|
operation,
|
|
@@ -197,7 +197,7 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
197
197
|
typeSchemas: type.schemas,
|
|
198
198
|
transformer: options.queryKey
|
|
199
199
|
}),
|
|
200
|
-
!shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
200
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_plugin_client_components.Client, {
|
|
201
201
|
name: client.name,
|
|
202
202
|
baseURL: options.client.baseURL,
|
|
203
203
|
operation,
|
|
@@ -209,17 +209,17 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
209
209
|
pathParamsType: options.pathParamsType,
|
|
210
210
|
parser: options.parser
|
|
211
211
|
}),
|
|
212
|
-
infiniteOptions && /* @__PURE__ */ (0,
|
|
213
|
-
/* @__PURE__ */ (0,
|
|
212
|
+
infiniteOptions && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
213
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
214
214
|
name: ["InfiniteData"],
|
|
215
215
|
isTypeOnly: true,
|
|
216
216
|
path: importPath
|
|
217
217
|
}),
|
|
218
|
-
/* @__PURE__ */ (0,
|
|
218
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
219
219
|
name: ["infiniteQueryOptions"],
|
|
220
220
|
path: importPath
|
|
221
221
|
}),
|
|
222
|
-
/* @__PURE__ */ (0,
|
|
222
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.InfiniteQueryOptions, {
|
|
223
223
|
name: queryOptions.name,
|
|
224
224
|
clientName: client.name,
|
|
225
225
|
queryKeyName: queryKey.name,
|
|
@@ -235,12 +235,12 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
235
235
|
queryParam: infiniteOptions.queryParam
|
|
236
236
|
})
|
|
237
237
|
] }),
|
|
238
|
-
infiniteOptions && /* @__PURE__ */ (0,
|
|
239
|
-
/* @__PURE__ */ (0,
|
|
238
|
+
infiniteOptions && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
239
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
240
240
|
name: ["useInfiniteQuery"],
|
|
241
241
|
path: importPath
|
|
242
242
|
}),
|
|
243
|
-
/* @__PURE__ */ (0,
|
|
243
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
244
244
|
name: [
|
|
245
245
|
"QueryKey",
|
|
246
246
|
"QueryClient",
|
|
@@ -250,7 +250,7 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
250
250
|
path: importPath,
|
|
251
251
|
isTypeOnly: true
|
|
252
252
|
}),
|
|
253
|
-
/* @__PURE__ */ (0,
|
|
253
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.InfiniteQuery, {
|
|
254
254
|
name: query.name,
|
|
255
255
|
queryOptionsName: queryOptions.name,
|
|
256
256
|
typeSchemas: type.schemas,
|
|
@@ -272,13 +272,13 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
272
272
|
|
|
273
273
|
//#endregion
|
|
274
274
|
//#region src/generators/mutationGenerator.tsx
|
|
275
|
-
const mutationGenerator = (0,
|
|
275
|
+
const mutationGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
|
|
276
276
|
name: "react-query",
|
|
277
277
|
Operation({ config, plugin, operation, generator }) {
|
|
278
278
|
const { options, options: { output } } = plugin;
|
|
279
|
-
const pluginManager = (0,
|
|
280
|
-
const oas = (0,
|
|
281
|
-
const { getSchemas, getName, getFile } = (0,
|
|
279
|
+
const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
|
|
280
|
+
const oas = (0, _kubb_plugin_oas_hooks.useOas)();
|
|
281
|
+
const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
282
282
|
const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method);
|
|
283
283
|
const isMutation = options.mutation !== false && !isQuery && (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
284
284
|
const importPath = options.mutation ? options.mutation.importPath : "@tanstack/react-query";
|
|
@@ -291,26 +291,26 @@ const mutationGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)
|
|
|
291
291
|
file: getFile(operation, { prefix: "use" })
|
|
292
292
|
};
|
|
293
293
|
const type = {
|
|
294
|
-
file: getFile(operation, { pluginKey: [
|
|
294
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_ts.pluginTsName] }),
|
|
295
295
|
schemas: getSchemas(operation, {
|
|
296
|
-
pluginKey: [
|
|
296
|
+
pluginKey: [_kubb_plugin_ts.pluginTsName],
|
|
297
297
|
type: "type"
|
|
298
298
|
})
|
|
299
299
|
};
|
|
300
300
|
const zod = {
|
|
301
|
-
file: getFile(operation, { pluginKey: [
|
|
301
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_zod.pluginZodName] }),
|
|
302
302
|
schemas: getSchemas(operation, {
|
|
303
|
-
pluginKey: [
|
|
303
|
+
pluginKey: [_kubb_plugin_zod.pluginZodName],
|
|
304
304
|
type: "function"
|
|
305
305
|
})
|
|
306
306
|
};
|
|
307
|
-
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([
|
|
307
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([_kubb_plugin_client.pluginClientName]) && options.client.clientType !== "class";
|
|
308
308
|
const client = {
|
|
309
309
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
310
310
|
type: "function",
|
|
311
|
-
pluginKey: [
|
|
311
|
+
pluginKey: [_kubb_plugin_client.pluginClientName]
|
|
312
312
|
}) : getName(operation, { type: "function" }),
|
|
313
|
-
file: getFile(operation, { pluginKey: [
|
|
313
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_client.pluginClientName] })
|
|
314
314
|
};
|
|
315
315
|
const mutationOptions = { name: getName(operation, {
|
|
316
316
|
type: "function",
|
|
@@ -327,70 +327,70 @@ const mutationGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)
|
|
|
327
327
|
})
|
|
328
328
|
};
|
|
329
329
|
if (!isMutation) return null;
|
|
330
|
-
return /* @__PURE__ */ (0,
|
|
330
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
|
|
331
331
|
baseName: mutation.file.baseName,
|
|
332
332
|
path: mutation.file.path,
|
|
333
333
|
meta: mutation.file.meta,
|
|
334
|
-
banner: (0,
|
|
334
|
+
banner: (0, _kubb_plugin_oas_utils.getBanner)({
|
|
335
335
|
oas,
|
|
336
336
|
output,
|
|
337
337
|
config: pluginManager.config
|
|
338
338
|
}),
|
|
339
|
-
footer: (0,
|
|
339
|
+
footer: (0, _kubb_plugin_oas_utils.getFooter)({
|
|
340
340
|
oas,
|
|
341
341
|
output
|
|
342
342
|
}),
|
|
343
343
|
children: [
|
|
344
|
-
options.parser === "zod" && /* @__PURE__ */ (0,
|
|
344
|
+
options.parser === "zod" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
345
345
|
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
346
346
|
root: mutation.file.path,
|
|
347
347
|
path: zod.file.path
|
|
348
348
|
}),
|
|
349
|
-
options.client.importPath ? /* @__PURE__ */ (0,
|
|
350
|
-
/* @__PURE__ */ (0,
|
|
349
|
+
options.client.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
350
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
351
351
|
name: "fetch",
|
|
352
352
|
path: options.client.importPath
|
|
353
353
|
}),
|
|
354
|
-
/* @__PURE__ */ (0,
|
|
354
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
355
355
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
356
356
|
path: options.client.importPath,
|
|
357
357
|
isTypeOnly: true
|
|
358
358
|
}),
|
|
359
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0,
|
|
359
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
360
360
|
name: ["ResponseConfig"],
|
|
361
361
|
path: options.client.importPath,
|
|
362
362
|
isTypeOnly: true
|
|
363
363
|
})
|
|
364
|
-
] }) : /* @__PURE__ */ (0,
|
|
365
|
-
/* @__PURE__ */ (0,
|
|
364
|
+
] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
365
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
366
366
|
name: ["fetch"],
|
|
367
367
|
root: mutation.file.path,
|
|
368
368
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
369
369
|
}),
|
|
370
|
-
/* @__PURE__ */ (0,
|
|
370
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
371
371
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
372
372
|
root: mutation.file.path,
|
|
373
373
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
374
374
|
isTypeOnly: true
|
|
375
375
|
}),
|
|
376
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0,
|
|
376
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
377
377
|
name: ["ResponseConfig"],
|
|
378
378
|
root: mutation.file.path,
|
|
379
379
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
380
380
|
isTypeOnly: true
|
|
381
381
|
})
|
|
382
382
|
] }),
|
|
383
|
-
shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
383
|
+
shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
384
384
|
name: [client.name],
|
|
385
385
|
root: mutation.file.path,
|
|
386
386
|
path: client.file.path
|
|
387
387
|
}),
|
|
388
|
-
!shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
388
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
389
389
|
name: ["buildFormData"],
|
|
390
390
|
root: mutation.file.path,
|
|
391
391
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
392
392
|
}),
|
|
393
|
-
/* @__PURE__ */ (0,
|
|
393
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
394
394
|
name: [
|
|
395
395
|
type.schemas.request?.name,
|
|
396
396
|
type.schemas.response.name,
|
|
@@ -403,7 +403,7 @@ const mutationGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)
|
|
|
403
403
|
path: type.file.path,
|
|
404
404
|
isTypeOnly: true
|
|
405
405
|
}),
|
|
406
|
-
/* @__PURE__ */ (0,
|
|
406
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.MutationKey, {
|
|
407
407
|
name: mutationKey.name,
|
|
408
408
|
typeName: mutationKey.typeName,
|
|
409
409
|
operation,
|
|
@@ -412,7 +412,7 @@ const mutationGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)
|
|
|
412
412
|
paramsCasing: options.paramsCasing,
|
|
413
413
|
transformer: options.mutationKey
|
|
414
414
|
}),
|
|
415
|
-
!shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
415
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_plugin_client_components.Client, {
|
|
416
416
|
name: client.name,
|
|
417
417
|
baseURL: options.client.baseURL,
|
|
418
418
|
operation,
|
|
@@ -424,11 +424,11 @@ const mutationGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)
|
|
|
424
424
|
pathParamsType: options.pathParamsType,
|
|
425
425
|
parser: options.parser
|
|
426
426
|
}),
|
|
427
|
-
/* @__PURE__ */ (0,
|
|
427
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
428
428
|
name: ["mutationOptions"],
|
|
429
429
|
path: importPath
|
|
430
430
|
}),
|
|
431
|
-
/* @__PURE__ */ (0,
|
|
431
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.MutationOptions, {
|
|
432
432
|
name: mutationOptions.name,
|
|
433
433
|
clientName: client.name,
|
|
434
434
|
mutationKeyName: mutationKey.name,
|
|
@@ -438,12 +438,12 @@ const mutationGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)
|
|
|
438
438
|
pathParamsType: options.pathParamsType,
|
|
439
439
|
dataReturnType: options.client.dataReturnType || "data"
|
|
440
440
|
}),
|
|
441
|
-
options.mutation && /* @__PURE__ */ (0,
|
|
442
|
-
/* @__PURE__ */ (0,
|
|
441
|
+
options.mutation && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
442
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
443
443
|
name: ["useMutation"],
|
|
444
444
|
path: importPath
|
|
445
445
|
}),
|
|
446
|
-
/* @__PURE__ */ (0,
|
|
446
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
447
447
|
name: [
|
|
448
448
|
"UseMutationOptions",
|
|
449
449
|
"UseMutationResult",
|
|
@@ -452,7 +452,7 @@ const mutationGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)
|
|
|
452
452
|
path: importPath,
|
|
453
453
|
isTypeOnly: true
|
|
454
454
|
}),
|
|
455
|
-
/* @__PURE__ */ (0,
|
|
455
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.Mutation, {
|
|
456
456
|
name: mutation.name,
|
|
457
457
|
mutationOptionsName: mutationOptions.name,
|
|
458
458
|
typeName: mutation.typeName,
|
|
@@ -471,13 +471,13 @@ const mutationGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)
|
|
|
471
471
|
|
|
472
472
|
//#endregion
|
|
473
473
|
//#region src/generators/queryGenerator.tsx
|
|
474
|
-
const queryGenerator = (0,
|
|
474
|
+
const queryGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
|
|
475
475
|
name: "react-query",
|
|
476
476
|
Operation({ config, plugin, operation, generator }) {
|
|
477
477
|
const { options, options: { output } } = plugin;
|
|
478
|
-
const pluginManager = (0,
|
|
479
|
-
const oas = (0,
|
|
480
|
-
const { getSchemas, getName, getFile } = (0,
|
|
478
|
+
const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
|
|
479
|
+
const oas = (0, _kubb_plugin_oas_hooks.useOas)();
|
|
480
|
+
const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
481
481
|
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
482
482
|
const isMutation = (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
483
483
|
const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
|
|
@@ -489,13 +489,13 @@ const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
489
489
|
typeName: getName(operation, { type: "type" }),
|
|
490
490
|
file: getFile(operation, { prefix: "use" })
|
|
491
491
|
};
|
|
492
|
-
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([
|
|
492
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([_kubb_plugin_client.pluginClientName]) && options.client.clientType !== "class";
|
|
493
493
|
const client = {
|
|
494
494
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
495
495
|
type: "function",
|
|
496
|
-
pluginKey: [
|
|
496
|
+
pluginKey: [_kubb_plugin_client.pluginClientName]
|
|
497
497
|
}) : getName(operation, { type: "function" }),
|
|
498
|
-
file: getFile(operation, { pluginKey: [
|
|
498
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_client.pluginClientName] })
|
|
499
499
|
};
|
|
500
500
|
const queryOptions = { name: getName(operation, {
|
|
501
501
|
type: "function",
|
|
@@ -512,84 +512,84 @@ const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
512
512
|
})
|
|
513
513
|
};
|
|
514
514
|
const type = {
|
|
515
|
-
file: getFile(operation, { pluginKey: [
|
|
515
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_ts.pluginTsName] }),
|
|
516
516
|
schemas: getSchemas(operation, {
|
|
517
|
-
pluginKey: [
|
|
517
|
+
pluginKey: [_kubb_plugin_ts.pluginTsName],
|
|
518
518
|
type: "type"
|
|
519
519
|
})
|
|
520
520
|
};
|
|
521
521
|
const zod = {
|
|
522
|
-
file: getFile(operation, { pluginKey: [
|
|
522
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_zod.pluginZodName] }),
|
|
523
523
|
schemas: getSchemas(operation, {
|
|
524
|
-
pluginKey: [
|
|
524
|
+
pluginKey: [_kubb_plugin_zod.pluginZodName],
|
|
525
525
|
type: "function"
|
|
526
526
|
})
|
|
527
527
|
};
|
|
528
528
|
if (!isQuery || isMutation) return null;
|
|
529
|
-
return /* @__PURE__ */ (0,
|
|
529
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
|
|
530
530
|
baseName: query.file.baseName,
|
|
531
531
|
path: query.file.path,
|
|
532
532
|
meta: query.file.meta,
|
|
533
|
-
banner: (0,
|
|
533
|
+
banner: (0, _kubb_plugin_oas_utils.getBanner)({
|
|
534
534
|
oas,
|
|
535
535
|
output,
|
|
536
536
|
config: pluginManager.config
|
|
537
537
|
}),
|
|
538
|
-
footer: (0,
|
|
538
|
+
footer: (0, _kubb_plugin_oas_utils.getFooter)({
|
|
539
539
|
oas,
|
|
540
540
|
output
|
|
541
541
|
}),
|
|
542
542
|
children: [
|
|
543
|
-
options.parser === "zod" && /* @__PURE__ */ (0,
|
|
543
|
+
options.parser === "zod" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
544
544
|
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
545
545
|
root: query.file.path,
|
|
546
546
|
path: zod.file.path
|
|
547
547
|
}),
|
|
548
|
-
options.client.importPath ? /* @__PURE__ */ (0,
|
|
549
|
-
/* @__PURE__ */ (0,
|
|
548
|
+
options.client.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
549
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
550
550
|
name: "fetch",
|
|
551
551
|
path: options.client.importPath
|
|
552
552
|
}),
|
|
553
|
-
/* @__PURE__ */ (0,
|
|
553
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
554
554
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
555
555
|
path: options.client.importPath,
|
|
556
556
|
isTypeOnly: true
|
|
557
557
|
}),
|
|
558
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0,
|
|
558
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
559
559
|
name: ["ResponseConfig"],
|
|
560
560
|
path: options.client.importPath,
|
|
561
561
|
isTypeOnly: true
|
|
562
562
|
})
|
|
563
|
-
] }) : /* @__PURE__ */ (0,
|
|
564
|
-
/* @__PURE__ */ (0,
|
|
563
|
+
] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
564
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
565
565
|
name: ["fetch"],
|
|
566
566
|
root: query.file.path,
|
|
567
567
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
568
568
|
}),
|
|
569
|
-
/* @__PURE__ */ (0,
|
|
569
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
570
570
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
571
571
|
root: query.file.path,
|
|
572
572
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
573
573
|
isTypeOnly: true
|
|
574
574
|
}),
|
|
575
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0,
|
|
575
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
576
576
|
name: ["ResponseConfig"],
|
|
577
577
|
root: query.file.path,
|
|
578
578
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
579
579
|
isTypeOnly: true
|
|
580
580
|
})
|
|
581
581
|
] }),
|
|
582
|
-
shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
582
|
+
shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
583
583
|
name: [client.name],
|
|
584
584
|
root: query.file.path,
|
|
585
585
|
path: client.file.path
|
|
586
586
|
}),
|
|
587
|
-
!shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
587
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
588
588
|
name: ["buildFormData"],
|
|
589
589
|
root: query.file.path,
|
|
590
590
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
591
591
|
}),
|
|
592
|
-
/* @__PURE__ */ (0,
|
|
592
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
593
593
|
name: [
|
|
594
594
|
type.schemas.request?.name,
|
|
595
595
|
type.schemas.response.name,
|
|
@@ -602,7 +602,7 @@ const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
602
602
|
path: type.file.path,
|
|
603
603
|
isTypeOnly: true
|
|
604
604
|
}),
|
|
605
|
-
/* @__PURE__ */ (0,
|
|
605
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryKey, {
|
|
606
606
|
name: queryKey.name,
|
|
607
607
|
typeName: queryKey.typeName,
|
|
608
608
|
operation,
|
|
@@ -611,7 +611,7 @@ const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
611
611
|
paramsCasing: options.paramsCasing,
|
|
612
612
|
transformer: options.queryKey
|
|
613
613
|
}),
|
|
614
|
-
!shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
614
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_plugin_client_components.Client, {
|
|
615
615
|
name: client.name,
|
|
616
616
|
baseURL: options.client.baseURL,
|
|
617
617
|
operation,
|
|
@@ -623,11 +623,11 @@ const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
623
623
|
pathParamsType: options.pathParamsType,
|
|
624
624
|
parser: options.parser
|
|
625
625
|
}),
|
|
626
|
-
/* @__PURE__ */ (0,
|
|
626
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
627
627
|
name: ["queryOptions"],
|
|
628
628
|
path: importPath
|
|
629
629
|
}),
|
|
630
|
-
/* @__PURE__ */ (0,
|
|
630
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryOptions, {
|
|
631
631
|
name: queryOptions.name,
|
|
632
632
|
clientName: client.name,
|
|
633
633
|
queryKeyName: queryKey.name,
|
|
@@ -637,12 +637,12 @@ const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
637
637
|
pathParamsType: options.pathParamsType,
|
|
638
638
|
dataReturnType: options.client.dataReturnType || "data"
|
|
639
639
|
}),
|
|
640
|
-
options.query && /* @__PURE__ */ (0,
|
|
641
|
-
/* @__PURE__ */ (0,
|
|
640
|
+
options.query && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
641
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
642
642
|
name: ["useQuery"],
|
|
643
643
|
path: importPath
|
|
644
644
|
}),
|
|
645
|
-
/* @__PURE__ */ (0,
|
|
645
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
646
646
|
name: [
|
|
647
647
|
"QueryKey",
|
|
648
648
|
"QueryClient",
|
|
@@ -653,7 +653,7 @@ const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
653
653
|
path: importPath,
|
|
654
654
|
isTypeOnly: true
|
|
655
655
|
}),
|
|
656
|
-
/* @__PURE__ */ (0,
|
|
656
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.Query, {
|
|
657
657
|
name: query.name,
|
|
658
658
|
queryOptionsName: queryOptions.name,
|
|
659
659
|
typeSchemas: type.schemas,
|
|
@@ -673,13 +673,13 @@ const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
673
673
|
|
|
674
674
|
//#endregion
|
|
675
675
|
//#region src/generators/suspenseInfiniteQueryGenerator.tsx
|
|
676
|
-
const suspenseInfiniteQueryGenerator = (0,
|
|
676
|
+
const suspenseInfiniteQueryGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
|
|
677
677
|
name: "react-suspense-infinite-query",
|
|
678
678
|
Operation({ config, operation, generator, plugin }) {
|
|
679
679
|
const { options, options: { output } } = plugin;
|
|
680
|
-
const pluginManager = (0,
|
|
681
|
-
const oas = (0,
|
|
682
|
-
const { getSchemas, getName, getFile } = (0,
|
|
680
|
+
const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
|
|
681
|
+
const oas = (0, _kubb_plugin_oas_hooks.useOas)();
|
|
682
|
+
const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
683
683
|
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
684
684
|
const isMutation = (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
685
685
|
const isSuspense = !!options.suspense;
|
|
@@ -697,16 +697,16 @@ const suspenseInfiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createRe
|
|
|
697
697
|
suffix: "suspenseInfinite"
|
|
698
698
|
})
|
|
699
699
|
};
|
|
700
|
-
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([
|
|
700
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([_kubb_plugin_client.pluginClientName]) && options.client.clientType !== "class";
|
|
701
701
|
const client = {
|
|
702
702
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
703
703
|
type: "function",
|
|
704
|
-
pluginKey: [
|
|
704
|
+
pluginKey: [_kubb_plugin_client.pluginClientName]
|
|
705
705
|
}) : getName(operation, {
|
|
706
706
|
type: "function",
|
|
707
707
|
suffix: "suspenseInfinite"
|
|
708
708
|
}),
|
|
709
|
-
file: getFile(operation, { pluginKey: [
|
|
709
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_client.pluginClientName] })
|
|
710
710
|
};
|
|
711
711
|
const queryOptions = { name: getName(operation, {
|
|
712
712
|
type: "function",
|
|
@@ -723,84 +723,84 @@ const suspenseInfiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createRe
|
|
|
723
723
|
})
|
|
724
724
|
};
|
|
725
725
|
const type = {
|
|
726
|
-
file: getFile(operation, { pluginKey: [
|
|
726
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_ts.pluginTsName] }),
|
|
727
727
|
schemas: getSchemas(operation, {
|
|
728
|
-
pluginKey: [
|
|
728
|
+
pluginKey: [_kubb_plugin_ts.pluginTsName],
|
|
729
729
|
type: "type"
|
|
730
730
|
})
|
|
731
731
|
};
|
|
732
732
|
const zod = {
|
|
733
|
-
file: getFile(operation, { pluginKey: [
|
|
733
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_zod.pluginZodName] }),
|
|
734
734
|
schemas: getSchemas(operation, {
|
|
735
|
-
pluginKey: [
|
|
735
|
+
pluginKey: [_kubb_plugin_zod.pluginZodName],
|
|
736
736
|
type: "function"
|
|
737
737
|
})
|
|
738
738
|
};
|
|
739
739
|
if (!isQuery || isMutation || !isSuspense || !infiniteOptions) return null;
|
|
740
|
-
return /* @__PURE__ */ (0,
|
|
740
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
|
|
741
741
|
baseName: query.file.baseName,
|
|
742
742
|
path: query.file.path,
|
|
743
743
|
meta: query.file.meta,
|
|
744
|
-
banner: (0,
|
|
744
|
+
banner: (0, _kubb_plugin_oas_utils.getBanner)({
|
|
745
745
|
oas,
|
|
746
746
|
output,
|
|
747
747
|
config: pluginManager.config
|
|
748
748
|
}),
|
|
749
|
-
footer: (0,
|
|
749
|
+
footer: (0, _kubb_plugin_oas_utils.getFooter)({
|
|
750
750
|
oas,
|
|
751
751
|
output
|
|
752
752
|
}),
|
|
753
753
|
children: [
|
|
754
|
-
options.parser === "zod" && /* @__PURE__ */ (0,
|
|
754
|
+
options.parser === "zod" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
755
755
|
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
756
756
|
root: query.file.path,
|
|
757
757
|
path: zod.file.path
|
|
758
758
|
}),
|
|
759
|
-
options.client.importPath ? /* @__PURE__ */ (0,
|
|
760
|
-
/* @__PURE__ */ (0,
|
|
759
|
+
options.client.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
760
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
761
761
|
name: "fetch",
|
|
762
762
|
path: options.client.importPath
|
|
763
763
|
}),
|
|
764
|
-
/* @__PURE__ */ (0,
|
|
764
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
765
765
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
766
766
|
path: options.client.importPath,
|
|
767
767
|
isTypeOnly: true
|
|
768
768
|
}),
|
|
769
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0,
|
|
769
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
770
770
|
name: ["ResponseConfig"],
|
|
771
771
|
path: options.client.importPath,
|
|
772
772
|
isTypeOnly: true
|
|
773
773
|
})
|
|
774
|
-
] }) : /* @__PURE__ */ (0,
|
|
775
|
-
/* @__PURE__ */ (0,
|
|
774
|
+
] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
775
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
776
776
|
name: ["fetch"],
|
|
777
777
|
root: query.file.path,
|
|
778
778
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
779
779
|
}),
|
|
780
|
-
/* @__PURE__ */ (0,
|
|
780
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
781
781
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
782
782
|
root: query.file.path,
|
|
783
783
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
784
784
|
isTypeOnly: true
|
|
785
785
|
}),
|
|
786
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0,
|
|
786
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
787
787
|
name: ["ResponseConfig"],
|
|
788
788
|
root: query.file.path,
|
|
789
789
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
790
790
|
isTypeOnly: true
|
|
791
791
|
})
|
|
792
792
|
] }),
|
|
793
|
-
shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
793
|
+
shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
794
794
|
name: [client.name],
|
|
795
795
|
root: query.file.path,
|
|
796
796
|
path: client.file.path
|
|
797
797
|
}),
|
|
798
|
-
!shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
798
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
799
799
|
name: ["buildFormData"],
|
|
800
800
|
root: query.file.path,
|
|
801
801
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
802
802
|
}),
|
|
803
|
-
/* @__PURE__ */ (0,
|
|
803
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
804
804
|
name: [
|
|
805
805
|
type.schemas.request?.name,
|
|
806
806
|
type.schemas.response.name,
|
|
@@ -813,7 +813,7 @@ const suspenseInfiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createRe
|
|
|
813
813
|
path: type.file.path,
|
|
814
814
|
isTypeOnly: true
|
|
815
815
|
}),
|
|
816
|
-
/* @__PURE__ */ (0,
|
|
816
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryKey, {
|
|
817
817
|
name: queryKey.name,
|
|
818
818
|
typeName: queryKey.typeName,
|
|
819
819
|
operation,
|
|
@@ -822,7 +822,7 @@ const suspenseInfiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createRe
|
|
|
822
822
|
typeSchemas: type.schemas,
|
|
823
823
|
transformer: options.queryKey
|
|
824
824
|
}),
|
|
825
|
-
!shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
825
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_plugin_client_components.Client, {
|
|
826
826
|
name: client.name,
|
|
827
827
|
baseURL: options.client.baseURL,
|
|
828
828
|
operation,
|
|
@@ -834,17 +834,17 @@ const suspenseInfiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createRe
|
|
|
834
834
|
pathParamsType: options.pathParamsType,
|
|
835
835
|
parser: options.parser
|
|
836
836
|
}),
|
|
837
|
-
infiniteOptions && /* @__PURE__ */ (0,
|
|
838
|
-
/* @__PURE__ */ (0,
|
|
837
|
+
infiniteOptions && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
838
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
839
839
|
name: ["InfiniteData"],
|
|
840
840
|
isTypeOnly: true,
|
|
841
841
|
path: importPath
|
|
842
842
|
}),
|
|
843
|
-
/* @__PURE__ */ (0,
|
|
843
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
844
844
|
name: ["infiniteQueryOptions"],
|
|
845
845
|
path: importPath
|
|
846
846
|
}),
|
|
847
|
-
/* @__PURE__ */ (0,
|
|
847
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.SuspenseInfiniteQueryOptions, {
|
|
848
848
|
name: queryOptions.name,
|
|
849
849
|
clientName: client.name,
|
|
850
850
|
queryKeyName: queryKey.name,
|
|
@@ -860,12 +860,12 @@ const suspenseInfiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createRe
|
|
|
860
860
|
queryParam: infiniteOptions.queryParam
|
|
861
861
|
})
|
|
862
862
|
] }),
|
|
863
|
-
infiniteOptions && /* @__PURE__ */ (0,
|
|
864
|
-
/* @__PURE__ */ (0,
|
|
863
|
+
infiniteOptions && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
864
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
865
865
|
name: ["useSuspenseInfiniteQuery"],
|
|
866
866
|
path: importPath
|
|
867
867
|
}),
|
|
868
|
-
/* @__PURE__ */ (0,
|
|
868
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
869
869
|
name: [
|
|
870
870
|
"QueryKey",
|
|
871
871
|
"QueryClient",
|
|
@@ -875,7 +875,7 @@ const suspenseInfiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createRe
|
|
|
875
875
|
path: importPath,
|
|
876
876
|
isTypeOnly: true
|
|
877
877
|
}),
|
|
878
|
-
/* @__PURE__ */ (0,
|
|
878
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.SuspenseInfiniteQuery, {
|
|
879
879
|
name: query.name,
|
|
880
880
|
queryOptionsName: queryOptions.name,
|
|
881
881
|
typeSchemas: type.schemas,
|
|
@@ -897,13 +897,13 @@ const suspenseInfiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createRe
|
|
|
897
897
|
|
|
898
898
|
//#endregion
|
|
899
899
|
//#region src/generators/suspenseQueryGenerator.tsx
|
|
900
|
-
const suspenseQueryGenerator = (0,
|
|
900
|
+
const suspenseQueryGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
|
|
901
901
|
name: "react-suspense-query",
|
|
902
902
|
Operation({ config, operation, generator, plugin }) {
|
|
903
903
|
const { options, options: { output } } = plugin;
|
|
904
|
-
const pluginManager = (0,
|
|
905
|
-
const oas = (0,
|
|
906
|
-
const { getSchemas, getName, getFile } = (0,
|
|
904
|
+
const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
|
|
905
|
+
const oas = (0, _kubb_plugin_oas_hooks.useOas)();
|
|
906
|
+
const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
907
907
|
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
908
908
|
const isMutation = (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
909
909
|
const isSuspense = !!options.suspense;
|
|
@@ -920,16 +920,16 @@ const suspenseQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
920
920
|
suffix: "suspense"
|
|
921
921
|
})
|
|
922
922
|
};
|
|
923
|
-
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([
|
|
923
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([_kubb_plugin_client.pluginClientName]) && options.client.clientType !== "class";
|
|
924
924
|
const client = {
|
|
925
925
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
926
926
|
type: "function",
|
|
927
|
-
pluginKey: [
|
|
927
|
+
pluginKey: [_kubb_plugin_client.pluginClientName]
|
|
928
928
|
}) : getName(operation, {
|
|
929
929
|
type: "function",
|
|
930
930
|
suffix: "suspense"
|
|
931
931
|
}),
|
|
932
|
-
file: getFile(operation, { pluginKey: [
|
|
932
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_client.pluginClientName] })
|
|
933
933
|
};
|
|
934
934
|
const queryOptions = { name: getName(operation, {
|
|
935
935
|
type: "function",
|
|
@@ -946,84 +946,84 @@ const suspenseQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
946
946
|
})
|
|
947
947
|
};
|
|
948
948
|
const type = {
|
|
949
|
-
file: getFile(operation, { pluginKey: [
|
|
949
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_ts.pluginTsName] }),
|
|
950
950
|
schemas: getSchemas(operation, {
|
|
951
|
-
pluginKey: [
|
|
951
|
+
pluginKey: [_kubb_plugin_ts.pluginTsName],
|
|
952
952
|
type: "type"
|
|
953
953
|
})
|
|
954
954
|
};
|
|
955
955
|
const zod = {
|
|
956
|
-
file: getFile(operation, { pluginKey: [
|
|
956
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_zod.pluginZodName] }),
|
|
957
957
|
schemas: getSchemas(operation, {
|
|
958
|
-
pluginKey: [
|
|
958
|
+
pluginKey: [_kubb_plugin_zod.pluginZodName],
|
|
959
959
|
type: "function"
|
|
960
960
|
})
|
|
961
961
|
};
|
|
962
962
|
if (!isQuery || isMutation || !isSuspense) return null;
|
|
963
|
-
return /* @__PURE__ */ (0,
|
|
963
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
|
|
964
964
|
baseName: query.file.baseName,
|
|
965
965
|
path: query.file.path,
|
|
966
966
|
meta: query.file.meta,
|
|
967
|
-
banner: (0,
|
|
967
|
+
banner: (0, _kubb_plugin_oas_utils.getBanner)({
|
|
968
968
|
oas,
|
|
969
969
|
output,
|
|
970
970
|
config: pluginManager.config
|
|
971
971
|
}),
|
|
972
|
-
footer: (0,
|
|
972
|
+
footer: (0, _kubb_plugin_oas_utils.getFooter)({
|
|
973
973
|
oas,
|
|
974
974
|
output
|
|
975
975
|
}),
|
|
976
976
|
children: [
|
|
977
|
-
options.parser === "zod" && /* @__PURE__ */ (0,
|
|
977
|
+
options.parser === "zod" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
978
978
|
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
979
979
|
root: query.file.path,
|
|
980
980
|
path: zod.file.path
|
|
981
981
|
}),
|
|
982
|
-
options.client.importPath ? /* @__PURE__ */ (0,
|
|
983
|
-
/* @__PURE__ */ (0,
|
|
982
|
+
options.client.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
983
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
984
984
|
name: "fetch",
|
|
985
985
|
path: options.client.importPath
|
|
986
986
|
}),
|
|
987
|
-
/* @__PURE__ */ (0,
|
|
987
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
988
988
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
989
989
|
path: options.client.importPath,
|
|
990
990
|
isTypeOnly: true
|
|
991
991
|
}),
|
|
992
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0,
|
|
992
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
993
993
|
name: ["ResponseConfig"],
|
|
994
994
|
path: options.client.importPath,
|
|
995
995
|
isTypeOnly: true
|
|
996
996
|
})
|
|
997
|
-
] }) : /* @__PURE__ */ (0,
|
|
998
|
-
/* @__PURE__ */ (0,
|
|
997
|
+
] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
998
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
999
999
|
name: ["fetch"],
|
|
1000
1000
|
root: query.file.path,
|
|
1001
1001
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
1002
1002
|
}),
|
|
1003
|
-
/* @__PURE__ */ (0,
|
|
1003
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
1004
1004
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
1005
1005
|
root: query.file.path,
|
|
1006
1006
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
1007
1007
|
isTypeOnly: true
|
|
1008
1008
|
}),
|
|
1009
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ (0,
|
|
1009
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
1010
1010
|
name: ["ResponseConfig"],
|
|
1011
1011
|
root: query.file.path,
|
|
1012
1012
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
1013
1013
|
isTypeOnly: true
|
|
1014
1014
|
})
|
|
1015
1015
|
] }),
|
|
1016
|
-
shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
1016
|
+
shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
1017
1017
|
name: [client.name],
|
|
1018
1018
|
root: query.file.path,
|
|
1019
1019
|
path: client.file.path
|
|
1020
1020
|
}),
|
|
1021
|
-
!shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
1021
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
1022
1022
|
name: ["buildFormData"],
|
|
1023
1023
|
root: query.file.path,
|
|
1024
1024
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
1025
1025
|
}),
|
|
1026
|
-
/* @__PURE__ */ (0,
|
|
1026
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
1027
1027
|
name: [
|
|
1028
1028
|
type.schemas.request?.name,
|
|
1029
1029
|
type.schemas.response.name,
|
|
@@ -1036,7 +1036,7 @@ const suspenseQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
1036
1036
|
path: type.file.path,
|
|
1037
1037
|
isTypeOnly: true
|
|
1038
1038
|
}),
|
|
1039
|
-
/* @__PURE__ */ (0,
|
|
1039
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryKey, {
|
|
1040
1040
|
name: queryKey.name,
|
|
1041
1041
|
typeName: queryKey.typeName,
|
|
1042
1042
|
operation,
|
|
@@ -1045,7 +1045,7 @@ const suspenseQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
1045
1045
|
typeSchemas: type.schemas,
|
|
1046
1046
|
transformer: options.queryKey
|
|
1047
1047
|
}),
|
|
1048
|
-
!shouldUseClientPlugin && /* @__PURE__ */ (0,
|
|
1048
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_plugin_client_components.Client, {
|
|
1049
1049
|
name: client.name,
|
|
1050
1050
|
baseURL: options.client.baseURL,
|
|
1051
1051
|
operation,
|
|
@@ -1057,11 +1057,11 @@ const suspenseQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
1057
1057
|
pathParamsType: options.pathParamsType,
|
|
1058
1058
|
parser: options.parser
|
|
1059
1059
|
}),
|
|
1060
|
-
/* @__PURE__ */ (0,
|
|
1060
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
1061
1061
|
name: ["queryOptions"],
|
|
1062
1062
|
path: importPath
|
|
1063
1063
|
}),
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1064
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryOptions, {
|
|
1065
1065
|
name: queryOptions.name,
|
|
1066
1066
|
clientName: client.name,
|
|
1067
1067
|
queryKeyName: queryKey.name,
|
|
@@ -1071,12 +1071,12 @@ const suspenseQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
1071
1071
|
pathParamsType: options.pathParamsType,
|
|
1072
1072
|
dataReturnType: options.client.dataReturnType
|
|
1073
1073
|
}),
|
|
1074
|
-
options.suspense && /* @__PURE__ */ (0,
|
|
1075
|
-
/* @__PURE__ */ (0,
|
|
1074
|
+
options.suspense && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
1075
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
1076
1076
|
name: ["useSuspenseQuery"],
|
|
1077
1077
|
path: importPath
|
|
1078
1078
|
}),
|
|
1079
|
-
/* @__PURE__ */ (0,
|
|
1079
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
1080
1080
|
name: [
|
|
1081
1081
|
"QueryKey",
|
|
1082
1082
|
"QueryClient",
|
|
@@ -1086,7 +1086,7 @@ const suspenseQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
1086
1086
|
path: importPath,
|
|
1087
1087
|
isTypeOnly: true
|
|
1088
1088
|
}),
|
|
1089
|
-
/* @__PURE__ */ (0,
|
|
1089
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.SuspenseQuery, {
|
|
1090
1090
|
name: query.name,
|
|
1091
1091
|
queryOptionsName: queryOptions.name,
|
|
1092
1092
|
typeSchemas: type.schemas,
|
|
@@ -1141,4 +1141,4 @@ Object.defineProperty(exports, 'suspenseQueryGenerator', {
|
|
|
1141
1141
|
return suspenseQueryGenerator;
|
|
1142
1142
|
}
|
|
1143
1143
|
});
|
|
1144
|
-
//# sourceMappingURL=generators-
|
|
1144
|
+
//# sourceMappingURL=generators-BNtUetHy.cjs.map
|