@kubb/plugin-swr 3.0.14 → 3.2.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/{chunk-23A6KPTG.js → chunk-4EFF327C.js} +10 -3
- package/dist/chunk-4EFF327C.js.map +1 -0
- package/dist/{chunk-ZO4CRCE6.cjs → chunk-4ZIGOWYH.cjs} +15 -8
- package/dist/chunk-4ZIGOWYH.cjs.map +1 -0
- package/dist/{chunk-HOCARL2F.js → chunk-7ELDJ4IB.js} +33 -24
- package/dist/chunk-7ELDJ4IB.js.map +1 -0
- package/dist/{chunk-442Q5BKM.cjs → chunk-DJ57MWSH.cjs} +33 -24
- package/dist/chunk-DJ57MWSH.cjs.map +1 -0
- package/dist/components.cjs +6 -6
- package/dist/components.d.cts +15 -8
- package/dist/components.d.ts +15 -8
- package/dist/components.js +1 -1
- package/dist/generators.cjs +4 -4
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +18 -10
- 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 +16 -8
- package/dist/index.js.map +1 -1
- package/dist/{types-AhGZx7jH.d.cts → types-CwvU4w1t.d.cts} +16 -0
- package/dist/{types-AhGZx7jH.d.ts → types-CwvU4w1t.d.ts} +16 -0
- package/package.json +12 -12
- package/src/components/Mutation.tsx +7 -2
- package/src/components/MutationKey.tsx +5 -4
- package/src/components/Query.tsx +9 -3
- package/src/components/QueryKey.tsx +9 -6
- package/src/components/QueryOptions.tsx +8 -5
- package/src/generators/mutationGenerator.tsx +3 -0
- package/src/generators/queryGenerator.tsx +4 -0
- package/src/plugin.ts +16 -6
- package/src/types.ts +8 -0
- package/dist/chunk-23A6KPTG.js.map +0 -1
- package/dist/chunk-442Q5BKM.cjs.map +0 -1
- package/dist/chunk-HOCARL2F.js.map +0 -1
- package/dist/chunk-ZO4CRCE6.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QueryKey, QueryOptions, Query, MutationKey, Mutation } from './chunk-
|
|
1
|
+
import { QueryKey, QueryOptions, Query, MutationKey, Mutation } from './chunk-7ELDJ4IB.js';
|
|
2
2
|
import '@kubb/plugin-client';
|
|
3
3
|
import { Client } from '@kubb/plugin-client/components';
|
|
4
4
|
import { createReactGenerator } from '@kubb/plugin-oas';
|
|
@@ -79,6 +79,7 @@ var queryGenerator = createReactGenerator({
|
|
|
79
79
|
operation,
|
|
80
80
|
pathParamsType: options.pathParamsType,
|
|
81
81
|
typeSchemas: type.schemas,
|
|
82
|
+
paramsCasing: options.paramsCasing,
|
|
82
83
|
transformer: options.queryKey
|
|
83
84
|
}
|
|
84
85
|
),
|
|
@@ -93,6 +94,7 @@ var queryGenerator = createReactGenerator({
|
|
|
93
94
|
typeSchemas: type.schemas,
|
|
94
95
|
zodSchemas: zod.schemas,
|
|
95
96
|
dataReturnType: options.client.dataReturnType,
|
|
97
|
+
paramsCasing: options.paramsCasing,
|
|
96
98
|
paramsType: options.paramsType,
|
|
97
99
|
pathParamsType: options.pathParamsType,
|
|
98
100
|
parser: options.parser
|
|
@@ -105,6 +107,7 @@ var queryGenerator = createReactGenerator({
|
|
|
105
107
|
clientName: client.name,
|
|
106
108
|
typeSchemas: type.schemas,
|
|
107
109
|
paramsType: options.paramsType,
|
|
110
|
+
paramsCasing: options.paramsCasing,
|
|
108
111
|
pathParamsType: options.pathParamsType
|
|
109
112
|
}
|
|
110
113
|
),
|
|
@@ -122,6 +125,7 @@ var queryGenerator = createReactGenerator({
|
|
|
122
125
|
operation,
|
|
123
126
|
dataReturnType: options.client.dataReturnType,
|
|
124
127
|
queryKeyName: queryKey.name,
|
|
128
|
+
paramsCasing: options.paramsCasing,
|
|
125
129
|
queryKeyTypeName: queryKey.typeName
|
|
126
130
|
}
|
|
127
131
|
)
|
|
@@ -195,6 +199,7 @@ var mutationGenerator = createReactGenerator({
|
|
|
195
199
|
operation,
|
|
196
200
|
pathParamsType: options.pathParamsType,
|
|
197
201
|
typeSchemas: type.schemas,
|
|
202
|
+
paramsCasing: options.paramsCasing,
|
|
198
203
|
transformer: options.mutationKey
|
|
199
204
|
}
|
|
200
205
|
),
|
|
@@ -209,6 +214,7 @@ var mutationGenerator = createReactGenerator({
|
|
|
209
214
|
typeSchemas: type.schemas,
|
|
210
215
|
zodSchemas: zod.schemas,
|
|
211
216
|
dataReturnType: options.client.dataReturnType,
|
|
217
|
+
paramsCasing: options.paramsCasing,
|
|
212
218
|
paramsType: options.paramsType,
|
|
213
219
|
pathParamsType: options.pathParamsType,
|
|
214
220
|
parser: options.parser
|
|
@@ -224,6 +230,7 @@ var mutationGenerator = createReactGenerator({
|
|
|
224
230
|
operation,
|
|
225
231
|
dataReturnType: options.client.dataReturnType,
|
|
226
232
|
paramsType: options.paramsType,
|
|
233
|
+
paramsCasing: options.paramsCasing,
|
|
227
234
|
pathParamsType: options.pathParamsType,
|
|
228
235
|
mutationKeyName: mutationKey.name,
|
|
229
236
|
mutationKeyTypeName: mutationKey.typeName
|
|
@@ -234,5 +241,5 @@ var mutationGenerator = createReactGenerator({
|
|
|
234
241
|
});
|
|
235
242
|
|
|
236
243
|
export { mutationGenerator, queryGenerator };
|
|
237
|
-
//# sourceMappingURL=chunk-
|
|
238
|
-
//# sourceMappingURL=chunk-
|
|
244
|
+
//# sourceMappingURL=chunk-4EFF327C.js.map
|
|
245
|
+
//# sourceMappingURL=chunk-4EFF327C.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generators/queryGenerator.tsx","../src/generators/mutationGenerator.tsx"],"names":["createReactGenerator","useApp","useOperationManager","difference","pluginTsName","pluginZodName","jsxs","File","jsx","Client"],"mappings":";;;;;;;;;;;AAYO,IAAM,iBAAiB,oBAAgC,CAAA;AAAA,EAC5D,IAAM,EAAA,WAAA;AAAA,EACN,SAAU,CAAA,EAAE,OAAS,EAAA,SAAA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AA;AAAA,UACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,UACxB,QAAQ,OAAQ,CAAA;AAAA;AAAA,OAClB;AAAA,MACC,OAAA,CAAQ,4BACPD,GAAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,MAAM,QAAS,CAAA,IAAA;AAAA,UACf,YAAY,MAAO,CAAA,IAAA;AAAA,UACnB,UAAU,QAAS,CAAA,QAAA;AAAA,UACnB,aAAa,IAAK,CAAA,OAAA;AAAA,UAClB,SAAA;AAAA,UACA,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,UAC/B,YAAY,OAAQ,CAAA,UAAA;AAAA,UACpB,cAAc,OAAQ,CAAA,YAAA;AAAA,UACtB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,UACxB,iBAAiB,WAAY,CAAA,IAAA;AAAA,UAC7B,qBAAqB,WAAY,CAAA;AAAA;AAAA;AACnC,KAEJ,EAAA,CAAA;AAAA;AAGN,CAAC","file":"chunk-4EFF327C.js","sourcesContent":["import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Query, QueryOptions } from '../components'\nimport { QueryKey } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSwr>({\n name: 'swr-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSwr>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const importPath = options.query ? options.query.importPath : 'swr/mutation'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}\n\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n\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 pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.queryKey}\n />\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n />\n {options.query && (\n <>\n <File.Import name=\"useSWR\" path={importPath} />\n <File.Import name={['SWRResponse']} 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 dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n paramsCasing={options.paramsCasing}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { MutationKey } from '../components'\nimport { Mutation } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSwr>({\n name: 'swr-mutation',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSwr>()\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 : 'swr'\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 client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const mutationKey = {\n name: getName(operation, { type: 'const', suffix: 'MutationKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),\n }\n\n if (!isMutation) {\n return null\n }\n\n return (\n <File baseName={mutation.file.baseName} path={mutation.file.path} meta={mutation.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={mutation.file.path} path={zod.file.path} />}\n <File.Import name=\"useSWRMutation\" path={importPath} />\n <File.Import name={['SWRMutationResponse']} path={importPath} isTypeOnly />\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', '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={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 <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n {options.mutation && (\n <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 paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n mutationKeyTypeName={mutationKey.typeName}\n />\n )}\n </File>\n )\n },\n})\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDJ57MWSH_cjs = require('./chunk-DJ57MWSH.cjs');
|
|
4
4
|
require('@kubb/plugin-client');
|
|
5
5
|
var components = require('@kubb/plugin-client/components');
|
|
6
6
|
var pluginOas = require('@kubb/plugin-oas');
|
|
@@ -74,13 +74,14 @@ var queryGenerator = pluginOas.createReactGenerator({
|
|
|
74
74
|
}
|
|
75
75
|
),
|
|
76
76
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
-
|
|
77
|
+
chunkDJ57MWSH_cjs.QueryKey,
|
|
78
78
|
{
|
|
79
79
|
name: queryKey.name,
|
|
80
80
|
typeName: queryKey.typeName,
|
|
81
81
|
operation,
|
|
82
82
|
pathParamsType: options.pathParamsType,
|
|
83
83
|
typeSchemas: type.schemas,
|
|
84
|
+
paramsCasing: options.paramsCasing,
|
|
84
85
|
transformer: options.queryKey
|
|
85
86
|
}
|
|
86
87
|
),
|
|
@@ -95,18 +96,20 @@ var queryGenerator = pluginOas.createReactGenerator({
|
|
|
95
96
|
typeSchemas: type.schemas,
|
|
96
97
|
zodSchemas: zod.schemas,
|
|
97
98
|
dataReturnType: options.client.dataReturnType,
|
|
99
|
+
paramsCasing: options.paramsCasing,
|
|
98
100
|
paramsType: options.paramsType,
|
|
99
101
|
pathParamsType: options.pathParamsType,
|
|
100
102
|
parser: options.parser
|
|
101
103
|
}
|
|
102
104
|
),
|
|
103
105
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
104
|
-
|
|
106
|
+
chunkDJ57MWSH_cjs.QueryOptions,
|
|
105
107
|
{
|
|
106
108
|
name: queryOptions.name,
|
|
107
109
|
clientName: client.name,
|
|
108
110
|
typeSchemas: type.schemas,
|
|
109
111
|
paramsType: options.paramsType,
|
|
112
|
+
paramsCasing: options.paramsCasing,
|
|
110
113
|
pathParamsType: options.pathParamsType
|
|
111
114
|
}
|
|
112
115
|
),
|
|
@@ -114,7 +117,7 @@ var queryGenerator = pluginOas.createReactGenerator({
|
|
|
114
117
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "useSWR", path: importPath }),
|
|
115
118
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["SWRResponse"], path: importPath, isTypeOnly: true }),
|
|
116
119
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
117
|
-
|
|
120
|
+
chunkDJ57MWSH_cjs.Query,
|
|
118
121
|
{
|
|
119
122
|
name: query.name,
|
|
120
123
|
queryOptionsName: queryOptions.name,
|
|
@@ -124,6 +127,7 @@ var queryGenerator = pluginOas.createReactGenerator({
|
|
|
124
127
|
operation,
|
|
125
128
|
dataReturnType: options.client.dataReturnType,
|
|
126
129
|
queryKeyName: queryKey.name,
|
|
130
|
+
paramsCasing: options.paramsCasing,
|
|
127
131
|
queryKeyTypeName: queryKey.typeName
|
|
128
132
|
}
|
|
129
133
|
)
|
|
@@ -190,13 +194,14 @@ var mutationGenerator = pluginOas.createReactGenerator({
|
|
|
190
194
|
}
|
|
191
195
|
),
|
|
192
196
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
193
|
-
|
|
197
|
+
chunkDJ57MWSH_cjs.MutationKey,
|
|
194
198
|
{
|
|
195
199
|
name: mutationKey.name,
|
|
196
200
|
typeName: mutationKey.typeName,
|
|
197
201
|
operation,
|
|
198
202
|
pathParamsType: options.pathParamsType,
|
|
199
203
|
typeSchemas: type.schemas,
|
|
204
|
+
paramsCasing: options.paramsCasing,
|
|
200
205
|
transformer: options.mutationKey
|
|
201
206
|
}
|
|
202
207
|
),
|
|
@@ -211,13 +216,14 @@ var mutationGenerator = pluginOas.createReactGenerator({
|
|
|
211
216
|
typeSchemas: type.schemas,
|
|
212
217
|
zodSchemas: zod.schemas,
|
|
213
218
|
dataReturnType: options.client.dataReturnType,
|
|
219
|
+
paramsCasing: options.paramsCasing,
|
|
214
220
|
paramsType: options.paramsType,
|
|
215
221
|
pathParamsType: options.pathParamsType,
|
|
216
222
|
parser: options.parser
|
|
217
223
|
}
|
|
218
224
|
),
|
|
219
225
|
options.mutation && /* @__PURE__ */ jsxRuntime.jsx(
|
|
220
|
-
|
|
226
|
+
chunkDJ57MWSH_cjs.Mutation,
|
|
221
227
|
{
|
|
222
228
|
name: mutation.name,
|
|
223
229
|
clientName: client.name,
|
|
@@ -226,6 +232,7 @@ var mutationGenerator = pluginOas.createReactGenerator({
|
|
|
226
232
|
operation,
|
|
227
233
|
dataReturnType: options.client.dataReturnType,
|
|
228
234
|
paramsType: options.paramsType,
|
|
235
|
+
paramsCasing: options.paramsCasing,
|
|
229
236
|
pathParamsType: options.pathParamsType,
|
|
230
237
|
mutationKeyName: mutationKey.name,
|
|
231
238
|
mutationKeyTypeName: mutationKey.typeName
|
|
@@ -237,5 +244,5 @@ var mutationGenerator = pluginOas.createReactGenerator({
|
|
|
237
244
|
|
|
238
245
|
exports.mutationGenerator = mutationGenerator;
|
|
239
246
|
exports.queryGenerator = queryGenerator;
|
|
240
|
-
//# sourceMappingURL=chunk-
|
|
241
|
-
//# sourceMappingURL=chunk-
|
|
247
|
+
//# sourceMappingURL=chunk-4ZIGOWYH.cjs.map
|
|
248
|
+
//# sourceMappingURL=chunk-4ZIGOWYH.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generators/queryGenerator.tsx","../src/generators/mutationGenerator.tsx"],"names":["createReactGenerator","useApp","useOperationManager","difference","pluginTsName","pluginZodName","File","jsx","QueryKey","Client","QueryOptions","jsxs","Fragment","Query","MutationKey","Mutation"],"mappings":";;;;;;;;;;;;;AAYO,IAAM,iB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,GAAI,CAAA,OAAA;AAAA,UAChB,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,UAC/B,cAAc,OAAQ,CAAA,YAAA;AAAA,UACtB,YAAY,OAAQ,CAAA,UAAA;AAAA,UACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,UACxB,QAAQ,OAAQ,CAAA;AAAA;AAAA,OAClB;AAAA,MACC,OAAA,CAAQ,4BACPF,cAAAA;AAAA,QAACQ,0BAAA;AAAA,QAAA;AAAA,UACC,MAAM,QAAS,CAAA,IAAA;AAAA,UACf,YAAY,MAAO,CAAA,IAAA;AAAA,UACnB,UAAU,QAAS,CAAA,QAAA;AAAA,UACnB,aAAa,IAAK,CAAA,OAAA;AAAA,UAClB,SAAA;AAAA,UACA,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,UAC/B,YAAY,OAAQ,CAAA,UAAA;AAAA,UACpB,cAAc,OAAQ,CAAA,YAAA;AAAA,UACtB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,UACxB,iBAAiB,WAAY,CAAA,IAAA;AAAA,UAC7B,qBAAqB,WAAY,CAAA;AAAA;AAAA;AACnC,KAEJ,EAAA,CAAA;AAAA;AAGN,CAAC","file":"chunk-4ZIGOWYH.cjs","sourcesContent":["import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Query, QueryOptions } from '../components'\nimport { QueryKey } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSwr>({\n name: 'swr-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSwr>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const importPath = options.query ? options.query.importPath : 'swr/mutation'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}\n\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n\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 pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.queryKey}\n />\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n />\n {options.query && (\n <>\n <File.Import name=\"useSWR\" path={importPath} />\n <File.Import name={['SWRResponse']} 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 dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n paramsCasing={options.paramsCasing}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { MutationKey } from '../components'\nimport { Mutation } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSwr>({\n name: 'swr-mutation',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSwr>()\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 : 'swr'\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 client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const mutationKey = {\n name: getName(operation, { type: 'const', suffix: 'MutationKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),\n }\n\n if (!isMutation) {\n return null\n }\n\n return (\n <File baseName={mutation.file.baseName} path={mutation.file.path} meta={mutation.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={mutation.file.path} path={zod.file.path} />}\n <File.Import name=\"useSWRMutation\" path={importPath} />\n <File.Import name={['SWRMutationResponse']} path={importPath} isTypeOnly />\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', '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={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 <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n {options.mutation && (\n <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 paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n mutationKeyTypeName={mutationKey.typeName}\n />\n )}\n </File>\n )\n },\n})\n"]}
|
|
@@ -9,13 +9,13 @@ import { jsxs, Fragment, jsx } from '@kubb/react/jsx-runtime';
|
|
|
9
9
|
function getParams({}) {
|
|
10
10
|
return FunctionParams.factory({});
|
|
11
11
|
}
|
|
12
|
-
var getTransformer = ({ operation }) => {
|
|
13
|
-
const path = new URLPath(operation.path);
|
|
12
|
+
var getTransformer = ({ operation, casing }) => {
|
|
13
|
+
const path = new URLPath(operation.path, { casing });
|
|
14
14
|
return [JSON.stringify({ url: path.path })].filter(Boolean);
|
|
15
15
|
};
|
|
16
|
-
function MutationKey({ name, typeSchemas, pathParamsType, operation, typeName, transformer = getTransformer }) {
|
|
16
|
+
function MutationKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }) {
|
|
17
17
|
const params = getParams({ pathParamsType, typeSchemas });
|
|
18
|
-
const keys = transformer({ operation, schemas: typeSchemas });
|
|
18
|
+
const keys = transformer({ operation, schemas: typeSchemas, casing: paramsCasing });
|
|
19
19
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20
20
|
/* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(Function.Arrow, { name, export: true, params: params.toConstructor(), singleLine: true, children: `[${keys.join(", ")}] as const` }) }),
|
|
21
21
|
/* @__PURE__ */ jsx(File.Source, { name: typeName, isExportable: true, isIndexable: true, isTypeOnly: true, children: /* @__PURE__ */ jsx(Type, { name: typeName, export: true, children: `ReturnType<typeof ${name}>` }) })
|
|
@@ -23,12 +23,12 @@ function MutationKey({ name, typeSchemas, pathParamsType, operation, typeName, t
|
|
|
23
23
|
}
|
|
24
24
|
MutationKey.getParams = getParams;
|
|
25
25
|
MutationKey.getTransformer = getTransformer;
|
|
26
|
-
function getParams2({ pathParamsType, dataReturnType, typeSchemas, mutationKeyTypeName }) {
|
|
26
|
+
function getParams2({ pathParamsType, paramsCasing, dataReturnType, typeSchemas, mutationKeyTypeName }) {
|
|
27
27
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
28
28
|
return FunctionParams.factory({
|
|
29
29
|
pathParams: {
|
|
30
30
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
31
|
-
children: getPathParams(typeSchemas.pathParams, { typed: true })
|
|
31
|
+
children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing })
|
|
32
32
|
},
|
|
33
33
|
params: typeSchemas.queryParams?.name ? {
|
|
34
34
|
type: typeSchemas.queryParams?.name,
|
|
@@ -56,6 +56,7 @@ function Mutation({
|
|
|
56
56
|
mutationKeyName,
|
|
57
57
|
mutationKeyTypeName,
|
|
58
58
|
paramsType,
|
|
59
|
+
paramsCasing,
|
|
59
60
|
pathParamsType,
|
|
60
61
|
dataReturnType,
|
|
61
62
|
typeSchemas,
|
|
@@ -74,12 +75,14 @@ function Mutation({
|
|
|
74
75
|
typeSchemas
|
|
75
76
|
});
|
|
76
77
|
const params = getParams2({
|
|
78
|
+
paramsCasing,
|
|
77
79
|
pathParamsType,
|
|
78
80
|
dataReturnType,
|
|
79
81
|
typeSchemas,
|
|
80
82
|
mutationKeyTypeName
|
|
81
83
|
});
|
|
82
84
|
const clientParams = Client.getParams({
|
|
85
|
+
paramsCasing,
|
|
83
86
|
paramsType,
|
|
84
87
|
typeSchemas,
|
|
85
88
|
pathParamsType
|
|
@@ -108,11 +111,11 @@ function Mutation({
|
|
|
108
111
|
}
|
|
109
112
|
) });
|
|
110
113
|
}
|
|
111
|
-
function getParams3({ pathParamsType, typeSchemas }) {
|
|
114
|
+
function getParams3({ pathParamsType, paramsCasing, typeSchemas }) {
|
|
112
115
|
return FunctionParams.factory({
|
|
113
116
|
pathParams: {
|
|
114
117
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
115
|
-
children: getPathParams(typeSchemas.pathParams, { typed: true })
|
|
118
|
+
children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing })
|
|
116
119
|
},
|
|
117
120
|
data: typeSchemas.request?.name ? {
|
|
118
121
|
type: typeSchemas.request?.name,
|
|
@@ -124,8 +127,8 @@ function getParams3({ pathParamsType, typeSchemas }) {
|
|
|
124
127
|
} : void 0
|
|
125
128
|
});
|
|
126
129
|
}
|
|
127
|
-
var getTransformer2 = ({ operation, schemas }) => {
|
|
128
|
-
const path = new URLPath(operation.path);
|
|
130
|
+
var getTransformer2 = ({ operation, schemas, casing }) => {
|
|
131
|
+
const path = new URLPath(operation.path, { casing });
|
|
129
132
|
const keys = [
|
|
130
133
|
path.toObject({
|
|
131
134
|
type: "path",
|
|
@@ -136,11 +139,12 @@ var getTransformer2 = ({ operation, schemas }) => {
|
|
|
136
139
|
].filter(Boolean);
|
|
137
140
|
return keys;
|
|
138
141
|
};
|
|
139
|
-
function QueryKey({ name, typeSchemas, pathParamsType, operation, typeName, transformer = getTransformer2 }) {
|
|
140
|
-
const params = getParams3({ pathParamsType, typeSchemas });
|
|
142
|
+
function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer2 }) {
|
|
143
|
+
const params = getParams3({ pathParamsType, paramsCasing, typeSchemas });
|
|
141
144
|
const keys = transformer({
|
|
142
145
|
operation,
|
|
143
|
-
schemas: typeSchemas
|
|
146
|
+
schemas: typeSchemas,
|
|
147
|
+
casing: paramsCasing
|
|
144
148
|
});
|
|
145
149
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
146
150
|
/* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(Function.Arrow, { name, export: true, params: params.toConstructor(), singleLine: true, children: `[${keys.join(", ")}] as const` }) }),
|
|
@@ -149,13 +153,13 @@ function QueryKey({ name, typeSchemas, pathParamsType, operation, typeName, tran
|
|
|
149
153
|
}
|
|
150
154
|
QueryKey.getParams = getParams3;
|
|
151
155
|
QueryKey.getTransformer = getTransformer2;
|
|
152
|
-
function getParams4({ paramsType, pathParamsType, typeSchemas }) {
|
|
156
|
+
function getParams4({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
153
157
|
if (paramsType === "object") {
|
|
154
158
|
return FunctionParams.factory({
|
|
155
159
|
data: {
|
|
156
160
|
mode: "object",
|
|
157
161
|
children: {
|
|
158
|
-
...getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
162
|
+
...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
159
163
|
data: typeSchemas.request?.name ? {
|
|
160
164
|
type: typeSchemas.request?.name,
|
|
161
165
|
optional: isOptional(typeSchemas.request?.schema)
|
|
@@ -179,7 +183,7 @@ function getParams4({ paramsType, pathParamsType, typeSchemas }) {
|
|
|
179
183
|
return FunctionParams.factory({
|
|
180
184
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
181
185
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
182
|
-
children: getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
186
|
+
children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
183
187
|
optional: isOptional(typeSchemas.pathParams?.schema)
|
|
184
188
|
} : void 0,
|
|
185
189
|
data: typeSchemas.request?.name ? {
|
|
@@ -200,9 +204,10 @@ function getParams4({ paramsType, pathParamsType, typeSchemas }) {
|
|
|
200
204
|
}
|
|
201
205
|
});
|
|
202
206
|
}
|
|
203
|
-
function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType }) {
|
|
204
|
-
const params = getParams4({ paramsType, pathParamsType, typeSchemas });
|
|
207
|
+
function QueryOptions({ name, clientName, typeSchemas, paramsCasing, paramsType, pathParamsType }) {
|
|
208
|
+
const params = getParams4({ paramsType, paramsCasing, pathParamsType, typeSchemas });
|
|
205
209
|
const clientParams = Client.getParams({
|
|
210
|
+
paramsCasing,
|
|
206
211
|
paramsType,
|
|
207
212
|
typeSchemas,
|
|
208
213
|
pathParamsType
|
|
@@ -216,14 +221,14 @@ function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsTyp
|
|
|
216
221
|
` }) });
|
|
217
222
|
}
|
|
218
223
|
QueryOptions.getParams = getParams4;
|
|
219
|
-
function getParams5({ paramsType, pathParamsType, dataReturnType, typeSchemas, queryKeyTypeName }) {
|
|
224
|
+
function getParams5({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas, queryKeyTypeName }) {
|
|
220
225
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
221
226
|
if (paramsType === "object") {
|
|
222
227
|
return FunctionParams.factory({
|
|
223
228
|
data: {
|
|
224
229
|
mode: "object",
|
|
225
230
|
children: {
|
|
226
|
-
...getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
231
|
+
...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
227
232
|
data: typeSchemas.request?.name ? {
|
|
228
233
|
type: typeSchemas.request?.name,
|
|
229
234
|
optional: isOptional(typeSchemas.request?.schema)
|
|
@@ -253,7 +258,7 @@ function getParams5({ paramsType, pathParamsType, dataReturnType, typeSchemas, q
|
|
|
253
258
|
return FunctionParams.factory({
|
|
254
259
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
255
260
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
256
|
-
children: getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
261
|
+
children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
257
262
|
optional: isOptional(typeSchemas.pathParams?.schema)
|
|
258
263
|
} : void 0,
|
|
259
264
|
data: typeSchemas.request?.name ? {
|
|
@@ -289,15 +294,18 @@ function Query({
|
|
|
289
294
|
operation,
|
|
290
295
|
dataReturnType,
|
|
291
296
|
paramsType,
|
|
297
|
+
paramsCasing,
|
|
292
298
|
pathParamsType
|
|
293
299
|
}) {
|
|
294
300
|
const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
|
|
295
301
|
const generics = [TData, typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error", `${queryKeyTypeName} | null`];
|
|
296
302
|
const queryKeyParams = QueryKey.getParams({
|
|
297
303
|
pathParamsType,
|
|
298
|
-
typeSchemas
|
|
304
|
+
typeSchemas,
|
|
305
|
+
paramsCasing
|
|
299
306
|
});
|
|
300
307
|
const params = getParams5({
|
|
308
|
+
paramsCasing,
|
|
301
309
|
paramsType,
|
|
302
310
|
pathParamsType,
|
|
303
311
|
dataReturnType,
|
|
@@ -305,6 +313,7 @@ function Query({
|
|
|
305
313
|
queryKeyTypeName
|
|
306
314
|
});
|
|
307
315
|
const queryOptionsParams = QueryOptions.getParams({
|
|
316
|
+
paramsCasing,
|
|
308
317
|
paramsType,
|
|
309
318
|
pathParamsType,
|
|
310
319
|
typeSchemas
|
|
@@ -336,5 +345,5 @@ function Query({
|
|
|
336
345
|
}
|
|
337
346
|
|
|
338
347
|
export { Mutation, MutationKey, Query, QueryKey, QueryOptions };
|
|
339
|
-
//# sourceMappingURL=chunk-
|
|
340
|
-
//# sourceMappingURL=chunk-
|
|
348
|
+
//# sourceMappingURL=chunk-7ELDJ4IB.js.map
|
|
349
|
+
//# sourceMappingURL=chunk-7ELDJ4IB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/MutationKey.tsx","../src/components/Mutation.tsx","../src/components/QueryKey.tsx","../src/components/QueryOptions.tsx","../src/components/Query.tsx"],"names":["getParams","FunctionParams","jsx","File","Function","getPathParams","isOptional","getTransformer","URLPath","jsxs","Fragment","Type","Client","getComments"],"mappings":";;;;;;;;AAuBA,SAAS,SAAA,CAAU,EAAoB,EAAA;AACrC,EAAO,OAAA,cAAA,CAAe,OAAQ,CAAA,EAAE,CAAA;AAClC;AAEA,IAAM,cAA8B,GAAA,CAAC,EAAE,SAAA,EAAW,QAAa,KAAA;AAC7D,EAAA,MAAM,OAAO,IAAI,OAAA,CAAQ,UAAU,IAAM,EAAA,EAAE,QAAQ,CAAA;AAEnD,EAAO,OAAA,CAAC,IAAK,CAAA,SAAA,CAAU,EAAE,GAAA,EAAK,IAAK,CAAA,IAAA,EAAM,CAAC,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAC5D,CAAA;AAEO,SAAS,WAAA,CAAY,EAAE,IAAA,EAAM,WAAa,EAAA,YAAA,EAAc,gBAAgB,SAAW,EAAA,QAAA,EAAU,WAAc,GAAA,cAAA,EAAoC,EAAA;AACpJ,EAAA,MAAM,MAAS,GAAA,SAAA,CAAU,EAAE,cAAA,EAAgB,aAAa,CAAA;AACxD,EAAM,MAAA,IAAA,GAAO,YAAY,EAAE,SAAA,EAAW,SAAS,WAAa,EAAA,MAAA,EAAQ,cAAc,CAAA;AAElF,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,IAAA,CAAK,MAAL,EAAA,EAAY,IAAY,EAAA,YAAA,EAAY,IAAC,EAAA,WAAA,EAAW,IAC/C,EAAA,QAAA,kBAAA,GAAA,CAAC,QAAS,CAAA,KAAA,EAAT,EAAe,IAAA,EAAY,MAAM,EAAA,IAAA,EAAC,MAAQ,EAAA,MAAA,CAAO,aAAc,EAAA,EAAG,UAAU,EAAA,IAAA,EAC1E,QAAI,EAAA,CAAA,CAAA,EAAA,IAAA,CAAK,IAAK,CAAA,IAAI,CAAC,CAAA,UAAA,CAAA,EACtB,CACF,EAAA,CAAA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;AAAA;AAAA,aAAA,EAG3B,gBAAgB,CAAA,CAAA,EAAI,kBAAmB,CAAA,MAAA,EAAQ,CAAA;AAAA;AAAA;AAAA;AAAA,OAAA;AAAA;AAAA,GAM1D,EAAA,CAAA;AAEJ","file":"chunk-7ELDJ4IB.js","sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport { File, Function, FunctionParams, Type } from '@kubb/react'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport type { ReactNode } from 'react'\nimport type { PluginSwr, Transformer } from '../types'\n\ntype Props = {\n name: string\n typeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n transformer: Transformer | undefined\n}\n\ntype GetParamsProps = {\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({}: GetParamsProps) {\n return FunctionParams.factory({})\n}\n\nconst getTransformer: Transformer = ({ operation, casing }) => {\n const path = new URLPath(operation.path, { casing })\n\n return [JSON.stringify({ url: path.path })].filter(Boolean)\n}\n\nexport function MutationKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }: Props): ReactNode {\n const params = getParams({ pathParamsType, typeSchemas })\n const keys = transformer({ operation, schemas: typeSchemas, casing: paramsCasing })\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={params.toConstructor()} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type name={typeName} export>\n {`ReturnType<typeof ${name}>`}\n </Type>\n </File.Source>\n </>\n )\n}\n\nMutationKey.getParams = getParams\nMutationKey.getTransformer = getTransformer\n","import { File, Function, FunctionParams } from '@kubb/react'\n\nimport { type Operation, isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport type { ReactNode } from 'react'\nimport type { PluginSwr } from '../types.ts'\nimport { MutationKey } from './MutationKey.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n clientName: string\n mutationKeyName: string\n mutationKeyTypeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n typeSchemas: OperationSchemas\n mutationKeyTypeName: string\n}\n// TODO add same logic as being done for react-query mutations\nfunction getParams({ pathParamsType, paramsCasing, dataReturnType, typeSchemas, mutationKeyTypeName }: GetParamsProps) {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n\n return FunctionParams.factory({\n pathParams: {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n },\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n options: {\n type: `\n{\n mutation?: Parameters<typeof useSWRMutation<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', mutationKeyTypeName, typeSchemas.request?.name].join(', ')}>>[2],\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'},\n shouldFetch?: boolean,\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function Mutation({\n name,\n clientName,\n mutationKeyName,\n mutationKeyTypeName,\n paramsType,\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n}: Props): ReactNode {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const generics = [\n TData,\n typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error',\n `${mutationKeyTypeName} | null`,\n typeSchemas.request?.name, //arg: data\n ].filter(Boolean)\n\n const mutationKeyParams = MutationKey.getParams({\n pathParamsType,\n typeSchemas,\n })\n\n const params = getParams({\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n mutationKeyTypeName,\n })\n\n const clientParams = Client.getParams({\n paramsCasing,\n paramsType,\n typeSchemas,\n pathParamsType,\n })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n >\n {`\n const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}\n const mutationKey = ${mutationKeyName}(${mutationKeyParams.toCall()})\n\n return useSWRMutation<${generics}>(\n shouldFetch ? mutationKey : null,\n async (_url${typeSchemas.request?.name ? ', { arg: data }' : ''}) => {\n return ${clientName}(${clientParams.toCall()})\n },\n mutationOptions\n )\n `}\n </Function>\n </File.Source>\n )\n}\n","import { URLPath } from '@kubb/core/utils'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams, Type } from '@kubb/react'\n\nimport { type Operation, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport type { ReactNode } from 'react'\nimport type { PluginSwr, Transformer } from '../types'\n\ntype Props = {\n name: string\n typeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n transformer: Transformer | undefined\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ pathParamsType, paramsCasing, typeSchemas }: GetParamsProps) {\n return FunctionParams.factory({\n pathParams: {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n },\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n })\n}\n\nconst getTransformer: Transformer = ({ operation, schemas, casing }) => {\n const path = new URLPath(operation.path, { casing })\n const keys = [\n path.toObject({\n type: 'path',\n stringify: true,\n }),\n schemas.queryParams?.name ? '...(params ? [params] : [])' : undefined,\n schemas.request?.name ? '...(data ? [data] : [])' : undefined,\n ].filter(Boolean)\n\n return keys\n}\n\nexport function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }: Props): ReactNode {\n const params = getParams({ pathParamsType, paramsCasing, typeSchemas })\n const keys = transformer({\n operation,\n schemas: typeSchemas,\n casing: paramsCasing,\n })\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={params.toConstructor()} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type name={typeName} export>\n {`ReturnType<typeof ${name}>`}\n </Type>\n </File.Source>\n </>\n )\n}\n\nQueryKey.getParams = getParams\nQueryKey.getTransformer = getTransformer\n","import { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react'\n\nimport type { ReactNode } from 'react'\nimport type { PluginSwr } from '../types.ts'\n\nimport { isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\n\ntype Props = {\n name: string\n clientName: string\n typeSchemas: OperationSchemas\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n}\n\ntype GetParamsProps = {\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n config: {\n type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>',\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n config: {\n type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>',\n default: '{}',\n },\n })\n}\n\nexport function QueryOptions({ name, clientName, typeSchemas, paramsCasing, paramsType, pathParamsType }: Props): ReactNode {\n const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })\n const clientParams = Client.getParams({\n paramsCasing,\n paramsType,\n typeSchemas,\n pathParamsType,\n })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={params.toConstructor()}>\n {`\n return {\n fetcher: async () => {\n return ${clientName}(${clientParams.toCall()})\n },\n }\n `}\n </Function>\n </File.Source>\n )\n}\n\nQueryOptions.getParams = getParams\n","import { URLPath } from '@kubb/core/utils'\nimport { File, Function, FunctionParams } from '@kubb/react'\n\nimport { type Operation, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport type { ReactNode } from 'react'\nimport type { PluginSwr } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\nimport { QueryOptions } from './QueryOptions.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n typeSchemas: OperationSchemas\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n operation: Operation\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n queryKeyTypeName: string\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas, queryKeyTypeName }: GetParamsProps) {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n options: {\n type: `\n{\n query?: Parameters<typeof useSWR<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', `${queryKeyTypeName} | null`].join(', ')}, any>>[2],\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'},\n shouldFetch?: boolean,\n}\n`,\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n options: {\n type: `\n{\n query?: Parameters<typeof useSWR<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', `${queryKeyTypeName} | null`].join(', ')}, any>>[2],\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'},\n shouldFetch?: boolean,\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function Query({\n name,\n typeSchemas,\n queryKeyName,\n queryKeyTypeName,\n queryOptionsName,\n operation,\n dataReturnType,\n paramsType,\n paramsCasing,\n pathParamsType,\n}: Props): ReactNode {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const generics = [TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', `${queryKeyTypeName} | null`]\n\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const params = getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n queryKeyTypeName,\n })\n\n const queryOptionsParams = QueryOptions.getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n typeSchemas,\n })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n >\n {`\n const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}\n\n const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})\n\n return useSWR<${generics.join(', ')}>(\n shouldFetch ? queryKey : null,\n {\n ...${queryOptionsName}(${queryOptionsParams.toCall()}),\n ...queryOptions\n }\n )\n `}\n </Function>\n </File.Source>\n )\n}\n"]}
|