@kubb/plugin-react-query 5.3.0 → 5.3.1
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/OVERVIEW.md +20 -0
- package/dist/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/kubb-extension.json +218 -0
- package/package.json +8 -5
package/OVERVIEW.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# React Query
|
|
2
|
+
|
|
3
|
+
Generates TanStack Query helpers for React from your OpenAPI spec. By default you get `queryOptions` and `mutationOptions` factories with their cache keys. Set `hooks: true` to also get `useQuery`, `useSuspenseQuery`, `useInfiniteQuery`, and `useMutation` hooks.
|
|
4
|
+
|
|
5
|
+
The plugin ships no HTTP client. Each helper calls a function generated by a client plugin.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
- Add `@kubb/plugin-ts` and a client plugin: `@kubb/plugin-fetch` or `@kubb/plugin-axios`.
|
|
10
|
+
- Install `@tanstack/react-query` v5 or higher in the app that uses the generated code.
|
|
11
|
+
- Configure validation on the client plugin, not here.
|
|
12
|
+
|
|
13
|
+
## Options worth knowing
|
|
14
|
+
|
|
15
|
+
- `client` picks `fetch` or `axios` when both client plugins are registered. A single client is detected automatically.
|
|
16
|
+
- `hooks` adds the `use*` hooks on top of the option factories.
|
|
17
|
+
- `suspense` adds `useSuspenseQuery` hooks.
|
|
18
|
+
- `infinite` adds infinite queries for pagination. Set `infinite.queryParam` to the query parameter that holds the page cursor.
|
|
19
|
+
- `query` and `mutation` set which HTTP methods become queries (`GET`) and mutations (`POST`, `PUT`, `PATCH`, `DELETE`), and where the TanStack Query runtime is imported from. Set either to `false` to skip it.
|
|
20
|
+
- `customOptions` routes every hook through your own function that returns extra options.
|
package/dist/index.cjs
CHANGED
|
@@ -350,8 +350,14 @@ function createGroupConfig(group) {
|
|
|
350
350
|
};
|
|
351
351
|
}
|
|
352
352
|
//#endregion
|
|
353
|
+
//#region kubb-extension.json
|
|
354
|
+
var compatibility = {
|
|
355
|
+
"kubb": ">=5.8.0",
|
|
356
|
+
"node": ">=22"
|
|
357
|
+
};
|
|
358
|
+
//#endregion
|
|
353
359
|
//#region package.json
|
|
354
|
-
var version = "5.3.
|
|
360
|
+
var version = "5.3.1";
|
|
355
361
|
//#endregion
|
|
356
362
|
//#region ../../internals/client/src/resolveClient.ts
|
|
357
363
|
/**
|
|
@@ -2472,7 +2478,7 @@ const pluginReactQuery = (0, kubb_kit.definePlugin)({
|
|
|
2472
2478
|
meta: {
|
|
2473
2479
|
name: pluginReactQueryName,
|
|
2474
2480
|
version,
|
|
2475
|
-
compatibility
|
|
2481
|
+
compatibility
|
|
2476
2482
|
},
|
|
2477
2483
|
dependencies: { [_kubb_plugin_ts.pluginTsName]: {} },
|
|
2478
2484
|
setup(options) {
|