@kubb/plugin-solid-query 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{components-Bi0-xvca.cjs → components-CrpQqUQQ.cjs} +181 -4
- package/dist/components-CrpQqUQQ.cjs.map +1 -0
- package/dist/{components-B_yhFBLa.js → components-JN6XAKh3.js} +169 -4
- package/dist/components-JN6XAKh3.js.map +1 -0
- package/dist/components.cjs +3 -1
- package/dist/components.d.cts +58 -2
- package/dist/components.d.ts +58 -2
- package/dist/components.js +2 -2
- package/dist/{generators-0TNaKUZf.cjs → generators-CUcA3_rk.cjs} +161 -5
- package/dist/generators-CUcA3_rk.cjs.map +1 -0
- package/dist/{generators-DsUzHPML.js → generators-DRX-ix2A.js} +155 -5
- package/dist/generators-DRX-ix2A.js.map +1 -0
- package/dist/generators.cjs +3 -2
- package/dist/generators.d.cts +5 -2
- package/dist/generators.d.ts +5 -2
- package/dist/generators.js +3 -3
- package/dist/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/{types-BcAT9UxT.d.cts → types-BI1GJc6y.d.cts} +27 -1
- package/dist/{types-B5mFPIGb.d.ts → types-fv5KLGsJ.d.ts} +27 -1
- package/package.json +9 -10
- package/src/components/Mutation.tsx +177 -0
- package/src/components/MutationKey.tsx +54 -0
- package/src/components/Query.tsx +1 -1
- package/src/components/index.ts +2 -0
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +2 -2
- package/src/generators/__snapshots__/clientGetImportPath.ts +2 -2
- package/src/generators/__snapshots__/findByTags.ts +2 -2
- package/src/generators/__snapshots__/findByTagsObject.ts +2 -2
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +2 -2
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +2 -2
- package/src/generators/__snapshots__/findByTagsWithZod.ts +2 -2
- package/src/generators/__snapshots__/postAsQuery.ts +2 -2
- package/src/generators/index.ts +1 -0
- package/src/generators/mutationGenerator.tsx +144 -0
- package/src/generators/queryGenerator.tsx +1 -1
- package/src/plugin.ts +14 -9
- package/src/types.ts +28 -0
- package/dist/components-B_yhFBLa.js.map +0 -1
- package/dist/components-Bi0-xvca.cjs.map +0 -1
- package/dist/generators-0TNaKUZf.cjs.map +0 -1
- package/dist/generators-DsUzHPML.js.map +0 -1
package/dist/components.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Operation, OperationSchemas, PluginSolidQuery, Transformer } from "./types-
|
|
1
|
+
import { Operation, OperationSchemas, PluginSolidQuery, Transformer } from "./types-fv5KLGsJ.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region ../react/src/utils/getFunctionParams.d.ts
|
|
@@ -45,6 +45,62 @@ declare class FunctionParams {
|
|
|
45
45
|
toConstructor(): string;
|
|
46
46
|
}
|
|
47
47
|
//#endregion
|
|
48
|
+
//#region src/components/Mutation.d.ts
|
|
49
|
+
type Props$4 = {
|
|
50
|
+
/**
|
|
51
|
+
* Name of the function
|
|
52
|
+
*/
|
|
53
|
+
name: string;
|
|
54
|
+
typeName: string;
|
|
55
|
+
clientName: string;
|
|
56
|
+
mutationKeyName: string;
|
|
57
|
+
typeSchemas: OperationSchemas;
|
|
58
|
+
operation: Operation;
|
|
59
|
+
dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType'];
|
|
60
|
+
paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing'];
|
|
61
|
+
paramsType: PluginSolidQuery['resolvedOptions']['paramsType'];
|
|
62
|
+
pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType'];
|
|
63
|
+
};
|
|
64
|
+
declare function Mutation({
|
|
65
|
+
name,
|
|
66
|
+
clientName,
|
|
67
|
+
paramsCasing,
|
|
68
|
+
paramsType,
|
|
69
|
+
pathParamsType,
|
|
70
|
+
dataReturnType,
|
|
71
|
+
typeSchemas,
|
|
72
|
+
operation,
|
|
73
|
+
mutationKeyName
|
|
74
|
+
}: Props$4): ReactNode;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/components/MutationKey.d.ts
|
|
77
|
+
type Props$3 = {
|
|
78
|
+
name: string;
|
|
79
|
+
typeName: string;
|
|
80
|
+
typeSchemas: OperationSchemas;
|
|
81
|
+
operation: Operation;
|
|
82
|
+
paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing'];
|
|
83
|
+
pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType'];
|
|
84
|
+
transformer: Transformer | undefined;
|
|
85
|
+
};
|
|
86
|
+
type GetParamsProps$3 = {
|
|
87
|
+
pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType'];
|
|
88
|
+
typeSchemas: OperationSchemas;
|
|
89
|
+
};
|
|
90
|
+
declare function MutationKey({
|
|
91
|
+
name,
|
|
92
|
+
typeSchemas,
|
|
93
|
+
pathParamsType,
|
|
94
|
+
paramsCasing,
|
|
95
|
+
operation,
|
|
96
|
+
typeName,
|
|
97
|
+
transformer
|
|
98
|
+
}: Props$3): ReactNode;
|
|
99
|
+
declare namespace MutationKey {
|
|
100
|
+
var getParams: ({}: GetParamsProps$3) => FunctionParams;
|
|
101
|
+
var getTransformer: Transformer;
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
48
104
|
//#region src/components/Query.d.ts
|
|
49
105
|
type Props$2 = {
|
|
50
106
|
/**
|
|
@@ -159,5 +215,5 @@ declare namespace QueryOptions {
|
|
|
159
215
|
}: GetParamsProps) => FunctionParams;
|
|
160
216
|
}
|
|
161
217
|
//#endregion
|
|
162
|
-
export { Query, QueryKey, QueryOptions };
|
|
218
|
+
export { Mutation, MutationKey, Query, QueryKey, QueryOptions };
|
|
163
219
|
//# sourceMappingURL=components.d.ts.map
|
package/dist/components.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Query, QueryKey, QueryOptions } from "./components-
|
|
1
|
+
import { Mutation, MutationKey, Query, QueryKey, QueryOptions } from "./components-JN6XAKh3.js";
|
|
2
2
|
|
|
3
|
-
export { Query, QueryKey, QueryOptions };
|
|
3
|
+
export { Mutation, MutationKey, Query, QueryKey, QueryOptions };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const require_components = require('./components-
|
|
1
|
+
const require_components = require('./components-CrpQqUQQ.cjs');
|
|
2
2
|
let __kubb_plugin_oas = require("@kubb/plugin-oas");
|
|
3
3
|
__kubb_plugin_oas = require_components.__toESM(__kubb_plugin_oas);
|
|
4
4
|
let __kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
5
5
|
__kubb_plugin_ts = require_components.__toESM(__kubb_plugin_ts);
|
|
6
6
|
let __kubb_plugin_zod = require("@kubb/plugin-zod");
|
|
7
7
|
__kubb_plugin_zod = require_components.__toESM(__kubb_plugin_zod);
|
|
8
|
+
let __kubb_plugin_client_components = require("@kubb/plugin-client/components");
|
|
9
|
+
__kubb_plugin_client_components = require_components.__toESM(__kubb_plugin_client_components);
|
|
8
10
|
let __kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
|
|
9
11
|
__kubb_plugin_oas_utils = require_components.__toESM(__kubb_plugin_oas_utils);
|
|
10
12
|
let __kubb_react = require("@kubb/react");
|
|
11
13
|
__kubb_react = require_components.__toESM(__kubb_react);
|
|
12
14
|
let __kubb_react_jsx_runtime = require("@kubb/react/jsx-runtime");
|
|
13
15
|
__kubb_react_jsx_runtime = require_components.__toESM(__kubb_react_jsx_runtime);
|
|
14
|
-
let __kubb_plugin_client_components = require("@kubb/plugin-client/components");
|
|
15
|
-
__kubb_plugin_client_components = require_components.__toESM(__kubb_plugin_client_components);
|
|
16
16
|
let __kubb_plugin_client = require("@kubb/plugin-client");
|
|
17
17
|
__kubb_plugin_client = require_components.__toESM(__kubb_plugin_client);
|
|
18
18
|
let __kubb_plugin_oas_hooks = require("@kubb/plugin-oas/hooks");
|
|
@@ -20,6 +20,156 @@ __kubb_plugin_oas_hooks = require_components.__toESM(__kubb_plugin_oas_hooks);
|
|
|
20
20
|
let remeda = require("remeda");
|
|
21
21
|
remeda = require_components.__toESM(remeda);
|
|
22
22
|
|
|
23
|
+
//#region src/generators/mutationGenerator.tsx
|
|
24
|
+
const mutationGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
25
|
+
name: "solid-query",
|
|
26
|
+
Operation({ options, operation }) {
|
|
27
|
+
const { plugin: { options: { output } }, pluginManager } = (0, __kubb_react.useApp)();
|
|
28
|
+
const oas = (0, __kubb_plugin_oas_hooks.useOas)();
|
|
29
|
+
const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)();
|
|
30
|
+
const isMutation = !(!!options.query && options.query?.methods.some((method) => operation.method === method)) && (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
31
|
+
const importPath = options.mutation ? options.mutation.importPath : "@tanstack/solid-query";
|
|
32
|
+
const mutation = {
|
|
33
|
+
name: getName(operation, {
|
|
34
|
+
type: "function",
|
|
35
|
+
prefix: "use"
|
|
36
|
+
}),
|
|
37
|
+
typeName: getName(operation, { type: "type" }),
|
|
38
|
+
file: getFile(operation, { prefix: "use" })
|
|
39
|
+
};
|
|
40
|
+
const type = {
|
|
41
|
+
file: getFile(operation, { pluginKey: [__kubb_plugin_ts.pluginTsName] }),
|
|
42
|
+
schemas: getSchemas(operation, {
|
|
43
|
+
pluginKey: [__kubb_plugin_ts.pluginTsName],
|
|
44
|
+
type: "type"
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
const zod = {
|
|
48
|
+
file: getFile(operation, { pluginKey: [__kubb_plugin_zod.pluginZodName] }),
|
|
49
|
+
schemas: getSchemas(operation, {
|
|
50
|
+
pluginKey: [__kubb_plugin_zod.pluginZodName],
|
|
51
|
+
type: "function"
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
const hasClientPlugin = !!pluginManager.getPluginByKey([__kubb_plugin_client.pluginClientName]);
|
|
55
|
+
const client = {
|
|
56
|
+
name: hasClientPlugin ? getName(operation, {
|
|
57
|
+
type: "function",
|
|
58
|
+
pluginKey: [__kubb_plugin_client.pluginClientName]
|
|
59
|
+
}) : getName(operation, { type: "function" }),
|
|
60
|
+
file: getFile(operation, { pluginKey: [__kubb_plugin_client.pluginClientName] })
|
|
61
|
+
};
|
|
62
|
+
const mutationKey = {
|
|
63
|
+
name: getName(operation, {
|
|
64
|
+
type: "const",
|
|
65
|
+
suffix: "MutationKey"
|
|
66
|
+
}),
|
|
67
|
+
typeName: getName(operation, {
|
|
68
|
+
type: "type",
|
|
69
|
+
suffix: "MutationKey"
|
|
70
|
+
})
|
|
71
|
+
};
|
|
72
|
+
if (!isMutation) return null;
|
|
73
|
+
return /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsxs)(__kubb_react.File, {
|
|
74
|
+
baseName: mutation.file.baseName,
|
|
75
|
+
path: mutation.file.path,
|
|
76
|
+
meta: mutation.file.meta,
|
|
77
|
+
banner: (0, __kubb_plugin_oas_utils.getBanner)({
|
|
78
|
+
oas,
|
|
79
|
+
output,
|
|
80
|
+
config: pluginManager.config
|
|
81
|
+
}),
|
|
82
|
+
footer: (0, __kubb_plugin_oas_utils.getFooter)({
|
|
83
|
+
oas,
|
|
84
|
+
output
|
|
85
|
+
}),
|
|
86
|
+
children: [
|
|
87
|
+
options.parser === "zod" && /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
88
|
+
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
89
|
+
root: mutation.file.path,
|
|
90
|
+
path: zod.file.path
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
93
|
+
name: "fetch",
|
|
94
|
+
path: options.client.importPath
|
|
95
|
+
}),
|
|
96
|
+
!!hasClientPlugin && /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
97
|
+
name: [client.name],
|
|
98
|
+
root: mutation.file.path,
|
|
99
|
+
path: client.file.path
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
102
|
+
name: [
|
|
103
|
+
"RequestConfig",
|
|
104
|
+
"ResponseConfig",
|
|
105
|
+
"ResponseErrorConfig"
|
|
106
|
+
],
|
|
107
|
+
path: options.client.importPath,
|
|
108
|
+
isTypeOnly: true
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
111
|
+
name: [
|
|
112
|
+
type.schemas.request?.name,
|
|
113
|
+
type.schemas.response.name,
|
|
114
|
+
type.schemas.pathParams?.name,
|
|
115
|
+
type.schemas.queryParams?.name,
|
|
116
|
+
type.schemas.headerParams?.name,
|
|
117
|
+
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
118
|
+
].filter(Boolean),
|
|
119
|
+
root: mutation.file.path,
|
|
120
|
+
path: type.file.path,
|
|
121
|
+
isTypeOnly: true
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(require_components.MutationKey, {
|
|
124
|
+
name: mutationKey.name,
|
|
125
|
+
typeName: mutationKey.typeName,
|
|
126
|
+
operation,
|
|
127
|
+
pathParamsType: options.pathParamsType,
|
|
128
|
+
typeSchemas: type.schemas,
|
|
129
|
+
paramsCasing: options.paramsCasing,
|
|
130
|
+
transformer: options.mutationKey
|
|
131
|
+
}),
|
|
132
|
+
!hasClientPlugin && /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_plugin_client_components.Client, {
|
|
133
|
+
name: client.name,
|
|
134
|
+
baseURL: options.client.baseURL,
|
|
135
|
+
operation,
|
|
136
|
+
typeSchemas: type.schemas,
|
|
137
|
+
zodSchemas: zod.schemas,
|
|
138
|
+
dataReturnType: options.client.dataReturnType,
|
|
139
|
+
paramsCasing: options.paramsCasing,
|
|
140
|
+
paramsType: options.paramsType,
|
|
141
|
+
pathParamsType: options.pathParamsType,
|
|
142
|
+
parser: options.parser
|
|
143
|
+
}),
|
|
144
|
+
options.mutation && /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsxs)(__kubb_react_jsx_runtime.Fragment, { children: [
|
|
145
|
+
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
146
|
+
name: ["useMutation"],
|
|
147
|
+
path: importPath
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
150
|
+
name: ["UseMutationOptions", "QueryClient"],
|
|
151
|
+
path: importPath,
|
|
152
|
+
isTypeOnly: true
|
|
153
|
+
}),
|
|
154
|
+
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(require_components.Mutation, {
|
|
155
|
+
name: mutation.name,
|
|
156
|
+
clientName: client.name,
|
|
157
|
+
typeName: mutation.typeName,
|
|
158
|
+
typeSchemas: type.schemas,
|
|
159
|
+
operation,
|
|
160
|
+
dataReturnType: options.client.dataReturnType,
|
|
161
|
+
paramsCasing: options.paramsCasing,
|
|
162
|
+
paramsType: options.paramsType,
|
|
163
|
+
pathParamsType: options.pathParamsType,
|
|
164
|
+
mutationKeyName: mutationKey.name
|
|
165
|
+
})
|
|
166
|
+
] })
|
|
167
|
+
]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
//#endregion
|
|
23
173
|
//#region src/generators/queryGenerator.tsx
|
|
24
174
|
const queryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
25
175
|
name: "svelte-query",
|
|
@@ -168,7 +318,7 @@ const queryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
168
318
|
}),
|
|
169
319
|
options.query && /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsxs)(__kubb_react_jsx_runtime.Fragment, { children: [
|
|
170
320
|
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
171
|
-
name: ["
|
|
321
|
+
name: ["useQuery"],
|
|
172
322
|
path: importPath
|
|
173
323
|
}),
|
|
174
324
|
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
@@ -200,10 +350,16 @@ const queryGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
200
350
|
});
|
|
201
351
|
|
|
202
352
|
//#endregion
|
|
353
|
+
Object.defineProperty(exports, 'mutationGenerator', {
|
|
354
|
+
enumerable: true,
|
|
355
|
+
get: function () {
|
|
356
|
+
return mutationGenerator;
|
|
357
|
+
}
|
|
358
|
+
});
|
|
203
359
|
Object.defineProperty(exports, 'queryGenerator', {
|
|
204
360
|
enumerable: true,
|
|
205
361
|
get: function () {
|
|
206
362
|
return queryGenerator;
|
|
207
363
|
}
|
|
208
364
|
});
|
|
209
|
-
//# sourceMappingURL=generators-
|
|
365
|
+
//# sourceMappingURL=generators-CUcA3_rk.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-CUcA3_rk.cjs","names":["pluginTsName","pluginZodName","pluginClientName","File","MutationKey","Client","Mutation","pluginClientName","pluginTsName","pluginZodName","File","QueryKey","Client","QueryOptions","Query"],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"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 { Mutation, MutationKey } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'solid-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n pluginManager,\n } = useApp<PluginSolidQuery>()\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/solid-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\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 pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.mutationKey}\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 {options.mutation && (\n <>\n <File.Import name={['useMutation']} path={importPath} />\n <File.Import name={['UseMutationOptions', '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 dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\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 { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'svelte-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n pluginManager,\n } = useApp<PluginSolidQuery>()\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(['post', 'put', 'delete', 'patch'], options.query ? options.query.methods : []).some((method) => operation.method === method)\n const importPath = options.query ? options.query.importPath : '@tanstack/solid-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 <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.queryKey}\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={['useQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'UseBaseQueryOptions', 'UseQueryResult']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n paramsCasing={options.paramsCasing}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAa,gEAA2D;CACtE,MAAM;CACN,UAAU,EAAE,SAAS,aAAa;EAChC,MAAM,EACJ,QAAQ,EACN,SAAS,EAAE,YAEb,4CAC4B;EAC9B,MAAM,2CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,8DAAiC;EAG9D,MAAM,aACJ,EAFc,CAAC,CAAC,QAAQ,SAAS,QAAQ,OAAO,QAAQ,MAAM,WAAW,UAAU,WAAW,OAAO,4BAG1F,QAAQ,WAAW,QAAQ,SAAS,UAAU,EAAE,EAAE,QAAQ,QAAQ,QAAQ,MAAM,UAAU,EAAE,CAAC,CAAC,MAAM,WAAW,UAAU,WAAW,OAAO;EAExJ,MAAM,aAAa,QAAQ,WAAW,QAAQ,SAAS,aAAa;EAEpE,MAAM,WAAW;GACf,MAAM,QAAQ,WAAW;IAAE,MAAM;IAAY,QAAQ;IAAO,CAAC;GAC7D,UAAU,QAAQ,WAAW,EAAE,MAAM,QAAQ,CAAC;GAC9C,MAAM,QAAQ,WAAW,EAAE,QAAQ,OAAO,CAAC;GAC5C;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,8BAAa,EAAE,CAAC;GAEvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAACA,8BAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;EAED,MAAM,MAAM;GACV,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACC,gCAAc,EAAE,CAAC;GACxD,SAAS,WAAW,WAAW;IAAE,WAAW,CAACA,gCAAc;IAAE,MAAM;IAAY,CAAC;GACjF;EAED,MAAM,kBAAkB,CAAC,CAAC,cAAc,eAAe,CAACC,sCAAiB,CAAC;EAC1E,MAAM,SAAS;GACb,MA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YAAY,IAAI;KAChB,gBAAgB,QAAQ,OAAO;KAC/B,cAAc,QAAQ;KACtB,YAAY,QAAQ;KACpB,gBAAgB,QAAQ;KACxB,QAAQ,QAAQ;MAChB;IAEJ,kDAACF,kBAAK;KAAO,MAAM,CAAC,eAAe;KAAE,MAAM;MAAc;IACzD,kDAACG;KACC,MAAM,aAAa;KACnB,YAAY,OAAO;KACnB,cAAc,SAAS;KACvB,aAAa,KAAK;KAClB,cAAc,QAAQ;KACtB,YAAY,QAAQ;KACpB,gBAAgB,QAAQ;KACxB,gBAAgB,QAAQ,OAAO;MAC/B;IACD,QAAQ,SACP;KACE,kDAACH,kBAAK;MAAO,MAAM,CAAC,WAAW;MAAE,MAAM;OAAc;KACrD,kDAACA,kBAAK;MAAO,MAAM;OAAC;OAAY;OAAe;OAAuB;OAAiB;MAAE,MAAM;MAAY;OAAa;KACxH,kDAACI;MACC,MAAM,MAAM;MACZ,kBAAkB,aAAa;MAC/B,aAAa,KAAK;MAClB,YAAY,QAAQ;MACpB,gBAAgB,QAAQ;MACb;MACX,cAAc,QAAQ;MACtB,gBAAgB,QAAQ,OAAO;MAC/B,cAAc,SAAS;MACvB,kBAAkB,SAAS;OAC3B;QACD;;IAEA;;CAGZ,CAAC"}
|
|
@@ -1,15 +1,165 @@
|
|
|
1
|
-
import { Query, QueryKey, QueryOptions } from "./components-
|
|
1
|
+
import { Mutation, MutationKey, Query, QueryKey, QueryOptions } from "./components-JN6XAKh3.js";
|
|
2
2
|
import { createReactGenerator } from "@kubb/plugin-oas";
|
|
3
3
|
import { pluginTsName } from "@kubb/plugin-ts";
|
|
4
4
|
import { pluginZodName } from "@kubb/plugin-zod";
|
|
5
|
+
import { Client } from "@kubb/plugin-client/components";
|
|
5
6
|
import { getBanner, getFooter } from "@kubb/plugin-oas/utils";
|
|
6
7
|
import { File, useApp } from "@kubb/react";
|
|
7
8
|
import { Fragment, jsx, jsxs } from "@kubb/react/jsx-runtime";
|
|
8
|
-
import { Client } from "@kubb/plugin-client/components";
|
|
9
9
|
import { pluginClientName } from "@kubb/plugin-client";
|
|
10
10
|
import { useOas, useOperationManager } from "@kubb/plugin-oas/hooks";
|
|
11
11
|
import { difference } from "remeda";
|
|
12
12
|
|
|
13
|
+
//#region src/generators/mutationGenerator.tsx
|
|
14
|
+
const mutationGenerator = createReactGenerator({
|
|
15
|
+
name: "solid-query",
|
|
16
|
+
Operation({ options, operation }) {
|
|
17
|
+
const { plugin: { options: { output } }, pluginManager } = useApp();
|
|
18
|
+
const oas = useOas();
|
|
19
|
+
const { getSchemas, getName, getFile } = useOperationManager();
|
|
20
|
+
const isMutation = !(!!options.query && options.query?.methods.some((method) => operation.method === method)) && difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
21
|
+
const importPath = options.mutation ? options.mutation.importPath : "@tanstack/solid-query";
|
|
22
|
+
const mutation = {
|
|
23
|
+
name: getName(operation, {
|
|
24
|
+
type: "function",
|
|
25
|
+
prefix: "use"
|
|
26
|
+
}),
|
|
27
|
+
typeName: getName(operation, { type: "type" }),
|
|
28
|
+
file: getFile(operation, { prefix: "use" })
|
|
29
|
+
};
|
|
30
|
+
const type = {
|
|
31
|
+
file: getFile(operation, { pluginKey: [pluginTsName] }),
|
|
32
|
+
schemas: getSchemas(operation, {
|
|
33
|
+
pluginKey: [pluginTsName],
|
|
34
|
+
type: "type"
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
const zod = {
|
|
38
|
+
file: getFile(operation, { pluginKey: [pluginZodName] }),
|
|
39
|
+
schemas: getSchemas(operation, {
|
|
40
|
+
pluginKey: [pluginZodName],
|
|
41
|
+
type: "function"
|
|
42
|
+
})
|
|
43
|
+
};
|
|
44
|
+
const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]);
|
|
45
|
+
const client = {
|
|
46
|
+
name: hasClientPlugin ? getName(operation, {
|
|
47
|
+
type: "function",
|
|
48
|
+
pluginKey: [pluginClientName]
|
|
49
|
+
}) : getName(operation, { type: "function" }),
|
|
50
|
+
file: getFile(operation, { pluginKey: [pluginClientName] })
|
|
51
|
+
};
|
|
52
|
+
const mutationKey = {
|
|
53
|
+
name: getName(operation, {
|
|
54
|
+
type: "const",
|
|
55
|
+
suffix: "MutationKey"
|
|
56
|
+
}),
|
|
57
|
+
typeName: getName(operation, {
|
|
58
|
+
type: "type",
|
|
59
|
+
suffix: "MutationKey"
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
if (!isMutation) return null;
|
|
63
|
+
return /* @__PURE__ */ jsxs(File, {
|
|
64
|
+
baseName: mutation.file.baseName,
|
|
65
|
+
path: mutation.file.path,
|
|
66
|
+
meta: mutation.file.meta,
|
|
67
|
+
banner: getBanner({
|
|
68
|
+
oas,
|
|
69
|
+
output,
|
|
70
|
+
config: pluginManager.config
|
|
71
|
+
}),
|
|
72
|
+
footer: getFooter({
|
|
73
|
+
oas,
|
|
74
|
+
output
|
|
75
|
+
}),
|
|
76
|
+
children: [
|
|
77
|
+
options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
|
|
78
|
+
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
79
|
+
root: mutation.file.path,
|
|
80
|
+
path: zod.file.path
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
83
|
+
name: "fetch",
|
|
84
|
+
path: options.client.importPath
|
|
85
|
+
}),
|
|
86
|
+
!!hasClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
87
|
+
name: [client.name],
|
|
88
|
+
root: mutation.file.path,
|
|
89
|
+
path: client.file.path
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
92
|
+
name: [
|
|
93
|
+
"RequestConfig",
|
|
94
|
+
"ResponseConfig",
|
|
95
|
+
"ResponseErrorConfig"
|
|
96
|
+
],
|
|
97
|
+
path: options.client.importPath,
|
|
98
|
+
isTypeOnly: true
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
101
|
+
name: [
|
|
102
|
+
type.schemas.request?.name,
|
|
103
|
+
type.schemas.response.name,
|
|
104
|
+
type.schemas.pathParams?.name,
|
|
105
|
+
type.schemas.queryParams?.name,
|
|
106
|
+
type.schemas.headerParams?.name,
|
|
107
|
+
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
108
|
+
].filter(Boolean),
|
|
109
|
+
root: mutation.file.path,
|
|
110
|
+
path: type.file.path,
|
|
111
|
+
isTypeOnly: true
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ jsx(MutationKey, {
|
|
114
|
+
name: mutationKey.name,
|
|
115
|
+
typeName: mutationKey.typeName,
|
|
116
|
+
operation,
|
|
117
|
+
pathParamsType: options.pathParamsType,
|
|
118
|
+
typeSchemas: type.schemas,
|
|
119
|
+
paramsCasing: options.paramsCasing,
|
|
120
|
+
transformer: options.mutationKey
|
|
121
|
+
}),
|
|
122
|
+
!hasClientPlugin && /* @__PURE__ */ jsx(Client, {
|
|
123
|
+
name: client.name,
|
|
124
|
+
baseURL: options.client.baseURL,
|
|
125
|
+
operation,
|
|
126
|
+
typeSchemas: type.schemas,
|
|
127
|
+
zodSchemas: zod.schemas,
|
|
128
|
+
dataReturnType: options.client.dataReturnType,
|
|
129
|
+
paramsCasing: options.paramsCasing,
|
|
130
|
+
paramsType: options.paramsType,
|
|
131
|
+
pathParamsType: options.pathParamsType,
|
|
132
|
+
parser: options.parser
|
|
133
|
+
}),
|
|
134
|
+
options.mutation && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
135
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
136
|
+
name: ["useMutation"],
|
|
137
|
+
path: importPath
|
|
138
|
+
}),
|
|
139
|
+
/* @__PURE__ */ jsx(File.Import, {
|
|
140
|
+
name: ["UseMutationOptions", "QueryClient"],
|
|
141
|
+
path: importPath,
|
|
142
|
+
isTypeOnly: true
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ jsx(Mutation, {
|
|
145
|
+
name: mutation.name,
|
|
146
|
+
clientName: client.name,
|
|
147
|
+
typeName: mutation.typeName,
|
|
148
|
+
typeSchemas: type.schemas,
|
|
149
|
+
operation,
|
|
150
|
+
dataReturnType: options.client.dataReturnType,
|
|
151
|
+
paramsCasing: options.paramsCasing,
|
|
152
|
+
paramsType: options.paramsType,
|
|
153
|
+
pathParamsType: options.pathParamsType,
|
|
154
|
+
mutationKeyName: mutationKey.name
|
|
155
|
+
})
|
|
156
|
+
] })
|
|
157
|
+
]
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
//#endregion
|
|
13
163
|
//#region src/generators/queryGenerator.tsx
|
|
14
164
|
const queryGenerator = createReactGenerator({
|
|
15
165
|
name: "svelte-query",
|
|
@@ -158,7 +308,7 @@ const queryGenerator = createReactGenerator({
|
|
|
158
308
|
}),
|
|
159
309
|
options.query && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
160
310
|
/* @__PURE__ */ jsx(File.Import, {
|
|
161
|
-
name: ["
|
|
311
|
+
name: ["useQuery"],
|
|
162
312
|
path: importPath
|
|
163
313
|
}),
|
|
164
314
|
/* @__PURE__ */ jsx(File.Import, {
|
|
@@ -190,5 +340,5 @@ const queryGenerator = createReactGenerator({
|
|
|
190
340
|
});
|
|
191
341
|
|
|
192
342
|
//#endregion
|
|
193
|
-
export { queryGenerator };
|
|
194
|
-
//# sourceMappingURL=generators-
|
|
343
|
+
export { mutationGenerator, queryGenerator };
|
|
344
|
+
//# sourceMappingURL=generators-DRX-ix2A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-DRX-ix2A.js","names":[],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"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 { Mutation, MutationKey } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'solid-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n pluginManager,\n } = useApp<PluginSolidQuery>()\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/solid-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\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 pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.mutationKey}\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 {options.mutation && (\n <>\n <File.Import name={['useMutation']} path={importPath} />\n <File.Import name={['UseMutationOptions', '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 dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\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 { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'svelte-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n pluginManager,\n } = useApp<PluginSolidQuery>()\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(['post', 'put', 'delete', 'patch'], options.query ? options.query.methods : []).some((method) => operation.method === method)\n const importPath = options.query ? options.query.importPath : '@tanstack/solid-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 <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.queryKey}\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={['useQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'UseBaseQueryOptions', 'UseQueryResult']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n paramsCasing={options.paramsCasing}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,oBAAoB,qBAAuC;CACtE,MAAM;CACN,UAAU,EAAE,SAAS,aAAa;EAChC,MAAM,EACJ,QAAQ,EACN,SAAS,EAAE,YAEb,kBACE,QAA0B;EAC9B,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,YAAY,qBAAqB;EAG9D,MAAM,aACJ,EAFc,CAAC,CAAC,QAAQ,SAAS,QAAQ,OAAO,QAAQ,MAAM,WAAW,UAAU,WAAW,OAAO,KAGrG,WAAW,QAAQ,WAAW,QAAQ,SAAS,UAAU,EAAE,EAAE,QAAQ,QAAQ,QAAQ,MAAM,UAAU,EAAE,CAAC,CAAC,MAAM,WAAW,UAAU,WAAW,OAAO;EAExJ,MAAM,aAAa,QAAQ,WAAW,QAAQ,SAAS,aAAa;EAEpE,MAAM,WAAW;GACf,MAAM,QAAQ,WAAW;IAAE,MAAM;IAAY,QAAQ;IAAO,CAAC;GAC7D,UAAU,QAAQ,WAAW,EAAE,MAAM,QAAQ,CAAC;GAC9C,MAAM,QAAQ,WAAW,EAAE,QAAQ,OAAO,CAAC;GAC5C;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,CAAC;GAEvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,aAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;EAED,MAAM,MAAM;GACV,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,cAAc,EAAE,CAAC;GACxD,SAAS,WAAW,WAAW;IAAE,WAAW,CA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KACtB,gBAAgB,QAAQ;KACxB,aAAa,KAAK;KAClB,aAAa,QAAQ;MACrB;IACD,CAAC,mBACA,oBAAC;KACC,MAAM,OAAO;KACb,SAAS,QAAQ,OAAO;KACb;KACX,aAAa,KAAK;KAClB,YAAY,IAAI;KAChB,gBAAgB,QAAQ,OAAO;KAC/B,cAAc,QAAQ;KACtB,YAAY,QAAQ;KACpB,gBAAgB,QAAQ;KACxB,QAAQ,QAAQ;MAChB;IAEJ,oBAAC,KAAK;KAAO,MAAM,CAAC,eAAe;KAAE,MAAM;MAAc;IACzD,oBAAC;KACC,MAAM,aAAa;KACnB,YAAY,OAAO;KACnB,cAAc,SAAS;KACvB,aAAa,KAAK;KAClB,cAAc,QAAQ;KACtB,YAAY,QAAQ;KACpB,gBAAgB,QAAQ;KACxB,gBAAgB,QAAQ,OAAO;MAC/B;IACD,QAAQ,SACP;KACE,oBAAC,KAAK;MAAO,MAAM,CAAC,WAAW;MAAE,MAAM;OAAc;KACrD,oBAAC,KAAK;MAAO,MAAM;OAAC;OAAY;OAAe;OAAuB;OAAiB;MAAE,MAAM;MAAY;OAAa;KACxH,oBAAC;MACC,MAAM,MAAM;MACZ,kBAAkB,aAAa;MAC/B,aAAa,KAAK;MAClB,YAAY,QAAQ;MACpB,gBAAgB,QAAQ;MACb;MACX,cAAc,QAAQ;MACtB,gBAAgB,QAAQ,OAAO;MAC/B,cAAc,SAAS;MACvB,kBAAkB,SAAS;OAC3B;QACD;;IAEA;;CAGZ,CAAC"}
|
package/dist/generators.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
require('./components-
|
|
2
|
-
const require_generators = require('./generators-
|
|
1
|
+
require('./components-CrpQqUQQ.cjs');
|
|
2
|
+
const require_generators = require('./generators-CUcA3_rk.cjs');
|
|
3
3
|
|
|
4
|
+
exports.mutationGenerator = require_generators.mutationGenerator;
|
|
4
5
|
exports.queryGenerator = require_generators.queryGenerator;
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { Generator, PluginSolidQuery } from "./types-
|
|
1
|
+
import { Generator, PluginSolidQuery } from "./types-BI1GJc6y.cjs";
|
|
2
2
|
|
|
3
|
+
//#region src/generators/mutationGenerator.d.ts
|
|
4
|
+
declare const mutationGenerator: Generator<PluginSolidQuery>;
|
|
5
|
+
//#endregion
|
|
3
6
|
//#region src/generators/queryGenerator.d.ts
|
|
4
7
|
declare const queryGenerator: Generator<PluginSolidQuery>;
|
|
5
8
|
//#endregion
|
|
6
|
-
export { queryGenerator };
|
|
9
|
+
export { mutationGenerator, queryGenerator };
|
|
7
10
|
//# sourceMappingURL=generators.d.cts.map
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { Generator, PluginSolidQuery } from "./types-
|
|
1
|
+
import { Generator, PluginSolidQuery } from "./types-fv5KLGsJ.js";
|
|
2
2
|
|
|
3
|
+
//#region src/generators/mutationGenerator.d.ts
|
|
4
|
+
declare const mutationGenerator: Generator<PluginSolidQuery>;
|
|
5
|
+
//#endregion
|
|
3
6
|
//#region src/generators/queryGenerator.d.ts
|
|
4
7
|
declare const queryGenerator: Generator<PluginSolidQuery>;
|
|
5
8
|
//#endregion
|
|
6
|
-
export { queryGenerator };
|
|
9
|
+
export { mutationGenerator, queryGenerator };
|
|
7
10
|
//# sourceMappingURL=generators.d.ts.map
|
package/dist/generators.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./components-
|
|
2
|
-
import { queryGenerator } from "./generators-
|
|
1
|
+
import "./components-JN6XAKh3.js";
|
|
2
|
+
import { mutationGenerator, queryGenerator } from "./generators-DRX-ix2A.js";
|
|
3
3
|
|
|
4
|
-
export { queryGenerator };
|
|
4
|
+
export { mutationGenerator, queryGenerator };
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_components = require('./components-
|
|
2
|
-
const require_generators = require('./generators-
|
|
1
|
+
const require_components = require('./components-CrpQqUQQ.cjs');
|
|
2
|
+
const require_generators = require('./generators-CUcA3_rk.cjs');
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_components.__toESM(node_path);
|
|
5
5
|
let __kubb_core = require("@kubb/core");
|
|
@@ -19,7 +19,7 @@ const pluginSolidQuery = (0, __kubb_core.createPlugin)((options) => {
|
|
|
19
19
|
const { output = {
|
|
20
20
|
path: "hooks",
|
|
21
21
|
barrelType: "named"
|
|
22
|
-
}, group, exclude = [], include, override = [], parser = "client", transformers = {}, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", queryKey = require_components.QueryKey.getTransformer, generators = [require_generators.queryGenerator].filter(Boolean), query = {}, paramsCasing, contentType } = options;
|
|
22
|
+
}, group, exclude = [], include, override = [], parser = "client", transformers = {}, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", queryKey = require_components.QueryKey.getTransformer, generators = [require_generators.queryGenerator, require_generators.mutationGenerator].filter(Boolean), mutation = {}, query = {}, mutationKey = require_components.MutationKey.getTransformer, paramsCasing, contentType } = options;
|
|
23
23
|
return {
|
|
24
24
|
name: pluginSolidQueryName,
|
|
25
25
|
options: {
|
|
@@ -36,6 +36,17 @@ const pluginSolidQuery = (0, __kubb_core.createPlugin)((options) => {
|
|
|
36
36
|
importPath: "@tanstack/solid-query",
|
|
37
37
|
...query
|
|
38
38
|
},
|
|
39
|
+
mutationKey,
|
|
40
|
+
mutation: {
|
|
41
|
+
methods: [
|
|
42
|
+
"post",
|
|
43
|
+
"put",
|
|
44
|
+
"patch",
|
|
45
|
+
"delete"
|
|
46
|
+
],
|
|
47
|
+
importPath: "@tanstack/solid-query",
|
|
48
|
+
...mutation
|
|
49
|
+
},
|
|
39
50
|
paramsType,
|
|
40
51
|
pathParamsType,
|
|
41
52
|
parser,
|