@kubb/plugin-solid-query 3.18.3 → 4.0.2
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-CCkbce4B.cjs → components-CrpQqUQQ.cjs} +194 -14
- package/dist/components-CrpQqUQQ.cjs.map +1 -0
- package/dist/{components-DteoGXDw.js → components-JN6XAKh3.js} +172 -10
- 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-CUcA3_rk.cjs +365 -0
- package/dist/generators-CUcA3_rk.cjs.map +1 -0
- package/dist/{generators-D4zsCZ8Y.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 +29 -14
- 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 +17 -8
- 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 +11 -12
- 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-CCkbce4B.cjs.map +0 -1
- package/dist/components-DteoGXDw.js.map +0 -1
- package/dist/generators-D4zsCZ8Y.js.map +0 -1
- package/dist/generators-yp4-76zC.cjs +0 -199
- package/dist/generators-yp4-76zC.cjs.map +0 -1
|
@@ -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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AAQ;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,11 +1,17 @@
|
|
|
1
|
-
const require_components = require('./components-
|
|
2
|
-
const require_generators = require('./generators-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const require_components = require('./components-CrpQqUQQ.cjs');
|
|
2
|
+
const require_generators = require('./generators-CUcA3_rk.cjs');
|
|
3
|
+
let node_path = require("node:path");
|
|
4
|
+
node_path = require_components.__toESM(node_path);
|
|
5
|
+
let __kubb_core = require("@kubb/core");
|
|
6
|
+
__kubb_core = require_components.__toESM(__kubb_core);
|
|
7
|
+
let __kubb_core_transformers = require("@kubb/core/transformers");
|
|
8
|
+
__kubb_core_transformers = require_components.__toESM(__kubb_core_transformers);
|
|
9
|
+
let __kubb_plugin_oas = require("@kubb/plugin-oas");
|
|
10
|
+
__kubb_plugin_oas = require_components.__toESM(__kubb_plugin_oas);
|
|
11
|
+
let __kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
12
|
+
__kubb_plugin_ts = require_components.__toESM(__kubb_plugin_ts);
|
|
13
|
+
let __kubb_plugin_zod = require("@kubb/plugin-zod");
|
|
14
|
+
__kubb_plugin_zod = require_components.__toESM(__kubb_plugin_zod);
|
|
9
15
|
|
|
10
16
|
//#region src/plugin.ts
|
|
11
17
|
const pluginSolidQueryName = "plugin-solid-query";
|
|
@@ -13,7 +19,7 @@ const pluginSolidQuery = (0, __kubb_core.createPlugin)((options) => {
|
|
|
13
19
|
const { output = {
|
|
14
20
|
path: "hooks",
|
|
15
21
|
barrelType: "named"
|
|
16
|
-
}, 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;
|
|
17
23
|
return {
|
|
18
24
|
name: pluginSolidQueryName,
|
|
19
25
|
options: {
|
|
@@ -30,6 +36,17 @@ const pluginSolidQuery = (0, __kubb_core.createPlugin)((options) => {
|
|
|
30
36
|
importPath: "@tanstack/solid-query",
|
|
31
37
|
...query
|
|
32
38
|
},
|
|
39
|
+
mutationKey,
|
|
40
|
+
mutation: {
|
|
41
|
+
methods: [
|
|
42
|
+
"post",
|
|
43
|
+
"put",
|
|
44
|
+
"patch",
|
|
45
|
+
"delete"
|
|
46
|
+
],
|
|
47
|
+
importPath: "@tanstack/solid-query",
|
|
48
|
+
...mutation
|
|
49
|
+
},
|
|
33
50
|
paramsType,
|
|
34
51
|
pathParamsType,
|
|
35
52
|
parser,
|
|
@@ -43,8 +60,7 @@ const pluginSolidQuery = (0, __kubb_core.createPlugin)((options) => {
|
|
|
43
60
|
].filter(Boolean),
|
|
44
61
|
resolvePath(baseName, pathMode, options$1) {
|
|
45
62
|
const root = node_path.default.resolve(this.config.root, this.config.output.path);
|
|
46
|
-
|
|
47
|
-
if (mode === "single")
|
|
63
|
+
if ((pathMode ?? __kubb_core.FileManager.getMode(node_path.default.resolve(root, output.path))) === "single")
|
|
48
64
|
/**
|
|
49
65
|
* when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
|
|
50
66
|
* Other plugins then need to call addOrAppend instead of just add from the fileManager class
|
|
@@ -73,7 +89,7 @@ const pluginSolidQuery = (0, __kubb_core.createPlugin)((options) => {
|
|
|
73
89
|
const mode = __kubb_core.FileManager.getMode(node_path.default.resolve(root, output.path));
|
|
74
90
|
const baseURL = await swaggerPlugin.context.getBaseURL();
|
|
75
91
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
76
|
-
const
|
|
92
|
+
const files = await new __kubb_plugin_oas.OperationGenerator(this.plugin.options, {
|
|
77
93
|
oas,
|
|
78
94
|
pluginManager: this.pluginManager,
|
|
79
95
|
plugin: this.plugin,
|
|
@@ -82,8 +98,7 @@ const pluginSolidQuery = (0, __kubb_core.createPlugin)((options) => {
|
|
|
82
98
|
include,
|
|
83
99
|
override,
|
|
84
100
|
mode
|
|
85
|
-
});
|
|
86
|
-
const files = await operationGenerator.build(...generators);
|
|
101
|
+
}).build(...generators);
|
|
87
102
|
await this.addFile(...files);
|
|
88
103
|
const barrelFiles = await this.fileManager.getBarrelFiles({
|
|
89
104
|
type: output.barrelType ?? "named",
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["QueryKey","queryGenerator","pluginOasName","pluginTsName","pluginZodName","path","FileManager","options","groupName: Group['name']","PluginManager","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["QueryKey","queryGenerator","mutationGenerator","MutationKey","pluginOasName","pluginTsName","pluginZodName","path","FileManager","options","groupName: Group['name']","PluginManager","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport type { Plugin } from '@kubb/core'\nimport { createPlugin, FileManager, type Group, PluginManager } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = createPlugin<PluginSolidQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, mutationGenerator].filter(Boolean),\n mutation = {},\n query = {},\n mutationKey = MutationKey.getTransformer,\n paramsCasing,\n contentType,\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n pathParamsType,\n ...options.client,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/solid-query',\n ...query,\n },\n mutationKey,\n mutation: {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/solid-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n group,\n paramsCasing,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.add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,GAAG,YAAY;;EAErC;EACD"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Options, PluginSolidQuery, UserPluginWithLifeCycle } from "./types-
|
|
1
|
+
import { Options, PluginSolidQuery, UserPluginWithLifeCycle } from "./types-BI1GJc6y.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginSolidQueryName = "plugin-solid-query";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Options, PluginSolidQuery, UserPluginWithLifeCycle } from "./types-
|
|
1
|
+
import { Options, PluginSolidQuery, UserPluginWithLifeCycle } from "./types-fv5KLGsJ.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginSolidQueryName = "plugin-solid-query";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { QueryKey } from "./components-
|
|
2
|
-
import { queryGenerator } from "./generators-
|
|
1
|
+
import { MutationKey, QueryKey } from "./components-JN6XAKh3.js";
|
|
2
|
+
import { mutationGenerator, queryGenerator } from "./generators-DRX-ix2A.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { FileManager, PluginManager, createPlugin } from "@kubb/core";
|
|
5
5
|
import { camelCase, pascalCase } from "@kubb/core/transformers";
|
|
@@ -13,7 +13,7 @@ const pluginSolidQuery = createPlugin((options) => {
|
|
|
13
13
|
const { output = {
|
|
14
14
|
path: "hooks",
|
|
15
15
|
barrelType: "named"
|
|
16
|
-
}, group, exclude = [], include, override = [], parser = "client", transformers = {}, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", queryKey = QueryKey.getTransformer, generators = [queryGenerator].filter(Boolean), query = {}, paramsCasing, contentType } = options;
|
|
16
|
+
}, group, exclude = [], include, override = [], parser = "client", transformers = {}, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", queryKey = QueryKey.getTransformer, generators = [queryGenerator, mutationGenerator].filter(Boolean), mutation = {}, query = {}, mutationKey = MutationKey.getTransformer, paramsCasing, contentType } = options;
|
|
17
17
|
return {
|
|
18
18
|
name: pluginSolidQueryName,
|
|
19
19
|
options: {
|
|
@@ -30,6 +30,17 @@ const pluginSolidQuery = createPlugin((options) => {
|
|
|
30
30
|
importPath: "@tanstack/solid-query",
|
|
31
31
|
...query
|
|
32
32
|
},
|
|
33
|
+
mutationKey,
|
|
34
|
+
mutation: {
|
|
35
|
+
methods: [
|
|
36
|
+
"post",
|
|
37
|
+
"put",
|
|
38
|
+
"patch",
|
|
39
|
+
"delete"
|
|
40
|
+
],
|
|
41
|
+
importPath: "@tanstack/solid-query",
|
|
42
|
+
...mutation
|
|
43
|
+
},
|
|
33
44
|
paramsType,
|
|
34
45
|
pathParamsType,
|
|
35
46
|
parser,
|
|
@@ -43,8 +54,7 @@ const pluginSolidQuery = createPlugin((options) => {
|
|
|
43
54
|
].filter(Boolean),
|
|
44
55
|
resolvePath(baseName, pathMode, options$1) {
|
|
45
56
|
const root = path.resolve(this.config.root, this.config.output.path);
|
|
46
|
-
|
|
47
|
-
if (mode === "single")
|
|
57
|
+
if ((pathMode ?? FileManager.getMode(path.resolve(root, output.path))) === "single")
|
|
48
58
|
/**
|
|
49
59
|
* when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
|
|
50
60
|
* Other plugins then need to call addOrAppend instead of just add from the fileManager class
|
|
@@ -73,7 +83,7 @@ const pluginSolidQuery = createPlugin((options) => {
|
|
|
73
83
|
const mode = FileManager.getMode(path.resolve(root, output.path));
|
|
74
84
|
const baseURL = await swaggerPlugin.context.getBaseURL();
|
|
75
85
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
76
|
-
const
|
|
86
|
+
const files = await new OperationGenerator(this.plugin.options, {
|
|
77
87
|
oas,
|
|
78
88
|
pluginManager: this.pluginManager,
|
|
79
89
|
plugin: this.plugin,
|
|
@@ -82,8 +92,7 @@ const pluginSolidQuery = createPlugin((options) => {
|
|
|
82
92
|
include,
|
|
83
93
|
override,
|
|
84
94
|
mode
|
|
85
|
-
});
|
|
86
|
-
const files = await operationGenerator.build(...generators);
|
|
95
|
+
}).build(...generators);
|
|
87
96
|
await this.addFile(...files);
|
|
88
97
|
const barrelFiles = await this.fileManager.getBarrelFiles({
|
|
89
98
|
type: output.barrelType ?? "named",
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\
|
|
1
|
+
{"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport type { Plugin } from '@kubb/core'\nimport { createPlugin, FileManager, type Group, PluginManager } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = createPlugin<PluginSolidQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, mutationGenerator].filter(Boolean),\n mutation = {},\n query = {},\n mutationKey = MutationKey.getTransformer,\n paramsCasing,\n contentType,\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n pathParamsType,\n ...options.client,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/solid-query',\n ...query,\n },\n mutationKey,\n mutation: {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/solid-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n group,\n paramsCasing,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;AAYA,MAAa,uBAAuB;AAEpC,MAAa,mBAAmB,cAAgC,YAAY;CAC1E,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,WAAW,SAAS,gBACpB,aAAa,CAAC,gBAAgB,kBAAkB,CAAC,OAAO,QAAQ,EAChE,WAAW,EAAE,EACb,QAAQ,EAAE,EACV,cAAc,YAAY,gBAC1B,cACA,gBACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,QAAQ;IACN,YAAY;IACZ,gBAAgB;IAChB;IACA,GAAG,QAAQ;IACZ;GACD;GACA,OACE,UAAU,QACN,QACA;IACE,SAAS,CAAC,MAAM;IAChB,YAAY;IACZ,GAAG;IACJ;GACP;GACA,UAAU;IACR,SAAS;KAAC;KAAQ;KAAO;KAAS;KAAS;IAC3C,YAAY;IACZ,GAAG;IACJ;GACD;GACA;GACA;GACA;GACA;GACD;EACD,KAAK;GAAC;GAAe;GAAc,WAAW,QAAQ,gBAAgB;GAAU,CAAC,OAAO,QAAQ;EAChG,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,YAAY,YAAY,QA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IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,MAAM,KAAK,YAAY,eAAe;IACxD,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,QAAQ,GAAG,YAAY;;EAErC;EACD"}
|
|
@@ -1254,6 +1254,10 @@ type Transformer = (props: TransformerProps) => unknown[];
|
|
|
1254
1254
|
* Customize the queryKey
|
|
1255
1255
|
*/
|
|
1256
1256
|
type QueryKey = Transformer;
|
|
1257
|
+
/**
|
|
1258
|
+
* Customize the mutationKey
|
|
1259
|
+
*/
|
|
1260
|
+
type MutationKey = Transformer;
|
|
1257
1261
|
type Query = {
|
|
1258
1262
|
/**
|
|
1259
1263
|
* Define which HttpMethods can be used for queries
|
|
@@ -1269,6 +1273,21 @@ type Query = {
|
|
|
1269
1273
|
*/
|
|
1270
1274
|
importPath?: string;
|
|
1271
1275
|
};
|
|
1276
|
+
type Mutation = {
|
|
1277
|
+
/**
|
|
1278
|
+
* Define which HttpMethods can be used for mutations
|
|
1279
|
+
* @default ['post', 'put', 'delete']
|
|
1280
|
+
*/
|
|
1281
|
+
methods: Array<HttpMethod>;
|
|
1282
|
+
/**
|
|
1283
|
+
* Path to the useQuery that will be used to do the useQuery functionality.
|
|
1284
|
+
* It will be used as `import { useQuery } from '${importPath}'`.
|
|
1285
|
+
* It allows both relative and absolute path.
|
|
1286
|
+
* the path will be applied as is, so relative path should be based on the file being generated.
|
|
1287
|
+
* @default '@tanstack/solid-query'
|
|
1288
|
+
*/
|
|
1289
|
+
importPath?: string;
|
|
1290
|
+
};
|
|
1272
1291
|
type Options$1 = {
|
|
1273
1292
|
/**
|
|
1274
1293
|
* Specify the export location for the files and define the behavior of the output
|
|
@@ -1325,6 +1344,11 @@ type Options$1 = {
|
|
|
1325
1344
|
* Which parser should be used before returning the data to `@tanstack/query`.
|
|
1326
1345
|
* `'zod'` will use `@kubb/plugin-zod` to parse the data.
|
|
1327
1346
|
*/
|
|
1347
|
+
mutationKey?: MutationKey;
|
|
1348
|
+
/**
|
|
1349
|
+
* Override some useMutation behaviours.
|
|
1350
|
+
*/
|
|
1351
|
+
mutation?: Partial<Mutation> | false;
|
|
1328
1352
|
parser?: PluginClient['options']['parser'];
|
|
1329
1353
|
transformers?: {
|
|
1330
1354
|
/**
|
|
@@ -1349,8 +1373,10 @@ type ResolvedOptions = {
|
|
|
1349
1373
|
pathParamsType: NonNullable<Options$1['pathParamsType']>;
|
|
1350
1374
|
queryKey: QueryKey | undefined;
|
|
1351
1375
|
query: NonNullable<Required<Query>> | false;
|
|
1376
|
+
mutationKey: MutationKey | undefined;
|
|
1377
|
+
mutation: NonNullable<Required<Mutation>> | false;
|
|
1352
1378
|
};
|
|
1353
1379
|
type PluginSolidQuery = PluginFactoryOptions<'plugin-solid-query', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1354
1380
|
//#endregion
|
|
1355
1381
|
export { Generator, type Operation$1 as Operation, OperationSchemas, Options$1 as Options, PluginSolidQuery, Transformer, UserPluginWithLifeCycle };
|
|
1356
|
-
//# sourceMappingURL=types-
|
|
1382
|
+
//# sourceMappingURL=types-BI1GJc6y.d.cts.map
|
|
@@ -1254,6 +1254,10 @@ type Transformer = (props: TransformerProps) => unknown[];
|
|
|
1254
1254
|
* Customize the queryKey
|
|
1255
1255
|
*/
|
|
1256
1256
|
type QueryKey = Transformer;
|
|
1257
|
+
/**
|
|
1258
|
+
* Customize the mutationKey
|
|
1259
|
+
*/
|
|
1260
|
+
type MutationKey = Transformer;
|
|
1257
1261
|
type Query = {
|
|
1258
1262
|
/**
|
|
1259
1263
|
* Define which HttpMethods can be used for queries
|
|
@@ -1269,6 +1273,21 @@ type Query = {
|
|
|
1269
1273
|
*/
|
|
1270
1274
|
importPath?: string;
|
|
1271
1275
|
};
|
|
1276
|
+
type Mutation = {
|
|
1277
|
+
/**
|
|
1278
|
+
* Define which HttpMethods can be used for mutations
|
|
1279
|
+
* @default ['post', 'put', 'delete']
|
|
1280
|
+
*/
|
|
1281
|
+
methods: Array<HttpMethod>;
|
|
1282
|
+
/**
|
|
1283
|
+
* Path to the useQuery that will be used to do the useQuery functionality.
|
|
1284
|
+
* It will be used as `import { useQuery } from '${importPath}'`.
|
|
1285
|
+
* It allows both relative and absolute path.
|
|
1286
|
+
* the path will be applied as is, so relative path should be based on the file being generated.
|
|
1287
|
+
* @default '@tanstack/solid-query'
|
|
1288
|
+
*/
|
|
1289
|
+
importPath?: string;
|
|
1290
|
+
};
|
|
1272
1291
|
type Options$1 = {
|
|
1273
1292
|
/**
|
|
1274
1293
|
* Specify the export location for the files and define the behavior of the output
|
|
@@ -1325,6 +1344,11 @@ type Options$1 = {
|
|
|
1325
1344
|
* Which parser should be used before returning the data to `@tanstack/query`.
|
|
1326
1345
|
* `'zod'` will use `@kubb/plugin-zod` to parse the data.
|
|
1327
1346
|
*/
|
|
1347
|
+
mutationKey?: MutationKey;
|
|
1348
|
+
/**
|
|
1349
|
+
* Override some useMutation behaviours.
|
|
1350
|
+
*/
|
|
1351
|
+
mutation?: Partial<Mutation> | false;
|
|
1328
1352
|
parser?: PluginClient['options']['parser'];
|
|
1329
1353
|
transformers?: {
|
|
1330
1354
|
/**
|
|
@@ -1349,8 +1373,10 @@ type ResolvedOptions = {
|
|
|
1349
1373
|
pathParamsType: NonNullable<Options$1['pathParamsType']>;
|
|
1350
1374
|
queryKey: QueryKey | undefined;
|
|
1351
1375
|
query: NonNullable<Required<Query>> | false;
|
|
1376
|
+
mutationKey: MutationKey | undefined;
|
|
1377
|
+
mutation: NonNullable<Required<Mutation>> | false;
|
|
1352
1378
|
};
|
|
1353
1379
|
type PluginSolidQuery = PluginFactoryOptions<'plugin-solid-query', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1354
1380
|
//#endregion
|
|
1355
1381
|
export { Generator, type Operation$1 as Operation, OperationSchemas, Options$1 as Options, PluginSolidQuery, Transformer, UserPluginWithLifeCycle };
|
|
1356
|
-
//# sourceMappingURL=types-
|
|
1382
|
+
//# sourceMappingURL=types-fv5KLGsJ.d.ts.map
|