@kubb/plugin-svelte-query 3.16.1 → 3.16.3
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-B3IxfIQc.js +487 -0
- package/dist/components-B3IxfIQc.js.map +1 -0
- package/dist/components-Bl5LenX1.cjs +545 -0
- package/dist/components-Bl5LenX1.cjs.map +1 -0
- package/dist/components.cjs +6 -27
- package/dist/components.d.cts +191 -85
- package/dist/components.d.ts +191 -85
- package/dist/components.js +3 -3
- package/dist/generators-B0aaCM9R.cjs +355 -0
- package/dist/generators-B0aaCM9R.cjs.map +1 -0
- package/dist/generators-CNk_QjGS.js +344 -0
- package/dist/generators-CNk_QjGS.js.map +1 -0
- package/dist/generators.cjs +4 -16
- package/dist/generators.d.cts +8 -9
- package/dist/generators.d.ts +8 -9
- package/dist/generators.js +4 -4
- package/dist/index.cjs +108 -136
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -8
- package/dist/index.d.ts +6 -8
- package/dist/index.js +108 -130
- package/dist/index.js.map +1 -1
- package/dist/types-BmYdmD4y.d.ts +1361 -0
- package/dist/types-DGLdNNAs.d.cts +1361 -0
- package/package.json +25 -30
- package/dist/chunk-IRUWABQ4.js +0 -398
- package/dist/chunk-IRUWABQ4.js.map +0 -1
- package/dist/chunk-NPZ54AT7.cjs +0 -289
- package/dist/chunk-NPZ54AT7.cjs.map +0 -1
- package/dist/chunk-OJL7OC3Y.cjs +0 -404
- package/dist/chunk-OJL7OC3Y.cjs.map +0 -1
- package/dist/chunk-Y534JBKZ.js +0 -286
- package/dist/chunk-Y534JBKZ.js.map +0 -1
- package/dist/components.cjs.map +0 -1
- package/dist/components.js.map +0 -1
- package/dist/generators.cjs.map +0 -1
- package/dist/generators.js.map +0 -1
- package/dist/types-BIWbWacf.d.cts +0 -140
- package/dist/types-BIWbWacf.d.ts +0 -140
package/dist/chunk-NPZ54AT7.cjs
DELETED
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkOJL7OC3Y_cjs = require('./chunk-OJL7OC3Y.cjs');
|
|
4
|
-
var pluginClient = require('@kubb/plugin-client');
|
|
5
|
-
var components = require('@kubb/plugin-client/components');
|
|
6
|
-
var pluginOas = require('@kubb/plugin-oas');
|
|
7
|
-
var hooks = require('@kubb/plugin-oas/hooks');
|
|
8
|
-
var utils = require('@kubb/plugin-oas/utils');
|
|
9
|
-
var pluginTs = require('@kubb/plugin-ts');
|
|
10
|
-
var pluginZod = require('@kubb/plugin-zod');
|
|
11
|
-
var react = require('@kubb/react');
|
|
12
|
-
var remeda = require('remeda');
|
|
13
|
-
var jsxRuntime = require('@kubb/react/jsx-runtime');
|
|
14
|
-
|
|
15
|
-
var queryGenerator = pluginOas.createReactGenerator({
|
|
16
|
-
name: "svelte-query",
|
|
17
|
-
Operation({ options, operation }) {
|
|
18
|
-
const {
|
|
19
|
-
plugin: {
|
|
20
|
-
options: { output }
|
|
21
|
-
},
|
|
22
|
-
pluginManager
|
|
23
|
-
} = react.useApp();
|
|
24
|
-
const oas = hooks.useOas();
|
|
25
|
-
const { getSchemas, getName, getFile } = hooks.useOperationManager();
|
|
26
|
-
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
27
|
-
const isMutation = remeda.difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(
|
|
28
|
-
(method) => operation.method === method
|
|
29
|
-
);
|
|
30
|
-
const importPath = options.query ? options.query.importPath : "@tanstack/svelte-query";
|
|
31
|
-
const query = {
|
|
32
|
-
name: getName(operation, { type: "function", prefix: "create" }),
|
|
33
|
-
typeName: getName(operation, { type: "type" }),
|
|
34
|
-
file: getFile(operation, { prefix: "create" })
|
|
35
|
-
};
|
|
36
|
-
const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClient.pluginClientName]);
|
|
37
|
-
const client = {
|
|
38
|
-
name: hasClientPlugin ? getName(operation, {
|
|
39
|
-
type: "function",
|
|
40
|
-
pluginKey: [pluginClient.pluginClientName]
|
|
41
|
-
}) : getName(operation, {
|
|
42
|
-
type: "function"
|
|
43
|
-
}),
|
|
44
|
-
file: getFile(operation, { pluginKey: [pluginClient.pluginClientName] })
|
|
45
|
-
};
|
|
46
|
-
const queryOptions = {
|
|
47
|
-
name: getName(operation, { type: "function", suffix: "QueryOptions" })
|
|
48
|
-
};
|
|
49
|
-
const queryKey = {
|
|
50
|
-
name: getName(operation, { type: "const", suffix: "QueryKey" }),
|
|
51
|
-
typeName: getName(operation, { type: "type", suffix: "QueryKey" })
|
|
52
|
-
};
|
|
53
|
-
const type = {
|
|
54
|
-
file: getFile(operation, { pluginKey: [pluginTs.pluginTsName] }),
|
|
55
|
-
//todo remove type?
|
|
56
|
-
schemas: getSchemas(operation, { pluginKey: [pluginTs.pluginTsName], type: "type" })
|
|
57
|
-
};
|
|
58
|
-
const zod = {
|
|
59
|
-
file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
|
|
60
|
-
schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
|
|
61
|
-
};
|
|
62
|
-
if (!isQuery || isMutation) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
66
|
-
react.File,
|
|
67
|
-
{
|
|
68
|
-
baseName: query.file.baseName,
|
|
69
|
-
path: query.file.path,
|
|
70
|
-
meta: query.file.meta,
|
|
71
|
-
banner: utils.getBanner({ oas, output, config: pluginManager.config }),
|
|
72
|
-
footer: utils.getFooter({ oas, output }),
|
|
73
|
-
children: [
|
|
74
|
-
options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean), root: query.file.path, path: zod.file.path }),
|
|
75
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "fetch", path: options.client.importPath }),
|
|
76
|
-
!!hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [client.name], root: query.file.path, path: client.file.path }),
|
|
77
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
78
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
79
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
80
|
-
react.File.Import,
|
|
81
|
-
{
|
|
82
|
-
name: [
|
|
83
|
-
type.schemas.request?.name,
|
|
84
|
-
type.schemas.response.name,
|
|
85
|
-
type.schemas.pathParams?.name,
|
|
86
|
-
type.schemas.queryParams?.name,
|
|
87
|
-
type.schemas.headerParams?.name,
|
|
88
|
-
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
89
|
-
].filter(Boolean),
|
|
90
|
-
root: query.file.path,
|
|
91
|
-
path: type.file.path,
|
|
92
|
-
isTypeOnly: true
|
|
93
|
-
}
|
|
94
|
-
),
|
|
95
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
96
|
-
chunkOJL7OC3Y_cjs.QueryKey,
|
|
97
|
-
{
|
|
98
|
-
name: queryKey.name,
|
|
99
|
-
typeName: queryKey.typeName,
|
|
100
|
-
operation,
|
|
101
|
-
pathParamsType: options.pathParamsType,
|
|
102
|
-
typeSchemas: type.schemas,
|
|
103
|
-
paramsCasing: options.paramsCasing,
|
|
104
|
-
transformer: options.queryKey
|
|
105
|
-
}
|
|
106
|
-
),
|
|
107
|
-
!hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(
|
|
108
|
-
components.Client,
|
|
109
|
-
{
|
|
110
|
-
name: client.name,
|
|
111
|
-
baseURL: options.client.baseURL,
|
|
112
|
-
operation,
|
|
113
|
-
typeSchemas: type.schemas,
|
|
114
|
-
zodSchemas: zod.schemas,
|
|
115
|
-
dataReturnType: options.client.dataReturnType,
|
|
116
|
-
paramsCasing: options.paramsCasing,
|
|
117
|
-
paramsType: options.paramsType,
|
|
118
|
-
pathParamsType: options.pathParamsType,
|
|
119
|
-
parser: options.parser
|
|
120
|
-
}
|
|
121
|
-
),
|
|
122
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["queryOptions"], path: importPath }),
|
|
123
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
124
|
-
chunkOJL7OC3Y_cjs.QueryOptions,
|
|
125
|
-
{
|
|
126
|
-
name: queryOptions.name,
|
|
127
|
-
clientName: client.name,
|
|
128
|
-
queryKeyName: queryKey.name,
|
|
129
|
-
typeSchemas: type.schemas,
|
|
130
|
-
paramsCasing: options.paramsCasing,
|
|
131
|
-
paramsType: options.paramsType,
|
|
132
|
-
pathParamsType: options.pathParamsType,
|
|
133
|
-
dataReturnType: options.client.dataReturnType
|
|
134
|
-
}
|
|
135
|
-
),
|
|
136
|
-
options.query && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
137
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["createQuery"], path: importPath }),
|
|
138
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "QueryClient", "CreateBaseQueryOptions", "CreateQueryResult"], path: importPath, isTypeOnly: true }),
|
|
139
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
140
|
-
chunkOJL7OC3Y_cjs.Query,
|
|
141
|
-
{
|
|
142
|
-
name: query.name,
|
|
143
|
-
queryOptionsName: queryOptions.name,
|
|
144
|
-
typeSchemas: type.schemas,
|
|
145
|
-
pathParamsType: options.pathParamsType,
|
|
146
|
-
operation,
|
|
147
|
-
paramsCasing: options.paramsCasing,
|
|
148
|
-
paramsType: options.paramsType,
|
|
149
|
-
dataReturnType: options.client.dataReturnType,
|
|
150
|
-
queryKeyName: queryKey.name,
|
|
151
|
-
queryKeyTypeName: queryKey.typeName
|
|
152
|
-
}
|
|
153
|
-
)
|
|
154
|
-
] })
|
|
155
|
-
]
|
|
156
|
-
}
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
var mutationGenerator = pluginOas.createReactGenerator({
|
|
161
|
-
name: "svelte-query",
|
|
162
|
-
Operation({ options, operation }) {
|
|
163
|
-
const {
|
|
164
|
-
plugin: {
|
|
165
|
-
options: { output }
|
|
166
|
-
},
|
|
167
|
-
pluginManager
|
|
168
|
-
} = react.useApp();
|
|
169
|
-
const oas = hooks.useOas();
|
|
170
|
-
const { getSchemas, getName, getFile } = hooks.useOperationManager();
|
|
171
|
-
const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method);
|
|
172
|
-
const isMutation = !isQuery && remeda.difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
173
|
-
const importPath = options.mutation ? options.mutation.importPath : "@tanstack/svelte-query";
|
|
174
|
-
const mutation = {
|
|
175
|
-
name: getName(operation, { type: "function", prefix: "create" }),
|
|
176
|
-
typeName: getName(operation, { type: "type" }),
|
|
177
|
-
file: getFile(operation, { prefix: "create" })
|
|
178
|
-
};
|
|
179
|
-
const type = {
|
|
180
|
-
file: getFile(operation, { pluginKey: [pluginTs.pluginTsName] }),
|
|
181
|
-
//todo remove type?
|
|
182
|
-
schemas: getSchemas(operation, { pluginKey: [pluginTs.pluginTsName], type: "type" })
|
|
183
|
-
};
|
|
184
|
-
const zod = {
|
|
185
|
-
file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
|
|
186
|
-
schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
|
|
187
|
-
};
|
|
188
|
-
const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClient.pluginClientName]);
|
|
189
|
-
const client = {
|
|
190
|
-
name: hasClientPlugin ? getName(operation, {
|
|
191
|
-
type: "function",
|
|
192
|
-
pluginKey: [pluginClient.pluginClientName]
|
|
193
|
-
}) : getName(operation, {
|
|
194
|
-
type: "function"
|
|
195
|
-
}),
|
|
196
|
-
file: getFile(operation, { pluginKey: [pluginClient.pluginClientName] })
|
|
197
|
-
};
|
|
198
|
-
const mutationKey = {
|
|
199
|
-
name: getName(operation, { type: "const", suffix: "MutationKey" }),
|
|
200
|
-
typeName: getName(operation, { type: "type", suffix: "MutationKey" })
|
|
201
|
-
};
|
|
202
|
-
if (!isMutation) {
|
|
203
|
-
return null;
|
|
204
|
-
}
|
|
205
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
206
|
-
react.File,
|
|
207
|
-
{
|
|
208
|
-
baseName: mutation.file.baseName,
|
|
209
|
-
path: mutation.file.path,
|
|
210
|
-
meta: mutation.file.meta,
|
|
211
|
-
banner: utils.getBanner({ oas, output, config: pluginManager.config }),
|
|
212
|
-
footer: utils.getFooter({ oas, output }),
|
|
213
|
-
children: [
|
|
214
|
-
options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean), root: mutation.file.path, path: zod.file.path }),
|
|
215
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "fetch", path: options.client.importPath }),
|
|
216
|
-
!!hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [client.name], root: mutation.file.path, path: client.file.path }),
|
|
217
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig", "ResponseConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
218
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
219
|
-
react.File.Import,
|
|
220
|
-
{
|
|
221
|
-
name: [
|
|
222
|
-
type.schemas.request?.name,
|
|
223
|
-
type.schemas.response.name,
|
|
224
|
-
type.schemas.pathParams?.name,
|
|
225
|
-
type.schemas.queryParams?.name,
|
|
226
|
-
type.schemas.headerParams?.name,
|
|
227
|
-
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
228
|
-
].filter(Boolean),
|
|
229
|
-
root: mutation.file.path,
|
|
230
|
-
path: type.file.path,
|
|
231
|
-
isTypeOnly: true
|
|
232
|
-
}
|
|
233
|
-
),
|
|
234
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
235
|
-
chunkOJL7OC3Y_cjs.MutationKey,
|
|
236
|
-
{
|
|
237
|
-
name: mutationKey.name,
|
|
238
|
-
typeName: mutationKey.typeName,
|
|
239
|
-
operation,
|
|
240
|
-
paramsCasing: options.paramsCasing,
|
|
241
|
-
pathParamsType: options.pathParamsType,
|
|
242
|
-
typeSchemas: type.schemas,
|
|
243
|
-
transformer: options.mutationKey
|
|
244
|
-
}
|
|
245
|
-
),
|
|
246
|
-
!hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(
|
|
247
|
-
components.Client,
|
|
248
|
-
{
|
|
249
|
-
name: client.name,
|
|
250
|
-
baseURL: options.client.baseURL,
|
|
251
|
-
operation,
|
|
252
|
-
typeSchemas: type.schemas,
|
|
253
|
-
zodSchemas: zod.schemas,
|
|
254
|
-
dataReturnType: options.client.dataReturnType,
|
|
255
|
-
paramsCasing: options.paramsCasing,
|
|
256
|
-
paramsType: options.paramsType,
|
|
257
|
-
pathParamsType: options.pathParamsType,
|
|
258
|
-
parser: options.parser
|
|
259
|
-
}
|
|
260
|
-
),
|
|
261
|
-
options.mutation && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
262
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["createMutation"], path: importPath }),
|
|
263
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["CreateMutationOptions", "CreateMutationResult", "QueryClient"], path: importPath, isTypeOnly: true }),
|
|
264
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
265
|
-
chunkOJL7OC3Y_cjs.Mutation,
|
|
266
|
-
{
|
|
267
|
-
name: mutation.name,
|
|
268
|
-
clientName: client.name,
|
|
269
|
-
typeName: mutation.typeName,
|
|
270
|
-
typeSchemas: type.schemas,
|
|
271
|
-
operation,
|
|
272
|
-
paramsCasing: options.paramsCasing,
|
|
273
|
-
dataReturnType: options.client.dataReturnType,
|
|
274
|
-
paramsType: options.paramsType,
|
|
275
|
-
pathParamsType: options.pathParamsType,
|
|
276
|
-
mutationKeyName: mutationKey.name
|
|
277
|
-
}
|
|
278
|
-
)
|
|
279
|
-
] })
|
|
280
|
-
]
|
|
281
|
-
}
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
exports.mutationGenerator = mutationGenerator;
|
|
287
|
-
exports.queryGenerator = queryGenerator;
|
|
288
|
-
//# sourceMappingURL=chunk-NPZ54AT7.cjs.map
|
|
289
|
-
//# sourceMappingURL=chunk-NPZ54AT7.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generators/queryGenerator.tsx","../src/generators/mutationGenerator.tsx"],"names":["createReactGenerator","useApp","useOas","useOperationManager","difference","pluginClientName","pluginTsName","pluginZodName","jsxs","File","getBanner","getFooter","jsx","QueryKey","Client","QueryOptions","Fragment","Query","MutationKey","Mutation"],"mappings":";;;;;;;;;;;;;;AAYO,IAAM,iBAAiBA,8BAAwC,CAAA;AAAA,EACpE,IAAM,EAAA,cAAA;AAAA,EACN,SAAU,CAAA,EAAE,OAAS,EAAA,SAAA,EAAa,EAAA;AAChC,IAAM,MAAA;AAAA,MACJ,MAAQ,EAAA;AAAA,QACN,OAAA,EAAS,EAAE,MAAO;AAAA,OACpB;AAAA,MACA;AAAA,QACEC,YAA0B,EAAA;AAC9B,IAAA,MAAM,MAAMC,YAAO,EAAA;AACnB,IAAA,MAAM,EAAE,UAAA,EAAY,OAAS,EAAA,OAAA,KAAYC,yBAAoB,EAAA;AAE7D,IAAA,MAAM,OAAU,GAAA,OAAO,OAAQ,CAAA,KAAA,KAAU,YAAY,IAAO,GAAA,OAAA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AA,cAAA;AAAA,cAC/B,cAAc,OAAQ,CAAA,YAAA;AAAA,cACtB,YAAY,OAAQ,CAAA,UAAA;AAAA,cACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,cACxB,QAAQ,OAAQ,CAAA;AAAA;AAAA,WAClB;AAAA,UAED,OAAQ,CAAA,QAAA,oBACPN,eAAAA,CAAAQ,qBAAA,EACE,QAAA,EAAA;AAAA,4BAAAJ,cAAAA,CAACH,WAAK,MAAL,EAAA,EAAY,MAAM,CAAC,gBAAgB,CAAG,EAAA,IAAA,EAAM,UAAY,EAAA,CAAA;AAAA,4BACzDG,cAAAA,CAACH,UAAK,CAAA,MAAA,EAAL,EAAY,IAAM,EAAA,CAAC,uBAAyB,EAAA,sBAAA,EAAwB,aAAa,CAAA,EAAG,IAAM,EAAA,UAAA,EAAY,YAAU,IAAC,EAAA,CAAA;AAAA,4BAClHG,cAAAA;AAAA,cAACO,0BAAA;AAAA,cAAA;AAAA,gBACC,MAAM,QAAS,CAAA,IAAA;AAAA,gBACf,YAAY,MAAO,CAAA,IAAA;AAAA,gBACnB,UAAU,QAAS,CAAA,QAAA;AAAA,gBACnB,aAAa,IAAK,CAAA,OAAA;AAAA,gBAClB,SAAA;AAAA,gBACA,cAAc,OAAQ,CAAA,YAAA;AAAA,gBACtB,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,gBAC/B,YAAY,OAAQ,CAAA,UAAA;AAAA,gBACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,gBACxB,iBAAiB,WAAY,CAAA;AAAA;AAAA;AAC/B,WACF,EAAA;AAAA;AAAA;AAAA,KAEJ;AAAA;AAGN,CAAC","file":"chunk-NPZ54AT7.cjs","sourcesContent":["import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n pluginManager,\n } = useApp<PluginSvelteQuery>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const importPath = options.query ? options.query.importPath : '@tanstack/svelte-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n const client = {\n name: hasClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginKey: [pluginClientName],\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginKey: [pluginClientName] }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File\n baseName={query.file.baseName}\n path={query.file.path}\n meta={query.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={query.file.path} path={zod.file.path} />\n )}\n <File.Import name={'fetch'} path={options.client.importPath} />\n {!!hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.queryKey}\n />\n\n {!hasClientPlugin && (\n <Client\n name={client.name}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n <File.Import name={['queryOptions']} path={importPath} />\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n queryKeyName={queryKey.name}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType}\n />\n {options.query && (\n <>\n <File.Import name={['createQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'CreateBaseQueryOptions', 'CreateQueryResult']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n pathParamsType={options.pathParamsType}\n operation={operation}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n pluginManager,\n } = useApp<PluginSvelteQuery>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : '@tanstack/svelte-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n const client = {\n name: hasClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginKey: [pluginClientName],\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginKey: [pluginClientName] }),\n }\n\n const mutationKey = {\n name: getName(operation, { type: 'const', suffix: 'MutationKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),\n }\n\n if (!isMutation) {\n return null\n }\n\n return (\n <File\n baseName={mutation.file.baseName}\n path={mutation.file.path}\n meta={mutation.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={mutation.file.path} path={zod.file.path} />\n )}\n <File.Import name={'fetch'} path={options.client.importPath} />\n {!!hasClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}\n <File.Import name={['RequestConfig', 'ResponseConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.mutationKey}\n />\n {!hasClientPlugin && (\n <Client\n name={client.name}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.mutation && (\n <>\n <File.Import name={['createMutation']} path={importPath} />\n <File.Import name={['CreateMutationOptions', 'CreateMutationResult', 'QueryClient']} path={importPath} isTypeOnly />\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n paramsCasing={options.paramsCasing}\n dataReturnType={options.client.dataReturnType}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n />\n </>\n )}\n </File>\n )\n },\n})\n"]}
|