@kubb/plugin-svelte-query 3.4.5 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-7GM4ILPD.cjs +273 -0
- package/dist/chunk-7GM4ILPD.cjs.map +1 -0
- package/dist/chunk-AKSVF5YB.js +270 -0
- package/dist/chunk-AKSVF5YB.js.map +1 -0
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/generators.cjs +3 -3
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{types-CdgT4Eeh.d.cts → types-C3C1lWLx.d.cts} +7 -7
- package/dist/{types-CdgT4Eeh.d.ts → types-C3C1lWLx.d.ts} +7 -7
- package/package.json +11 -11
- package/src/generators/mutationGenerator.tsx +10 -2
- package/src/generators/queryGenerator.tsx +10 -2
- package/src/types.ts +3 -3
- package/dist/chunk-KACKUZF2.js +0 -247
- package/dist/chunk-KACKUZF2.js.map +0 -1
- package/dist/chunk-L344MSSI.cjs +0 -250
- package/dist/chunk-L344MSSI.cjs.map +0 -1
package/dist/chunk-L344MSSI.cjs
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk5E5RFWUM_cjs = require('./chunk-5E5RFWUM.cjs');
|
|
4
|
-
var pluginOas = require('@kubb/plugin-oas');
|
|
5
|
-
var hooks = require('@kubb/plugin-oas/hooks');
|
|
6
|
-
var pluginTs = require('@kubb/plugin-ts');
|
|
7
|
-
var pluginZod = require('@kubb/plugin-zod');
|
|
8
|
-
var react = require('@kubb/react');
|
|
9
|
-
var remeda = require('remeda');
|
|
10
|
-
var jsxRuntime = require('@kubb/react/jsx-runtime');
|
|
11
|
-
|
|
12
|
-
var queryGenerator = pluginOas.createReactGenerator({
|
|
13
|
-
name: "svelte-query",
|
|
14
|
-
Operation({ options, operation }) {
|
|
15
|
-
const {
|
|
16
|
-
plugin: {
|
|
17
|
-
options: { output }
|
|
18
|
-
}
|
|
19
|
-
} = react.useApp();
|
|
20
|
-
const { getSchemas, getName, getFile } = hooks.useOperationManager();
|
|
21
|
-
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
22
|
-
const isMutation = remeda.difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(
|
|
23
|
-
(method) => operation.method === method
|
|
24
|
-
);
|
|
25
|
-
const importPath = options.query ? options.query.importPath : "@tanstack/svelte-query";
|
|
26
|
-
const query = {
|
|
27
|
-
name: getName(operation, { type: "function", prefix: "create" }),
|
|
28
|
-
typeName: getName(operation, { type: "type" }),
|
|
29
|
-
file: getFile(operation, { prefix: "create" })
|
|
30
|
-
};
|
|
31
|
-
const client = {
|
|
32
|
-
name: getName(operation, { type: "function" })
|
|
33
|
-
};
|
|
34
|
-
const queryOptions = {
|
|
35
|
-
name: getName(operation, { type: "function", suffix: "QueryOptions" })
|
|
36
|
-
};
|
|
37
|
-
const queryKey = {
|
|
38
|
-
name: getName(operation, { type: "const", suffix: "QueryKey" }),
|
|
39
|
-
typeName: getName(operation, { type: "type", suffix: "QueryKey" })
|
|
40
|
-
};
|
|
41
|
-
const type = {
|
|
42
|
-
file: getFile(operation, { pluginKey: [pluginTs.pluginTsName] }),
|
|
43
|
-
//todo remove type?
|
|
44
|
-
schemas: getSchemas(operation, { pluginKey: [pluginTs.pluginTsName], type: "type" })
|
|
45
|
-
};
|
|
46
|
-
const zod = {
|
|
47
|
-
file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
|
|
48
|
-
schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
|
|
49
|
-
};
|
|
50
|
-
if (!isQuery || isMutation) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: query.file.baseName, path: query.file.path, meta: query.file.meta, banner: output?.banner, footer: output?.footer, children: [
|
|
54
|
-
options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
|
|
55
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
|
|
56
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
57
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
58
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
59
|
-
react.File.Import,
|
|
60
|
-
{
|
|
61
|
-
name: [
|
|
62
|
-
type.schemas.request?.name,
|
|
63
|
-
type.schemas.response.name,
|
|
64
|
-
type.schemas.pathParams?.name,
|
|
65
|
-
type.schemas.queryParams?.name,
|
|
66
|
-
type.schemas.headerParams?.name,
|
|
67
|
-
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
68
|
-
].filter(Boolean),
|
|
69
|
-
root: query.file.path,
|
|
70
|
-
path: type.file.path,
|
|
71
|
-
isTypeOnly: true
|
|
72
|
-
}
|
|
73
|
-
),
|
|
74
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
75
|
-
chunk5E5RFWUM_cjs.QueryKey,
|
|
76
|
-
{
|
|
77
|
-
name: queryKey.name,
|
|
78
|
-
typeName: queryKey.typeName,
|
|
79
|
-
operation,
|
|
80
|
-
pathParamsType: options.pathParamsType,
|
|
81
|
-
typeSchemas: type.schemas,
|
|
82
|
-
paramsCasing: options.paramsCasing,
|
|
83
|
-
transformer: options.queryKey
|
|
84
|
-
}
|
|
85
|
-
),
|
|
86
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
87
|
-
chunk5E5RFWUM_cjs.Client,
|
|
88
|
-
{
|
|
89
|
-
name: client.name,
|
|
90
|
-
isExportable: false,
|
|
91
|
-
isIndexable: false,
|
|
92
|
-
baseURL: options.client.baseURL,
|
|
93
|
-
operation,
|
|
94
|
-
typeSchemas: type.schemas,
|
|
95
|
-
zodSchemas: zod.schemas,
|
|
96
|
-
dataReturnType: options.client.dataReturnType,
|
|
97
|
-
paramsCasing: options.paramsCasing,
|
|
98
|
-
paramsType: options.paramsType,
|
|
99
|
-
pathParamsType: options.pathParamsType,
|
|
100
|
-
parser: options.parser
|
|
101
|
-
}
|
|
102
|
-
),
|
|
103
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["queryOptions"], path: importPath }),
|
|
104
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
105
|
-
chunk5E5RFWUM_cjs.QueryOptions,
|
|
106
|
-
{
|
|
107
|
-
name: queryOptions.name,
|
|
108
|
-
clientName: client.name,
|
|
109
|
-
queryKeyName: queryKey.name,
|
|
110
|
-
typeSchemas: type.schemas,
|
|
111
|
-
paramsCasing: options.paramsCasing,
|
|
112
|
-
paramsType: options.paramsType,
|
|
113
|
-
pathParamsType: options.pathParamsType,
|
|
114
|
-
dataReturnType: options.client.dataReturnType
|
|
115
|
-
}
|
|
116
|
-
),
|
|
117
|
-
options.query && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
118
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["createQuery"], path: importPath }),
|
|
119
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "CreateBaseQueryOptions", "CreateQueryResult"], path: importPath, isTypeOnly: true }),
|
|
120
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
121
|
-
chunk5E5RFWUM_cjs.Query,
|
|
122
|
-
{
|
|
123
|
-
name: query.name,
|
|
124
|
-
queryOptionsName: queryOptions.name,
|
|
125
|
-
typeSchemas: type.schemas,
|
|
126
|
-
pathParamsType: options.pathParamsType,
|
|
127
|
-
operation,
|
|
128
|
-
paramsCasing: options.paramsCasing,
|
|
129
|
-
paramsType: options.paramsType,
|
|
130
|
-
dataReturnType: options.client.dataReturnType,
|
|
131
|
-
queryKeyName: queryKey.name,
|
|
132
|
-
queryKeyTypeName: queryKey.typeName
|
|
133
|
-
}
|
|
134
|
-
)
|
|
135
|
-
] })
|
|
136
|
-
] });
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
var mutationGenerator = pluginOas.createReactGenerator({
|
|
140
|
-
name: "svelte-query",
|
|
141
|
-
Operation({ options, operation }) {
|
|
142
|
-
const {
|
|
143
|
-
plugin: {
|
|
144
|
-
options: { output }
|
|
145
|
-
}
|
|
146
|
-
} = react.useApp();
|
|
147
|
-
const { getSchemas, getName, getFile } = hooks.useOperationManager();
|
|
148
|
-
const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method);
|
|
149
|
-
const isMutation = !isQuery && remeda.difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
150
|
-
const importPath = options.mutation ? options.mutation.importPath : "@tanstack/svelte-query";
|
|
151
|
-
const mutation = {
|
|
152
|
-
name: getName(operation, { type: "function", prefix: "create" }),
|
|
153
|
-
typeName: getName(operation, { type: "type" }),
|
|
154
|
-
file: getFile(operation, { prefix: "create" })
|
|
155
|
-
};
|
|
156
|
-
const type = {
|
|
157
|
-
file: getFile(operation, { pluginKey: [pluginTs.pluginTsName] }),
|
|
158
|
-
//todo remove type?
|
|
159
|
-
schemas: getSchemas(operation, { pluginKey: [pluginTs.pluginTsName], type: "type" })
|
|
160
|
-
};
|
|
161
|
-
const zod = {
|
|
162
|
-
file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
|
|
163
|
-
schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
|
|
164
|
-
};
|
|
165
|
-
const client = {
|
|
166
|
-
name: getName(operation, { type: "function" })
|
|
167
|
-
};
|
|
168
|
-
const mutationKey = {
|
|
169
|
-
name: getName(operation, { type: "const", suffix: "MutationKey" }),
|
|
170
|
-
typeName: getName(operation, { type: "type", suffix: "MutationKey" })
|
|
171
|
-
};
|
|
172
|
-
if (!isMutation) {
|
|
173
|
-
return null;
|
|
174
|
-
}
|
|
175
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: mutation.file.baseName, path: mutation.file.path, meta: mutation.file.meta, banner: output?.banner, footer: output?.footer, children: [
|
|
176
|
-
options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: mutation.file.path, path: zod.file.path }),
|
|
177
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
|
|
178
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig", "ResponseConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
179
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
180
|
-
react.File.Import,
|
|
181
|
-
{
|
|
182
|
-
name: [
|
|
183
|
-
type.schemas.request?.name,
|
|
184
|
-
type.schemas.response.name,
|
|
185
|
-
type.schemas.pathParams?.name,
|
|
186
|
-
type.schemas.queryParams?.name,
|
|
187
|
-
type.schemas.headerParams?.name,
|
|
188
|
-
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
189
|
-
].filter(Boolean),
|
|
190
|
-
root: mutation.file.path,
|
|
191
|
-
path: type.file.path,
|
|
192
|
-
isTypeOnly: true
|
|
193
|
-
}
|
|
194
|
-
),
|
|
195
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
196
|
-
chunk5E5RFWUM_cjs.MutationKey,
|
|
197
|
-
{
|
|
198
|
-
name: mutationKey.name,
|
|
199
|
-
typeName: mutationKey.typeName,
|
|
200
|
-
operation,
|
|
201
|
-
paramsCasing: options.paramsCasing,
|
|
202
|
-
pathParamsType: options.pathParamsType,
|
|
203
|
-
typeSchemas: type.schemas,
|
|
204
|
-
transformer: options.mutationKey
|
|
205
|
-
}
|
|
206
|
-
),
|
|
207
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
208
|
-
chunk5E5RFWUM_cjs.Client,
|
|
209
|
-
{
|
|
210
|
-
name: client.name,
|
|
211
|
-
isExportable: false,
|
|
212
|
-
isIndexable: false,
|
|
213
|
-
baseURL: options.client.baseURL,
|
|
214
|
-
operation,
|
|
215
|
-
typeSchemas: type.schemas,
|
|
216
|
-
zodSchemas: zod.schemas,
|
|
217
|
-
dataReturnType: options.client.dataReturnType,
|
|
218
|
-
paramsCasing: options.paramsCasing,
|
|
219
|
-
paramsType: options.paramsType,
|
|
220
|
-
pathParamsType: options.pathParamsType,
|
|
221
|
-
parser: options.parser
|
|
222
|
-
}
|
|
223
|
-
),
|
|
224
|
-
options.mutation && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
225
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["createMutation"], path: importPath }),
|
|
226
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["CreateMutationOptions", "CreateMutationResult"], path: importPath, isTypeOnly: true }),
|
|
227
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
228
|
-
chunk5E5RFWUM_cjs.Mutation,
|
|
229
|
-
{
|
|
230
|
-
name: mutation.name,
|
|
231
|
-
clientName: client.name,
|
|
232
|
-
typeName: mutation.typeName,
|
|
233
|
-
typeSchemas: type.schemas,
|
|
234
|
-
operation,
|
|
235
|
-
paramsCasing: options.paramsCasing,
|
|
236
|
-
dataReturnType: options.client.dataReturnType,
|
|
237
|
-
paramsType: options.paramsType,
|
|
238
|
-
pathParamsType: options.pathParamsType,
|
|
239
|
-
mutationKeyName: mutationKey.name
|
|
240
|
-
}
|
|
241
|
-
)
|
|
242
|
-
] })
|
|
243
|
-
] });
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
exports.mutationGenerator = mutationGenerator;
|
|
248
|
-
exports.queryGenerator = queryGenerator;
|
|
249
|
-
//# sourceMappingURL=chunk-L344MSSI.cjs.map
|
|
250
|
-
//# sourceMappingURL=chunk-L344MSSI.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generators/queryGenerator.tsx","../src/generators/mutationGenerator.tsx"],"names":["createReactGenerator","useApp","useOperationManager","difference","pluginTsName","pluginZodName","File","jsx","QueryKey","Client","QueryOptions","jsxs","Fragment","Query","MutationKey","Mutation"],"mappings":";;;;;;;;;;;AAUO,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;AACpB,QACEC,YAA0B,EAAA;AAC9B,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,CAAQ,KAAO,EAAA,OAAA,CAAQ,IAAK,CAAA,CAAC,MAAW,KAAA,SAAA,CAAU,WAAW,MAAM,CAAA;AAC/H,IAAA,MAAM,aAAaC,iBAAW,CAAA,OAAA,CAAQ,QAAW,GAAA,OAAA,CAAQ,SAAS,OAAU,GAAA,EAAI,EAAA,OAAA,CAAQ,QAAQ,OAAQ,CAAA,KAAA,CAAM,OAAU,GAAA,EAAE,CAAE,CAAA,IAAA;AAAA,MAC1H,CAAC,MAAW,KAAA,SAAA,CAAU,MAAW,KAAA;AAAA,KACnC;AACA,IAAA,MAAM,UAAa,GAAA,OAAA,CAAQ,KAAQ,GAAA,OA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ClB,SAAA;AAAA,YACA,cAAc,OAAQ,CAAA,YAAA;AAAA,YACtB,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,YAC/B,YAAY,OAAQ,CAAA,UAAA;AAAA,YACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,YACxB,iBAAiB,WAAY,CAAA;AAAA;AAAA;AAC/B,OACF,EAAA;AAAA,KAEJ,EAAA,CAAA;AAAA;AAGN,CAAC","file":"chunk-L344MSSI.cjs","sourcesContent":["import { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\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 } = useApp<PluginSvelteQuery>()\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 client = {\n name: getName(operation, { type: 'function' }),\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 baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}\n <File.Import name={'client'} path={options.client.importPath} />\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 <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\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 <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', '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 { useOperationManager } from '@kubb/plugin-oas/hooks'\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 } = useApp<PluginSvelteQuery>()\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 client = {\n name: getName(operation, { type: 'function' }),\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 baseName={mutation.file.baseName} path={mutation.file.path} meta={mutation.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={mutation.file.path} path={zod.file.path} />}\n\n <File.Import name={'client'} path={options.client.importPath} />\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 <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\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 {options.mutation && (\n <>\n <File.Import name={['createMutation']} path={importPath} />\n <File.Import name={['CreateMutationOptions', 'CreateMutationResult']} 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"]}
|