@kubb/plugin-vue-query 5.3.2 → 5.3.3
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 +10 -10
- package/kubb-extension.json +1 -1
- package/package.json +10 -5
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
package/docs/overview.md
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
# Vue Query
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Vue Query plugin generates TanStack Query helpers for Vue from your OpenAPI spec. By default you get `queryOptions` factories with their query keys, plus a key for each mutation. Set `hooks: true` to also get `useQuery` and `useMutation` composables with reactive parameters.
|
|
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/vue-query` v5 or
|
|
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/vue-query` 5.41 or a later v5 release and `vue` 3.3 or a later v3 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
|
-
- `hooks` adds the `use*` composables on top of the option factories.
|
|
17
|
-
- `infinite` adds
|
|
18
|
-
- `query` and `mutation` set which HTTP methods become queries (`GET`) and mutations (`POST`, `PUT`, `PATCH`, `DELETE`)
|
|
16
|
+
- `hooks` adds the `use*` composables on top of the query option factories.
|
|
17
|
+
- `infinite` adds `useInfiniteQuery` composables for pagination. It needs `hooks: true` and covers the operations that take the query parameter named in `infinite.queryParam`, which defaults to `'id'`.
|
|
18
|
+
- `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.
|
|
19
|
+
|
|
20
|
+
See [Options](https://kubb.dev/extensions/kubb-labs/plugin-vue-query/options) for every option and its default.
|
|
19
21
|
|
|
20
22
|
## Example
|
|
21
23
|
|
|
24
|
+
The config below generates `useQuery` and `useMutation` composables that call the Fetch client.
|
|
25
|
+
|
|
22
26
|
```typescript [kubb.config.ts]
|
|
23
27
|
import { defineConfig } from 'kubb/config'
|
|
24
28
|
import { pluginTs } from '@kubb/plugin-ts'
|
|
@@ -35,7 +39,3 @@ export default defineConfig({
|
|
|
35
39
|
],
|
|
36
40
|
})
|
|
37
41
|
```
|
|
38
|
-
|
|
39
|
-
## See also
|
|
40
|
-
|
|
41
|
-
- [TanStack Query for Vue](https://tanstack.com/query/latest/docs/framework/vue/overview)
|
package/kubb-extension.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "plugin-vue-query",
|
|
5
5
|
"export": "pluginVueQuery",
|
|
6
6
|
"displayName": "Vue Query",
|
|
7
|
-
"description": "Generates TanStack Query
|
|
7
|
+
"description": "Generates typed TanStack Query helpers for Vue from your OpenAPI spec: queryOptions factories with their query and mutation keys. Set hooks to also get useQuery and useMutation composables, 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-vue-query",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.3",
|
|
4
4
|
"description": "Generate type-safe TanStack Query (Vue Query) composables with Kubb. Covers useQuery, useMutation, useInfiniteQuery, and queryOptions with Vue 3 Composition API support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"code-generation",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"registry": "https://registry.npmjs.org/"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@kubb/plugin-ts": "^5.0.
|
|
81
|
+
"@kubb/plugin-ts": "^5.0.10"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@internals/client": "0.0.0",
|
|
@@ -86,15 +86,20 @@
|
|
|
86
86
|
"@internals/tanstack-query": "0.0.0",
|
|
87
87
|
"@internals/utils": "0.0.0",
|
|
88
88
|
"@tanstack/vue-query": "^5.104.1",
|
|
89
|
-
"kubb": "^5.8.3"
|
|
89
|
+
"kubb": "^5.8.3",
|
|
90
|
+
"vue": "^3.5.43"
|
|
90
91
|
},
|
|
91
92
|
"peerDependencies": {
|
|
92
|
-
"@tanstack/vue-query": "^5.
|
|
93
|
-
"kubb": "^5.8.3"
|
|
93
|
+
"@tanstack/vue-query": "^5.41.0",
|
|
94
|
+
"kubb": "^5.8.3",
|
|
95
|
+
"vue": ">=3.3.0"
|
|
94
96
|
},
|
|
95
97
|
"peerDependenciesMeta": {
|
|
96
98
|
"@tanstack/vue-query": {
|
|
97
99
|
"optional": true
|
|
100
|
+
},
|
|
101
|
+
"vue": {
|
|
102
|
+
"optional": true
|
|
98
103
|
}
|
|
99
104
|
},
|
|
100
105
|
"engines": {
|