@kubb/plugin-react-query 5.0.0-beta.3 → 5.0.0-beta.30

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 (48) hide show
  1. package/README.md +34 -83
  2. package/dist/{components-DTGLu4UV.js → components-CDmg-RPi.js} +275 -255
  3. package/dist/components-CDmg-RPi.js.map +1 -0
  4. package/dist/{components-dAKJEn9b.cjs → components-MPBTffPl.cjs} +299 -255
  5. package/dist/components-MPBTffPl.cjs.map +1 -0
  6. package/dist/components.cjs +1 -1
  7. package/dist/components.d.ts +1 -75
  8. package/dist/components.js +1 -1
  9. package/dist/{generators-C_fbcjpG.js → generators-Bma51Uar.js} +301 -261
  10. package/dist/generators-Bma51Uar.js.map +1 -0
  11. package/dist/{generators-CWEQsdO9.cjs → generators-BtsWNz-6.cjs} +299 -259
  12. package/dist/generators-BtsWNz-6.cjs.map +1 -0
  13. package/dist/generators.cjs +1 -1
  14. package/dist/generators.d.ts +41 -1
  15. package/dist/generators.js +1 -1
  16. package/dist/index.cjs +143 -20
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +30 -1
  19. package/dist/index.js +143 -20
  20. package/dist/index.js.map +1 -1
  21. package/dist/types-DiZPLTXl.d.ts +400 -0
  22. package/extension.yaml +1507 -0
  23. package/package.json +16 -18
  24. package/src/components/InfiniteQuery.tsx +19 -13
  25. package/src/components/InfiniteQueryOptions.tsx +29 -47
  26. package/src/components/Mutation.tsx +35 -15
  27. package/src/components/MutationOptions.tsx +14 -13
  28. package/src/components/Query.tsx +9 -10
  29. package/src/components/QueryOptions.tsx +6 -27
  30. package/src/components/SuspenseInfiniteQuery.tsx +19 -13
  31. package/src/components/SuspenseInfiniteQueryOptions.tsx +29 -47
  32. package/src/components/SuspenseQuery.tsx +9 -10
  33. package/src/generators/customHookOptionsFileGenerator.tsx +18 -14
  34. package/src/generators/hookOptionsGenerator.tsx +36 -33
  35. package/src/generators/infiniteQueryGenerator.tsx +46 -64
  36. package/src/generators/mutationGenerator.tsx +42 -50
  37. package/src/generators/queryGenerator.tsx +43 -49
  38. package/src/generators/suspenseInfiniteQueryGenerator.tsx +41 -51
  39. package/src/generators/suspenseQueryGenerator.tsx +44 -62
  40. package/src/plugin.ts +42 -16
  41. package/src/resolvers/resolverReactQuery.ts +102 -6
  42. package/src/types.ts +199 -61
  43. package/src/utils.ts +10 -33
  44. package/dist/components-DTGLu4UV.js.map +0 -1
  45. package/dist/components-dAKJEn9b.cjs.map +0 -1
  46. package/dist/generators-CWEQsdO9.cjs.map +0 -1
  47. package/dist/generators-C_fbcjpG.js.map +0 -1
  48. package/dist/types-DfaFRSBf.d.ts +0 -284
package/README.md CHANGED
@@ -1,5 +1,5 @@
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>
@@ -11,9 +11,9 @@
11
11
  [![Sponsors][sponsors-src]][sponsors-href]
12
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,11 +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
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.
25
46
 
26
47
  ## Supporting Kubb
27
48
 
28
- 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:
29
50
 
30
51
  - [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
31
52
 
@@ -37,87 +58,17 @@ Kubb uses an MIT-licensed open source project with its ongoing development made
37
58
 
38
59
  <!-- Badges -->
39
60
 
40
- [npm-version-src]: https://img.shields.io/npm/v/@kubb/plugin-tanstack-query?flat&colorA=18181B&colorB=f58517
41
- [npm-version-href]: https://npmjs.com/package/@kubb/plugin-tanstack-query
42
- [npm-downloads-src]: https://img.shields.io/npm/dm/@kubb/plugin-tanstack-query?flat&colorA=18181B&colorB=f58517
43
- [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
44
65
  [license-src]: https://img.shields.io/github/license/kubb-labs/kubb.svg?flat&colorA=18181B&colorB=f58517
45
66
  [license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
46
67
  [build-src]: https://img.shields.io/github/actions/workflow/status/kubb-labs/kubb/ci.yaml?style=flat&colorA=18181B&colorB=f58517
47
- [build-href]: https://www.npmjs.com/package/@kubb/plugin-tanstack-query
48
- [minified-src]: https://img.shields.io/bundlephobia/min/@kubb/plugin-tanstack-query?style=flat&colorA=18181B&colorB=f58517
49
- [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
50
71
  [coverage-src]: https://img.shields.io/codecov/c/github/kubb-labs/kubb?style=flat&colorA=18181B&colorB=f58517
51
- [coverage-href]: https://www.npmjs.com/package/@kubb/plugin-tanstack-query
72
+ [coverage-href]: https://www.npmjs.com/package/@kubb/plugin-react-query
52
73
  [sponsors-src]: https://img.shields.io/github/sponsors/stijnvanhulle?style=flat&colorA=18181B&colorB=f58517
53
74
  [sponsors-href]: https://github.com/sponsors/stijnvanhulle/
54
-
55
- ## options query
56
-
57
- ### v4
58
-
59
- UseBaseQueryOptions => react-query only
60
- UseQueryOptions => vue-query only
61
- CreateQueryOptions => solid-query only
62
- CreateQueryOptions => svelte-query only
63
-
64
- ### v5
65
-
66
- UseBaseQueryOptions => react-query only https://github.com/TanStack/query/blob/ce1305c27e7ac7988656d171d882a665a286cc6a/packages/react-query/src/types.ts#L18
67
- QueryObserverOptions => vue-query only https://github.com/TanStack/query/blob/main/packages/vue-query/src/useQuery.ts#L24
68
- UseQueryOptions => solid-query only
69
-
70
- ## result query
71
-
72
- ### v4
73
-
74
- UseQueryResult => react-query only
75
- UseQueryReturnType => vue-query only
76
- CreateQueryResult => solid-query only
77
- CreateQueryResult => svelte-query only
78
-
79
- ### v5
80
-
81
- UseQueryResult => react-query only
82
- UseQueryReturnType => vue-query only
83
-
84
- ## queryOptions() query
85
-
86
- ### v5
87
-
88
- queryOptions => react-query only
89
-
90
- ```typescript
91
- {
92
- query: {
93
- types: {
94
- options: 'UseBaseQueryOptions'
95
- result: 'UseQueryResult'
96
- }
97
- }
98
- }
99
- ```
100
-
101
- ## options mutation
102
-
103
- ### v4
104
-
105
- UseMutationOptions => react-query only
106
- VueMutationObserverOptions => vue-query only
107
-
108
- ### v5
109
-
110
- UseMutationOptions => react-query only
111
- MutationObserverOptions => vue-query only
112
-
113
- ## result mutation
114
-
115
- ### v4
116
-
117
- UseMutationResult => react-query only
118
- UseMutationReturnType => vue-query only
119
-
120
- ### v5
121
-
122
- UseMutationResult => react-query only
123
- UseMutationReturnType => vue-query only