@kubb/plugin-vue-query 4.8.1 → 4.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{components-D4_8ei0d.cjs → components-BXOqc0vT.cjs} +2 -2
- package/dist/{components-D4_8ei0d.cjs.map → components-BXOqc0vT.cjs.map} +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/{generators-Rv6g4zhu.js → generators-BKpG_fLE.js} +16 -16
- package/dist/generators-BKpG_fLE.js.map +1 -0
- package/dist/{generators-D82LUIfH.cjs → generators-jBphJR6A.cjs} +17 -17
- package/dist/generators-jBphJR6A.cjs.map +1 -0
- package/dist/generators.cjs +2 -2
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +6 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/{types-DnhJ7rMJ.d.cts → types-BnerPCg0.d.ts} +11 -3
- package/dist/{types-BaFknRp-.d.ts → types-CWp_kGtI.d.cts} +11 -3
- package/package.json +7 -7
- package/src/generators/infiniteQueryGenerator.tsx +6 -4
- package/src/generators/mutationGenerator.tsx +6 -4
- package/src/generators/queryGenerator.tsx +6 -4
- package/src/plugin.ts +4 -3
- package/src/types.ts +1 -1
- package/dist/generators-D82LUIfH.cjs.map +0 -1
- package/dist/generators-Rv6g4zhu.js.map +0 -1
|
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
const require_components = require('./components-
|
|
28
|
+
const require_components = require('./components-BXOqc0vT.cjs');
|
|
29
29
|
let node_path = require("node:path");
|
|
30
30
|
node_path = __toESM(node_path);
|
|
31
31
|
let __kubb_plugin_client = require("@kubb/plugin-client");
|
|
@@ -64,9 +64,9 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
64
64
|
suffix: "infinite"
|
|
65
65
|
})
|
|
66
66
|
};
|
|
67
|
-
const
|
|
67
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([__kubb_plugin_client.pluginClientName]) && options.client.clientType !== "class";
|
|
68
68
|
const client = {
|
|
69
|
-
name:
|
|
69
|
+
name: shouldUseClientPlugin ? getName(operation, {
|
|
70
70
|
type: "function",
|
|
71
71
|
pluginKey: [__kubb_plugin_client.pluginClientName]
|
|
72
72
|
}) : getName(operation, {
|
|
@@ -166,12 +166,12 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
166
166
|
path: "vue",
|
|
167
167
|
isTypeOnly: true
|
|
168
168
|
}),
|
|
169
|
-
|
|
169
|
+
shouldUseClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
170
170
|
name: [client.name],
|
|
171
171
|
root: query.file.path,
|
|
172
172
|
path: client.file.path
|
|
173
173
|
}),
|
|
174
|
-
!
|
|
174
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
175
175
|
name: ["buildFormData"],
|
|
176
176
|
root: query.file.path,
|
|
177
177
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
@@ -198,7 +198,7 @@ const infiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
198
198
|
typeSchemas: type.schemas,
|
|
199
199
|
transformer: options.queryKey
|
|
200
200
|
}),
|
|
201
|
-
!
|
|
201
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_plugin_client_components.Client, {
|
|
202
202
|
name: client.name,
|
|
203
203
|
baseURL: options.client.baseURL,
|
|
204
204
|
operation,
|
|
@@ -302,9 +302,9 @@ const mutationGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)
|
|
|
302
302
|
type: "function"
|
|
303
303
|
})
|
|
304
304
|
};
|
|
305
|
-
const
|
|
305
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([__kubb_plugin_client.pluginClientName]) && options.client.clientType !== "class";
|
|
306
306
|
const client = {
|
|
307
|
-
name:
|
|
307
|
+
name: shouldUseClientPlugin ? getName(operation, {
|
|
308
308
|
type: "function",
|
|
309
309
|
pluginKey: [__kubb_plugin_client.pluginClientName]
|
|
310
310
|
}) : getName(operation, { type: "function" }),
|
|
@@ -379,12 +379,12 @@ const mutationGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)
|
|
|
379
379
|
path: "vue",
|
|
380
380
|
isTypeOnly: true
|
|
381
381
|
}),
|
|
382
|
-
|
|
382
|
+
shouldUseClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
383
383
|
name: [client.name],
|
|
384
384
|
root: mutation.file.path,
|
|
385
385
|
path: client.file.path
|
|
386
386
|
}),
|
|
387
|
-
!
|
|
387
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
388
388
|
name: ["buildFormData"],
|
|
389
389
|
root: mutation.file.path,
|
|
390
390
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
@@ -411,7 +411,7 @@ const mutationGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)
|
|
|
411
411
|
typeSchemas: type.schemas,
|
|
412
412
|
transformer: options.mutationKey
|
|
413
413
|
}),
|
|
414
|
-
!
|
|
414
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_plugin_client_components.Client, {
|
|
415
415
|
name: client.name,
|
|
416
416
|
baseURL: options.client.baseURL,
|
|
417
417
|
operation,
|
|
@@ -471,9 +471,9 @@ const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
471
471
|
typeName: getName(operation, { type: "type" }),
|
|
472
472
|
file: getFile(operation, { prefix: "use" })
|
|
473
473
|
};
|
|
474
|
-
const
|
|
474
|
+
const shouldUseClientPlugin = !!pluginManager.getPluginByKey([__kubb_plugin_client.pluginClientName]) && options.client.clientType !== "class";
|
|
475
475
|
const client = {
|
|
476
|
-
name:
|
|
476
|
+
name: shouldUseClientPlugin ? getName(operation, {
|
|
477
477
|
type: "function",
|
|
478
478
|
pluginKey: [__kubb_plugin_client.pluginClientName]
|
|
479
479
|
}) : getName(operation, { type: "function" }),
|
|
@@ -570,12 +570,12 @@ const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
570
570
|
path: "vue",
|
|
571
571
|
isTypeOnly: true
|
|
572
572
|
}),
|
|
573
|
-
|
|
573
|
+
shouldUseClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
574
574
|
name: [client.name],
|
|
575
575
|
root: query.file.path,
|
|
576
576
|
path: client.file.path
|
|
577
577
|
}),
|
|
578
|
-
!
|
|
578
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
579
579
|
name: ["buildFormData"],
|
|
580
580
|
root: query.file.path,
|
|
581
581
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
@@ -602,7 +602,7 @@ const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
602
602
|
typeSchemas: type.schemas,
|
|
603
603
|
transformer: options.queryKey
|
|
604
604
|
}),
|
|
605
|
-
!
|
|
605
|
+
!shouldUseClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_plugin_client_components.Client, {
|
|
606
606
|
name: client.name,
|
|
607
607
|
baseURL: options.client.baseURL,
|
|
608
608
|
operation,
|
|
@@ -686,4 +686,4 @@ Object.defineProperty(exports, 'queryGenerator', {
|
|
|
686
686
|
return queryGenerator;
|
|
687
687
|
}
|
|
688
688
|
});
|
|
689
|
-
//# sourceMappingURL=generators-
|
|
689
|
+
//# sourceMappingURL=generators-jBphJR6A.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-jBphJR6A.cjs","names":["pluginClientName","pluginTsName","pluginZodName","File","path","QueryKey","Client","InfiniteQueryOptions","InfiniteQuery","pluginTsName","pluginZodName","pluginClientName","File","path","MutationKey","Client","Mutation","pluginClientName","pluginTsName","pluginZodName","File","path","QueryKey","Client","QueryOptions","Query"],"sources":["../src/generators/infiniteQueryGenerator.tsx","../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 { InfiniteQuery, InfiniteQueryOptions, QueryKey } from '../components'\nimport type { PluginVueQuery } from '../types'\n\nexport const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({\n name: 'vue-infinite-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 isInfinite = isQuery && !!options.infinite\n const importPath = options.query ? options.query.importPath : '@tanstack/vue-query'\n\n const query = {\n name: getName(operation, {\n type: 'function',\n prefix: 'use',\n suffix: 'infinite',\n }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use', suffix: 'infinite' }),\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 suffix: 'infinite',\n }),\n file: getFile(operation, { pluginKey: [pluginClientName] }),\n }\n\n const queryOptions = {\n name: getName(operation, {\n type: 'function',\n suffix: 'InfiniteQueryOptions',\n }),\n }\n\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'InfiniteQueryKey' }),\n typeName: getName(operation, {\n type: 'type',\n suffix: 'InfiniteQueryKey',\n }),\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 || !isInfinite) {\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 <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['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 <File.Import name={['toValue']} path=\"vue\" />\n <File.Import name={['MaybeRefOrGetter']} path=\"vue\" isTypeOnly />\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 <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.queryKey}\n />\n {!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.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.infinite && (\n <>\n <File.Import name={['InfiniteData']} isTypeOnly path={importPath} />\n <File.Import name={['infiniteQueryOptions']} path={importPath} />\n <InfiniteQueryOptions\n name={queryOptions.name}\n clientName={client.name}\n queryKeyName={queryKey.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType || 'data'}\n cursorParam={options.infinite.cursorParam}\n nextParam={options.infinite.nextParam}\n previousParam={options.infinite.previousParam}\n initialPageParam={options.infinite.initialPageParam}\n queryParam={options.infinite.queryParam}\n />\n </>\n )}\n {options.infinite && (\n <>\n <File.Import name={['useInfiniteQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'UseInfiniteQueryOptions', 'UseInfiniteQueryReturnType']} path={importPath} isTypeOnly />\n <InfiniteQuery\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n dataReturnType={options.client.dataReturnType || 'data'}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\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 { Mutation, MutationKey } from '../components'\nimport type { PluginVueQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginVueQuery>({\n name: 'vue-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 !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/vue-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n // 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 <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['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 <File.Import name={['MaybeRefOrGetter']} path=\"vue\" isTypeOnly />\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 <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\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.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.mutation && (\n <>\n <File.Import name={['useMutation']} path={importPath} />\n <File.Import name={['MutationObserverOptions', '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 { PluginVueQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginVueQuery>({\n name: 'vue-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/vue-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\n }\n\n const 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 <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['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 <File.Import name={['toValue']} path=\"vue\" />\n <File.Import name={['MaybeRefOrGetter']} path=\"vue\" isTypeOnly />\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 <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.queryKey}\n />\n {!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.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 paramsCasing={options.paramsCasing}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType || 'data'}\n />\n {options.query && (\n <>\n <File.Import name={['useQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'UseQueryOptions', 'UseQueryReturnType']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n dataReturnType={options.client.dataReturnType || 'data'}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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AAK;KAChB;MACA;IACF,yDAACE;KACC,MAAM,SAAS;KACf,UAAU,SAAS;KACR;KACX,cAAc,QAAQ;KACtB,gBAAgB,QAAQ;KACxB,aAAa,KAAK;KAClB,aAAa,QAAQ;MACrB;IACD,CAAC,yBACA,yDAACC;KACC,MAAM,OAAO;KACb,SAAS,QAAQ,OAAO;KACb;KACX,aAAa,KAAK;KAClB,YAAY,IAAI;KAChB,gBAAgB,QAAQ,OAAO,kBAAkB;KACjD,cAAc,QAAQ;KACtB,YAAY,QAAQ;KACpB,gBAAgB,QAAQ;KACxB,QAAQ,QAAQ;MAChB;IAEJ,yDAACH,yBAAK;KAAO,MAAM,CAAC,eAAe;KAAE,MAAM;MAAc;IACzD,yDAACI;KACC,MAAM,aAAa;KACnB,YAAY,OAAO;KACnB,cAAc,SAAS;KACvB,cAAc,QAAQ;KACtB,aAAa,KAAK;KAClB,YAAY,QAAQ;KACpB,gBAAgB,QAAQ;KACxB,gBAAgB,QAAQ,OAAO,kBAAkB;MACjD;IACD,QAAQ,SACP;KACE,yDAACJ,yBAAK;MAAO,MAAM,CAAC,WAAW;MAAE,MAAM;OAAc;KACrD,yDAACA,yBAAK;MAAO,MAAM;OAAC;OAAY;OAAe;OAAmB;OAAqB;MAAE,MAAM;MAAY;OAAa;KACxH,yDAACK;MACC,MAAM,MAAM;MACZ,kBAAkB,aAAa;MAC/B,aAAa,KAAK;MAClB,cAAc,QAAQ;MACtB,YAAY,QAAQ;MACpB,gBAAgB,QAAQ;MACb;MACX,gBAAgB,QAAQ,OAAO,kBAAkB;MACjD,cAAc,SAAS;MACvB,kBAAkB,SAAS;OAC3B;QACD;;IAEA;;CAGZ,CAAC"}
|
package/dist/generators.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_generators = require('./generators-
|
|
2
|
-
require('./components-
|
|
1
|
+
const require_generators = require('./generators-jBphJR6A.cjs');
|
|
2
|
+
require('./components-BXOqc0vT.cjs');
|
|
3
3
|
|
|
4
4
|
exports.infiniteQueryGenerator = require_generators.infiniteQueryGenerator;
|
|
5
5
|
exports.mutationGenerator = require_generators.mutationGenerator;
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ReactGenerator, r as PluginVueQuery } from "./types-
|
|
1
|
+
import { a as ReactGenerator, r as PluginVueQuery } from "./types-CWp_kGtI.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/generators/infiniteQueryGenerator.d.ts
|
|
4
4
|
declare const infiniteQueryGenerator: ReactGenerator<PluginVueQuery>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ReactGenerator, r as PluginVueQuery } from "./types-
|
|
1
|
+
import { a as ReactGenerator, r as PluginVueQuery } from "./types-BnerPCg0.js";
|
|
2
2
|
|
|
3
3
|
//#region src/generators/infiniteQueryGenerator.d.ts
|
|
4
4
|
declare const infiniteQueryGenerator: ReactGenerator<PluginVueQuery>;
|
package/dist/generators.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "./components-CPddkKK9.js";
|
|
2
|
-
import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-
|
|
2
|
+
import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-BKpG_fLE.js";
|
|
3
3
|
|
|
4
4
|
export { infiniteQueryGenerator, mutationGenerator, queryGenerator };
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_generators = require('./generators-
|
|
2
|
-
const require_components = require('./components-
|
|
1
|
+
const require_generators = require('./generators-jBphJR6A.cjs');
|
|
2
|
+
const require_components = require('./components-BXOqc0vT.cjs');
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_generators.__toESM(node_path);
|
|
5
5
|
let __kubb_core = require("@kubb/core");
|
|
@@ -21,15 +21,16 @@ const pluginVueQuery = (0, __kubb_core.definePlugin)((options) => {
|
|
|
21
21
|
require_generators.infiniteQueryGenerator,
|
|
22
22
|
require_generators.mutationGenerator
|
|
23
23
|
].filter(Boolean), contentType, client } = options;
|
|
24
|
-
const
|
|
25
|
-
const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${
|
|
24
|
+
const clientName = client?.client ?? "axios";
|
|
25
|
+
const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
|
|
26
26
|
return {
|
|
27
27
|
name: pluginVueQueryName,
|
|
28
28
|
options: {
|
|
29
29
|
output,
|
|
30
30
|
client: {
|
|
31
31
|
...options.client,
|
|
32
|
-
client:
|
|
32
|
+
client: clientName,
|
|
33
|
+
clientType: client?.clientType ?? "function",
|
|
33
34
|
dataReturnType: client?.dataReturnType ?? "data",
|
|
34
35
|
pathParamsType,
|
|
35
36
|
importPath: clientImportPath
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["MutationKey","QueryKey","queryGenerator","infiniteQueryGenerator","mutationGenerator","pluginOasName","pluginTsName","pluginZodName","path","options","groupName: Group['name']","pluginClientName","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\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 { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\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, infiniteQueryGenerator, mutationGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["MutationKey","QueryKey","queryGenerator","infiniteQueryGenerator","mutationGenerator","pluginOasName","pluginTsName","pluginZodName","path","options","groupName: Group['name']","pluginClientName","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\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 { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\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, infiniteQueryGenerator, 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: pluginVueQueryName,\n options: {\n output,\n client: {\n ...options.client,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n dataReturnType: client?.dataReturnType ?? 'data',\n pathParamsType,\n importPath: clientImportPath,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n nextParam: undefined,\n previousParam: undefined,\n ...infinite,\n }\n : false,\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/vue-query',\n ...query,\n },\n mutationKey,\n mutation: {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/vue-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.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled\n await this.upsertFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\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: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,qBAAqB;AAElC,MAAa,gDAA+C,YAAY;CACtE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,UACA,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAA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2B,uCAAuC,CAAC;KACnE,cAAc;KACd,aAAa;KACd,CACF;IACF,CAAC;GAeJ,MAAM,QAAQ,MAZa,IAAII,qCAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,sCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as Options, r as PluginVueQuery, s as UserPluginWithLifeCycle } from "./types-
|
|
1
|
+
import { n as Options, r as PluginVueQuery, s as UserPluginWithLifeCycle } from "./types-CWp_kGtI.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginVueQueryName = "plugin-vue-query";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as Options, r as PluginVueQuery, s as UserPluginWithLifeCycle } from "./types-
|
|
1
|
+
import { n as Options, r as PluginVueQuery, s as UserPluginWithLifeCycle } from "./types-BnerPCg0.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginVueQueryName = "plugin-vue-query";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as MutationKey, s as QueryKey } from "./components-CPddkKK9.js";
|
|
2
|
-
import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-
|
|
2
|
+
import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-BKpG_fLE.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
|
|
5
5
|
import { camelCase, pascalCase } from "@kubb/core/transformers";
|
|
@@ -20,15 +20,16 @@ const pluginVueQuery = definePlugin((options) => {
|
|
|
20
20
|
infiniteQueryGenerator,
|
|
21
21
|
mutationGenerator
|
|
22
22
|
].filter(Boolean), contentType, client } = options;
|
|
23
|
-
const
|
|
24
|
-
const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${
|
|
23
|
+
const clientName = client?.client ?? "axios";
|
|
24
|
+
const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
|
|
25
25
|
return {
|
|
26
26
|
name: pluginVueQueryName,
|
|
27
27
|
options: {
|
|
28
28
|
output,
|
|
29
29
|
client: {
|
|
30
30
|
...options.client,
|
|
31
|
-
client:
|
|
31
|
+
client: clientName,
|
|
32
|
+
clientType: client?.clientType ?? "function",
|
|
32
33
|
dataReturnType: client?.dataReturnType ?? "data",
|
|
33
34
|
pathParamsType,
|
|
34
35
|
importPath: clientImportPath
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\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 { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\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, infiniteQueryGenerator, mutationGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const
|
|
1
|
+
{"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\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 { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\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, infiniteQueryGenerator, 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: pluginVueQueryName,\n options: {\n output,\n client: {\n ...options.client,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n dataReturnType: client?.dataReturnType ?? 'data',\n pathParamsType,\n importPath: clientImportPath,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n nextParam: undefined,\n previousParam: undefined,\n ...infinite,\n }\n : false,\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/vue-query',\n ...query,\n },\n mutationKey,\n mutation: {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/vue-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.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled\n await this.upsertFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\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: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,qBAAqB;AAElC,MAAa,iBAAiB,cAA8B,YAAY;CACtE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,UACA,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,WAAW,E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AAuC,CAAC;KACnE,cAAc;KACd,aAAa;KACd,CACF;IACF,CAAC;GAeJ,MAAM,QAAQ,MAZa,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,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,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
1
2
|
import * as OasTypes from "oas/types";
|
|
2
3
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
3
4
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
@@ -5,7 +6,6 @@ import { OpenAPIV3 } from "openapi-types";
|
|
|
5
6
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
6
7
|
import BaseOas from "oas";
|
|
7
8
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
9
9
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
10
10
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
11
11
|
|
|
@@ -1094,6 +1094,13 @@ type Options$2 = {
|
|
|
1094
1094
|
* @default 'axios'
|
|
1095
1095
|
*/
|
|
1096
1096
|
client?: 'axios' | 'fetch';
|
|
1097
|
+
/**
|
|
1098
|
+
* How to generate the client code
|
|
1099
|
+
* - 'function' will generate standalone functions for each operation.
|
|
1100
|
+
* - 'class' will generate a class with methods for each operation.
|
|
1101
|
+
* @default 'function'
|
|
1102
|
+
*/
|
|
1103
|
+
clientType?: 'function' | 'class';
|
|
1097
1104
|
/**
|
|
1098
1105
|
* Bundle the selected client into the generated `.kubb` directory.
|
|
1099
1106
|
* When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
@@ -1117,6 +1124,7 @@ type ResolvedOptions$1 = {
|
|
|
1117
1124
|
group?: Options$2['group'];
|
|
1118
1125
|
baseURL: string | undefined;
|
|
1119
1126
|
client: Options$2['client'];
|
|
1127
|
+
clientType: NonNullable<Options$2['clientType']>;
|
|
1120
1128
|
bundle: NonNullable<Options$2['bundle']>;
|
|
1121
1129
|
parser: NonNullable<Options$2['parser']>;
|
|
1122
1130
|
urlType: NonNullable<Options$2['urlType']>;
|
|
@@ -1215,7 +1223,7 @@ type Options$1 = {
|
|
|
1215
1223
|
* Group the @tanstack/query hooks based on the provided name.
|
|
1216
1224
|
*/
|
|
1217
1225
|
group?: Group;
|
|
1218
|
-
client?: Pick<PluginClient['options'], 'client' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle'>;
|
|
1226
|
+
client?: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle'>;
|
|
1219
1227
|
/**
|
|
1220
1228
|
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
1221
1229
|
*/
|
|
@@ -1297,4 +1305,4 @@ type ResolvedOptions = {
|
|
|
1297
1305
|
type PluginVueQuery = PluginFactoryOptions<'plugin-vue-query', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1298
1306
|
//#endregion
|
|
1299
1307
|
export { ReactGenerator as a, Operation$1 as c, Transformer as i, Options$1 as n, OperationSchemas as o, PluginVueQuery as r, UserPluginWithLifeCycle as s, Infinite as t };
|
|
1300
|
-
//# sourceMappingURL=types-
|
|
1308
|
+
//# sourceMappingURL=types-BnerPCg0.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
2
1
|
import * as OasTypes from "oas/types";
|
|
3
2
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
4
3
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
@@ -6,6 +5,7 @@ import { OpenAPIV3 } from "openapi-types";
|
|
|
6
5
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
7
6
|
import BaseOas from "oas";
|
|
8
7
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
9
9
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
10
10
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
11
11
|
|
|
@@ -1094,6 +1094,13 @@ type Options$2 = {
|
|
|
1094
1094
|
* @default 'axios'
|
|
1095
1095
|
*/
|
|
1096
1096
|
client?: 'axios' | 'fetch';
|
|
1097
|
+
/**
|
|
1098
|
+
* How to generate the client code
|
|
1099
|
+
* - 'function' will generate standalone functions for each operation.
|
|
1100
|
+
* - 'class' will generate a class with methods for each operation.
|
|
1101
|
+
* @default 'function'
|
|
1102
|
+
*/
|
|
1103
|
+
clientType?: 'function' | 'class';
|
|
1097
1104
|
/**
|
|
1098
1105
|
* Bundle the selected client into the generated `.kubb` directory.
|
|
1099
1106
|
* When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
@@ -1117,6 +1124,7 @@ type ResolvedOptions$1 = {
|
|
|
1117
1124
|
group?: Options$2['group'];
|
|
1118
1125
|
baseURL: string | undefined;
|
|
1119
1126
|
client: Options$2['client'];
|
|
1127
|
+
clientType: NonNullable<Options$2['clientType']>;
|
|
1120
1128
|
bundle: NonNullable<Options$2['bundle']>;
|
|
1121
1129
|
parser: NonNullable<Options$2['parser']>;
|
|
1122
1130
|
urlType: NonNullable<Options$2['urlType']>;
|
|
@@ -1215,7 +1223,7 @@ type Options$1 = {
|
|
|
1215
1223
|
* Group the @tanstack/query hooks based on the provided name.
|
|
1216
1224
|
*/
|
|
1217
1225
|
group?: Group;
|
|
1218
|
-
client?: Pick<PluginClient['options'], 'client' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle'>;
|
|
1226
|
+
client?: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle'>;
|
|
1219
1227
|
/**
|
|
1220
1228
|
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
1221
1229
|
*/
|
|
@@ -1297,4 +1305,4 @@ type ResolvedOptions = {
|
|
|
1297
1305
|
type PluginVueQuery = PluginFactoryOptions<'plugin-vue-query', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1298
1306
|
//#endregion
|
|
1299
1307
|
export { ReactGenerator as a, Operation$1 as c, Transformer as i, Options$1 as n, OperationSchemas as o, PluginVueQuery as r, UserPluginWithLifeCycle as s, Infinite as t };
|
|
1300
|
-
//# sourceMappingURL=types-
|
|
1308
|
+
//# sourceMappingURL=types-CWp_kGtI.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-vue-query",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.1",
|
|
4
4
|
"description": "Vue Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for Vue.js applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue-query",
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@kubb/react-fabric": "0.5.4",
|
|
72
72
|
"remeda": "^2.32.0",
|
|
73
|
-
"@kubb/core": "4.
|
|
74
|
-
"@kubb/oas": "4.
|
|
75
|
-
"@kubb/plugin-client": "4.
|
|
76
|
-
"@kubb/plugin-oas": "4.
|
|
77
|
-
"@kubb/plugin-ts": "4.
|
|
78
|
-
"@kubb/plugin-zod": "4.
|
|
73
|
+
"@kubb/core": "4.9.1",
|
|
74
|
+
"@kubb/oas": "4.9.1",
|
|
75
|
+
"@kubb/plugin-client": "4.9.1",
|
|
76
|
+
"@kubb/plugin-oas": "4.9.1",
|
|
77
|
+
"@kubb/plugin-ts": "4.9.1",
|
|
78
|
+
"@kubb/plugin-zod": "4.9.1"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"@kubb/react-fabric": "0.5.4"
|
|
@@ -42,8 +42,10 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])
|
|
45
|
+
// Class-based clients are not compatible with query hooks, so we generate inline clients
|
|
46
|
+
const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'
|
|
45
47
|
const client = {
|
|
46
|
-
name:
|
|
48
|
+
name: shouldUseClientPlugin
|
|
47
49
|
? getName(operation, {
|
|
48
50
|
type: 'function',
|
|
49
51
|
pluginKey: [pluginClientName],
|
|
@@ -124,8 +126,8 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
124
126
|
)}
|
|
125
127
|
<File.Import name={['toValue']} path="vue" />
|
|
126
128
|
<File.Import name={['MaybeRefOrGetter']} path="vue" isTypeOnly />
|
|
127
|
-
{
|
|
128
|
-
{!
|
|
129
|
+
{shouldUseClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}
|
|
130
|
+
{!shouldUseClientPlugin && (
|
|
129
131
|
<File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
|
|
130
132
|
)}
|
|
131
133
|
<File.Import
|
|
@@ -150,7 +152,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
150
152
|
typeSchemas={type.schemas}
|
|
151
153
|
transformer={options.queryKey}
|
|
152
154
|
/>
|
|
153
|
-
{!
|
|
155
|
+
{!shouldUseClientPlugin && (
|
|
154
156
|
<Client
|
|
155
157
|
name={client.name}
|
|
156
158
|
baseURL={options.client.baseURL}
|
|
@@ -49,8 +49,10 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])
|
|
52
|
+
// Class-based clients are not compatible with query hooks, so we generate inline clients
|
|
53
|
+
const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'
|
|
52
54
|
const client = {
|
|
53
|
-
name:
|
|
55
|
+
name: shouldUseClientPlugin
|
|
54
56
|
? getName(operation, {
|
|
55
57
|
type: 'function',
|
|
56
58
|
pluginKey: [pluginClientName],
|
|
@@ -107,8 +109,8 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
107
109
|
</>
|
|
108
110
|
)}
|
|
109
111
|
<File.Import name={['MaybeRefOrGetter']} path="vue" isTypeOnly />
|
|
110
|
-
{
|
|
111
|
-
{!
|
|
112
|
+
{shouldUseClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}
|
|
113
|
+
{!shouldUseClientPlugin && (
|
|
112
114
|
<File.Import name={['buildFormData']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
|
|
113
115
|
)}
|
|
114
116
|
<File.Import
|
|
@@ -133,7 +135,7 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
133
135
|
typeSchemas={type.schemas}
|
|
134
136
|
transformer={options.mutationKey}
|
|
135
137
|
/>
|
|
136
|
-
{!
|
|
138
|
+
{!shouldUseClientPlugin && (
|
|
137
139
|
<Client
|
|
138
140
|
name={client.name}
|
|
139
141
|
baseURL={options.client.baseURL}
|