@kubb/plugin-react-query 5.9.0-canary.20261029T145027 → 5.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +115 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +115 -54
- package/dist/index.js.map +1 -1
- package/docs/options.md +32 -0
- package/kubb-extension.json +1 -1
- package/package.json +9 -9
package/docs/options.md
CHANGED
|
@@ -9,6 +9,7 @@ Pass these options to `pluginReactQuery()`. Shared options link to [Shared plugi
|
|
|
9
9
|
| [`output`](https://kubb.dev/docs/5.x/reference/plugin-options#output) | Where files are written: `path`, `mode`, `barrel`, `banner`, `footer`. | `{ path: 'hooks', barrel: { type: 'named' } }` |
|
|
10
10
|
| [`group`](https://kubb.dev/docs/5.x/reference/plugin-options#group) | Split output by tag or path: `type`, `name`. | None |
|
|
11
11
|
| [`client`](#client) | Which registered client plugin the hooks call. | Auto-detected |
|
|
12
|
+
| [`returnType`](#returntype) | Shape of the value the hooks resolve to. | `'data'` |
|
|
12
13
|
| [`infinite`](#infinite) | Generate `useInfiniteQuery` hooks for pagination. | `false` |
|
|
13
14
|
| [`suspense`](#suspense) | Generate `useSuspenseQuery` hooks. | `false` |
|
|
14
15
|
| [`query`](#query) | Configure the query hooks. | `{ methods: ['GET', 'QUERY'], importPath: '@tanstack/react-query' }` |
|
|
@@ -50,6 +51,37 @@ Calls the operations generated by [`@kubb/plugin-client`](https://kubb.dev/exten
|
|
|
50
51
|
|
|
51
52
|
::
|
|
52
53
|
|
|
54
|
+
### returnType
|
|
55
|
+
|
|
56
|
+
Shape of the value the generated hooks resolve to.
|
|
57
|
+
|
|
58
|
+
| | |
|
|
59
|
+
| -------- | ------------------ |
|
|
60
|
+
| Type | `'full' \| 'data'` |
|
|
61
|
+
| Required | `false` |
|
|
62
|
+
| Default | `'data'` |
|
|
63
|
+
|
|
64
|
+
::field-group
|
|
65
|
+
|
|
66
|
+
:::field{name="'full'"}
|
|
67
|
+
Returns the client's whole `RequestResult` (`{ status, data, error, contentType, request, response }`), so a hook can read the status and the response headers next to `data`. Infinite queries read the page cursor from `lastPage.data`. Needs a client plugin whose own `returnType` is `'full'` or `'plain'`; with a client `returnType: 'data'` generation stops with an error.
|
|
68
|
+
:::
|
|
69
|
+
|
|
70
|
+
:::field{name="'data'"}
|
|
71
|
+
Returns the success body.
|
|
72
|
+
:::
|
|
73
|
+
|
|
74
|
+
::
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
pluginReactQuery({ returnType: 'full' })
|
|
78
|
+
|
|
79
|
+
const { data: result } = useGetPetById({ path: { petId: 1 } })
|
|
80
|
+
|
|
81
|
+
const etag = result?.response.headers.get('ETag')
|
|
82
|
+
const pet = result?.data
|
|
83
|
+
```
|
|
84
|
+
|
|
53
85
|
### infinite
|
|
54
86
|
|
|
55
87
|
Adds `infiniteQueryOptions` and `useInfiniteQuery` for operations that declare the query parameter named in `infinite.queryParam`. Needs [`hooks: true`](#hooks).
|
package/kubb-extension.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-react-query",
|
|
3
|
-
"version": "5.9.
|
|
3
|
+
"version": "5.9.1",
|
|
4
4
|
"description": "Generate type-safe TanStack Query (React Query) hooks with Kubb. Covers useQuery, useMutation, useInfiniteQuery, and queryOptions with full TypeScript support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"code-generation",
|
|
@@ -81,16 +81,16 @@
|
|
|
81
81
|
"registry": "https://registry.npmjs.org/"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@kubb/kit": "^5.
|
|
85
|
-
"@kubb/plugin-ts": "^5.
|
|
86
|
-
"@kubb/renderer-jsx": "^5.
|
|
84
|
+
"@kubb/kit": "^5.16.0",
|
|
85
|
+
"@kubb/plugin-ts": "^5.4.1",
|
|
86
|
+
"@kubb/renderer-jsx": "^5.16.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@internals/client": "0.
|
|
90
|
-
"@internals/shared": "0.
|
|
91
|
-
"@internals/tanstack-query": "0.
|
|
92
|
-
"@internals/utils": "0.
|
|
93
|
-
"@tanstack/react-query": "^5.
|
|
89
|
+
"@internals/client": "0.0.0",
|
|
90
|
+
"@internals/shared": "0.0.0",
|
|
91
|
+
"@internals/tanstack-query": "0.0.0",
|
|
92
|
+
"@internals/utils": "0.0.0",
|
|
93
|
+
"@tanstack/react-query": "^5.105.3"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"@tanstack/react-query": "^5.82.0"
|