@kubb/plugin-svelte-query 5.0.0-alpha.1 → 5.0.0-alpha.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/{generators-BtTsGGrM.js → generators-BjJF5K9h.js} +15 -15
- package/dist/generators-BjJF5K9h.js.map +1 -0
- package/dist/{generators-DVAAgPhB.cjs → generators-DB6bWBb1.cjs} +15 -15
- package/dist/generators-DB6bWBb1.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +2 -2
- package/dist/generators.js +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/generators/mutationGenerator.tsx +7 -7
- package/src/generators/queryGenerator.tsx +7 -7
- package/src/plugin.ts +2 -2
- package/dist/generators-BtTsGGrM.js.map +0 -1
- package/dist/generators-DVAAgPhB.cjs.map +0 -1
|
@@ -32,26 +32,26 @@ const mutationGenerator = createReactGenerator({
|
|
|
32
32
|
file: getFile(operation, { prefix: "create" })
|
|
33
33
|
};
|
|
34
34
|
const type = {
|
|
35
|
-
file: getFile(operation, {
|
|
35
|
+
file: getFile(operation, { pluginName: pluginTsName }),
|
|
36
36
|
schemas: getSchemas(operation, {
|
|
37
|
-
|
|
37
|
+
pluginName: pluginTsName,
|
|
38
38
|
type: "type"
|
|
39
39
|
})
|
|
40
40
|
};
|
|
41
41
|
const zod = {
|
|
42
|
-
file: getFile(operation, {
|
|
42
|
+
file: getFile(operation, { pluginName: pluginZodName }),
|
|
43
43
|
schemas: getSchemas(operation, {
|
|
44
|
-
|
|
44
|
+
pluginName: pluginZodName,
|
|
45
45
|
type: "function"
|
|
46
46
|
})
|
|
47
47
|
};
|
|
48
|
-
const shouldUseClientPlugin = !!pluginManager.
|
|
48
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
49
49
|
const client = {
|
|
50
50
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
51
51
|
type: "function",
|
|
52
|
-
|
|
52
|
+
pluginName: pluginClientName
|
|
53
53
|
}) : getName(operation, { type: "function" }),
|
|
54
|
-
file: getFile(operation, {
|
|
54
|
+
file: getFile(operation, { pluginName: pluginClientName })
|
|
55
55
|
};
|
|
56
56
|
const mutationKey = {
|
|
57
57
|
name: getName(operation, {
|
|
@@ -220,13 +220,13 @@ const queryGenerator = createReactGenerator({
|
|
|
220
220
|
typeName: getName(operation, { type: "type" }),
|
|
221
221
|
file: getFile(operation, { prefix: "create" })
|
|
222
222
|
};
|
|
223
|
-
const shouldUseClientPlugin = !!pluginManager.
|
|
223
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByName(pluginClientName) && options.client.clientType !== "class";
|
|
224
224
|
const client = {
|
|
225
225
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
226
226
|
type: "function",
|
|
227
|
-
|
|
227
|
+
pluginName: pluginClientName
|
|
228
228
|
}) : getName(operation, { type: "function" }),
|
|
229
|
-
file: getFile(operation, {
|
|
229
|
+
file: getFile(operation, { pluginName: pluginClientName })
|
|
230
230
|
};
|
|
231
231
|
const queryOptions = { name: getName(operation, {
|
|
232
232
|
type: "function",
|
|
@@ -243,16 +243,16 @@ const queryGenerator = createReactGenerator({
|
|
|
243
243
|
})
|
|
244
244
|
};
|
|
245
245
|
const type = {
|
|
246
|
-
file: getFile(operation, {
|
|
246
|
+
file: getFile(operation, { pluginName: pluginTsName }),
|
|
247
247
|
schemas: getSchemas(operation, {
|
|
248
|
-
|
|
248
|
+
pluginName: pluginTsName,
|
|
249
249
|
type: "type"
|
|
250
250
|
})
|
|
251
251
|
};
|
|
252
252
|
const zod = {
|
|
253
|
-
file: getFile(operation, {
|
|
253
|
+
file: getFile(operation, { pluginName: pluginZodName }),
|
|
254
254
|
schemas: getSchemas(operation, {
|
|
255
|
-
|
|
255
|
+
pluginName: pluginZodName,
|
|
256
256
|
type: "function"
|
|
257
257
|
})
|
|
258
258
|
};
|
|
@@ -411,4 +411,4 @@ const queryGenerator = createReactGenerator({
|
|
|
411
411
|
//#endregion
|
|
412
412
|
export { mutationGenerator as n, queryGenerator as t };
|
|
413
413
|
|
|
414
|
-
//# sourceMappingURL=generators-
|
|
414
|
+
//# sourceMappingURL=generators-BjJF5K9h.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-BjJF5K9h.js","names":[],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n options.mutation !== false &&\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : '@tanstack/svelte-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const type = {\n file: getFile(operation, { pluginName: pluginTsName }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginName: pluginTsName, type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginName: pluginZodName }),\n schemas: getSchemas(operation, { pluginName: pluginZodName, type: 'function' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginName: pluginClientName,\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginName: 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 {options.client.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'fetch'} path={options.client.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && (\n <File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n )}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import\n name={['ResponseConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n )}\n </>\n )}\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\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={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.mutationKey}\n />\n {!shouldUseClientPlugin && (\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 || 'data'}\n paramsCasing={options.client?.paramsCasing || options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.mutation && (\n <>\n <File.Import name={['createMutation']} path={importPath} />\n <File.Import name={['CreateMutationOptions', 'CreateMutationResult', 'QueryClient']} path={importPath} isTypeOnly />\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n paramsCasing={options.paramsCasing}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const importPath = options.query ? options.query.importPath : '@tanstack/svelte-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginName: pluginClientName,\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginName: 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, { pluginName: pluginTsName }),\n //todo remove type?\n schemas: getSchemas(operation, {\n pluginName: pluginTsName,\n type: 'type',\n }),\n }\n\n const zod = {\n file: getFile(operation, { pluginName: pluginZodName }),\n schemas: getSchemas(operation, {\n pluginName: pluginZodName,\n type: 'function',\n }),\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 {options.client.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'fetch'} path={options.client.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && (\n <File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n )}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={query.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\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\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.queryKey}\n />\n\n {!shouldUseClientPlugin && (\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 || 'data'}\n paramsCasing={options.client?.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 || 'data'}\n />\n {options.query && (\n <>\n <File.Import name={['createQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'CreateBaseQueryOptions', 'CreateQueryResult']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n pathParamsType={options.pathParamsType}\n operation={operation}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n dataReturnType={options.client.dataReturnType || 'data'}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,oBAAoB,qBAAwC;CACvE,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EACJ,SACA,SAAS,EAAE,aACT;EACJ,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,YAAY,oBAAoB,UAAU;EAEvE,MAAM,UAAU,CAAC,CAAC,QAAQ,SAAS,QAAQ,OAAO,QAAQ,MAAM,WAAW,UAAU,WAAW,OAAO;EACvG,MAAM,aACJ,QAAQ,aA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;MAC3B,CAAA;KACD,EAAA,CAAA;IAEA;;;CAGZ,CAAC"}
|
|
@@ -32,26 +32,26 @@ const mutationGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)(
|
|
|
32
32
|
file: getFile(operation, { prefix: "create" })
|
|
33
33
|
};
|
|
34
34
|
const type = {
|
|
35
|
-
file: getFile(operation, {
|
|
35
|
+
file: getFile(operation, { pluginName: _kubb_plugin_ts.pluginTsName }),
|
|
36
36
|
schemas: getSchemas(operation, {
|
|
37
|
-
|
|
37
|
+
pluginName: _kubb_plugin_ts.pluginTsName,
|
|
38
38
|
type: "type"
|
|
39
39
|
})
|
|
40
40
|
};
|
|
41
41
|
const zod = {
|
|
42
|
-
file: getFile(operation, {
|
|
42
|
+
file: getFile(operation, { pluginName: _kubb_plugin_zod.pluginZodName }),
|
|
43
43
|
schemas: getSchemas(operation, {
|
|
44
|
-
|
|
44
|
+
pluginName: _kubb_plugin_zod.pluginZodName,
|
|
45
45
|
type: "function"
|
|
46
46
|
})
|
|
47
47
|
};
|
|
48
|
-
const shouldUseClientPlugin = !!pluginManager.
|
|
48
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByName(_kubb_plugin_client.pluginClientName) && options.client.clientType !== "class";
|
|
49
49
|
const client = {
|
|
50
50
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
51
51
|
type: "function",
|
|
52
|
-
|
|
52
|
+
pluginName: _kubb_plugin_client.pluginClientName
|
|
53
53
|
}) : getName(operation, { type: "function" }),
|
|
54
|
-
file: getFile(operation, {
|
|
54
|
+
file: getFile(operation, { pluginName: _kubb_plugin_client.pluginClientName })
|
|
55
55
|
};
|
|
56
56
|
const mutationKey = {
|
|
57
57
|
name: getName(operation, {
|
|
@@ -220,13 +220,13 @@ const queryGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
220
220
|
typeName: getName(operation, { type: "type" }),
|
|
221
221
|
file: getFile(operation, { prefix: "create" })
|
|
222
222
|
};
|
|
223
|
-
const shouldUseClientPlugin = !!pluginManager.
|
|
223
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByName(_kubb_plugin_client.pluginClientName) && options.client.clientType !== "class";
|
|
224
224
|
const client = {
|
|
225
225
|
name: shouldUseClientPlugin ? getName(operation, {
|
|
226
226
|
type: "function",
|
|
227
|
-
|
|
227
|
+
pluginName: _kubb_plugin_client.pluginClientName
|
|
228
228
|
}) : getName(operation, { type: "function" }),
|
|
229
|
-
file: getFile(operation, {
|
|
229
|
+
file: getFile(operation, { pluginName: _kubb_plugin_client.pluginClientName })
|
|
230
230
|
};
|
|
231
231
|
const queryOptions = { name: getName(operation, {
|
|
232
232
|
type: "function",
|
|
@@ -243,16 +243,16 @@ const queryGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
243
243
|
})
|
|
244
244
|
};
|
|
245
245
|
const type = {
|
|
246
|
-
file: getFile(operation, {
|
|
246
|
+
file: getFile(operation, { pluginName: _kubb_plugin_ts.pluginTsName }),
|
|
247
247
|
schemas: getSchemas(operation, {
|
|
248
|
-
|
|
248
|
+
pluginName: _kubb_plugin_ts.pluginTsName,
|
|
249
249
|
type: "type"
|
|
250
250
|
})
|
|
251
251
|
};
|
|
252
252
|
const zod = {
|
|
253
|
-
file: getFile(operation, {
|
|
253
|
+
file: getFile(operation, { pluginName: _kubb_plugin_zod.pluginZodName }),
|
|
254
254
|
schemas: getSchemas(operation, {
|
|
255
|
-
|
|
255
|
+
pluginName: _kubb_plugin_zod.pluginZodName,
|
|
256
256
|
type: "function"
|
|
257
257
|
})
|
|
258
258
|
};
|
|
@@ -422,4 +422,4 @@ Object.defineProperty(exports, "queryGenerator", {
|
|
|
422
422
|
}
|
|
423
423
|
});
|
|
424
424
|
|
|
425
|
-
//# sourceMappingURL=generators-
|
|
425
|
+
//# sourceMappingURL=generators-DB6bWBb1.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-DB6bWBb1.cjs","names":["pluginTsName","pluginZodName","pluginClientName","File","path","MutationKey","Client","Mutation","pluginClientName","pluginTsName","pluginZodName","File","path","QueryKey","Client","QueryOptions","Query"],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n options.mutation !== false &&\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : '@tanstack/svelte-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const type = {\n file: getFile(operation, { pluginName: pluginTsName }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginName: pluginTsName, type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginName: pluginZodName }),\n schemas: getSchemas(operation, { pluginName: pluginZodName, type: 'function' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginName: pluginClientName,\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginName: 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 {options.client.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'fetch'} path={options.client.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && (\n <File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n )}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import\n name={['ResponseConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n )}\n </>\n )}\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\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={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.mutationKey}\n />\n {!shouldUseClientPlugin && (\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 || 'data'}\n paramsCasing={options.client?.paramsCasing || options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.mutation && (\n <>\n <File.Import name={['createMutation']} path={importPath} />\n <File.Import name={['CreateMutationOptions', 'CreateMutationResult', 'QueryClient']} path={importPath} isTypeOnly />\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n paramsCasing={options.paramsCasing}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const importPath = options.query ? options.query.importPath : '@tanstack/svelte-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginName: pluginClientName,\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginName: 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, { pluginName: pluginTsName }),\n //todo remove type?\n schemas: getSchemas(operation, {\n pluginName: pluginTsName,\n type: 'type',\n }),\n }\n\n const zod = {\n file: getFile(operation, { pluginName: pluginZodName }),\n schemas: getSchemas(operation, {\n pluginName: pluginZodName,\n type: 'function',\n }),\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 {options.client.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'fetch'} path={options.client.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && (\n <File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n )}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={query.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\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\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.queryKey}\n />\n\n {!shouldUseClientPlugin && (\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 || 'data'}\n paramsCasing={options.client?.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 || 'data'}\n />\n {options.query && (\n <>\n <File.Import name={['createQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'CreateBaseQueryOptions', 'CreateQueryResult']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n pathParamsType={options.pathParamsType}\n operation={operation}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n dataReturnType={options.client.dataReturnType || 'data'}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,qBAAA,GAAA,4BAAA,sBAA4D;CACvE,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EACJ,SACA,SAAS,EAAE,aACT;EACJ,MAAM,iBAAA,GAAA,iBAAA,mBAAkC;EAExC,MAAM,OAAA,GAAA,uBAAA,SAAc;EACpB,MAAM,EAAE,YAAY,SAAS,aAAA,GAAA,uBAAA,qBAAgC,UAAU;EAEvE,MAAM,UAAU,CAAC,CAAC,QAAQ,SAAS,QAAQ,OAAO,QAAQ,MAAM,WAAW,UAAU,WAAW,OAAO;EACvG,MAAM,aACJ,QAAQ,aAAa,SACrB,CAAC,YAAA,GAAA,OAAA,YACU,QAAQ,WAAW,QAAQ,SAAS,UAAU,EAAE,EAAE,QAAQ,QAAQ,QAAQ,MAAM,UAAU,EAAE,CAAC,CAAC,MAAM,WAAW,UAAU,WAAW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kB;MACjD,cAAc,SAAS;MACvB,kBAAkB,SAAS;MAC3B,CAAA;KACD,EAAA,CAAA;IAEA;;;CAGZ,CAAC"}
|
package/dist/generators.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_generators = require("./generators-
|
|
2
|
+
const require_generators = require("./generators-DB6bWBb1.cjs");
|
|
3
3
|
exports.mutationGenerator = require_generators.mutationGenerator;
|
|
4
4
|
exports.queryGenerator = require_generators.queryGenerator;
|
package/dist/generators.d.ts
CHANGED
|
@@ -26,14 +26,14 @@ declare global {
|
|
|
26
26
|
*
|
|
27
27
|
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
28
28
|
*
|
|
29
|
-
* `
|
|
29
|
+
* `pluginName` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
30
30
|
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
31
31
|
*/
|
|
32
32
|
type Ref = {
|
|
33
33
|
propertyName: string;
|
|
34
34
|
originalName: string;
|
|
35
35
|
path: KubbFile.Path;
|
|
36
|
-
|
|
36
|
+
pluginName?: string;
|
|
37
37
|
};
|
|
38
38
|
type Refs = Record<string, Ref>;
|
|
39
39
|
type OperationSchema = {
|
package/dist/generators.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as mutationGenerator, t as queryGenerator } from "./generators-
|
|
1
|
+
import { n as mutationGenerator, t as queryGenerator } from "./generators-BjJF5K9h.js";
|
|
2
2
|
export { mutationGenerator, queryGenerator };
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_components = require("./components-kpjS70qO.cjs");
|
|
3
|
-
const require_generators = require("./generators-
|
|
3
|
+
const require_generators = require("./generators-DB6bWBb1.cjs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_components.__toESM(node_path);
|
|
6
6
|
let _kubb_core = require("@kubb/core");
|
|
@@ -92,7 +92,7 @@ const pluginSvelteQuery = (0, _kubb_core.definePlugin)((options) => {
|
|
|
92
92
|
const oas = await this.getOas();
|
|
93
93
|
const baseURL = await this.getBaseURL();
|
|
94
94
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
95
|
-
const hasClientPlugin = !!this.pluginManager.
|
|
95
|
+
const hasClientPlugin = !!this.pluginManager.getPluginByName(_kubb_plugin_client.pluginClientName);
|
|
96
96
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
97
97
|
baseName: "fetch.ts",
|
|
98
98
|
path: node_path.default.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -134,7 +134,7 @@ const pluginSvelteQuery = (0, _kubb_core.definePlugin)((options) => {
|
|
|
134
134
|
type: output.barrelType ?? "named",
|
|
135
135
|
root,
|
|
136
136
|
output,
|
|
137
|
-
meta: {
|
|
137
|
+
meta: { pluginName: this.plugin.name }
|
|
138
138
|
});
|
|
139
139
|
await this.upsertFile(...barrelFiles);
|
|
140
140
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["MutationKey","QueryKey","queryGenerator","mutationGenerator","pluginOasName","pluginTsName","pluginZodName","path","camelCase","pascalCase","pluginClientName","fetchClientSource","axiosClientSource","configSource","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\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 { PluginSvelteQuery } from './types.ts'\n\nexport const pluginSvelteQueryName = 'plugin-svelte-query' satisfies PluginSvelteQuery['name']\n\nexport const pluginSvelteQuery = definePlugin<PluginSvelteQuery>((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 mutation = {},\n query = {},\n paramsCasing,\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, mutationGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginSvelteQueryName,\n options: {\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n dataReturnType: client?.dataReturnType ?? 'data',\n pathParamsType,\n importPath: clientImportPath,\n paramsCasing,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/svelte-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/svelte-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\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 ?? 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 install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["MutationKey","QueryKey","queryGenerator","mutationGenerator","pluginOasName","pluginTsName","pluginZodName","path","camelCase","pascalCase","pluginClientName","fetchClientSource","axiosClientSource","configSource","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\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 { PluginSvelteQuery } from './types.ts'\n\nexport const pluginSvelteQueryName = 'plugin-svelte-query' satisfies PluginSvelteQuery['name']\n\nexport const pluginSvelteQuery = definePlugin<PluginSvelteQuery>((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 mutation = {},\n query = {},\n paramsCasing,\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, mutationGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginSvelteQueryName,\n options: {\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n dataReturnType: client?.dataReturnType ?? 'data',\n pathParamsType,\n importPath: clientImportPath,\n paramsCasing,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/svelte-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/svelte-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\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 ?? 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 install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByName(pluginClientName)\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.upsertFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\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.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,wBAAwB;AAErC,MAAa,qBAAA,GAAA,WAAA,eAAqD,YAAY;CAC5E,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,EAAE,EACb,QAAQ,EAAE,EACV,cACA,cAAcA,mBAAAA,YAAY,gBAC1B,WAAWC,mBAAAA,SAAS,gBACpB,aAAa,CAACC,mBAAAA,gBAAgBC,mBAAAA,kBAAkB,CAAC,OAAO,QAAQ,EAChE,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe,KAAA;AAEhH,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,QAAQ;IACN,QAAQ,QAAQ;IAChB,SAAS,QAAQ;IACjB,QAAQ;IACR,YAAY,QAAQ,cAAc;IAClC,gBAAgB,QAAQ,kBAAkB;IAC1C;IACA,YAAY;IACZ;IACD;GACD;GACA,OACE,UAAU,QACN,QACA;IACE,SAAS,CAAC,MAAM;IAChB,YAAY;IACZ,GAAG;IACJ;GACP;GACA,UACE,aAAa,QACT,QACA;IACE,SAAS;KAAC;KAAQ;KAAO;KAAS;KAAS;IAC3C,YAAY;IACZ,GAAG;IACJ;GACP;GACA;GACA;GACA;GACA;GACD;EACD,KAAK;GAACC,iBAAAA;GAAeC,gBAAAA;GAAc,WAAW,QAAQC,iBAAAA,gBAAgB,KAAA;GAAU,CAAC,OAAO,QAAQ;EAChG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2
|
import { a as MutationKey, i as QueryKey, o as camelCase, s as pascalCase } from "./components-DntKBsnB.js";
|
|
3
|
-
import { n as mutationGenerator, t as queryGenerator } from "./generators-
|
|
3
|
+
import { n as mutationGenerator, t as queryGenerator } from "./generators-BjJF5K9h.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
|
|
6
6
|
import { pluginClientName } from "@kubb/plugin-client";
|
|
@@ -91,7 +91,7 @@ const pluginSvelteQuery = definePlugin((options) => {
|
|
|
91
91
|
const oas = await this.getOas();
|
|
92
92
|
const baseURL = await this.getBaseURL();
|
|
93
93
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
94
|
-
const hasClientPlugin = !!this.pluginManager.
|
|
94
|
+
const hasClientPlugin = !!this.pluginManager.getPluginByName(pluginClientName);
|
|
95
95
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
|
|
96
96
|
baseName: "fetch.ts",
|
|
97
97
|
path: path.resolve(root, ".kubb/fetch.ts"),
|
|
@@ -133,7 +133,7 @@ const pluginSvelteQuery = definePlugin((options) => {
|
|
|
133
133
|
type: output.barrelType ?? "named",
|
|
134
134
|
root,
|
|
135
135
|
output,
|
|
136
|
-
meta: {
|
|
136
|
+
meta: { pluginName: this.plugin.name }
|
|
137
137
|
});
|
|
138
138
|
await this.upsertFile(...barrelFiles);
|
|
139
139
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\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 { PluginSvelteQuery } from './types.ts'\n\nexport const pluginSvelteQueryName = 'plugin-svelte-query' satisfies PluginSvelteQuery['name']\n\nexport const pluginSvelteQuery = definePlugin<PluginSvelteQuery>((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 mutation = {},\n query = {},\n paramsCasing,\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, mutationGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginSvelteQueryName,\n options: {\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n dataReturnType: client?.dataReturnType ?? 'data',\n pathParamsType,\n importPath: clientImportPath,\n paramsCasing,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/svelte-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/svelte-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\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 ?? 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 install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.
|
|
1
|
+
{"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\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 { PluginSvelteQuery } from './types.ts'\n\nexport const pluginSvelteQueryName = 'plugin-svelte-query' satisfies PluginSvelteQuery['name']\n\nexport const pluginSvelteQuery = definePlugin<PluginSvelteQuery>((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 mutation = {},\n query = {},\n paramsCasing,\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, mutationGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginSvelteQueryName,\n options: {\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n dataReturnType: client?.dataReturnType ?? 'data',\n pathParamsType,\n importPath: clientImportPath,\n paramsCasing,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/svelte-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/svelte-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\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 ?? 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 install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByName(pluginClientName)\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.upsertFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\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.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,wBAAwB;AAErC,MAAa,oBAAoB,cAAiC,YAAY;CAC5E,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,EAAE,EACb,QAAQ,EAAE,EACV,cACA,cAAc,YAAY,gBAC1B,WAAW,SAAS,gBACpB,aAAa,CAAC,gBAAgB,kBAAkB,CAAC,OAAO,QAAQ,EAChE,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe,KAAA;AAEhH,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,QAAQ;IACN,QAAQ,QAAQ;IAChB,SAAS,QAAQ;IACjB,QAAQ;IACR,YAAY,QAAQ,cAAc;IAClC,gBAAgB,QAAQ,kBAAkB;IAC1C;IACA,YAAY;IACZ;IACD;GACD;GACA,OACE,UAAU,QACN,QACA;IACE,SAAS,CAAC,MAAM;IAChB,YAAY;IACZ,GAAG;IACJ;GACP;GACA,UACE,aAAa,QACT,QACA;IACE,SAAS;KAAC;KAAQ;KAAO;KAAS;KAAS;IAC3C,YAAY;IACZ,GAAG;IACJ;GACP;GACA;GACA;GACA;GACA;GACD;EACD,KAAK;GAAC;GAAe;GAAc,WAAW,QAAQ,gBAAgB,KAAA;GAAU,CAAC,OAAO,QAAQ;EAChG,YAAY,UAAU,UAAU,SAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,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WAAW;IACpB,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACP;KACE,MAAM;KACN,OAAO,KAAK,OAAO,QAAQ,OAAO,WAAW,UAAUA,WAAoBC;KAC3E,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;AAGJ,OAAI,CAAC,gBACH,OAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP;KACE,MAAM;KACN,OAAOC;KACP,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;GAgBJ,MAAM,QAAQ,MAba,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-svelte-query",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.2",
|
|
4
4
|
"description": "Svelte Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for Svelte applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svelte-query",
|
|
@@ -75,12 +75,12 @@
|
|
|
75
75
|
"@kubb/fabric-core": "0.13.3",
|
|
76
76
|
"@kubb/react-fabric": "0.13.3",
|
|
77
77
|
"remeda": "^2.33.6",
|
|
78
|
-
"@kubb/core": "5.0.0-alpha.
|
|
79
|
-
"@kubb/oas": "5.0.0-alpha.
|
|
80
|
-
"@kubb/plugin-client": "5.0.0-alpha.
|
|
81
|
-
"@kubb/plugin-oas": "5.0.0-alpha.
|
|
82
|
-
"@kubb/plugin-ts": "5.0.0-alpha.
|
|
83
|
-
"@kubb/plugin-zod": "5.0.0-alpha.
|
|
78
|
+
"@kubb/core": "5.0.0-alpha.2",
|
|
79
|
+
"@kubb/oas": "5.0.0-alpha.2",
|
|
80
|
+
"@kubb/plugin-client": "5.0.0-alpha.2",
|
|
81
|
+
"@kubb/plugin-oas": "5.0.0-alpha.2",
|
|
82
|
+
"@kubb/plugin-ts": "5.0.0-alpha.2",
|
|
83
|
+
"@kubb/plugin-zod": "5.0.0-alpha.2"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@kubb/fabric-core": "0.13.3",
|
|
@@ -39,29 +39,29 @@ export const mutationGenerator = createReactGenerator<PluginSvelteQuery>({
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const type = {
|
|
42
|
-
file: getFile(operation, {
|
|
42
|
+
file: getFile(operation, { pluginName: pluginTsName }),
|
|
43
43
|
//todo remove type?
|
|
44
|
-
schemas: getSchemas(operation, {
|
|
44
|
+
schemas: getSchemas(operation, { pluginName: pluginTsName, type: 'type' }),
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const zod = {
|
|
48
|
-
file: getFile(operation, {
|
|
49
|
-
schemas: getSchemas(operation, {
|
|
48
|
+
file: getFile(operation, { pluginName: pluginZodName }),
|
|
49
|
+
schemas: getSchemas(operation, { pluginName: pluginZodName, type: 'function' }),
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const hasClientPlugin = !!pluginManager.
|
|
52
|
+
const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)
|
|
53
53
|
// Class-based clients are not compatible with query hooks, so we generate inline clients
|
|
54
54
|
const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'
|
|
55
55
|
const client = {
|
|
56
56
|
name: shouldUseClientPlugin
|
|
57
57
|
? getName(operation, {
|
|
58
58
|
type: 'function',
|
|
59
|
-
|
|
59
|
+
pluginName: pluginClientName,
|
|
60
60
|
})
|
|
61
61
|
: getName(operation, {
|
|
62
62
|
type: 'function',
|
|
63
63
|
}),
|
|
64
|
-
file: getFile(operation, {
|
|
64
|
+
file: getFile(operation, { pluginName: pluginClientName }),
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
const mutationKey = {
|
|
@@ -36,19 +36,19 @@ export const queryGenerator = createReactGenerator<PluginSvelteQuery>({
|
|
|
36
36
|
file: getFile(operation, { prefix: 'create' }),
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
const hasClientPlugin = !!pluginManager.
|
|
39
|
+
const hasClientPlugin = !!pluginManager.getPluginByName(pluginClientName)
|
|
40
40
|
// Class-based clients are not compatible with query hooks, so we generate inline clients
|
|
41
41
|
const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'
|
|
42
42
|
const client = {
|
|
43
43
|
name: shouldUseClientPlugin
|
|
44
44
|
? getName(operation, {
|
|
45
45
|
type: 'function',
|
|
46
|
-
|
|
46
|
+
pluginName: pluginClientName,
|
|
47
47
|
})
|
|
48
48
|
: getName(operation, {
|
|
49
49
|
type: 'function',
|
|
50
50
|
}),
|
|
51
|
-
file: getFile(operation, {
|
|
51
|
+
file: getFile(operation, { pluginName: pluginClientName }),
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
const queryOptions = {
|
|
@@ -61,18 +61,18 @@ export const queryGenerator = createReactGenerator<PluginSvelteQuery>({
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
const type = {
|
|
64
|
-
file: getFile(operation, {
|
|
64
|
+
file: getFile(operation, { pluginName: pluginTsName }),
|
|
65
65
|
//todo remove type?
|
|
66
66
|
schemas: getSchemas(operation, {
|
|
67
|
-
|
|
67
|
+
pluginName: pluginTsName,
|
|
68
68
|
type: 'type',
|
|
69
69
|
}),
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
const zod = {
|
|
73
|
-
file: getFile(operation, {
|
|
73
|
+
file: getFile(operation, { pluginName: pluginZodName }),
|
|
74
74
|
schemas: getSchemas(operation, {
|
|
75
|
-
|
|
75
|
+
pluginName: pluginZodName,
|
|
76
76
|
type: 'function',
|
|
77
77
|
}),
|
|
78
78
|
}
|
package/src/plugin.ts
CHANGED
|
@@ -139,7 +139,7 @@ export const pluginSvelteQuery = definePlugin<PluginSvelteQuery>((options) => {
|
|
|
139
139
|
this.plugin.options.client.baseURL = baseURL
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
const hasClientPlugin = !!this.pluginManager.
|
|
142
|
+
const hasClientPlugin = !!this.pluginManager.getPluginByName(pluginClientName)
|
|
143
143
|
|
|
144
144
|
if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {
|
|
145
145
|
// pre add bundled fetch
|
|
@@ -197,7 +197,7 @@ export const pluginSvelteQuery = definePlugin<PluginSvelteQuery>((options) => {
|
|
|
197
197
|
root,
|
|
198
198
|
output,
|
|
199
199
|
meta: {
|
|
200
|
-
|
|
200
|
+
pluginName: this.plugin.name,
|
|
201
201
|
},
|
|
202
202
|
})
|
|
203
203
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-BtTsGGrM.js","names":[],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n options.mutation !== false &&\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : '@tanstack/svelte-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\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 {options.client.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'fetch'} path={options.client.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && (\n <File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n )}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import\n name={['ResponseConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n )}\n </>\n )}\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\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={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.mutationKey}\n />\n {!shouldUseClientPlugin && (\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 || 'data'}\n paramsCasing={options.client?.paramsCasing || options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.mutation && (\n <>\n <File.Import name={['createMutation']} path={importPath} />\n <File.Import name={['CreateMutationOptions', 'CreateMutationResult', 'QueryClient']} path={importPath} isTypeOnly />\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n paramsCasing={options.paramsCasing}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const importPath = options.query ? options.query.importPath : '@tanstack/svelte-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\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, {\n pluginKey: [pluginTsName],\n type: 'type',\n }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, {\n pluginKey: [pluginZodName],\n type: 'function',\n }),\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 {options.client.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'fetch'} path={options.client.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && (\n <File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n )}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={query.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\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\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.queryKey}\n />\n\n {!shouldUseClientPlugin && (\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 || 'data'}\n paramsCasing={options.client?.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 || 'data'}\n />\n {options.query && (\n <>\n <File.Import name={['createQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'CreateBaseQueryOptions', 'CreateQueryResult']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n pathParamsType={options.pathParamsType}\n operation={operation}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n dataReturnType={options.client.dataReturnType || 'data'}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,oBAAoB,qBAAwC;CACvE,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EACJ,SACA,SAAS,EAAE,aACT;EACJ,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,YAAY,oBAAoB,UAAU;EAEvE,MAAM,UAAU,CAAC,CAAC,QAAQ,SAAS,QAAQ,OAAO,QAAQ,MAAM,WAAW,UAAU,WAAW,OAAO;EACvG,MAAM,aACJ,QAAQ,aAAa,SACrB,CAAC,WACD,WAAW,QAAQ,WAAW,QAAQ,SAAS,UAAU,EAAE,EAAE,QAAQ,QAAQ,QAAQ,MAAM,UAAU,EAAE,CAAC,CAAC,MAAM,WAAW,UAAU,WAAW,OAAO;EAExJ,MAAM,aAAa,QAAQ,WAAW,QAAQ,SAAS,aAAa;EAEpE,MAAM,WAAW;GACf,MAAM,QAAQ,WAAW;IAAE,MAAM;IAAY,QAAQ;IAAU,CAAC;GAChE,UAAU,QAAQ,WAAW,EAAE,MAAM,QAAQ,CAAC;GAC9C,MAAM,QAAQ,WAAW,EAAE,QAAQ,UAAU,CAAC;GAC/C;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,CAAC;GAEvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,aAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;EAED,MAAM,M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AAQ,OAAO,kBAAkB;KACjD,cAAc,QAAQ,QAAQ,gBAAgB,QAAQ;KACtD,YAAY,QAAQ;KACpB,gBAAgB,QAAQ;KACxB,QAAQ,QAAQ;KAChB,CAAA;IAEJ,oBAAC,KAAK,QAAN;KAAa,MAAM,CAAC,eAAe;KAAE,MAAM;KAAc,CAAA;IACzD,oBAAC,cAAD;KACE,MAAM,aAAa;KACnB,YAAY,OAAO;KACnB,cAAc,SAAS;KACvB,aAAa,KAAK;KAClB,cAAc,QAAQ;KACtB,YAAY,QAAQ;KACpB,gBAAgB,QAAQ;KACxB,gBAAgB,QAAQ,OAAO,kBAAkB;KACjD,CAAA;IACD,QAAQ,SACP,qBAAA,UAAA,EAAA,UAAA;KACE,oBAAC,KAAK,QAAN;MAAa,MAAM,CAAC,cAAc;MAAE,MAAM;MAAc,CAAA;KACxD,oBAAC,KAAK,QAAN;MAAa,MAAM;OAAC;OAAY;OAAe;OAA0B;OAAoB;MAAE,MAAM;MAAY,YAAA;MAAa,CAAA;KAC9H,oBAAC,OAAD;MACE,MAAM,MAAM;MACZ,kBAAkB,aAAa;MAC/B,aAAa,KAAK;MAClB,gBAAgB,QAAQ;MACb;MACX,cAAc,QAAQ;MACtB,YAAY,QAAQ;MACpB,gBAAgB,QAAQ,OAAO,kBAAkB;MACjD,cAAc,SAAS;MACvB,kBAAkB,SAAS;MAC3B,CAAA;KACD,EAAA,CAAA;IAEA;;;CAGZ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-DVAAgPhB.cjs","names":["pluginTsName","pluginZodName","pluginClientName","File","path","MutationKey","Client","Mutation","pluginClientName","pluginTsName","pluginZodName","File","path","QueryKey","Client","QueryOptions","Query"],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n options.mutation !== false &&\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : '@tanstack/svelte-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\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 {options.client.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'fetch'} path={options.client.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && (\n <File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n )}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import\n name={['ResponseConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n )}\n </>\n )}\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\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={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.mutationKey}\n />\n {!shouldUseClientPlugin && (\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 || 'data'}\n paramsCasing={options.client?.paramsCasing || options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.mutation && (\n <>\n <File.Import name={['createMutation']} path={importPath} />\n <File.Import name={['CreateMutationOptions', 'CreateMutationResult', 'QueryClient']} path={importPath} isTypeOnly />\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n paramsCasing={options.paramsCasing}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\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 } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const importPath = options.query ? options.query.importPath : '@tanstack/svelte-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\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, {\n pluginKey: [pluginTsName],\n type: 'type',\n }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, {\n pluginKey: [pluginZodName],\n type: 'function',\n }),\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 {options.client.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'fetch'} path={options.client.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && (\n <File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n )}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={query.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\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\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.queryKey}\n />\n\n {!shouldUseClientPlugin && (\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 || 'data'}\n paramsCasing={options.client?.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 || 'data'}\n />\n {options.query && (\n <>\n <File.Import name={['createQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'CreateBaseQueryOptions', 'CreateQueryResult']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n pathParamsType={options.pathParamsType}\n operation={operation}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n dataReturnType={options.client.dataReturnType || 'data'}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,qBAAA,GAAA,4BAAA,sBAA4D;CACvE,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EACJ,SACA,SAAS,EAAE,aACT;EACJ,MAAM,iBAAA,GAAA,iBAAA,mBAAkC;EAExC,MAAM,OAAA,GAAA,uBAAA,SAAc;EACpB,MAAM,EAAE,YAAY,SAAS,aAAA,GAAA,uBAAA,qBAAgC,UAAU;EAEvE,MAAM,UAAU,CAAC,CAAC,QAAQ,SAAS,QAAQ,OAAO,QAAQ,MAAM,WAAW,UAAU,WAAW,OAAO;EACvG,MAAM,aACJ,QAAQ,aAAa,SACrB,CAAC,YAAA,GAAA,OAAA,YACU,QAAQ,WAAW,QAAQ,SAAS,UAAU,EAAE,EAAE,QAAQ,QAAQ,QAAQ,MAAM,UAAU,EAAE,CAAC,CAAC,MAAM,WAAW,UAAU,WAAW,OAAO;EAExJ,MAAM,aAAa,QAAQ,WAAW,QAAQ,SAAS,aAAa;EAEpE,MAAM,WAAW;GACf,MAAM,QAAQ,WAAW;IAAE,MAAM;IAAY,QAAQ;IAAU,CAAC;GAChE,UAAU,QAAQ,WAAW,EAAE,MAAM,QAAQ,CAAC;GAC9C,MAAM,QAAQ,W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