@kubb/plugin-react-query 5.0.0-beta.10 → 5.0.0-beta.22
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-Dow6tde8.js → components-BTwB9V-K.js} +34 -41
- package/dist/components-BTwB9V-K.js.map +1 -0
- package/dist/{components-HwdCDefj.cjs → components-D4SQmw7N.cjs} +34 -41
- package/dist/components-D4SQmw7N.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/{generators-yfZr_qfT.js → generators-BZ_sX2lp.js} +28 -28
- package/dist/generators-BZ_sX2lp.js.map +1 -0
- package/dist/{generators-CcOmnTPa.cjs → generators-C4bV7v9Z.cjs} +27 -27
- package/dist/generators-C4bV7v9Z.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/extension.yaml +18 -1
- package/package.json +8 -8
- package/src/components/InfiniteQueryOptions.tsx +17 -27
- package/src/components/SuspenseInfiniteQueryOptions.tsx +17 -27
- package/src/generators/customHookOptionsFileGenerator.tsx +2 -2
- package/src/generators/hookOptionsGenerator.tsx +5 -5
- package/src/generators/infiniteQueryGenerator.tsx +5 -5
- package/src/generators/mutationGenerator.tsx +5 -5
- package/src/generators/queryGenerator.tsx +5 -5
- package/src/generators/suspenseInfiniteQueryGenerator.tsx +5 -5
- package/src/generators/suspenseQueryGenerator.tsx +5 -5
- package/dist/components-Dow6tde8.js.map +0 -1
- package/dist/components-HwdCDefj.cjs.map +0 -1
- package/dist/generators-CcOmnTPa.cjs.map +0 -1
- package/dist/generators-yfZr_qfT.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./chunk--u3MIqq1.js";
|
|
2
|
-
import { _ as mutationKeyTransformer, d as queryKeyTransformer, v as camelCase } from "./components-
|
|
3
|
-
import { a as infiniteQueryGenerator, i as mutationGenerator, n as suspenseInfiniteQueryGenerator, o as hookOptionsGenerator, r as queryGenerator, s as customHookOptionsFileGenerator, t as suspenseQueryGenerator } from "./generators-
|
|
2
|
+
import { _ as mutationKeyTransformer, d as queryKeyTransformer, v as camelCase } from "./components-BTwB9V-K.js";
|
|
3
|
+
import { a as infiniteQueryGenerator, i as mutationGenerator, n as suspenseInfiniteQueryGenerator, o as hookOptionsGenerator, r as queryGenerator, s as customHookOptionsFileGenerator, t as suspenseQueryGenerator } from "./generators-BZ_sX2lp.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { ast, definePlugin, defineResolver } from "@kubb/core";
|
|
6
6
|
import { pluginClientName } from "@kubb/plugin-client";
|
package/extension.yaml
CHANGED
|
@@ -56,7 +56,7 @@ options:
|
|
|
56
56
|
type: "{ type: 'named' | 'all', nested?: boolean } | false"
|
|
57
57
|
required: false
|
|
58
58
|
default: "{ type: 'named' }"
|
|
59
|
-
description:
|
|
59
|
+
description: 'Configure barrel file export strategy. Use `type` to control named vs. wildcard exports; set `nested: true` to generate hierarchical barrels in subdirectories.'
|
|
60
60
|
examples:
|
|
61
61
|
- name: all
|
|
62
62
|
files:
|
|
@@ -70,6 +70,16 @@ options:
|
|
|
70
70
|
code: |
|
|
71
71
|
export { PetService } from './gen/petService.ts'
|
|
72
72
|
twoslash: false
|
|
73
|
+
- name: nested
|
|
74
|
+
files:
|
|
75
|
+
- name: kubb.config.ts
|
|
76
|
+
lang: typescript
|
|
77
|
+
code: |
|
|
78
|
+
output: {
|
|
79
|
+
path: './gen',
|
|
80
|
+
barrel: { type: 'named', nested: true },
|
|
81
|
+
}
|
|
82
|
+
twoslash: false
|
|
73
83
|
- name: 'false'
|
|
74
84
|
files:
|
|
75
85
|
- lang: typescript
|
|
@@ -88,6 +98,13 @@ options:
|
|
|
88
98
|
required: false
|
|
89
99
|
default: 'false'
|
|
90
100
|
description: Whether Kubb overrides existing external files that can be generated if they already exist.
|
|
101
|
+
- name: contentType
|
|
102
|
+
type: "'application/json' | (string & {})"
|
|
103
|
+
required: false
|
|
104
|
+
description: |
|
|
105
|
+
Define which content type to use.
|
|
106
|
+
|
|
107
|
+
By default, Kubb uses the first JSON-valid media type.
|
|
91
108
|
- name: group
|
|
92
109
|
type: Group
|
|
93
110
|
required: false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-react-query",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.22",
|
|
4
4
|
"description": "Generate type-safe TanStack Query (React Query) hooks from your OpenAPI specification. Covers useQuery, useMutation, useInfiniteQuery, and queryOptions with full TypeScript support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"code-generation",
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"registry": "https://registry.npmjs.org/"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@kubb/core": "5.0.0-beta.
|
|
72
|
-
"@kubb/renderer-jsx": "5.0.0-beta.
|
|
73
|
-
"remeda": "^2.34.
|
|
74
|
-
"@kubb/plugin-client": "5.0.0-beta.
|
|
75
|
-
"@kubb/plugin-ts": "5.0.0-beta.
|
|
76
|
-
"@kubb/plugin-zod": "5.0.0-beta.
|
|
71
|
+
"@kubb/core": "5.0.0-beta.22",
|
|
72
|
+
"@kubb/renderer-jsx": "5.0.0-beta.22",
|
|
73
|
+
"remeda": "^2.34.1",
|
|
74
|
+
"@kubb/plugin-client": "5.0.0-beta.22",
|
|
75
|
+
"@kubb/plugin-ts": "5.0.0-beta.22",
|
|
76
|
+
"@kubb/plugin-zod": "5.0.0-beta.22"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@internals/shared": "0.0.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@internals/utils": "0.0.0"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
|
-
"@kubb/renderer-jsx": "5.0.0-beta.
|
|
84
|
+
"@kubb/renderer-jsx": "5.0.0-beta.22"
|
|
85
85
|
},
|
|
86
86
|
"size-limit": [
|
|
87
87
|
{
|
|
@@ -92,35 +92,25 @@ export function InfiniteQueryOptions({
|
|
|
92
92
|
|
|
93
93
|
const hasNewParams = nextParam !== undefined || previousParam !== undefined
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (previousParam) {
|
|
106
|
-
const accessor = getNestedAccessor(previousParam, 'firstPage')
|
|
107
|
-
if (accessor) {
|
|
108
|
-
getPreviousPageParamExpr = `getPreviousPageParam: (firstPage) => ${accessor}`
|
|
109
|
-
}
|
|
95
|
+
const [getNextPageParamExpr, getPreviousPageParamExpr] = (() => {
|
|
96
|
+
if (hasNewParams) {
|
|
97
|
+
const nextAccessor = nextParam ? getNestedAccessor(nextParam, 'lastPage') : undefined
|
|
98
|
+
const prevAccessor = previousParam ? getNestedAccessor(previousParam, 'firstPage') : undefined
|
|
99
|
+
return [
|
|
100
|
+
nextAccessor ? `getNextPageParam: (lastPage) => ${nextAccessor}` : undefined,
|
|
101
|
+
prevAccessor ? `getPreviousPageParam: (firstPage) => ${prevAccessor}` : undefined,
|
|
102
|
+
] as const
|
|
110
103
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
getPreviousPageParamExpr = `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']`
|
|
114
|
-
} else {
|
|
115
|
-
if (dataReturnType === 'full') {
|
|
116
|
-
getNextPageParamExpr =
|
|
117
|
-
'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1'
|
|
118
|
-
} else {
|
|
119
|
-
getNextPageParamExpr =
|
|
120
|
-
'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1'
|
|
104
|
+
if (cursorParam) {
|
|
105
|
+
return [`getNextPageParam: (lastPage) => lastPage['${cursorParam}']`, `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']`] as const
|
|
121
106
|
}
|
|
122
|
-
|
|
123
|
-
|
|
107
|
+
return [
|
|
108
|
+
dataReturnType === 'full'
|
|
109
|
+
? 'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1'
|
|
110
|
+
: 'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1',
|
|
111
|
+
'getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1',
|
|
112
|
+
] as const
|
|
113
|
+
})()
|
|
124
114
|
|
|
125
115
|
const queryOptionsArr = [
|
|
126
116
|
`initialPageParam: ${typeof initialPageParam === 'string' ? JSON.stringify(initialPageParam) : initialPageParam}`,
|
|
@@ -92,35 +92,25 @@ export function SuspenseInfiniteQueryOptions({
|
|
|
92
92
|
|
|
93
93
|
const hasNewParams = nextParam !== undefined || previousParam !== undefined
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (previousParam) {
|
|
106
|
-
const accessor = getNestedAccessor(previousParam, 'firstPage')
|
|
107
|
-
if (accessor) {
|
|
108
|
-
getPreviousPageParamExpr = `getPreviousPageParam: (firstPage) => ${accessor}`
|
|
109
|
-
}
|
|
95
|
+
const [getNextPageParamExpr, getPreviousPageParamExpr] = (() => {
|
|
96
|
+
if (hasNewParams) {
|
|
97
|
+
const nextAccessor = nextParam ? getNestedAccessor(nextParam, 'lastPage') : undefined
|
|
98
|
+
const prevAccessor = previousParam ? getNestedAccessor(previousParam, 'firstPage') : undefined
|
|
99
|
+
return [
|
|
100
|
+
nextAccessor ? `getNextPageParam: (lastPage) => ${nextAccessor}` : undefined,
|
|
101
|
+
prevAccessor ? `getPreviousPageParam: (firstPage) => ${prevAccessor}` : undefined,
|
|
102
|
+
] as const
|
|
110
103
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
getPreviousPageParamExpr = `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']`
|
|
114
|
-
} else {
|
|
115
|
-
if (dataReturnType === 'full') {
|
|
116
|
-
getNextPageParamExpr =
|
|
117
|
-
'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1'
|
|
118
|
-
} else {
|
|
119
|
-
getNextPageParamExpr =
|
|
120
|
-
'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1'
|
|
104
|
+
if (cursorParam) {
|
|
105
|
+
return [`getNextPageParam: (lastPage) => lastPage['${cursorParam}']`, `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']`] as const
|
|
121
106
|
}
|
|
122
|
-
|
|
123
|
-
|
|
107
|
+
return [
|
|
108
|
+
dataReturnType === 'full'
|
|
109
|
+
? 'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1'
|
|
110
|
+
: 'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1',
|
|
111
|
+
'getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1',
|
|
112
|
+
] as const
|
|
113
|
+
})()
|
|
124
114
|
|
|
125
115
|
const queryOptionsArr = [
|
|
126
116
|
`initialPageParam: ${typeof initialPageParam === 'string' ? JSON.stringify(initialPageParam) : initialPageParam}`,
|
|
@@ -2,12 +2,12 @@ import fs from 'node:fs'
|
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
|
|
4
4
|
import { defineGenerator } from '@kubb/core'
|
|
5
|
-
import { File, Function,
|
|
5
|
+
import { File, Function, jsxRendererSync } from '@kubb/renderer-jsx'
|
|
6
6
|
import type { PluginReactQuery } from '../types'
|
|
7
7
|
|
|
8
8
|
export const customHookOptionsFileGenerator = defineGenerator<PluginReactQuery>({
|
|
9
9
|
name: 'react-query-custom-hook-options-file',
|
|
10
|
-
renderer:
|
|
10
|
+
renderer: jsxRendererSync,
|
|
11
11
|
operations(nodes, ctx) {
|
|
12
12
|
const { resolver, config, root } = ctx
|
|
13
13
|
const { output, customOptions, query, group } = ctx.options
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getOperationParameters } from '@internals/shared'
|
|
2
2
|
import { defineGenerator } from '@kubb/core'
|
|
3
|
-
import { File,
|
|
3
|
+
import { File, jsxRendererSync, Type } from '@kubb/renderer-jsx'
|
|
4
4
|
import type { KubbReactNode } from '@kubb/renderer-jsx/types'
|
|
5
5
|
import { difference } from 'remeda'
|
|
6
6
|
import type { PluginReactQuery } from '../types'
|
|
@@ -11,9 +11,9 @@ type MutationOption = PluginReactQuery['resolvedOptions']['mutation']
|
|
|
11
11
|
|
|
12
12
|
export const hookOptionsGenerator = defineGenerator<PluginReactQuery>({
|
|
13
13
|
name: 'react-query-hook-options',
|
|
14
|
-
renderer:
|
|
14
|
+
renderer: jsxRendererSync,
|
|
15
15
|
operations(nodes, ctx) {
|
|
16
|
-
const { resolver, config, root
|
|
16
|
+
const { resolver, config, root } = ctx
|
|
17
17
|
const { output, customOptions, query, mutation, suspense, infinite, group, override } = ctx.options
|
|
18
18
|
|
|
19
19
|
if (!customOptions) return null
|
|
@@ -116,8 +116,8 @@ export const hookOptionsGenerator = defineGenerator<PluginReactQuery>({
|
|
|
116
116
|
baseName={hookOptionsFile.baseName}
|
|
117
117
|
path={hookOptionsFile.path}
|
|
118
118
|
meta={hookOptionsFile.meta}
|
|
119
|
-
banner={resolver.resolveBanner(
|
|
120
|
-
footer={resolver.resolveFooter(
|
|
119
|
+
banner={resolver.resolveBanner(ctx.meta, { output, config })}
|
|
120
|
+
footer={resolver.resolveFooter(ctx.meta, { output, config })}
|
|
121
121
|
>
|
|
122
122
|
{imports}
|
|
123
123
|
<File.Source name={name} isExportable isIndexable isTypeOnly>
|
|
@@ -5,16 +5,16 @@ import { defineGenerator } from '@kubb/core'
|
|
|
5
5
|
import { Client, pluginClientName } from '@kubb/plugin-client'
|
|
6
6
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
7
7
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
8
|
-
import { File,
|
|
8
|
+
import { File, jsxRendererSync } from '@kubb/renderer-jsx'
|
|
9
9
|
import { difference } from 'remeda'
|
|
10
10
|
import { InfiniteQuery, InfiniteQueryOptions, QueryKey } from '../components'
|
|
11
11
|
import type { PluginReactQuery } from '../types'
|
|
12
12
|
|
|
13
13
|
export const infiniteQueryGenerator = defineGenerator<PluginReactQuery>({
|
|
14
14
|
name: 'react-infinite-query',
|
|
15
|
-
renderer:
|
|
15
|
+
renderer: jsxRendererSync,
|
|
16
16
|
operation(node, ctx) {
|
|
17
|
-
const {
|
|
17
|
+
const { config, driver, resolver, root } = ctx
|
|
18
18
|
const { output, query, mutation, infinite, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group, customOptions } = ctx.options
|
|
19
19
|
|
|
20
20
|
const pluginTs = driver.getPlugin(pluginTsName)
|
|
@@ -94,8 +94,8 @@ export const infiniteQueryGenerator = defineGenerator<PluginReactQuery>({
|
|
|
94
94
|
baseName={meta.file.baseName}
|
|
95
95
|
path={meta.file.path}
|
|
96
96
|
meta={meta.file.meta}
|
|
97
|
-
banner={resolver.resolveBanner(
|
|
98
|
-
footer={resolver.resolveFooter(
|
|
97
|
+
banner={resolver.resolveBanner(ctx.meta, { output, config })}
|
|
98
|
+
footer={resolver.resolveFooter(ctx.meta, { output, config })}
|
|
99
99
|
>
|
|
100
100
|
{fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}
|
|
101
101
|
{clientOptions.importPath ? (
|
|
@@ -5,16 +5,16 @@ import { defineGenerator } from '@kubb/core'
|
|
|
5
5
|
import { Client, pluginClientName } from '@kubb/plugin-client'
|
|
6
6
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
7
7
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
8
|
-
import { File,
|
|
8
|
+
import { File, jsxRendererSync } from '@kubb/renderer-jsx'
|
|
9
9
|
import { difference } from 'remeda'
|
|
10
10
|
import { Mutation, MutationKey, MutationOptions } from '../components'
|
|
11
11
|
import type { PluginReactQuery } from '../types'
|
|
12
12
|
|
|
13
13
|
export const mutationGenerator = defineGenerator<PluginReactQuery>({
|
|
14
14
|
name: 'react-query-mutation',
|
|
15
|
-
renderer:
|
|
15
|
+
renderer: jsxRendererSync,
|
|
16
16
|
operation(node, ctx) {
|
|
17
|
-
const {
|
|
17
|
+
const { config, driver, resolver, root } = ctx
|
|
18
18
|
const { output, query, mutation, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group, customOptions } = ctx.options
|
|
19
19
|
|
|
20
20
|
const pluginTs = driver.getPlugin(pluginTsName)
|
|
@@ -80,8 +80,8 @@ export const mutationGenerator = defineGenerator<PluginReactQuery>({
|
|
|
80
80
|
baseName={meta.file.baseName}
|
|
81
81
|
path={meta.file.path}
|
|
82
82
|
meta={meta.file.meta}
|
|
83
|
-
banner={resolver.resolveBanner(
|
|
84
|
-
footer={resolver.resolveFooter(
|
|
83
|
+
banner={resolver.resolveBanner(ctx.meta, { output, config })}
|
|
84
|
+
footer={resolver.resolveFooter(ctx.meta, { output, config })}
|
|
85
85
|
>
|
|
86
86
|
{fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}
|
|
87
87
|
{clientOptions.importPath ? (
|
|
@@ -5,16 +5,16 @@ import { defineGenerator } from '@kubb/core'
|
|
|
5
5
|
import { Client, pluginClientName } from '@kubb/plugin-client'
|
|
6
6
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
7
7
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
8
|
-
import { File,
|
|
8
|
+
import { File, jsxRendererSync } from '@kubb/renderer-jsx'
|
|
9
9
|
import { difference } from 'remeda'
|
|
10
10
|
import { Query, QueryKey, QueryOptions } from '../components'
|
|
11
11
|
import type { PluginReactQuery } from '../types'
|
|
12
12
|
|
|
13
13
|
export const queryGenerator = defineGenerator<PluginReactQuery>({
|
|
14
14
|
name: 'react-query',
|
|
15
|
-
renderer:
|
|
15
|
+
renderer: jsxRendererSync,
|
|
16
16
|
operation(node, ctx) {
|
|
17
|
-
const {
|
|
17
|
+
const { config, driver, resolver, root } = ctx
|
|
18
18
|
const { output, query, mutation, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group, customOptions } = ctx.options
|
|
19
19
|
|
|
20
20
|
const pluginTs = driver.getPlugin(pluginTsName)
|
|
@@ -85,8 +85,8 @@ export const queryGenerator = defineGenerator<PluginReactQuery>({
|
|
|
85
85
|
baseName={meta.file.baseName}
|
|
86
86
|
path={meta.file.path}
|
|
87
87
|
meta={meta.file.meta}
|
|
88
|
-
banner={resolver.resolveBanner(
|
|
89
|
-
footer={resolver.resolveFooter(
|
|
88
|
+
banner={resolver.resolveBanner(ctx.meta, { output, config })}
|
|
89
|
+
footer={resolver.resolveFooter(ctx.meta, { output, config })}
|
|
90
90
|
>
|
|
91
91
|
{fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}
|
|
92
92
|
{clientOptions.importPath ? (
|
|
@@ -5,16 +5,16 @@ import { defineGenerator } from '@kubb/core'
|
|
|
5
5
|
import { Client, pluginClientName } from '@kubb/plugin-client'
|
|
6
6
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
7
7
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
8
|
-
import { File,
|
|
8
|
+
import { File, jsxRendererSync } from '@kubb/renderer-jsx'
|
|
9
9
|
import { difference } from 'remeda'
|
|
10
10
|
import { QueryKey, SuspenseInfiniteQuery, SuspenseInfiniteQueryOptions } from '../components'
|
|
11
11
|
import type { PluginReactQuery } from '../types'
|
|
12
12
|
|
|
13
13
|
export const suspenseInfiniteQueryGenerator = defineGenerator<PluginReactQuery>({
|
|
14
14
|
name: 'react-suspense-infinite-query',
|
|
15
|
-
renderer:
|
|
15
|
+
renderer: jsxRendererSync,
|
|
16
16
|
operation(node, ctx) {
|
|
17
|
-
const {
|
|
17
|
+
const { config, driver, resolver, root } = ctx
|
|
18
18
|
const {
|
|
19
19
|
output,
|
|
20
20
|
query,
|
|
@@ -103,8 +103,8 @@ export const suspenseInfiniteQueryGenerator = defineGenerator<PluginReactQuery>(
|
|
|
103
103
|
baseName={meta.file.baseName}
|
|
104
104
|
path={meta.file.path}
|
|
105
105
|
meta={meta.file.meta}
|
|
106
|
-
banner={resolver.resolveBanner(
|
|
107
|
-
footer={resolver.resolveFooter(
|
|
106
|
+
banner={resolver.resolveBanner(ctx.meta, { output, config })}
|
|
107
|
+
footer={resolver.resolveFooter(ctx.meta, { output, config })}
|
|
108
108
|
>
|
|
109
109
|
{fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}
|
|
110
110
|
{clientOptions.importPath ? (
|
|
@@ -5,16 +5,16 @@ import { defineGenerator } from '@kubb/core'
|
|
|
5
5
|
import { Client, pluginClientName } from '@kubb/plugin-client'
|
|
6
6
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
7
7
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
8
|
-
import { File,
|
|
8
|
+
import { File, jsxRendererSync } from '@kubb/renderer-jsx'
|
|
9
9
|
import { difference } from 'remeda'
|
|
10
10
|
import { QueryKey, QueryOptions, SuspenseQuery } from '../components'
|
|
11
11
|
import type { PluginReactQuery } from '../types'
|
|
12
12
|
|
|
13
13
|
export const suspenseQueryGenerator = defineGenerator<PluginReactQuery>({
|
|
14
14
|
name: 'react-suspense-query',
|
|
15
|
-
renderer:
|
|
15
|
+
renderer: jsxRendererSync,
|
|
16
16
|
operation(node, ctx) {
|
|
17
|
-
const {
|
|
17
|
+
const { config, driver, resolver, root } = ctx
|
|
18
18
|
const { output, query, mutation, suspense, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group, customOptions } = ctx.options
|
|
19
19
|
|
|
20
20
|
const pluginTs = driver.getPlugin(pluginTsName)
|
|
@@ -86,8 +86,8 @@ export const suspenseQueryGenerator = defineGenerator<PluginReactQuery>({
|
|
|
86
86
|
baseName={meta.file.baseName}
|
|
87
87
|
path={meta.file.path}
|
|
88
88
|
meta={meta.file.meta}
|
|
89
|
-
banner={resolver.resolveBanner(
|
|
90
|
-
footer={resolver.resolveFooter(
|
|
89
|
+
banner={resolver.resolveBanner(ctx.meta, { output, config })}
|
|
90
|
+
footer={resolver.resolveFooter(ctx.meta, { output, config })}
|
|
91
91
|
>
|
|
92
92
|
{fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}
|
|
93
93
|
{clientOptions.importPath ? (
|