@kubb/plugin-react-query 5.0.0-alpha.8 → 5.0.0-beta.10

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.
Files changed (54) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +34 -85
  3. package/dist/components-Dow6tde8.js +1459 -0
  4. package/dist/components-Dow6tde8.js.map +1 -0
  5. package/dist/components-HwdCDefj.cjs +1603 -0
  6. package/dist/components-HwdCDefj.cjs.map +1 -0
  7. package/dist/components.cjs +1 -1
  8. package/dist/components.d.ts +49 -179
  9. package/dist/components.js +1 -1
  10. package/dist/generators-CcOmnTPa.cjs +1454 -0
  11. package/dist/generators-CcOmnTPa.cjs.map +1 -0
  12. package/dist/generators-yfZr_qfT.js +1412 -0
  13. package/dist/generators-yfZr_qfT.js.map +1 -0
  14. package/dist/generators.cjs +1 -1
  15. package/dist/generators.d.ts +9 -476
  16. package/dist/generators.js +1 -1
  17. package/dist/index.cjs +197 -126
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.js +193 -126
  21. package/dist/index.js.map +1 -1
  22. package/dist/types-DG_OxOym.d.ts +363 -0
  23. package/extension.yaml +911 -0
  24. package/package.json +59 -64
  25. package/src/components/InfiniteQuery.tsx +79 -138
  26. package/src/components/InfiniteQueryOptions.tsx +55 -166
  27. package/src/components/Mutation.tsx +74 -111
  28. package/src/components/MutationOptions.tsx +61 -80
  29. package/src/components/Query.tsx +66 -142
  30. package/src/components/QueryOptions.tsx +56 -138
  31. package/src/components/SuspenseInfiniteQuery.tsx +79 -138
  32. package/src/components/SuspenseInfiniteQueryOptions.tsx +55 -166
  33. package/src/components/SuspenseQuery.tsx +66 -152
  34. package/src/generators/customHookOptionsFileGenerator.tsx +37 -51
  35. package/src/generators/hookOptionsGenerator.tsx +111 -174
  36. package/src/generators/infiniteQueryGenerator.tsx +158 -178
  37. package/src/generators/mutationGenerator.tsx +112 -139
  38. package/src/generators/queryGenerator.tsx +128 -142
  39. package/src/generators/suspenseInfiniteQueryGenerator.tsx +157 -156
  40. package/src/generators/suspenseQueryGenerator.tsx +126 -152
  41. package/src/index.ts +1 -1
  42. package/src/plugin.ts +134 -187
  43. package/src/resolvers/resolverReactQuery.ts +107 -0
  44. package/src/types.ts +172 -49
  45. package/src/utils.ts +10 -0
  46. package/dist/components-BHQT9ZLc.cjs +0 -1634
  47. package/dist/components-BHQT9ZLc.cjs.map +0 -1
  48. package/dist/components-CpyHYGOw.js +0 -1520
  49. package/dist/components-CpyHYGOw.js.map +0 -1
  50. package/dist/generators-DP07m3rH.cjs +0 -1469
  51. package/dist/generators-DP07m3rH.cjs.map +0 -1
  52. package/dist/generators-DkQwKTc2.js +0 -1427
  53. package/dist/generators-DkQwKTc2.js.map +0 -1
  54. package/dist/types-D5S7Ny9r.d.ts +0 -270
package/LICENSE CHANGED
@@ -1,14 +1,21 @@
1
- Copyright (c) 2026 Stijn Van Hulle
1
+ MIT License
2
2
 
3
- This repository contains software under two licenses:
3
+ Copyright (c) 2026 Kubb Labs
4
4
 
5
- 1. Most of the code in this repository is licensed under the
6
- MIT License see licenses/LICENSE-MIT for the full license text.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
7
11
 
8
- 2. The following components are licensed under the
9
- GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later)
10
- — see licenses/LICENSE-AGPL-3.0 for the full license text:
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
11
14
 
12
- - packages/agent (published as @kubb/agent)
13
-
14
- Each package's own LICENSE file or package.json specifies its applicable license.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
1
  <div align="center">
2
- <h1>Plugin React-Query</h1>
2
+ <h1>@kubb/plugin-react-query</h1>
3
3
  <a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
4
4
  <img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
5
5
  </a>
6
6
 
7
-
8
7
  [![npm version][npm-version-src]][npm-version-href]
9
8
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
10
9
  [![Coverage][coverage-src]][coverage-href]
11
10
  [![License][license-src]][license-href]
12
11
  [![Sponsors][sponsors-src]][sponsors-href]
12
+
13
13
  <h4>
14
- <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/main//examples/typescript" target="_blank">View Demo</a>
14
+ <a href="https://codesandbox.io/s/github/kubb-labs/plugins/tree/main/examples/react-query" target="_blank">View Demo</a>
15
15
  <span> · </span>
16
- <a href="https://kubb.dev/" target="_blank">Documentation</a>
16
+ <a href="https://kubb.dev/plugins/react-query" target="_blank">Documentation</a>
17
17
  <span> · </span>
18
18
  <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
19
19
  <span> · </span>
@@ -21,12 +21,32 @@
21
21
  </h4>
22
22
  </div>
23
23
 
24
- Swagger integration for React-Query to generate all the different hooks based on an OpenAPI specification.
24
+ `@kubb/plugin-react-query` generates TanStack Query hooks from your OpenAPI specification. Each operation becomes a typed `useQuery`, `useMutation`, or `useInfiniteQuery` hook.
25
+
26
+ ## Features
25
27
 
