@kubb/plugin-react-query 5.0.0-beta.25 → 5.0.0-beta.28
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-C91DnOOV.js → components-CDmg-RPi.js} +32 -13
- package/dist/components-CDmg-RPi.js.map +1 -0
- package/dist/{components-C1_zAoAO.cjs → components-MPBTffPl.cjs} +32 -13
- package/dist/components-MPBTffPl.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/{generators-9srJC_zb.js → generators-Bma51Uar.js} +87 -39
- package/dist/generators-Bma51Uar.js.map +1 -0
- package/dist/{generators-DS3JH1hR.cjs → generators-BtsWNz-6.cjs} +87 -39
- package/dist/generators-BtsWNz-6.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/extension.yaml +5 -5
- package/package.json +7 -7
- package/src/components/InfiniteQuery.tsx +3 -2
- package/src/components/InfiniteQueryOptions.tsx +3 -2
- package/src/components/Mutation.tsx +5 -3
- package/src/components/MutationOptions.tsx +3 -2
- package/src/components/Query.tsx +5 -3
- package/src/components/QueryOptions.tsx +3 -2
- package/src/components/SuspenseInfiniteQuery.tsx +3 -2
- package/src/components/SuspenseInfiniteQueryOptions.tsx +3 -2
- package/src/components/SuspenseQuery.tsx +5 -3
- package/src/generators/hookOptionsGenerator.tsx +2 -2
- package/src/generators/infiniteQueryGenerator.tsx +6 -6
- package/src/generators/mutationGenerator.tsx +6 -6
- package/src/generators/queryGenerator.tsx +6 -6
- package/src/generators/suspenseInfiniteQueryGenerator.tsx +6 -6
- package/src/generators/suspenseQueryGenerator.tsx +6 -6
- package/src/plugin.ts +3 -3
- package/src/utils.ts +8 -1
- package/dist/components-C1_zAoAO.cjs.map +0 -1
- package/dist/components-C91DnOOV.js.map +0 -1
- package/dist/generators-9srJC_zb.js.map +0 -1
- package/dist/generators-DS3JH1hR.cjs.map +0 -1
|
@@ -4,7 +4,7 @@ import { functionPrinter } from '@kubb/plugin-ts'
|
|
|
4
4
|
import { File, Function } from '@kubb/renderer-jsx'
|
|
5
5
|
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
6
6
|
import type { PluginReactQuery } from '../types.ts'
|
|
7
|
-
import { buildRequestConfigType, resolveErrorNames } from '../utils.ts'
|
|
7
|
+
import { buildRequestConfigType, resolveErrorNames, resolveSuccessNames } from '../utils.ts'
|
|
8
8
|
|
|
9
9
|
type Props = {
|
|
10
10
|
name: string
|
|
@@ -48,7 +48,8 @@ export function MutationOptions({
|
|
|
48
48
|
pathParamsType,
|
|
49
49
|
mutationKeyName,
|
|
50
50
|
}: Props): KubbReactNode {
|
|
51
|
-
const
|
|
51
|
+
const successNames = resolveSuccessNames(node, tsResolver)
|
|
52
|
+
const responseName = successNames.length > 0 ? successNames.join(' | ') : tsResolver.resolveResponseName(node)
|
|
52
53
|
const TData = dataReturnType === 'data' ? responseName : `ResponseConfig<${responseName}>`
|
|
53
54
|
const errorNames = resolveErrorNames(node, tsResolver)
|
|
54
55
|
const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`
|
package/src/components/Query.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { functionPrinter } from '@kubb/plugin-ts'
|
|
|
4
4
|
import { File, Function } from '@kubb/renderer-jsx'
|
|
5
5
|
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
6
6
|
import type { PluginReactQuery } from '../types.ts'
|
|
7
|
-
import { buildQueryKeyParams, getComments, resolveErrorNames } from '../utils.ts'
|
|
7
|
+
import { buildQueryKeyParams, getComments, resolveErrorNames, resolveSuccessNames } from '../utils.ts'
|
|
8
8
|
import { getQueryOptionsParams } from './QueryOptions.tsx'
|
|
9
9
|
|
|
10
10
|
type Props = {
|
|
@@ -35,7 +35,8 @@ function buildQueryParamsNode(
|
|
|
35
35
|
},
|
|
36
36
|
): ast.FunctionParametersNode {
|
|
37
37
|
const { paramsType, paramsCasing, pathParamsType, dataReturnType, resolver } = options
|
|
38
|
-
const
|
|
38
|
+
const successNames = resolveSuccessNames(node, resolver)
|
|
39
|
+
const responseName = successNames.length > 0 ? successNames.join(' | ') : resolver.resolveResponseName(node)
|
|
39
40
|
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null
|
|
40
41
|
const errorNames = resolveErrorNames(node, resolver)
|
|
41
42
|
|
|
@@ -76,7 +77,8 @@ export function Query({
|
|
|
76
77
|
tsResolver,
|
|
77
78
|
customOptions,
|
|
78
79
|
}: Props): KubbReactNode {
|
|
79
|
-
const
|
|
80
|
+
const successNames = resolveSuccessNames(node, tsResolver)
|
|
81
|
+
const responseName = successNames.length > 0 ? successNames.join(' | ') : tsResolver.resolveResponseName(node)
|
|
80
82
|
const errorNames = resolveErrorNames(node, tsResolver)
|
|
81
83
|
|
|
82
84
|
const TData = dataReturnType === 'data' ? responseName : `ResponseConfig<${responseName}>`
|
|
@@ -5,7 +5,7 @@ import { File, Function } from '@kubb/renderer-jsx'
|
|
|
5
5
|
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
6
6
|
import { buildEnabledCheck } from '@internals/tanstack-query'
|
|
7
7
|
import type { PluginReactQuery } from '../types.ts'
|
|
8
|
-
import { buildQueryKeyParams, resolveErrorNames } from '../utils.ts'
|
|
8
|
+
import { buildQueryKeyParams, resolveErrorNames, resolveSuccessNames } from '../utils.ts'
|
|
9
9
|
|
|
10
10
|
type Props = {
|
|
11
11
|
name: string
|
|
@@ -63,7 +63,8 @@ export function QueryOptions({
|
|
|
63
63
|
pathParamsType,
|
|
64
64
|
queryKeyName,
|
|
65
65
|
}: Props): KubbReactNode {
|
|
66
|
-
const
|
|
66
|
+
const successNames = resolveSuccessNames(node, tsResolver)
|
|
67
|
+
const responseName = successNames.length > 0 ? successNames.join(' | ') : tsResolver.resolveResponseName(node)
|
|
67
68
|
const errorNames = resolveErrorNames(node, tsResolver)
|
|
68
69
|
|
|
69
70
|
const TData = dataReturnType === 'data' ? responseName : `ResponseConfig<${responseName}>`
|
|
@@ -5,7 +5,7 @@ import { functionPrinter } from '@kubb/plugin-ts'
|
|
|
5
5
|
import { File, Function } from '@kubb/renderer-jsx'
|
|
6
6
|
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
7
7
|
import type { Infinite, PluginReactQuery } from '../types.ts'
|
|
8
|
-
import { buildQueryKeyParams, getComments, resolveErrorNames } from '../utils.ts'
|
|
8
|
+
import { buildQueryKeyParams, getComments, resolveErrorNames, resolveSuccessNames } from '../utils.ts'
|
|
9
9
|
import { getQueryOptionsParams } from './QueryOptions.tsx'
|
|
10
10
|
|
|
11
11
|
type Props = {
|
|
@@ -77,7 +77,8 @@ export function SuspenseInfiniteQuery({
|
|
|
77
77
|
initialPageParam,
|
|
78
78
|
queryParam,
|
|
79
79
|
}: Props): KubbReactNode {
|
|
80
|
-
const
|
|
80
|
+
const successNames = resolveSuccessNames(node, tsResolver)
|
|
81
|
+
const responseName = successNames.length > 0 ? successNames.join(' | ') : tsResolver.resolveResponseName(node)
|
|
81
82
|
const errorNames = resolveErrorNames(node, tsResolver)
|
|
82
83
|
|
|
83
84
|
const responseType = dataReturnType === 'data' ? responseName : `ResponseConfig<${responseName}>`
|
|
@@ -6,7 +6,7 @@ import { functionPrinter } from '@kubb/plugin-ts'
|
|
|
6
6
|
import { File, Function } from '@kubb/renderer-jsx'
|
|
7
7
|
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
8
8
|
import type { Infinite, PluginReactQuery } from '../types.ts'
|
|
9
|
-
import { buildQueryKeyParams, resolveErrorNames } from '../utils.ts'
|
|
9
|
+
import { buildQueryKeyParams, resolveErrorNames, resolveSuccessNames } from '../utils.ts'
|
|
10
10
|
import { buildEnabledCheck } from '@internals/tanstack-query'
|
|
11
11
|
import { getQueryOptionsParams } from './QueryOptions.tsx'
|
|
12
12
|
|
|
@@ -46,7 +46,8 @@ export function SuspenseInfiniteQueryOptions({
|
|
|
46
46
|
queryParam,
|
|
47
47
|
queryKeyName,
|
|
48
48
|
}: Props): KubbReactNode {
|
|
49
|
-
const
|
|
49
|
+
const successNames = resolveSuccessNames(node, tsResolver)
|
|
50
|
+
const responseName = successNames.length > 0 ? successNames.join(' | ') : tsResolver.resolveResponseName(node)
|
|
50
51
|
const queryFnDataType = dataReturnType === 'data' ? responseName : `ResponseConfig<${responseName}>`
|
|
51
52
|
const errorNames = resolveErrorNames(node, tsResolver)
|
|
52
53
|
const errorType = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`
|
|
@@ -4,7 +4,7 @@ import { functionPrinter } from '@kubb/plugin-ts'
|
|
|
4
4
|
import { File, Function } from '@kubb/renderer-jsx'
|
|
5
5
|
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
6
6
|
import type { PluginReactQuery } from '../types.ts'
|
|
7
|
-
import { buildQueryKeyParams, getComments, resolveErrorNames } from '../utils.ts'
|
|
7
|
+
import { buildQueryKeyParams, getComments, resolveErrorNames, resolveSuccessNames } from '../utils.ts'
|
|
8
8
|
import { getQueryOptionsParams } from './QueryOptions.tsx'
|
|
9
9
|
|
|
10
10
|
type Props = {
|
|
@@ -35,7 +35,8 @@ function buildSuspenseQueryParamsNode(
|
|
|
35
35
|
},
|
|
36
36
|
): ast.FunctionParametersNode {
|
|
37
37
|
const { paramsType, paramsCasing, pathParamsType, dataReturnType, resolver } = options
|
|
38
|
-
const
|
|
38
|
+
const successNames = resolveSuccessNames(node, resolver)
|
|
39
|
+
const responseName = successNames.length > 0 ? successNames.join(' | ') : resolver.resolveResponseName(node)
|
|
39
40
|
const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null
|
|
40
41
|
const errorNames = resolveErrorNames(node, resolver)
|
|
41
42
|
|
|
@@ -76,7 +77,8 @@ export function SuspenseQuery({
|
|
|
76
77
|
tsResolver,
|
|
77
78
|
customOptions,
|
|
78
79
|
}: Props): KubbReactNode {
|
|
79
|
-
const
|
|
80
|
+
const successNames = resolveSuccessNames(node, tsResolver)
|
|
81
|
+
const responseName = successNames.length > 0 ? successNames.join(' | ') : tsResolver.resolveResponseName(node)
|
|
80
82
|
const errorNames = resolveErrorNames(node, tsResolver)
|
|
81
83
|
|
|
82
84
|
const TData = dataReturnType === 'data' ? responseName : `ResponseConfig<${responseName}>`
|
|
@@ -122,8 +122,8 @@ export const hookOptionsGenerator = defineGenerator<PluginReactQuery>({
|
|
|
122
122
|
baseName={hookOptionsFile.baseName}
|
|
123
123
|
path={hookOptionsFile.path}
|
|
124
124
|
meta={hookOptionsFile.meta}
|
|
125
|
-
banner={resolver.resolveBanner(ctx.meta, { output, config })}
|
|
126
|
-
footer={resolver.resolveFooter(ctx.meta, { output, config })}
|
|
125
|
+
banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: hookOptionsFile.path, baseName: hookOptionsFile.baseName } })}
|
|
126
|
+
footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: hookOptionsFile.path, baseName: hookOptionsFile.baseName } })}
|
|
127
127
|
>
|
|
128
128
|
{imports}
|
|
129
129
|
<File.Source name={name} isExportable isIndexable isTypeOnly>
|
|
@@ -103,27 +103,27 @@ export const infiniteQueryGenerator = defineGenerator<PluginReactQuery>({
|
|
|
103
103
|
baseName={meta.file.baseName}
|
|
104
104
|
path={meta.file.path}
|
|
105
105
|
meta={meta.file.meta}
|
|
106
|
-
banner={resolver.resolveBanner(ctx.meta, { output, config })}
|
|
107
|
-
footer={resolver.resolveFooter(ctx.meta, { output, config })}
|
|
106
|
+
banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}
|
|
107
|
+
footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}
|
|
108
108
|
>
|
|
109
109
|
{fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}
|
|
110
110
|
{clientOptions.importPath ? (
|
|
111
111
|
<>
|
|
112
|
-
{!shouldUseClientPlugin && <File.Import name={'
|
|
112
|
+
{!shouldUseClientPlugin && <File.Import name={'client'} path={clientOptions.importPath} />}
|
|
113
113
|
<File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={clientOptions.importPath} isTypeOnly />
|
|
114
114
|
{clientOptions.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={clientOptions.importPath} isTypeOnly />}
|
|
115
115
|
</>
|
|
116
116
|
) : (
|
|
117
117
|
<>
|
|
118
|
-
{!shouldUseClientPlugin && <File.Import name={['
|
|
118
|
+
{!shouldUseClientPlugin && <File.Import name={['client']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} />}
|
|
119
119
|
<File.Import
|
|
120
120
|
name={['Client', 'RequestConfig', 'ResponseErrorConfig']}
|
|
121
121
|
root={meta.file.path}
|
|
122
|
-
path={path.resolve(root, '.kubb/
|
|
122
|
+
path={path.resolve(root, '.kubb/client.ts')}
|
|
123
123
|
isTypeOnly
|
|
124
124
|
/>
|
|
125
125
|
{clientOptions.dataReturnType === 'full' && (
|
|
126
|
-
<File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/
|
|
126
|
+
<File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} isTypeOnly />
|
|
127
127
|
)}
|
|
128
128
|
</>
|
|
129
129
|
)}
|
|
@@ -88,27 +88,27 @@ export const mutationGenerator = defineGenerator<PluginReactQuery>({
|
|
|
88
88
|
baseName={meta.file.baseName}
|
|
89
89
|
path={meta.file.path}
|
|
90
90
|
meta={meta.file.meta}
|
|
91
|
-
banner={resolver.resolveBanner(ctx.meta, { output, config })}
|
|
92
|
-
footer={resolver.resolveFooter(ctx.meta, { output, config })}
|
|
91
|
+
banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}
|
|
92
|
+
footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}
|
|
93
93
|
>
|
|
94
94
|
{fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}
|
|
95
95
|
{clientOptions.importPath ? (
|
|
96
96
|
<>
|
|
97
|
-
{!shouldUseClientPlugin && <File.Import name={'
|
|
97
|
+
{!shouldUseClientPlugin && <File.Import name={'client'} path={clientOptions.importPath} />}
|
|
98
98
|
<File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={clientOptions.importPath} isTypeOnly />
|
|
99
99
|
{clientOptions.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={clientOptions.importPath} isTypeOnly />}
|
|
100
100
|
</>
|
|
101
101
|
) : (
|
|
102
102
|
<>
|
|
103
|
-
{!shouldUseClientPlugin && <File.Import name={['
|
|
103
|
+
{!shouldUseClientPlugin && <File.Import name={['client']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} />}
|
|
104
104
|
<File.Import
|
|
105
105
|
name={['Client', 'RequestConfig', 'ResponseErrorConfig']}
|
|
106
106
|
root={meta.file.path}
|
|
107
|
-
path={path.resolve(root, '.kubb/
|
|
107
|
+
path={path.resolve(root, '.kubb/client.ts')}
|
|
108
108
|
isTypeOnly
|
|
109
109
|
/>
|
|
110
110
|
{clientOptions.dataReturnType === 'full' && (
|
|
111
|
-
<File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/
|
|
111
|
+
<File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} isTypeOnly />
|
|
112
112
|
)}
|
|
113
113
|
</>
|
|
114
114
|
)}
|
|
@@ -93,27 +93,27 @@ export const queryGenerator = defineGenerator<PluginReactQuery>({
|
|
|
93
93
|
baseName={meta.file.baseName}
|
|
94
94
|
path={meta.file.path}
|
|
95
95
|
meta={meta.file.meta}
|
|
96
|
-
banner={resolver.resolveBanner(ctx.meta, { output, config })}
|
|
97
|
-
footer={resolver.resolveFooter(ctx.meta, { output, config })}
|
|
96
|
+
banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}
|
|
97
|
+
footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}
|
|
98
98
|
>
|
|
99
99
|
{fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}
|
|
100
100
|
{clientOptions.importPath ? (
|
|
101
101
|
<>
|
|
102
|
-
{!shouldUseClientPlugin && <File.Import name={'
|
|
102
|
+
{!shouldUseClientPlugin && <File.Import name={'client'} path={clientOptions.importPath} />}
|
|
103
103
|
<File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={clientOptions.importPath} isTypeOnly />
|
|
104
104
|
{clientOptions.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={clientOptions.importPath} isTypeOnly />}
|
|
105
105
|
</>
|
|
106
106
|
) : (
|
|
107
107
|
<>
|
|
108
|
-
{!shouldUseClientPlugin && <File.Import name={['
|
|
108
|
+
{!shouldUseClientPlugin && <File.Import name={['client']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} />}
|
|
109
109
|
<File.Import
|
|
110
110
|
name={['Client', 'RequestConfig', 'ResponseErrorConfig']}
|
|
111
111
|
root={meta.file.path}
|
|
112
|
-
path={path.resolve(root, '.kubb/
|
|
112
|
+
path={path.resolve(root, '.kubb/client.ts')}
|
|
113
113
|
isTypeOnly
|
|
114
114
|
/>
|
|
115
115
|
{clientOptions.dataReturnType === 'full' && (
|
|
116
|
-
<File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/
|
|
116
|
+
<File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} isTypeOnly />
|
|
117
117
|
)}
|
|
118
118
|
</>
|
|
119
119
|
)}
|
|
@@ -112,27 +112,27 @@ export const suspenseInfiniteQueryGenerator = defineGenerator<PluginReactQuery>(
|
|
|
112
112
|
baseName={meta.file.baseName}
|
|
113
113
|
path={meta.file.path}
|
|
114
114
|
meta={meta.file.meta}
|
|
115
|
-
banner={resolver.resolveBanner(ctx.meta, { output, config })}
|
|
116
|
-
footer={resolver.resolveFooter(ctx.meta, { output, config })}
|
|
115
|
+
banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}
|
|
116
|
+
footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}
|
|
117
117
|
>
|
|
118
118
|
{fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}
|
|
119
119
|
{clientOptions.importPath ? (
|
|
120
120
|
<>
|
|
121
|
-
{!shouldUseClientPlugin && <File.Import name={'
|
|
121
|
+
{!shouldUseClientPlugin && <File.Import name={'client'} path={clientOptions.importPath} />}
|
|
122
122
|
<File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={clientOptions.importPath} isTypeOnly />
|
|
123
123
|
{clientOptions.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={clientOptions.importPath} isTypeOnly />}
|
|
124
124
|
</>
|
|
125
125
|
) : (
|
|
126
126
|
<>
|
|
127
|
-
{!shouldUseClientPlugin && <File.Import name={['
|
|
127
|
+
{!shouldUseClientPlugin && <File.Import name={['client']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} />}
|
|
128
128
|
<File.Import
|
|
129
129
|
name={['Client', 'RequestConfig', 'ResponseErrorConfig']}
|
|
130
130
|
root={meta.file.path}
|
|
131
|
-
path={path.resolve(root, '.kubb/
|
|
131
|
+
path={path.resolve(root, '.kubb/client.ts')}
|
|
132
132
|
isTypeOnly
|
|
133
133
|
/>
|
|
134
134
|
{clientOptions.dataReturnType === 'full' && (
|
|
135
|
-
<File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/
|
|
135
|
+
<File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} isTypeOnly />
|
|
136
136
|
)}
|
|
137
137
|
</>
|
|
138
138
|
)}
|
|
@@ -95,27 +95,27 @@ export const suspenseQueryGenerator = defineGenerator<PluginReactQuery>({
|
|
|
95
95
|
baseName={meta.file.baseName}
|
|
96
96
|
path={meta.file.path}
|
|
97
97
|
meta={meta.file.meta}
|
|
98
|
-
banner={resolver.resolveBanner(ctx.meta, { output, config })}
|
|
99
|
-
footer={resolver.resolveFooter(ctx.meta, { output, config })}
|
|
98
|
+
banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}
|
|
99
|
+
footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}
|
|
100
100
|
>
|
|
101
101
|
{fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}
|
|
102
102
|
{clientOptions.importPath ? (
|
|
103
103
|
<>
|
|
104
|
-
{!shouldUseClientPlugin && <File.Import name={'
|
|
104
|
+
{!shouldUseClientPlugin && <File.Import name={'client'} path={clientOptions.importPath} />}
|
|
105
105
|
<File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={clientOptions.importPath} isTypeOnly />
|
|
106
106
|
{clientOptions.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={clientOptions.importPath} isTypeOnly />}
|
|
107
107
|
</>
|
|
108
108
|
) : (
|
|
109
109
|
<>
|
|
110
|
-
{!shouldUseClientPlugin && <File.Import name={['
|
|
110
|
+
{!shouldUseClientPlugin && <File.Import name={['client']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} />}
|
|
111
111
|
<File.Import
|
|
112
112
|
name={['Client', 'RequestConfig', 'ResponseErrorConfig']}
|
|
113
113
|
root={meta.file.path}
|
|
114
|
-
path={path.resolve(root, '.kubb/
|
|
114
|
+
path={path.resolve(root, '.kubb/client.ts')}
|
|
115
115
|
isTypeOnly
|
|
116
116
|
/>
|
|
117
117
|
{clientOptions.dataReturnType === 'full' && (
|
|
118
|
-
<File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/
|
|
118
|
+
<File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} isTypeOnly />
|
|
119
119
|
)}
|
|
120
120
|
</>
|
|
121
121
|
)}
|
package/src/plugin.ts
CHANGED
|
@@ -180,11 +180,11 @@ export const pluginReactQuery = definePlugin<PluginReactQuery>((options) => {
|
|
|
180
180
|
|
|
181
181
|
if (client?.bundle && !hasClientPlugin && !clientImportPath) {
|
|
182
182
|
ctx.injectFile({
|
|
183
|
-
baseName: '
|
|
184
|
-
path: path.resolve(root, '.kubb/
|
|
183
|
+
baseName: 'client.ts',
|
|
184
|
+
path: path.resolve(root, '.kubb/client.ts'),
|
|
185
185
|
sources: [
|
|
186
186
|
ast.createSource({
|
|
187
|
-
name: '
|
|
187
|
+
name: 'client',
|
|
188
188
|
nodes: [ast.createText(clientName === 'fetch' ? fetchClientSource : axiosClientSource)],
|
|
189
189
|
isExportable: true,
|
|
190
190
|
isIndexable: true,
|
package/src/utils.ts
CHANGED
|
@@ -7,4 +7,11 @@ export {
|
|
|
7
7
|
resolveQueryGroupType,
|
|
8
8
|
resolveZodSchemaNames,
|
|
9
9
|
} from '@internals/tanstack-query'
|
|
10
|
-
export {
|
|
10
|
+
export {
|
|
11
|
+
buildOperationComments as getComments,
|
|
12
|
+
buildRequestConfigType,
|
|
13
|
+
getContentTypeInfo,
|
|
14
|
+
resolveErrorNames,
|
|
15
|
+
resolveStatusCodeNames,
|
|
16
|
+
resolveSuccessNames,
|
|
17
|
+
} from '@internals/shared'
|