@kubb/plugin-svelte-query 3.16.2 → 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 +23 -28
- 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-Y534JBKZ.js
DELETED
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
import { QueryKey, QueryOptions, Query, MutationKey, Mutation } from './chunk-IRUWABQ4.js';
|
|
2
|
-
import { pluginClientName } from '@kubb/plugin-client';
|
|
3
|
-
import { Client } from '@kubb/plugin-client/components';
|
|
4
|
-
import { createReactGenerator } from '@kubb/plugin-oas';
|
|
5
|
-
import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks';
|
|
6
|
-
import { getFooter, getBanner } from '@kubb/plugin-oas/utils';
|
|
7
|
-
import { pluginTsName } from '@kubb/plugin-ts';
|
|
8
|
-
import { pluginZodName } from '@kubb/plugin-zod';
|
|
9
|
-
import { useApp, File } from '@kubb/react';
|
|
10
|
-
import { difference } from 'remeda';
|
|
11
|
-
import { jsxs, jsx, Fragment } from '@kubb/react/jsx-runtime';
|
|
12
|
-
|
|
13
|
-
var queryGenerator = createReactGenerator({
|
|
14
|
-
name: "svelte-query",
|
|
15
|
-
Operation({ options, operation }) {
|
|
16
|
-
const {
|
|
17
|
-
plugin: {
|
|
18
|
-
options: { output }
|
|
19
|
-
},
|
|
20
|
-
pluginManager
|
|
21
|
-
} = useApp();
|
|
22
|
-
const oas = useOas();
|
|
23
|
-
const { getSchemas, getName, getFile } = useOperationManager();
|
|
24
|
-
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
25
|
-
const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(
|
|
26
|
-
(method) => operation.method === method
|
|
27
|
-
);
|
|
28
|
-
const importPath = options.query ? options.query.importPath : "@tanstack/svelte-query";
|
|
29
|
-
const query = {
|
|
30
|
-
name: getName(operation, { type: "function", prefix: "create" }),
|
|
31
|
-
typeName: getName(operation, { type: "type" }),
|
|
32
|
-
file: getFile(operation, { prefix: "create" })
|
|
33
|
-
};
|
|
34
|
-
const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]);
|
|
35
|
-
const client = {
|
|
36
|
-
name: hasClientPlugin ? getName(operation, {
|
|
37
|
-
type: "function",
|
|
38
|
-
pluginKey: [pluginClientName]
|
|
39
|
-
}) : getName(operation, {
|
|
40
|
-
type: "function"
|
|
41
|
-
}),
|
|
42
|
-
file: getFile(operation, { pluginKey: [pluginClientName] })
|
|
43
|
-
};
|
|
44
|
-
const queryOptions = {
|
|
45
|
-
name: getName(operation, { type: "function", suffix: "QueryOptions" })
|
|
46
|
-
};
|
|
47
|
-
const queryKey = {
|
|
48
|
-
name: getName(operation, { type: "const", suffix: "QueryKey" }),
|
|
49
|
-
typeName: getName(operation, { type: "type", suffix: "QueryKey" })
|
|
50
|
-
};
|
|
51
|
-
const type = {
|
|
52
|
-
file: getFile(operation, { pluginKey: [pluginTsName] }),
|
|
53
|
-
//todo remove type?
|
|
54
|
-
schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: "type" })
|
|
55
|
-
};
|
|
56
|
-
const zod = {
|
|
57
|
-
file: getFile(operation, { pluginKey: [pluginZodName] }),
|
|
58
|
-
schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: "function" })
|
|
59
|
-
};
|
|
60
|
-
if (!isQuery || isMutation) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
return /* @__PURE__ */ jsxs(
|
|
64
|
-
File,
|
|
65
|
-
{
|
|
66
|
-
baseName: query.file.baseName,
|
|
67
|
-
path: query.file.path,
|
|
68
|
-
meta: query.file.meta,
|
|
69
|
-
banner: getBanner({ oas, output, config: pluginManager.config }),
|
|
70
|
-
footer: getFooter({ oas, output }),
|
|
71
|
-
children: [
|
|
72
|
-
options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, { name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean), root: query.file.path, path: zod.file.path }),
|
|
73
|
-
/* @__PURE__ */ jsx(File.Import, { name: "fetch", path: options.client.importPath }),
|
|
74
|
-
!!hasClientPlugin && /* @__PURE__ */ jsx(File.Import, { name: [client.name], root: query.file.path, path: client.file.path }),
|
|
75
|
-
/* @__PURE__ */ jsx(File.Import, { name: ["RequestConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
76
|
-
options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
77
|
-
/* @__PURE__ */ jsx(
|
|
78
|
-
File.Import,
|
|
79
|
-
{
|
|
80
|
-
name: [
|
|
81
|
-
type.schemas.request?.name,
|
|
82
|
-
type.schemas.response.name,
|
|
83
|
-
type.schemas.pathParams?.name,
|
|
84
|
-
type.schemas.queryParams?.name,
|
|
85
|
-
type.schemas.headerParams?.name,
|
|
86
|
-
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
87
|
-
].filter(Boolean),
|
|
88
|
-
root: query.file.path,
|
|
89
|
-
path: type.file.path,
|
|
90
|
-
isTypeOnly: true
|
|
91
|
-
}
|
|
92
|
-
),
|
|
93
|
-
/* @__PURE__ */ jsx(
|
|
94
|
-
QueryKey,
|
|
95
|
-
{
|
|
96
|
-
name: queryKey.name,
|
|
97
|
-
typeName: queryKey.typeName,
|
|
98
|
-
operation,
|
|
99
|
-
pathParamsType: options.pathParamsType,
|
|
100
|
-
typeSchemas: type.schemas,
|
|
101
|
-
paramsCasing: options.paramsCasing,
|
|
102
|
-
transformer: options.queryKey
|
|
103
|
-
}
|
|
104
|
-
),
|
|
105
|
-
!hasClientPlugin && /* @__PURE__ */ jsx(
|
|
106
|
-
Client,
|
|
107
|
-
{
|
|
108
|
-
name: client.name,
|
|
109
|
-
baseURL: options.client.baseURL,
|
|
110
|
-
operation,
|
|
111
|
-
typeSchemas: type.schemas,
|
|
112
|
-
zodSchemas: zod.schemas,
|
|
113
|
-
dataReturnType: options.client.dataReturnType,
|
|
114
|
-
paramsCasing: options.paramsCasing,
|
|
115
|
-
paramsType: options.paramsType,
|
|
116
|
-
pathParamsType: options.pathParamsType,
|
|
117
|
-
parser: options.parser
|
|
118
|
-
}
|
|
119
|
-
),
|
|
120
|
-
/* @__PURE__ */ jsx(File.Import, { name: ["queryOptions"], path: importPath }),
|
|
121
|
-
/* @__PURE__ */ jsx(
|
|
122
|
-
QueryOptions,
|
|
123
|
-
{
|
|
124
|
-
name: queryOptions.name,
|
|
125
|
-
clientName: client.name,
|
|
126
|
-
queryKeyName: queryKey.name,
|
|
127
|
-
typeSchemas: type.schemas,
|
|
128
|
-
paramsCasing: options.paramsCasing,
|
|
129
|
-
paramsType: options.paramsType,
|
|
130
|
-
pathParamsType: options.pathParamsType,
|
|
131
|
-
dataReturnType: options.client.dataReturnType
|
|
132
|
-
}
|
|
133
|
-
),
|
|
134
|
-
options.query && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
135
|
-
/* @__PURE__ */ jsx(File.Import, { name: ["createQuery"], path: importPath }),
|
|
136
|
-
/* @__PURE__ */ jsx(File.Import, { name: ["QueryKey", "QueryClient", "CreateBaseQueryOptions", "CreateQueryResult"], path: importPath, isTypeOnly: true }),
|
|
137
|
-
/* @__PURE__ */ jsx(
|
|
138
|
-
Query,
|
|
139
|
-
{
|
|
140
|
-
name: query.name,
|
|
141
|
-
queryOptionsName: queryOptions.name,
|
|
142
|
-
typeSchemas: type.schemas,
|
|
143
|
-
pathParamsType: options.pathParamsType,
|
|
144
|
-
operation,
|
|
145
|
-
paramsCasing: options.paramsCasing,
|
|
146
|
-
paramsType: options.paramsType,
|
|
147
|
-
dataReturnType: options.client.dataReturnType,
|
|
148
|
-
queryKeyName: queryKey.name,
|
|
149
|
-
queryKeyTypeName: queryKey.typeName
|
|
150
|
-
}
|
|
151
|
-
)
|
|
152
|
-
] })
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
var mutationGenerator = createReactGenerator({
|
|
159
|
-
name: "svelte-query",
|
|
160
|
-
Operation({ options, operation }) {
|
|
161
|
-
const {
|
|
162
|
-
plugin: {
|
|
163
|
-
options: { output }
|
|
164
|
-
},
|
|
165
|
-
pluginManager
|
|
166
|
-
} = useApp();
|
|
167
|
-
const oas = useOas();
|
|
168
|
-
const { getSchemas, getName, getFile } = useOperationManager();
|
|
169
|
-
const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method);
|
|
170
|
-
const isMutation = !isQuery && difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
171
|
-
const importPath = options.mutation ? options.mutation.importPath : "@tanstack/svelte-query";
|
|
172
|
-
const mutation = {
|
|
173
|
-
name: getName(operation, { type: "function", prefix: "create" }),
|
|
174
|
-
typeName: getName(operation, { type: "type" }),
|
|
175
|
-
file: getFile(operation, { prefix: "create" })
|
|
176
|
-
};
|
|
177
|
-
const type = {
|
|
178
|
-
file: getFile(operation, { pluginKey: [pluginTsName] }),
|
|
179
|
-
//todo remove type?
|
|
180
|
-
schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: "type" })
|
|
181
|
-
};
|
|
182
|
-
const zod = {
|
|
183
|
-
file: getFile(operation, { pluginKey: [pluginZodName] }),
|
|
184
|
-
schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: "function" })
|
|
185
|
-
};
|
|
186
|
-
const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]);
|
|
187
|
-
const client = {
|
|
188
|
-
name: hasClientPlugin ? getName(operation, {
|
|
189
|
-
type: "function",
|
|
190
|
-
pluginKey: [pluginClientName]
|
|
191
|
-
}) : getName(operation, {
|
|
192
|
-
type: "function"
|
|
193
|
-
}),
|
|
194
|
-
file: getFile(operation, { pluginKey: [pluginClientName] })
|
|
195
|
-
};
|
|
196
|
-
const mutationKey = {
|
|
197
|
-
name: getName(operation, { type: "const", suffix: "MutationKey" }),
|
|
198
|
-
typeName: getName(operation, { type: "type", suffix: "MutationKey" })
|
|
199
|
-
};
|
|
200
|
-
if (!isMutation) {
|
|
201
|
-
return null;
|
|
202
|
-
}
|
|
203
|
-
return /* @__PURE__ */ jsxs(
|
|
204
|
-
File,
|
|
205
|
-
{
|
|
206
|
-
baseName: mutation.file.baseName,
|
|
207
|
-
path: mutation.file.path,
|
|
208
|
-
meta: mutation.file.meta,
|
|
209
|
-
banner: getBanner({ oas, output, config: pluginManager.config }),
|
|
210
|
-
footer: getFooter({ oas, output }),
|
|
211
|
-
children: [
|
|
212
|
-
options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, { name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean), root: mutation.file.path, path: zod.file.path }),
|
|
213
|
-
/* @__PURE__ */ jsx(File.Import, { name: "fetch", path: options.client.importPath }),
|
|
214
|
-
!!hasClientPlugin && /* @__PURE__ */ jsx(File.Import, { name: [client.name], root: mutation.file.path, path: client.file.path }),
|
|
215
|
-
/* @__PURE__ */ jsx(File.Import, { name: ["RequestConfig", "ResponseConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
216
|
-
/* @__PURE__ */ jsx(
|
|
217
|
-
File.Import,
|
|
218
|
-
{
|
|
219
|
-
name: [
|
|
220
|
-
type.schemas.request?.name,
|
|
221
|
-
type.schemas.response.name,
|
|
222
|
-
type.schemas.pathParams?.name,
|
|
223
|
-
type.schemas.queryParams?.name,
|
|
224
|
-
type.schemas.headerParams?.name,
|
|
225
|
-
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
226
|
-
].filter(Boolean),
|
|
227
|
-
root: mutation.file.path,
|
|
228
|
-
path: type.file.path,
|
|
229
|
-
isTypeOnly: true
|
|
230
|
-
}
|
|
231
|
-
),
|
|
232
|
-
/* @__PURE__ */ jsx(
|
|
233
|
-
MutationKey,
|
|
234
|
-
{
|
|
235
|
-
name: mutationKey.name,
|
|
236
|
-
typeName: mutationKey.typeName,
|
|
237
|
-
operation,
|
|
238
|
-
paramsCasing: options.paramsCasing,
|
|
239
|
-
pathParamsType: options.pathParamsType,
|
|
240
|
-
typeSchemas: type.schemas,
|
|
241
|
-
transformer: options.mutationKey
|
|
242
|
-
}
|
|
243
|
-
),
|
|
244
|
-
!hasClientPlugin && /* @__PURE__ */ jsx(
|
|
245
|
-
Client,
|
|
246
|
-
{
|
|
247
|
-
name: client.name,
|
|
248
|
-
baseURL: options.client.baseURL,
|
|
249
|
-
operation,
|
|
250
|
-
typeSchemas: type.schemas,
|
|
251
|
-
zodSchemas: zod.schemas,
|
|
252
|
-
dataReturnType: options.client.dataReturnType,
|
|
253
|
-
paramsCasing: options.paramsCasing,
|
|
254
|
-
paramsType: options.paramsType,
|
|
255
|
-
pathParamsType: options.pathParamsType,
|
|
256
|
-
parser: options.parser
|
|
257
|
-
}
|
|
258
|
-
),
|
|
259
|
-
options.mutation && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
260
|
-
/* @__PURE__ */ jsx(File.Import, { name: ["createMutation"], path: importPath }),
|
|
261
|
-
/* @__PURE__ */ jsx(File.Import, { name: ["CreateMutationOptions", "CreateMutationResult", "QueryClient"], path: importPath, isTypeOnly: true }),
|
|
262
|
-
/* @__PURE__ */ jsx(
|
|
263
|
-
Mutation,
|
|
264
|
-
{
|
|
265
|
-
name: mutation.name,
|
|
266
|
-
clientName: client.name,
|
|
267
|
-
typeName: mutation.typeName,
|
|
268
|
-
typeSchemas: type.schemas,
|
|
269
|
-
operation,
|
|
270
|
-
paramsCasing: options.paramsCasing,
|
|
271
|
-
dataReturnType: options.client.dataReturnType,
|
|
272
|
-
paramsType: options.paramsType,
|
|
273
|
-
pathParamsType: options.pathParamsType,
|
|
274
|
-
mutationKeyName: mutationKey.name
|
|
275
|
-
}
|
|
276
|
-
)
|
|
277
|
-
] })
|
|
278
|
-
]
|
|
279
|
-
}
|
|
280
|
-
);
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
export { mutationGenerator, queryGenerator };
|
|
285
|
-
//# sourceMappingURL=chunk-Y534JBKZ.js.map
|
|
286
|
-
//# sourceMappingURL=chunk-Y534JBKZ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generators/queryGenerator.tsx","../src/generators/mutationGenerator.tsx"],"names":["createReactGenerator","useApp","useOas","useOperationManager","difference","pluginTsName","pluginZodName","pluginClientName","jsxs","File","getBanner","getFooter","jsx","Client","Fragment"],"mappings":";;;;;;;;;;;;AAYO,IAAM,iBAAiB,oBAAwC,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,QACE,MAA0B,EAAA;AAC9B,IAAA,MAAM,MAAM,MAAO,EAAA;AACnB,IAAA,MAAM,EAAE,UAAA,EAAY,OAAS,EAAA,OAAA,KAAY,mBAAoB,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,aAAa,UAAW,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,OAAA,CAAQ,MAAM,UAAa,GAAA,wBAAA;AAE9D,IAAA,MAAM,KAAQ,GAAA;AAAA,MACZ,IAAA,EAAM,QAAQ,SAAW,EAAA,EAAE,MAAM,UAAY,EAAA,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC/D,UAAU,OAAQ,CAAA,SAAA,EAAW,EAAE,IAAA,EAAM,QAAQ,CAAA;AAAA,M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A,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-Y534JBKZ.js","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"]}
|
package/dist/components.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"components.cjs"}
|
package/dist/components.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"components.js"}
|
package/dist/generators.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"generators.cjs"}
|
package/dist/generators.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"generators.js"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { Output, Group, PluginFactoryOptions, ResolveNameParams } from '@kubb/core';
|
|
2
|
-
import { Oas, contentType, Operation, HttpMethod } from '@kubb/oas';
|
|
3
|
-
import { PluginClient } from '@kubb/plugin-client';
|
|
4
|
-
import { Exclude, Include, Override, ResolvePathOptions, OperationSchemas, Generator } from '@kubb/plugin-oas';
|
|
5
|
-
|
|
6
|
-
type TransformerProps = {
|
|
7
|
-
operation: Operation;
|
|
8
|
-
schemas: OperationSchemas;
|
|
9
|
-
casing: 'camelcase' | undefined;
|
|
10
|
-
};
|
|
11
|
-
type Transformer = (props: TransformerProps) => unknown[];
|
|
12
|
-
/**
|
|
13
|
-
* Customize the queryKey
|
|
14
|
-
*/
|
|
15
|
-
type QueryKey = Transformer;
|
|
16
|
-
/**
|
|
17
|
-
* Customize the mutationKey
|
|
18
|
-
*/
|
|
19
|
-
type MutationKey = Transformer;
|
|
20
|
-
type Query = {
|
|
21
|
-
/**
|
|
22
|
-
* Define which HttpMethods can be used for queries
|
|
23
|
-
* @default ['get']
|
|
24
|
-
*/
|
|
25
|
-
methods: Array<HttpMethod>;
|
|
26
|
-
/**
|
|
27
|
-
* Path to the useQuery that will be used to do the useQuery functionality.
|
|
28
|
-
* It will be used as `import { useQuery } from '${importPath}'`.
|
|
29
|
-
* It allows both relative and absolute path.
|
|
30
|
-
* the path will be applied as is, so relative path should be based on the file being generated.
|
|
31
|
-
* @default '@tanstack/svelte-query'
|
|
32
|
-
*/
|
|
33
|
-
importPath?: string;
|
|
34
|
-
};
|
|
35
|
-
type Mutation = {
|
|
36
|
-
/**
|
|
37
|
-
* Define which HttpMethods can be used for mutations
|
|
38
|
-
* @default ['post', 'put', 'delete']
|
|
39
|
-
*/
|
|
40
|
-
methods: Array<HttpMethod>;
|
|
41
|
-
/**
|
|
42
|
-
* Path to the useQuery that will be used to do the useQuery functionality.
|
|
43
|
-
* It will be used as `import { useQuery } from '${importPath}'`.
|
|
44
|
-
* It allows both relative and absolute path.
|
|
45
|
-
* the path will be applied as is, so relative path should be based on the file being generated.
|
|
46
|
-
* @default '@tanstack/svelte-query'
|
|
47
|
-
*/
|
|
48
|
-
importPath?: string;
|
|
49
|
-
};
|
|
50
|
-
type Options = {
|
|
51
|
-
/**
|
|
52
|
-
* Specify the export location for the files and define the behavior of the output
|
|
53
|
-
* @default { path: 'hooks', barrelType: 'named' }
|
|
54
|
-
*/
|
|
55
|
-
output?: Output<Oas>;
|
|
56
|
-
/**
|
|
57
|
-
* Define which contentType should be used.
|
|
58
|
-
* By default, the first JSON valid mediaType will be used
|
|
59
|
-
*/
|
|
60
|
-
contentType?: contentType;
|
|
61
|
-
/**
|
|
62
|
-
* Group the @tanstack/query hooks based on the provided name.
|
|
63
|
-
*/
|
|
64
|
-
group?: Group;
|
|
65
|
-
client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath' | 'baseURL'>;
|
|
66
|
-
/**
|
|
67
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
68
|
-
*/
|
|
69
|
-
exclude?: Array<Exclude>;
|
|
70
|
-
/**
|
|
71
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
72
|
-
*/
|
|
73
|
-
include?: Array<Include>;
|
|
74
|
-
/**
|
|
75
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
76
|
-
*/
|
|
77
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
78
|
-
/**
|
|
79
|
-
* How to style your params, by default no casing is applied
|
|
80
|
-
* - 'camelcase' will use camelcase for the params names
|
|
81
|
-
*/
|
|
82
|
-
paramsCasing?: 'camelcase';
|
|
83
|
-
/**
|
|
84
|
-
* How to pass your params
|
|
85
|
-
* - 'object' will return the params and pathParams as an object.
|
|
86
|
-
* - 'inline' will return the params as comma separated params.
|
|
87
|
-
* @default 'inline'
|
|
88
|
-
*/
|
|
89
|
-
paramsType?: 'object' | 'inline';
|
|
90
|
-
/**
|
|
91
|
-
* How to pass your pathParams.
|
|
92
|
-
* - 'object' will return the pathParams as an object.
|
|
93
|
-
* - 'inline' will return the pathParams as comma separated params.
|
|
94
|
-
* @default 'inline'
|
|
95
|
-
*/
|
|
96
|
-
pathParamsType?: PluginClient['options']['pathParamsType'];
|
|
97
|
-
queryKey?: QueryKey;
|
|
98
|
-
/**
|
|
99
|
-
* Override some useQuery behaviours.
|
|
100
|
-
*/
|
|
101
|
-
query?: Partial<Query> | false;
|
|
102
|
-
mutationKey?: MutationKey;
|
|
103
|
-
/**
|
|
104
|
-
* Override some useMutation behaviours.
|
|
105
|
-
*/
|
|
106
|
-
mutation?: Mutation | false;
|
|
107
|
-
/**
|
|
108
|
-
* Which parser should be used before returning the data to `@tanstack/query`.
|
|
109
|
-
* `'zod'` will use `@kubb/plugin-zod` to parse the data.
|
|
110
|
-
*/
|
|
111
|
-
parser?: PluginClient['options']['parser'];
|
|
112
|
-
transformers?: {
|
|
113
|
-
/**
|
|
114
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
115
|
-
*/
|
|
116
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Define some generators next to the svelte-query generators
|
|
120
|
-
*/
|
|
121
|
-
generators?: Array<Generator<PluginSvelteQuery>>;
|
|
122
|
-
};
|
|
123
|
-
type ResolvedOptions = {
|
|
124
|
-
output: Output<Oas>;
|
|
125
|
-
group: Options['group'];
|
|
126
|
-
client: Required<Omit<NonNullable<PluginSvelteQuery['options']['client']>, 'baseURL'>> & {
|
|
127
|
-
baseURL?: string;
|
|
128
|
-
};
|
|
129
|
-
parser: Required<NonNullable<Options['parser']>>;
|
|
130
|
-
paramsCasing: Options['paramsCasing'];
|
|
131
|
-
paramsType: NonNullable<Options['paramsType']>;
|
|
132
|
-
pathParamsType: NonNullable<Options['pathParamsType']>;
|
|
133
|
-
queryKey: QueryKey | undefined;
|
|
134
|
-
query: NonNullable<Required<Query>> | false;
|
|
135
|
-
mutationKey: MutationKey | undefined;
|
|
136
|
-
mutation: NonNullable<Required<Mutation>> | false;
|
|
137
|
-
};
|
|
138
|
-
type PluginSvelteQuery = PluginFactoryOptions<'plugin-svelte-query', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
139
|
-
|
|
140
|
-
export type { Options as O, PluginSvelteQuery as P, Transformer as T };
|
package/dist/types-BIWbWacf.d.ts
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { Output, Group, PluginFactoryOptions, ResolveNameParams } from '@kubb/core';
|
|
2
|
-
import { Oas, contentType, Operation, HttpMethod } from '@kubb/oas';
|
|
3
|
-
import { PluginClient } from '@kubb/plugin-client';
|
|
4
|
-
import { Exclude, Include, Override, ResolvePathOptions, OperationSchemas, Generator } from '@kubb/plugin-oas';
|
|
5
|
-
|
|
6
|
-
type TransformerProps = {
|
|
7
|
-
operation: Operation;
|
|
8
|
-
schemas: OperationSchemas;
|
|
9
|
-
casing: 'camelcase' | undefined;
|
|
10
|
-
};
|
|
11
|
-
type Transformer = (props: TransformerProps) => unknown[];
|
|
12
|
-
/**
|
|
13
|
-
* Customize the queryKey
|
|
14
|
-
*/
|
|
15
|
-
type QueryKey = Transformer;
|
|
16
|
-
/**
|
|
17
|
-
* Customize the mutationKey
|
|
18
|
-
*/
|
|
19
|
-
type MutationKey = Transformer;
|
|
20
|
-
type Query = {
|
|
21
|
-
/**
|
|
22
|
-
* Define which HttpMethods can be used for queries
|
|
23
|
-
* @default ['get']
|
|
24
|
-
*/
|
|
25
|
-
methods: Array<HttpMethod>;
|
|
26
|
-
/**
|
|
27
|
-
* Path to the useQuery that will be used to do the useQuery functionality.
|
|
28
|
-
* It will be used as `import { useQuery } from '${importPath}'`.
|
|
29
|
-
* It allows both relative and absolute path.
|
|
30
|
-
* the path will be applied as is, so relative path should be based on the file being generated.
|
|
31
|
-
* @default '@tanstack/svelte-query'
|
|
32
|
-
*/
|
|
33
|
-
importPath?: string;
|
|
34
|
-
};
|
|
35
|
-
type Mutation = {
|
|
36
|
-
/**
|
|
37
|
-
* Define which HttpMethods can be used for mutations
|
|
38
|
-
* @default ['post', 'put', 'delete']
|
|
39
|
-
*/
|
|
40
|
-
methods: Array<HttpMethod>;
|
|
41
|
-
/**
|
|
42
|
-
* Path to the useQuery that will be used to do the useQuery functionality.
|
|
43
|
-
* It will be used as `import { useQuery } from '${importPath}'`.
|
|
44
|
-
* It allows both relative and absolute path.
|
|
45
|
-
* the path will be applied as is, so relative path should be based on the file being generated.
|
|
46
|
-
* @default '@tanstack/svelte-query'
|
|
47
|
-
*/
|
|
48
|
-
importPath?: string;
|
|
49
|
-
};
|
|
50
|
-
type Options = {
|
|
51
|
-
/**
|
|
52
|
-
* Specify the export location for the files and define the behavior of the output
|
|
53
|
-
* @default { path: 'hooks', barrelType: 'named' }
|
|
54
|
-
*/
|
|
55
|
-
output?: Output<Oas>;
|
|
56
|
-
/**
|
|
57
|
-
* Define which contentType should be used.
|
|
58
|
-
* By default, the first JSON valid mediaType will be used
|
|
59
|
-
*/
|
|
60
|
-
contentType?: contentType;
|
|
61
|
-
/**
|
|
62
|
-
* Group the @tanstack/query hooks based on the provided name.
|
|
63
|
-
*/
|
|
64
|
-
group?: Group;
|
|
65
|
-
client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath' | 'baseURL'>;
|
|
66
|
-
/**
|
|
67
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
68
|
-
*/
|
|
69
|
-
exclude?: Array<Exclude>;
|
|
70
|
-
/**
|
|
71
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
72
|
-
*/
|
|
73
|
-
include?: Array<Include>;
|
|
74
|
-
/**
|
|
75
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
76
|
-
*/
|
|
77
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
78
|
-
/**
|
|
79
|
-
* How to style your params, by default no casing is applied
|
|
80
|
-
* - 'camelcase' will use camelcase for the params names
|
|
81
|
-
*/
|
|
82
|
-
paramsCasing?: 'camelcase';
|
|
83
|
-
/**
|
|
84
|
-
* How to pass your params
|
|
85
|
-
* - 'object' will return the params and pathParams as an object.
|
|
86
|
-
* - 'inline' will return the params as comma separated params.
|
|
87
|
-
* @default 'inline'
|
|
88
|
-
*/
|
|
89
|
-
paramsType?: 'object' | 'inline';
|
|
90
|
-
/**
|
|
91
|
-
* How to pass your pathParams.
|
|
92
|
-
* - 'object' will return the pathParams as an object.
|
|
93
|
-
* - 'inline' will return the pathParams as comma separated params.
|
|
94
|
-
* @default 'inline'
|
|
95
|
-
*/
|
|
96
|
-
pathParamsType?: PluginClient['options']['pathParamsType'];
|
|
97
|
-
queryKey?: QueryKey;
|
|
98
|
-
/**
|
|
99
|
-
* Override some useQuery behaviours.
|
|
100
|
-
*/
|
|
101
|
-
query?: Partial<Query> | false;
|
|
102
|
-
mutationKey?: MutationKey;
|
|
103
|
-
/**
|
|
104
|
-
* Override some useMutation behaviours.
|
|
105
|
-
*/
|
|
106
|
-
mutation?: Mutation | false;
|
|
107
|
-
/**
|
|
108
|
-
* Which parser should be used before returning the data to `@tanstack/query`.
|
|
109
|
-
* `'zod'` will use `@kubb/plugin-zod` to parse the data.
|
|
110
|
-
*/
|
|
111
|
-
parser?: PluginClient['options']['parser'];
|
|
112
|
-
transformers?: {
|
|
113
|
-
/**
|
|
114
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
115
|
-
*/
|
|
116
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Define some generators next to the svelte-query generators
|
|
120
|
-
*/
|
|
121
|
-
generators?: Array<Generator<PluginSvelteQuery>>;
|
|
122
|
-
};
|
|
123
|
-
type ResolvedOptions = {
|
|
124
|
-
output: Output<Oas>;
|
|
125
|
-
group: Options['group'];
|
|
126
|
-
client: Required<Omit<NonNullable<PluginSvelteQuery['options']['client']>, 'baseURL'>> & {
|
|
127
|
-
baseURL?: string;
|
|
128
|
-
};
|
|
129
|
-
parser: Required<NonNullable<Options['parser']>>;
|
|
130
|
-
paramsCasing: Options['paramsCasing'];
|
|
131
|
-
paramsType: NonNullable<Options['paramsType']>;
|
|
132
|
-
pathParamsType: NonNullable<Options['pathParamsType']>;
|
|
133
|
-
queryKey: QueryKey | undefined;
|
|
134
|
-
query: NonNullable<Required<Query>> | false;
|
|
135
|
-
mutationKey: MutationKey | undefined;
|
|
136
|
-
mutation: NonNullable<Required<Mutation>> | false;
|
|
137
|
-
};
|
|
138
|
-
type PluginSvelteQuery = PluginFactoryOptions<'plugin-svelte-query', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
139
|
-
|
|
140
|
-
export type { Options as O, PluginSvelteQuery as P, Transformer as T };
|