@kubb/plugin-vue-query 5.5.3 → 5.5.4
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 +23 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/docs/options.md +20 -4
- package/package.json +5 -5
package/docs/options.md
CHANGED
|
@@ -11,9 +11,9 @@ Pass these options to `pluginVueQuery()`. Shared options link to [Shared plugin
|
|
|
11
11
|
| [`client`](#client) | Which registered client plugin the composables call. | Auto-detected |
|
|
12
12
|
| [`infinite`](#infinite) | Add `useInfiniteQuery` composables for paginated reads. | `false` |
|
|
13
13
|
| [`query`](#query) | Configure or disable query composables. | `{ methods: ['GET', 'QUERY'], importPath: '@tanstack/vue-query' }` |
|
|
14
|
-
| [`queryKey`](#querykey) | Build the `queryKey` for each query composable. |
|
|
14
|
+
| [`queryKey`](#querykey) | Build the `queryKey` for each query composable. | Exported `queryKeyTransformer` |
|
|
15
15
|
| [`mutation`](#mutation) | Configure or disable mutation composables. | `{ methods: ['POST', 'PUT', 'PATCH', 'DELETE'], importPath: '@tanstack/vue-query' }` |
|
|
16
|
-
| [`mutationKey`](#mutationkey) | Build the `mutationKey` for each mutation composable. |
|
|
16
|
+
| [`mutationKey`](#mutationkey) | Build the `mutationKey` for each mutation composable. | Exported `mutationKeyTransformer` |
|
|
17
17
|
| [`hooks`](#hooks) | Emit `use*` composables on top of the factory helpers. | `false` |
|
|
18
18
|
| [`include`](https://kubb.dev/docs/5.x/reference/plugin-options#include) | Keep only operations that match. | None |
|
|
19
19
|
| [`exclude`](https://kubb.dev/docs/5.x/reference/plugin-options#exclude) | Skip operations that match. | `[]` |
|
|
@@ -180,7 +180,7 @@ Builds the `queryKey` for each query composable. The callback receives the opera
|
|
|
180
180
|
| -------- | ------------------------------------------------------ |
|
|
181
181
|
| Type | `(props: { node, casing, variant }) => Array<unknown>` |
|
|
182
182
|
| Required | `false` |
|
|
183
|
-
| Default |
|
|
183
|
+
| Default | Exported `queryKeyTransformer` |
|
|
184
184
|
|
|
185
185
|
::code-group
|
|
186
186
|
|
|
@@ -194,6 +194,14 @@ export const getUserByNameQueryKey = () => [{ variant: 'query', operationId: 'ge
|
|
|
194
194
|
|
|
195
195
|
::
|
|
196
196
|
|
|
197
|
+
To extend the default key instead of replacing it, import `queryKeyTransformer` and spread its result. The default segments can change between releases, so spread them instead of reading single entries.
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
import { queryKeyTransformer } from '@kubb/plugin-vue-query'
|
|
201
|
+
|
|
202
|
+
queryKey: (props) => [JSON.stringify(props.node.operationId), ...queryKeyTransformer(props)]
|
|
203
|
+
```
|
|
204
|
+
|
|
197
205
|
### mutation
|
|
198
206
|
|
|
199
207
|
Decides which operations are treated as mutations. The plugin generates a `mutationKey` helper for each match by default. Pass `false` to skip, or set [`hooks`](#hooks) to also emit `useMutation`.
|
|
@@ -232,7 +240,15 @@ Builds the `mutationKey` for each mutation composable, useful for batching inval
|
|
|
232
240
|
| -------- | ------------------------------------------------------ |
|
|
233
241
|
| Type | `(props: { node, casing, variant }) => Array<unknown>` |
|
|
234
242
|
| Required | `false` |
|
|
235
|
-
| Default |
|
|
243
|
+
| Default | Exported `mutationKeyTransformer` |
|
|
244
|
+
|
|
245
|
+
Extend the default the same way with `mutationKeyTransformer`:
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
import { mutationKeyTransformer } from '@kubb/plugin-vue-query'
|
|
249
|
+
|
|
250
|
+
mutationKey: (props) => [JSON.stringify(props.node.operationId), ...mutationKeyTransformer(props)]
|
|
251
|
+
```
|
|
236
252
|
|
|
237
253
|
### hooks
|
|
238
254
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-vue-query",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.4",
|
|
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",
|
|
@@ -90,13 +90,13 @@
|
|
|
90
90
|
"@internals/shared": "0.0.0",
|
|
91
91
|
"@internals/tanstack-query": "0.0.0",
|
|
92
92
|
"@internals/utils": "0.0.0",
|
|
93
|
-
"@tanstack/vue-query": "^5.104.
|
|
94
|
-
"kubb": "^5.
|
|
95
|
-
"vue": "^3.5.
|
|
93
|
+
"@tanstack/vue-query": "^5.104.3",
|
|
94
|
+
"kubb": "^5.11.1",
|
|
95
|
+
"vue": "^3.5.44"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"@tanstack/vue-query": "^5.41.0",
|
|
99
|
-
"kubb": "^5.
|
|
99
|
+
"kubb": "^5.11.1",
|
|
100
100
|
"vue": ">=3.3.0"
|
|
101
101
|
},
|
|
102
102
|
"peerDependenciesMeta": {
|