@kubb/plugin-react-query 5.4.0-canary.20261013T112432 → 5.4.0-canary.20261013T135854
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 +1 -1
- package/dist/index.js +1 -1
- package/docs/overview.md +11 -11
- package/kubb-extension.json +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -357,7 +357,7 @@ var compatibility = {
|
|
|
357
357
|
};
|
|
358
358
|
//#endregion
|
|
359
359
|
//#region package.json
|
|
360
|
-
var version = "5.4.0-canary.
|
|
360
|
+
var version = "5.4.0-canary.20261013T135854";
|
|
361
361
|
//#endregion
|
|
362
362
|
//#region ../../internals/client/src/resolveClient.ts
|
|
363
363
|
/**
|
package/dist/index.js
CHANGED
|
@@ -330,7 +330,7 @@ var compatibility = {
|
|
|
330
330
|
};
|
|
331
331
|
//#endregion
|
|
332
332
|
//#region package.json
|
|
333
|
-
var version = "5.4.0-canary.
|
|
333
|
+
var version = "5.4.0-canary.20261013T135854";
|
|
334
334
|
//#endregion
|
|
335
335
|
//#region ../../internals/client/src/resolveClient.ts
|
|
336
336
|
/**
|
package/docs/overview.md
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
# React Query
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The React Query plugin generates TanStack Query helpers for React from your OpenAPI spec. By default you get `queryOptions` and `mutationOptions` factories with their query and mutation keys. Set `hooks: true` to also get `useQuery` and `useMutation` hooks.
|
|
4
4
|
|
|
5
5
|
The plugin ships no HTTP client. Each helper calls a function generated by a client plugin.
|
|
6
6
|
|
|
7
7
|
## Setup
|
|
8
8
|
|
|
9
|
-
- Add `@kubb/plugin-ts` and a client plugin: `@kubb/plugin-fetch` or `@kubb/plugin-axios`.
|
|
10
|
-
- Install `@tanstack/react-query`
|
|
9
|
+
- Add `@kubb/plugin-ts` and a client plugin: `@kubb/plugin-fetch` or `@kubb/plugin-axios`. Leave `sdk` unset on the client plugin.
|
|
10
|
+
- Install `@tanstack/react-query` 5.82 or a later v5 release in the app that uses the generated code.
|
|
11
11
|
- Configure validation on the client plugin, not here.
|
|
12
12
|
|
|
13
13
|
## Options worth knowing
|
|
14
14
|
|
|
15
15
|
- `client` picks `fetch` or `axios` when both client plugins are registered. A single client is detected automatically.
|
|
16
16
|
- `hooks` adds the `use*` hooks on top of the option factories.
|
|
17
|
-
- `suspense` adds `useSuspenseQuery` hooks.
|
|
18
|
-
- `infinite` adds
|
|
19
|
-
- `query` and `mutation` set which HTTP methods become queries (`GET`) and mutations (`POST`, `PUT`, `PATCH`, `DELETE`)
|
|
20
|
-
- `customOptions` routes every hook through your own function that returns extra options.
|
|
17
|
+
- `suspense: {}` adds `useSuspenseQuery` hooks. It needs `hooks: true`.
|
|
18
|
+
- `infinite` adds `useInfiniteQuery` hooks for pagination. It needs `hooks: true` and covers the operations that take the query parameter named in `infinite.queryParam`, which defaults to `'id'`.
|
|
19
|
+
- `query` and `mutation` set which HTTP methods become queries (`GET`) and mutations (`POST`, `PUT`, `PATCH`, `DELETE`). They also set where the TanStack Query runtime is imported from. Set either to `false` to skip those helpers.
|
|
20
|
+
- `customOptions: { importPath }` routes every hook through your own function that returns extra options. It needs `hooks: true`. Kubb creates a starter file at `importPath`, resolved from the generated hooks folder, when none exists.
|
|
21
|
+
|
|
22
|
+
See [Options](https://kubb.dev/extensions/kubb-labs/plugin-react-query/options) for every option and its default.
|
|
21
23
|
|
|
22
24
|
## Example
|
|
23
25
|
|
|
26
|
+
The config below generates `useQuery` and `useMutation` hooks that call the Fetch client.
|
|
27
|
+
|
|
24
28
|
```typescript [kubb.config.ts]
|
|
25
29
|
import { defineConfig } from 'kubb/config'
|
|
26
30
|
import { pluginTs } from '@kubb/plugin-ts'
|
|
@@ -37,7 +41,3 @@ export default defineConfig({
|
|
|
37
41
|
],
|
|
38
42
|
})
|
|
39
43
|
```
|
|
40
|
-
|
|
41
|
-
## See also
|
|
42
|
-
|
|
43
|
-
- [TanStack Query](https://tanstack.com/query)
|
package/kubb-extension.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "plugin-react-query",
|
|
5
5
|
"export": "pluginReactQuery",
|
|
6
6
|
"displayName": "React Query",
|
|
7
|
-
"description": "Generates typed TanStack Query
|
|
7
|
+
"description": "Generates typed TanStack Query helpers for React from your OpenAPI spec: queryOptions and mutationOptions factories with their cache keys. Set hooks to also get useQuery and useMutation hooks, plus useInfiniteQuery when infinite is set.",
|
|
8
8
|
"category": "framework",
|
|
9
9
|
"icon": {
|
|
10
10
|
"light": "https://kubb.dev/feature/tanstack.svg"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-react-query",
|
|
3
|
-
"version": "5.4.0-canary.
|
|
3
|
+
"version": "5.4.0-canary.20261013T135854",
|
|
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",
|
|
@@ -76,13 +76,13 @@
|
|
|
76
76
|
"registry": "https://registry.npmjs.org/"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@kubb/plugin-ts": "^5.1.0-canary.
|
|
79
|
+
"@kubb/plugin-ts": "^5.1.0-canary.20261013T135853"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@internals/client": "0.1.0-canary.
|
|
83
|
-
"@internals/shared": "0.1.0-canary.
|
|
84
|
-
"@internals/tanstack-query": "0.1.0-canary.
|
|
85
|
-
"@internals/utils": "0.1.0-canary.
|
|
82
|
+
"@internals/client": "0.1.0-canary.20261013T135853",
|
|
83
|
+
"@internals/shared": "0.1.0-canary.20261013T135853",
|
|
84
|
+
"@internals/tanstack-query": "0.1.0-canary.20261013T135853",
|
|
85
|
+
"@internals/utils": "0.1.0-canary.20261013T135853",
|
|
86
86
|
"@tanstack/react-query": "^5.104.1",
|
|
87
87
|
"kubb": "^5.8.3"
|
|
88
88
|
},
|