28
+ - Generates `useQuery`, `useMutation`, `useInfiniteQuery`, and `queryOptions` hooks
29
+ - Infers request, response, and error types from the spec
30
+ - Groups output files by tag, operation, or a custom strategy
31
+ - Works with `@kubb/plugin-ts`, `@kubb/plugin-zod`, and `@kubb/plugin-client`
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ bun add @kubb/plugin-react-query
37
+ # or
38
+ pnpm add @kubb/plugin-react-query
39
+ # or
40
+ npm install @kubb/plugin-react-query
41
+ ```
42
+
43
+ ## Documentation
44
+
45
+ See the [full documentation](https://kubb.dev/plugins/react-query) for configuration options and examples.
26
46
 
27
47
  ## Supporting Kubb
28
48
 
29
- Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
49
+ Kubb is an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
30
50
 
31
51
  - [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
32
52
 
@@ -36,90 +56,19 @@ Kubb uses an MIT-licensed open source project with its ongoing development made
36
56
  </a>
37
57
  </p>
38
58
 
39
-
40
59
  <!-- Badges -->
41
60
 
42
- [npm-version-src]: https://img.shields.io/npm/v/@kubb/plugin-tanstack-query?flat&colorA=18181B&colorB=f58517
43
- [npm-version-href]: https://npmjs.com/package/@kubb/plugin-tanstack-query
44
- [npm-downloads-src]: https://img.shields.io/npm/dm/@kubb/plugin-tanstack-query?flat&colorA=18181B&colorB=f58517
45
- [npm-downloads-href]: https://npmjs.com/package/@kubb/plugin-tanstack-query
61
+ [npm-version-src]: https://img.shields.io/npm/v/@kubb/plugin-react-query?flat&colorA=18181B&colorB=f58517
62
+ [npm-version-href]: https://npmjs.com/package/@kubb/plugin-react-query
63
+ [npm-downloads-src]: https://img.shields.io/npm/dm/@kubb/plugin-react-query?flat&colorA=18181B&colorB=f58517
64
+ [npm-downloads-href]: https://npmjs.com/package/@kubb/plugin-react-query
46
65
  [license-src]: https://img.shields.io/github/license/kubb-labs/kubb.svg?flat&colorA=18181B&colorB=f58517
47
66
  [license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
48
67
  [build-src]: https://img.shields.io/github/actions/workflow/status/kubb-labs/kubb/ci.yaml?style=flat&colorA=18181B&colorB=f58517
49
- [build-href]: https://www.npmjs.com/package/@kubb/plugin-tanstack-query
50
- [minified-src]: https://img.shields.io/bundlephobia/min/@kubb/plugin-tanstack-query?style=flat&colorA=18181B&colorB=f58517
51
- [minified-href]: https://www.npmjs.com/package/@kubb/plugin-tanstack-query
68
+ [build-href]: https://www.npmjs.com/package/@kubb/plugin-react-query
69
+ [minified-src]: https://img.shields.io/bundlephobia/min/@kubb/plugin-react-query?style=flat&colorA=18181B&colorB=f58517
70
+ [minified-href]: https://www.npmjs.com/package/@kubb/plugin-react-query
52
71
  [coverage-src]: https://img.shields.io/codecov/c/github/kubb-labs/kubb?style=flat&colorA=18181B&colorB=f58517
53
- [coverage-href]: https://www.npmjs.com/package/@kubb/plugin-tanstack-query
72
+ [coverage-href]: https://www.npmjs.com/package/@kubb/plugin-react-query
54
73
  [sponsors-src]: https://img.shields.io/github/sponsors/stijnvanhulle?style=flat&colorA=18181B&colorB=f58517
55
74
  [sponsors-href]: https://github.com/sponsors/stijnvanhulle/
56
-
57
- ## options query
58
-
59
- ### v4
60
-
61
- UseBaseQueryOptions => react-query only
62
- UseQueryOptions => vue-query only
63
- CreateQueryOptions => solid-query only
64
- CreateQueryOptions => svelte-query only
65
-
66
- ### v5
67
-
68
- UseBaseQueryOptions => react-query only https://github.com/TanStack/query/blob/ce1305c27e7ac7988656d171d882a665a286cc6a/packages/react-query/src/types.ts#L18
69
- QueryObserverOptions => vue-query only https://github.com/TanStack/query/blob/main/packages/vue-query/src/useQuery.ts#L24
70
- UseQueryOptions => solid-query only
71
-
72
- ## result query
73
-
74
- ### v4
75
-
76
- UseQueryResult => react-query only
77
- UseQueryReturnType => vue-query only
78
- CreateQueryResult => solid-query only
79
- CreateQueryResult => svelte-query only
80
-
81
- ### v5
82
-
83
- UseQueryResult => react-query only
84
- UseQueryReturnType => vue-query only
85
-
86
- ## queryOptions() query
87
-
88
- ### v5
89
-
90
- queryOptions => react-query only
91
-
92
- ```typescript
93
- {
94
- query: {
95
- types: {
96
- options: 'UseBaseQueryOptions'
97
- result: 'UseQueryResult'
98
- }
99
- }
100
- }
101
- ```
102
-
103
- ## options mutation
104
-
105
- ### v4
106
-
107
- UseMutationOptions => react-query only
108
- VueMutationObserverOptions => vue-query only
109
-
110
- ### v5
111
-
112
- UseMutationOptions => react-query only
113
- MutationObserverOptions => vue-query only
114
-
115
- ## result mutation
116
-
117
- ### v4
118
-
119
- UseMutationResult => react-query only
120
- UseMutationReturnType => vue-query only
121
-
122
- ### v5
123
-
124
- UseMutationResult => react-query only
125
- UseMutationReturnType => vue-query only