@kubb/plugin-react-query 4.0.2 → 4.1.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-CQAsEApg.cjs → components-DkiO4xNZ.cjs} +294 -231
- package/dist/components-DkiO4xNZ.cjs.map +1 -0
- package/dist/{components-BRLaeCYI.js → components-Dz_s6t75.js} +287 -230
- package/dist/components-Dz_s6t75.js.map +1 -0
- package/dist/components.cjs +2 -1
- package/dist/components.d.cts +137 -109
- package/dist/components.d.ts +137 -109
- package/dist/components.js +2 -2
- package/dist/{generators-DZJ_SWwE.cjs → generators-BiW_MevM.cjs} +25 -8
- package/dist/generators-BiW_MevM.cjs.map +1 -0
- package/dist/{generators-DrSq5cK7.js → generators-ByqomtgH.js} +23 -6
- package/dist/generators-ByqomtgH.js.map +1 -0
- package/dist/generators.cjs +2 -2
- package/dist/generators.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/package.json +8 -8
- package/src/components/Mutation.tsx +12 -40
- package/src/components/MutationOptions.tsx +113 -0
- package/src/components/index.ts +4 -3
- package/src/generators/__snapshots__/clientPostImportPath.ts +25 -12
- package/src/generators/__snapshots__/updatePetById.ts +25 -12
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +25 -12
- package/src/generators/mutationGenerator.tsx +18 -2
- package/dist/components-BRLaeCYI.js.map +0 -1
- package/dist/components-CQAsEApg.cjs.map +0 -1
- package/dist/generators-DZJ_SWwE.cjs.map +0 -1
- package/dist/generators-DrSq5cK7.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-ByqomtgH.js","names":[],"sources":["../src/generators/queryGenerator.tsx","../src/generators/mutationGenerator.tsx","../src/generators/infiniteQueryGenerator.tsx","../src/generators/suspenseQueryGenerator.tsx"],"sourcesContent":["import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginReactQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginReactQuery>({\n name: 'react-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n pluginManager,\n } = useApp<PluginReactQuery>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n\n const importPath = options.query ? options.query.importPath : '@tanstack/react-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 const client = {\n name: hasClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginKey: [pluginClientName],\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginKey: [pluginClientName] }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n // grouping is coming from react-query instead of zod option, we need to pass the options of zod instead\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File\n baseName={query.file.baseName}\n path={query.file.path}\n meta={query.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={query.file.path} path={zod.file.path} />\n )}\n <File.Import name={'fetch'} path={options.client.importPath} />\n {hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.queryKey}\n />\n {!hasClientPlugin && (\n <Client\n name={client.name}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n <File.Import name={['queryOptions']} path={importPath} />\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n queryKeyName={queryKey.name}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType}\n />\n {options.query && (\n <>\n <File.Import name={['useQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'QueryObserverOptions', 'UseQueryResult', 'QueryClient']} 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}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport { MutationOptions } from '../components/MutationOptions.tsx'\nimport type { PluginReactQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginReactQuery>({\n name: 'react-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n pluginManager,\n } = useApp<PluginReactQuery>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : '@tanstack/react-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n const client = {\n name: hasClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginKey: [pluginClientName],\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginKey: [pluginClientName] }),\n }\n\n const mutationOptions = {\n name: getName(operation, { type: 'function', suffix: 'MutationOptions' }),\n }\n\n const mutationKey = {\n name: getName(operation, { type: 'const', suffix: 'MutationKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),\n }\n\n if (!isMutation) {\n return null\n }\n\n return (\n <File\n baseName={mutation.file.baseName}\n path={mutation.file.path}\n meta={mutation.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={mutation.file.path} path={zod.file.path} />\n )}\n <File.Import name={'fetch'} path={options.client.importPath} />\n {!!hasClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}\n <File.Import name={['RequestConfig', 'ResponseConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.mutationKey}\n />\n\n {!hasClientPlugin && (\n <Client\n name={client.name}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n <File.Import name={['mutationOptions']} path={importPath} />\n\n <MutationOptions\n name={mutationOptions.name}\n clientName={client.name}\n mutationKeyName={mutationKey.name}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType}\n />\n {options.mutation && (\n <>\n <File.Import name={['useMutation']} path={importPath} />\n <File.Import name={['UseMutationOptions', 'QueryClient']} path={importPath} isTypeOnly />\n <Mutation\n name={mutation.name}\n mutationOptionsName={mutationOptions.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { InfiniteQuery, InfiniteQueryOptions, QueryKey } from '../components'\nimport type { PluginReactQuery } from '../types'\n\nexport const infiniteQueryGenerator = createReactGenerator<PluginReactQuery>({\n name: 'react-infinite-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n pluginManager,\n } = useApp<PluginReactQuery>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const isInfinite = !!options.infinite\n\n const importPath = options.query ? options.query.importPath : '@tanstack/react-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'use', suffix: 'infinite' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use', suffix: 'infinite' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n const client = {\n name: hasClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginKey: [pluginClientName],\n })\n : getName(operation, {\n type: 'function',\n suffix: 'infinite',\n }),\n file: getFile(operation, { pluginKey: [pluginClientName] }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'InfiniteQueryOptions' }),\n }\n\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'InfiniteQueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'InfiniteQueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation || !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 {<File.Import name={'fetch'} path={options.client.importPath} />}\n {hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.queryKey}\n />\n {!hasClientPlugin && (\n <Client\n name={client.name}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {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 paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType}\n cursorParam={options.infinite.cursorParam}\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', 'InfiniteQueryObserverOptions', 'UseInfiniteQueryResult']} 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}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n queryParam={options.infinite.queryParam}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { QueryKey, QueryOptions, SuspenseQuery } from '../components'\nimport type { PluginReactQuery } from '../types'\n\nexport const suspenseQueryGenerator = createReactGenerator<PluginReactQuery>({\n name: 'react-suspense-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n pluginManager,\n } = useApp<PluginReactQuery>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n\n const isSuspense = !!options.suspense\n\n const importPath = options.query ? options.query.importPath : '@tanstack/react-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'use', suffix: 'suspense' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use', suffix: 'suspense' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n const client = {\n name: hasClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginKey: [pluginClientName],\n })\n : getName(operation, {\n type: 'function',\n suffix: 'suspense',\n }),\n file: getFile(operation, { pluginKey: [pluginClientName] }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'SuspenseQueryOptions' }),\n }\n\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'SuspenseQueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'SuspenseQueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation || !isSuspense) {\n return null\n }\n\n return (\n <File\n baseName={query.file.baseName}\n path={query.file.path}\n meta={query.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={query.file.path} path={zod.file.path} />\n )}\n <File.Import name={'fetch'} path={options.client.importPath} />\n {hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.queryKey}\n />\n\n {!hasClientPlugin && (\n <Client\n name={client.name}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n <File.Import name={['queryOptions']} path={importPath} />\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n queryKeyName={queryKey.name}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType}\n />\n {options.suspense && (\n <>\n <File.Import name={['useSuspenseQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'UseSuspenseQueryOptions', 'UseSuspenseQueryResult']} path={importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n\n <SuspenseQuery\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n operation={operation}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,iBAAiB,qBAAuC;CACnE,MAAM;CACN,UAAU,EAAE,SAAS,aAAa;EAChC,MAAM,EACJ,QAAQ,EACN,SAAS,EAAE,YAEb,kBACE,QAA0B;EAC9B,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,YAAY,qBAAqB;EAE9D,MAAM,UAAU,OAAO,QAAQ,UAAU,YAAY,OAAO,QAAQ,OAAO,QAAQ,MAAM,WAAW,UAAU,WAAW,OAAO;EAChI,MAAM,aAAa,WAAW,QAAQ,WAAW,QAAQ,SAAS,UAAU,EAAE,EAAE,QAAQ,QAAQ,QAAQ,MAAM,UAAU,EAAE,CAAC,CAAC,MACzH,WAAW,UAAU,WAAW,OAClC;EAED,MAAM,aAAa,QAAQ,QAAQ,QAAQ,MAAM,aAAa;EAE9D,MAAM,QAAQ;GACZ,MAAM,QAAQ,WAAW;IAAE,MAAM;IAAY,QAAQ;IAAO,CAAC;GAC7D,UAAU,QAAQ,WAAW,EAAE,MAAM,QAAQ,CAAC;GAC9C,MAAM,QAAQ,WAAW,EAAE,QAAQ,OAAO,CAAC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aAAa;KACnB,YAAY,OAAO;KACnB,cAAc,SAAS;KACvB,aAAa,KAAK;KAClB,cAAc,QAAQ;KACtB,YAAY,QAAQ;KACpB,gBAAgB,QAAQ;KACxB,gBAAgB,QAAQ,OAAO;MAC/B;IACD,QAAQ,YACP;KACE,oBAAC,KAAK;MAAO,MAAM,CAAC,mBAAmB;MAAE,MAAM;OAAc;KAC7D,oBAAC,KAAK;MAAO,MAAM;OAAC;OAAY;OAAe;OAA2B;OAAyB;MAAE,MAAM;MAAY;OAAa;KACnI,QAAQ,OAAO,mBAAmB,UAAU,oBAAC,KAAK;MAAO,MAAM,CAAC,iBAAiB;MAAE,MAAM,QAAQ,OAAO;MAAY;OAAa;KAElI,oBAAC;MACC,MAAM,MAAM;MACZ,kBAAkB,aAAa;MAC/B,aAAa,KAAK;MAClB,YAAY,QAAQ;MACpB,cAAc,QAAQ;MACtB,gBAAgB,QAAQ;MACb;MACX,gBAAgB,QAAQ,OAAO;MAC/B,cAAc,SAAS;MACvB,kBAAkB,SAAS;OAC3B;QACD;;IAEA;;CAGZ,CAAC"}
|
package/dist/generators.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require('./components-
|
|
2
|
-
const require_generators = require('./generators-
|
|
1
|
+
require('./components-DkiO4xNZ.cjs');
|
|
2
|
+
const require_generators = require('./generators-BiW_MevM.cjs');
|
|
3
3
|
|
|
4
4
|
exports.infiniteQueryGenerator = require_generators.infiniteQueryGenerator;
|
|
5
5
|
exports.mutationGenerator = require_generators.mutationGenerator;
|
package/dist/generators.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./components-
|
|
2
|
-
import { infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseQueryGenerator } from "./generators-
|
|
1
|
+
import "./components-Dz_s6t75.js";
|
|
2
|
+
import { infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseQueryGenerator } from "./generators-ByqomtgH.js";
|
|
3
3
|
|
|
4
4
|
export { infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseQueryGenerator };
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_components = require('./components-
|
|
2
|
-
const require_generators = require('./generators-
|
|
1
|
+
const require_components = require('./components-DkiO4xNZ.cjs');
|
|
2
|
+
const require_generators = require('./generators-BiW_MevM.cjs');
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_components.__toESM(node_path);
|
|
5
5
|
let __kubb_core = require("@kubb/core");
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MutationKey, QueryKey } from "./components-
|
|
2
|
-
import { infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseQueryGenerator } from "./generators-
|
|
1
|
+
import { MutationKey, QueryKey } from "./components-Dz_s6t75.js";
|
|
2
|
+
import { infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseQueryGenerator } from "./generators-ByqomtgH.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { FileManager, PluginManager, createPlugin } from "@kubb/core";
|
|
5
5
|
import { camelCase, pascalCase } from "@kubb/core/transformers";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-react-query",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "React Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for React applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-query",
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
],
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"remeda": "^2.32.0",
|
|
64
|
-
"@kubb/core": "4.
|
|
65
|
-
"@kubb/oas": "4.
|
|
66
|
-
"@kubb/plugin-client": "4.
|
|
67
|
-
"@kubb/plugin-oas": "4.
|
|
68
|
-
"@kubb/plugin-ts": "4.
|
|
69
|
-
"@kubb/plugin-zod": "4.
|
|
70
|
-
"@kubb/react": "4.
|
|
64
|
+
"@kubb/core": "4.1.1",
|
|
65
|
+
"@kubb/oas": "4.1.1",
|
|
66
|
+
"@kubb/plugin-client": "4.1.1",
|
|
67
|
+
"@kubb/plugin-oas": "4.1.1",
|
|
68
|
+
"@kubb/plugin-ts": "4.1.1",
|
|
69
|
+
"@kubb/plugin-zod": "4.1.1",
|
|
70
|
+
"@kubb/react": "4.1.1"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/react": "^18.3.24",
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { type Operation, isOptional } from '@kubb/oas'
|
|
4
|
-
import { Client } from '@kubb/plugin-client/components'
|
|
1
|
+
import { isOptional, type Operation } from '@kubb/oas'
|
|
5
2
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
6
3
|
import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
|
|
7
|
-
import
|
|
4
|
+
import { File, Function, FunctionParams } from '@kubb/react'
|
|
8
5
|
import type { ReactNode } from 'react'
|
|
9
6
|
import type { PluginReactQuery } from '../types.ts'
|
|
10
7
|
import { MutationKey } from './MutationKey.tsx'
|
|
8
|
+
import { MutationOptions } from './MutationOptions.tsx'
|
|
11
9
|
|
|
12
10
|
type Props = {
|
|
13
11
|
/**
|
|
@@ -15,13 +13,12 @@ type Props = {
|
|
|
15
13
|
*/
|
|
16
14
|
name: string
|
|
17
15
|
typeName: string
|
|
18
|
-
|
|
16
|
+
mutationOptionsName: string
|
|
19
17
|
mutationKeyName: string
|
|
20
18
|
typeSchemas: OperationSchemas
|
|
21
19
|
operation: Operation
|
|
22
20
|
dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']
|
|
23
21
|
paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']
|
|
24
|
-
paramsType: PluginReactQuery['resolvedOptions']['paramsType']
|
|
25
22
|
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']
|
|
26
23
|
}
|
|
27
24
|
|
|
@@ -74,9 +71,8 @@ function getParams({ paramsCasing, dataReturnType, typeSchemas }: GetParamsProps
|
|
|
74
71
|
|
|
75
72
|
export function Mutation({
|
|
76
73
|
name,
|
|
77
|
-
|
|
74
|
+
mutationOptionsName,
|
|
78
75
|
paramsCasing,
|
|
79
|
-
paramsType,
|
|
80
76
|
pathParamsType,
|
|
81
77
|
dataReturnType,
|
|
82
78
|
typeSchemas,
|
|
@@ -95,14 +91,6 @@ export function Mutation({
|
|
|
95
91
|
typeSchemas,
|
|
96
92
|
})
|
|
97
93
|
|
|
98
|
-
const clientParams = Client.getParams({
|
|
99
|
-
paramsCasing,
|
|
100
|
-
paramsType,
|
|
101
|
-
typeSchemas,
|
|
102
|
-
pathParamsType,
|
|
103
|
-
isConfigurable: true,
|
|
104
|
-
})
|
|
105
|
-
|
|
106
94
|
const mutationParams = FunctionParams.factory({
|
|
107
95
|
...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
108
96
|
data: typeSchemas.request?.name
|
|
@@ -125,28 +113,14 @@ export function Mutation({
|
|
|
125
113
|
: undefined,
|
|
126
114
|
})
|
|
127
115
|
|
|
128
|
-
const
|
|
129
|
-
data: {
|
|
130
|
-
// No use of pathParams because useMutation can only take one argument in object form,
|
|
131
|
-
// see https://tanstack.com/query/latest/docs/framework/react/reference/useMutation#usemutation
|
|
132
|
-
mode: 'object',
|
|
133
|
-
children: Object.entries(mutationParams.params).reduce((acc, [key, value]) => {
|
|
134
|
-
if (value) {
|
|
135
|
-
acc[key] = {
|
|
136
|
-
...value,
|
|
137
|
-
type: undefined,
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return acc
|
|
142
|
-
}, {} as Params),
|
|
143
|
-
},
|
|
144
|
-
})
|
|
116
|
+
const mutationOptionsParams = MutationOptions.getParams({ typeSchemas })
|
|
145
117
|
|
|
146
118
|
const TRequest = mutationParams.toConstructor()
|
|
147
119
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
148
120
|
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
149
|
-
const
|
|
121
|
+
const returnType = `UseMutationOptions<${[TData, TError, TRequest ? `{${TRequest}}` : 'void', 'TContext'].join(', ')}>`
|
|
122
|
+
|
|
123
|
+
const mutationOptions = `${mutationOptionsName}(${mutationOptionsParams.toCall()})`
|
|
150
124
|
|
|
151
125
|
return (
|
|
152
126
|
<File.Source name={name} isExportable isIndexable>
|
|
@@ -164,13 +138,11 @@ export function Mutation({
|
|
|
164
138
|
const { client: queryClient, ...mutationOptions } = mutation;
|
|
165
139
|
const mutationKey = mutationOptions.mutationKey ?? ${mutationKeyName}(${mutationKeyParams.toCall()})
|
|
166
140
|
|
|
167
|
-
return useMutation
|
|
168
|
-
|
|
169
|
-
return ${clientName}(${clientParams.toCall()})
|
|
170
|
-
},
|
|
141
|
+
return useMutation({
|
|
142
|
+
...${mutationOptions},
|
|
171
143
|
mutationKey,
|
|
172
144
|
...mutationOptions
|
|
173
|
-
}, queryClient)
|
|
145
|
+
} as unknown as UseMutationOptions, queryClient) as ${returnType}
|
|
174
146
|
`}
|
|
175
147
|
</Function>
|
|
176
148
|
</File.Source>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { isOptional } from '@kubb/oas'
|
|
2
|
+
import { Client } from '@kubb/plugin-client/components'
|
|
3
|
+
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
4
|
+
import { getPathParams } from '@kubb/plugin-oas/utils'
|
|
5
|
+
import { File, Function, FunctionParams } from '@kubb/react'
|
|
6
|
+
import type { Params } from '@kubb/react/types'
|
|
7
|
+
import type { PluginReactQuery } from '../types.ts'
|
|
8
|
+
import { MutationKey } from './MutationKey.tsx'
|
|
9
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
name: string
|
|
12
|
+
clientName: string
|
|
13
|
+
mutationKeyName: string
|
|
14
|
+
typeSchemas: OperationSchemas
|
|
15
|
+
paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']
|
|
16
|
+
paramsType: PluginReactQuery['resolvedOptions']['paramsType']
|
|
17
|
+
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']
|
|
18
|
+
dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type GetParamsProps = {
|
|
22
|
+
typeSchemas: OperationSchemas
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getParams({ typeSchemas }: GetParamsProps) {
|
|
26
|
+
return FunctionParams.factory({
|
|
27
|
+
config: {
|
|
28
|
+
type: typeSchemas.request?.name
|
|
29
|
+
? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`
|
|
30
|
+
: 'Partial<RequestConfig> & { client?: typeof fetch }',
|
|
31
|
+
default: '{}',
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function MutationOptions({ name, clientName, dataReturnType, typeSchemas, paramsCasing, paramsType, pathParamsType, mutationKeyName }: Props) {
|
|
37
|
+
const params = getParams({ typeSchemas })
|
|
38
|
+
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
39
|
+
const TError = typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'
|
|
40
|
+
|
|
41
|
+
const clientParams = Client.getParams({
|
|
42
|
+
typeSchemas,
|
|
43
|
+
paramsCasing,
|
|
44
|
+
paramsType,
|
|
45
|
+
pathParamsType,
|
|
46
|
+
isConfigurable: true,
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const mutationKeyParams = MutationKey.getParams({
|
|
50
|
+
pathParamsType,
|
|
51
|
+
typeSchemas,
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const mutationParams = FunctionParams.factory({
|
|
55
|
+
...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
|
|
56
|
+
data: typeSchemas.request?.name
|
|
57
|
+
? {
|
|
58
|
+
type: typeSchemas.request?.name,
|
|
59
|
+
optional: isOptional(typeSchemas.request?.schema),
|
|
60
|
+
}
|
|
61
|
+
: undefined,
|
|
62
|
+
params: typeSchemas.queryParams?.name
|
|
63
|
+
? {
|
|
64
|
+
type: typeSchemas.queryParams?.name,
|
|
65
|
+
optional: isOptional(typeSchemas.queryParams?.schema),
|
|
66
|
+
}
|
|
67
|
+
: undefined,
|
|
68
|
+
headers: typeSchemas.headerParams?.name
|
|
69
|
+
? {
|
|
70
|
+
type: typeSchemas.headerParams?.name,
|
|
71
|
+
optional: isOptional(typeSchemas.headerParams?.schema),
|
|
72
|
+
}
|
|
73
|
+
: undefined,
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const dataParams = FunctionParams.factory({
|
|
77
|
+
data: {
|
|
78
|
+
// No use of pathParams because useMutation can only take one argument in object form,
|
|
79
|
+
// see https://tanstack.com/query/latest/docs/framework/react/reference/useMutation#usemutation
|
|
80
|
+
mode: 'object',
|
|
81
|
+
children: Object.entries(mutationParams.params).reduce((acc, [key, value]) => {
|
|
82
|
+
if (value) {
|
|
83
|
+
acc[key] = {
|
|
84
|
+
...value,
|
|
85
|
+
type: undefined,
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return acc
|
|
90
|
+
}, {} as Params),
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
const TRequest = mutationParams.toConstructor()
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<File.Source name={name} isExportable isIndexable>
|
|
98
|
+
<Function name={name} export params={params.toConstructor()}>
|
|
99
|
+
{`
|
|
100
|
+
const mutationKey = ${mutationKeyName}(${mutationKeyParams.toCall()})
|
|
101
|
+
return mutationOptions<${TData}, ResponseErrorConfig<${TError}>, ${TRequest ? `{${TRequest}}` : 'void'}, typeof mutationKey>({
|
|
102
|
+
mutationKey,
|
|
103
|
+
mutationFn: async(${dataParams.toConstructor()}) => {
|
|
104
|
+
return ${clientName}(${clientParams.toCall()})
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
`}
|
|
108
|
+
</Function>
|
|
109
|
+
</File.Source>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
MutationOptions.getParams = getParams
|
package/src/components/index.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
export { InfiniteQuery } from './InfiniteQuery.tsx'
|
|
2
|
+
export { InfiniteQueryOptions } from './InfiniteQueryOptions.tsx'
|
|
1
3
|
export { Mutation } from './Mutation.tsx'
|
|
4
|
+
export { MutationKey } from './MutationKey.tsx'
|
|
5
|
+
export { MutationOptions } from './MutationOptions.tsx'
|
|
2
6
|
export { Query } from './Query.tsx'
|
|
3
7
|
export { QueryKey } from './QueryKey.tsx'
|
|
4
|
-
export { MutationKey } from './MutationKey.tsx'
|
|
5
8
|
export { QueryOptions } from './QueryOptions.tsx'
|
|
6
|
-
export { InfiniteQueryOptions } from './InfiniteQueryOptions.tsx'
|
|
7
|
-
export { InfiniteQuery } from './InfiniteQuery.tsx'
|
|
8
9
|
export { SuspenseQuery } from './SuspenseQuery.tsx'
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import fetch from 'axios'
|
|
6
6
|
import type { UseMutationOptions, QueryClient } from '@tanstack/react-query'
|
|
7
7
|
import type { RequestConfig, ResponseErrorConfig } from 'axios'
|
|
8
|
-
import { useMutation } from '@tanstack/react-query'
|
|
8
|
+
import { mutationOptions, useMutation } from '@tanstack/react-query'
|
|
9
9
|
|
|
10
10
|
export const updatePetWithFormMutationKey = () => [{ url: '/pet/:pet_id' }] as const
|
|
11
11
|
|
|
@@ -35,6 +35,21 @@ export async function updatePetWithForm(
|
|
|
35
35
|
return updatePetWithFormMutationResponse.parse(res.data)
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
export function updatePetWithFormMutationOptions(config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof fetch } = {}) {
|
|
39
|
+
const mutationKey = updatePetWithFormMutationKey()
|
|
40
|
+
return mutationOptions<
|
|
41
|
+
UpdatePetWithFormMutationResponse,
|
|
42
|
+
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
43
|
+
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
44
|
+
typeof mutationKey
|
|
45
|
+
>({
|
|
46
|
+
mutationKey,
|
|
47
|
+
mutationFn: async ({ petId, data, params }) => {
|
|
48
|
+
return updatePetWithForm(petId, data, params, config)
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
38
53
|
/**
|
|
39
54
|
* @summary Updates a pet in the store with form data
|
|
40
55
|
* {@link /pet/:pet_id}
|
|
@@ -54,19 +69,17 @@ export function useUpdatePetWithForm<TContext>(
|
|
|
54
69
|
const { client: queryClient, ...mutationOptions } = mutation
|
|
55
70
|
const mutationKey = mutationOptions.mutationKey ?? updatePetWithFormMutationKey()
|
|
56
71
|
|
|
57
|
-
return useMutation
|
|
58
|
-
UpdatePetWithFormMutationResponse,
|
|
59
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
60
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
61
|
-
TContext
|
|
62
|
-
>(
|
|
72
|
+
return useMutation(
|
|
63
73
|
{
|
|
64
|
-
|
|
65
|
-
return updatePetWithForm(petId, data, params, config)
|
|
66
|
-
},
|
|
74
|
+
...updatePetWithFormMutationOptions(config),
|
|
67
75
|
mutationKey,
|
|
68
76
|
...mutationOptions,
|
|
69
|
-
},
|
|
77
|
+
} as unknown as UseMutationOptions,
|
|
70
78
|
queryClient,
|
|
71
|
-
)
|
|
79
|
+
) as UseMutationOptions<
|
|
80
|
+
UpdatePetWithFormMutationResponse,
|
|
81
|
+
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
82
|
+
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
83
|
+
TContext
|
|
84
|
+
>
|
|
72
85
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import fetch from '@kubb/plugin-client/clients/axios'
|
|
6
6
|
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
7
7
|
import type { UseMutationOptions, QueryClient } from '@tanstack/react-query'
|
|
8
|
-
import { useMutation } from '@tanstack/react-query'
|
|
8
|
+
import { mutationOptions, useMutation } from '@tanstack/react-query'
|
|
9
9
|
|
|
10
10
|
export const updatePetWithFormMutationKey = () => [{ url: '/pet/:pet_id' }] as const
|
|
11
11
|
|
|
@@ -35,6 +35,21 @@ export async function updatePetWithForm(
|
|
|
35
35
|
return updatePetWithFormMutationResponse.parse(res.data)
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
export function updatePetWithFormMutationOptions(config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof fetch } = {}) {
|
|
39
|
+
const mutationKey = updatePetWithFormMutationKey()
|
|
40
|
+
return mutationOptions<
|
|
41
|
+
UpdatePetWithFormMutationResponse,
|
|
42
|
+
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
43
|
+
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
44
|
+
typeof mutationKey
|
|
45
|
+
>({
|
|
46
|
+
mutationKey,
|
|
47
|
+
mutationFn: async ({ petId, data, params }) => {
|
|
48
|
+
return updatePetWithForm(petId, data, params, config)
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
38
53
|
/**
|
|
39
54
|
* @summary Updates a pet in the store with form data
|
|
40
55
|
* {@link /pet/:pet_id}
|
|
@@ -54,19 +69,17 @@ export function useUpdatePetWithForm<TContext>(
|
|
|
54
69
|
const { client: queryClient, ...mutationOptions } = mutation
|
|
55
70
|
const mutationKey = mutationOptions.mutationKey ?? updatePetWithFormMutationKey()
|
|
56
71
|
|
|
57
|
-
return useMutation
|
|
58
|
-
UpdatePetWithFormMutationResponse,
|
|
59
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
60
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
61
|
-
TContext
|
|
62
|
-
>(
|
|
72
|
+
return useMutation(
|
|
63
73
|
{
|
|
64
|
-
|
|
65
|
-
return updatePetWithForm(petId, data, params, config)
|
|
66
|
-
},
|
|
74
|
+
...updatePetWithFormMutationOptions(config),
|
|
67
75
|
mutationKey,
|
|
68
76
|
...mutationOptions,
|
|
69
|
-
},
|
|
77
|
+
} as unknown as UseMutationOptions,
|
|
70
78
|
queryClient,
|
|
71
|
-
)
|
|
79
|
+
) as UseMutationOptions<
|
|
80
|
+
UpdatePetWithFormMutationResponse,
|
|
81
|
+
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
82
|
+
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
83
|
+
TContext
|
|
84
|
+
>
|
|
72
85
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import fetch from '@kubb/plugin-client/clients/axios'
|
|
6
6
|
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
7
7
|
import type { UseMutationOptions, QueryClient } from '@tanstack/react-query'
|
|
8
|
-
import { useMutation } from '@tanstack/react-query'
|
|
8
|
+
import { mutationOptions, useMutation } from '@tanstack/react-query'
|
|
9
9
|
|
|
10
10
|
export const updatePetWithFormMutationKey = () => [{ url: '/pet/:pet_id' }] as const
|
|
11
11
|
|
|
@@ -35,6 +35,21 @@ export async function updatePetWithForm(
|
|
|
35
35
|
return updatePetWithFormMutationResponse.parse(res.data)
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
export function updatePetWithFormMutationOptions(config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof fetch } = {}) {
|
|
39
|
+
const mutationKey = updatePetWithFormMutationKey()
|
|
40
|
+
return mutationOptions<
|
|
41
|
+
UpdatePetWithFormMutationResponse,
|
|
42
|
+
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
43
|
+
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
44
|
+
typeof mutationKey
|
|
45
|
+
>({
|
|
46
|
+
mutationKey,
|
|
47
|
+
mutationFn: async ({ petId, data, params }) => {
|
|
48
|
+
return updatePetWithForm({ petId }, data, params, config)
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
38
53
|
/**
|
|
39
54
|
* @summary Updates a pet in the store with form data
|
|
40
55
|
* {@link /pet/:pet_id}
|
|
@@ -54,19 +69,17 @@ export function useUpdatePetWithForm<TContext>(
|
|
|
54
69
|
const { client: queryClient, ...mutationOptions } = mutation
|
|
55
70
|
const mutationKey = mutationOptions.mutationKey ?? updatePetWithFormMutationKey()
|
|
56
71
|
|
|
57
|
-
return useMutation
|
|
58
|
-
UpdatePetWithFormMutationResponse,
|
|
59
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
60
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
61
|
-
TContext
|
|
62
|
-
>(
|
|
72
|
+
return useMutation(
|
|
63
73
|
{
|
|
64
|
-
|
|
65
|
-
return updatePetWithForm({ petId }, data, params, config)
|
|
66
|
-
},
|
|
74
|
+
...updatePetWithFormMutationOptions(config),
|
|
67
75
|
mutationKey,
|
|
68
76
|
...mutationOptions,
|
|
69
|
-
},
|
|
77
|
+
} as unknown as UseMutationOptions,
|
|
70
78
|
queryClient,
|
|
71
|
-
)
|
|
79
|
+
) as UseMutationOptions<
|
|
80
|
+
UpdatePetWithFormMutationResponse,
|
|
81
|
+
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
82
|
+
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
83
|
+
TContext
|
|
84
|
+
>
|
|
72
85
|
}
|
|
@@ -8,6 +8,7 @@ import { pluginZodName } from '@kubb/plugin-zod'
|
|
|
8
8
|
import { File, useApp } from '@kubb/react'
|
|
9
9
|
import { difference } from 'remeda'
|
|
10
10
|
import { Mutation, MutationKey } from '../components'
|
|
11
|
+
import { MutationOptions } from '../components/MutationOptions.tsx'
|
|
11
12
|
import type { PluginReactQuery } from '../types'
|
|
12
13
|
|
|
13
14
|
export const mutationGenerator = createReactGenerator<PluginReactQuery>({
|
|
@@ -59,6 +60,10 @@ export const mutationGenerator = createReactGenerator<PluginReactQuery>({
|
|
|
59
60
|
file: getFile(operation, { pluginKey: [pluginClientName] }),
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
const mutationOptions = {
|
|
64
|
+
name: getName(operation, { type: 'function', suffix: 'MutationOptions' }),
|
|
65
|
+
}
|
|
66
|
+
|
|
62
67
|
const mutationKey = {
|
|
63
68
|
name: getName(operation, { type: 'const', suffix: 'MutationKey' }),
|
|
64
69
|
typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),
|
|
@@ -120,19 +125,30 @@ export const mutationGenerator = createReactGenerator<PluginReactQuery>({
|
|
|
120
125
|
parser={options.parser}
|
|
121
126
|
/>
|
|
122
127
|
)}
|
|
128
|
+
<File.Import name={['mutationOptions']} path={importPath} />
|
|
129
|
+
|
|
130
|
+
<MutationOptions
|
|
131
|
+
name={mutationOptions.name}
|
|
132
|
+
clientName={client.name}
|
|
133
|
+
mutationKeyName={mutationKey.name}
|
|
134
|
+
typeSchemas={type.schemas}
|
|
135
|
+
paramsCasing={options.paramsCasing}
|
|
136
|
+
paramsType={options.paramsType}
|
|
137
|
+
pathParamsType={options.pathParamsType}
|
|
138
|
+
dataReturnType={options.client.dataReturnType}
|
|
139
|
+
/>
|
|
123
140
|
{options.mutation && (
|
|
124
141
|
<>
|
|
125
142
|
<File.Import name={['useMutation']} path={importPath} />
|
|
126
143
|
<File.Import name={['UseMutationOptions', 'QueryClient']} path={importPath} isTypeOnly />
|
|
127
144
|
<Mutation
|
|
128
145
|
name={mutation.name}
|
|
129
|
-
|
|
146
|
+
mutationOptionsName={mutationOptions.name}
|
|
130
147
|
typeName={mutation.typeName}
|
|
131
148
|
typeSchemas={type.schemas}
|
|
132
149
|
operation={operation}
|
|
133
150
|
dataReturnType={options.client.dataReturnType}
|
|
134
151
|
paramsCasing={options.paramsCasing}
|
|
135
|
-
paramsType={options.paramsType}
|
|
136
152
|
pathParamsType={options.pathParamsType}
|
|
137
153
|
mutationKeyName={mutationKey.name}
|
|
138
154
|
/>
|