@kubb/plugin-react-query 5.0.0-beta.31 → 5.0.0-beta.35

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 (3) hide show
  1. package/README.md +11 -11
  2. package/extension.yaml +6 -29
  3. package/package.json +10 -9
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  <div align="center">
2
- <h1>@kubb/plugin-react-query</h1>
3
2
  <a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
4
- <img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
3
+ <img src="https://kubb.dev/og.png" alt="Kubb banner">
5
4
  </a>
6
5
 
7
6
  [![npm version][npm-version-src]][npm-version-href]
@@ -11,8 +10,6 @@
11
10
  [![Sponsors][sponsors-src]][sponsors-href]
12
11
 
13
12
  <h4>
14
- <a href="https://codesandbox.io/s/github/kubb-labs/plugins/tree/main/examples/react-query" target="_blank">View Demo</a>
15
- <span> · </span>
16
13
  <a href="https://kubb.dev/plugins/react-query" target="_blank">Documentation</a>
17
14
  <span> · </span>
18
15
  <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
@@ -21,14 +18,13 @@
21
18
  </h4>
22
19
  </div>
23
20
 
24
- `@kubb/plugin-react-query` generates TanStack Query hooks from your OpenAPI specification. Each operation becomes a typed `useQuery`, `useMutation`, or `useInfiniteQuery` hook.
21
+ <br />
22
+
23
+ # @kubb/plugin-react-query
25
24
 
26
- ## Features
25
+ ### Generate TanStack Query hooks from OpenAPI
27
26
 
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`
27
+ `@kubb/plugin-react-query` generates TanStack Query hooks from your OpenAPI specification. Each operation becomes a typed `useQuery`, `useMutation`, or `useInfiniteQuery` hook.
32
28
 
33
29
  ## Installation
34
30
 
@@ -46,7 +42,7 @@ See the [full documentation](https://kubb.dev/plugins/react-query) for configura
46
42
 
47
43
  ## Supporting Kubb
48
44
 
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:
45
+ Kubb is an open source project, and its development is funded entirely by sponsors. If you would like to become a sponsor, please consider:
50
46
 
51
47
  - [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
52
48
 
@@ -56,6 +52,10 @@ Kubb is an MIT-licensed open source project with its ongoing development made po
56
52
  </a>
57
53
  </p>
58
54
 
55
+ ## License
56
+
57
+ [MIT](https://github.com/kubb-labs/plugins/blob/main/LICENSE)
58
+
59
59
  <!-- Badges -->
60
60
 
61
61
  [npm-version-src]: https://img.shields.io/npm/v/@kubb/plugin-react-query?flat&colorA=18181B&colorB=f58517
package/extension.yaml CHANGED
@@ -317,31 +317,6 @@ options:
317
317
  }),
318
318
  ],
319
319
  })
320
- - name: contentType
321
- type: "'application/json' | (string & {})"
322
- required: false
323
- description: |
324
- Selects which request/response media type the generator reads from the OpenAPI spec.
325
-
326
- When omitted, Kubb picks the first JSON-compatible media type it finds (`application/json`, `application/vnd.api+json`, anything ending in `+json`). Set this when your spec defines multiple media types for the same operation and you want a non-default one.
327
- examples:
328
- - name: JSON API media type
329
- files:
330
- - lang: typescript
331
- twoslash: false
332
- code: |
333
- import { defineConfig } from 'kubb'
334
- import { pluginTs } from '@kubb/plugin-ts'
335
-
336
- export default defineConfig({
337
- input: { path: './petStore.yaml' },
338
- output: { path: './src/gen' },
339
- plugins: [
340
- pluginTs({
341
- contentType: 'application/vnd.api+json',
342
- }),
343
- ],
344
- })
345
320
  - name: group
346
321
  type: Group
347
322
  required: false
@@ -1046,13 +1021,13 @@ options:
1046
1021
  - name: methods
1047
1022
  type: Array<HttpMethod>
1048
1023
  required: false
1049
- default: "['post', 'put', 'delete']"
1024
+ default: "['post', 'put', 'patch', 'delete']"
1050
1025
  description: |
1051
1026
  HTTP methods treated as mutations. Operations using one of these methods generate a `useMutation`-style hook instead of a query.
1052
1027
 
1053
- Defaults to `['post', 'put', 'delete']`. Add `'patch'` if your API uses it for partial updates.
1028
+ Defaults to `['post', 'put', 'patch', 'delete']`. Narrow the list if your API uses one of these methods for reads.
1054
1029
  examples:
1055
- - name: Include PATCH as a mutation
1030
+ - name: Treat only POST and PUT as mutations
1056
1031
  files:
1057
1032
  - lang: typescript
1058
1033
  twoslash: false
@@ -1065,7 +1040,7 @@ options:
1065
1040
  output: { path: './src/gen' },
1066
1041
  plugins: [
1067
1042
  pluginReactQuery({
1068
- mutation: { methods: ['post', 'put', 'patch', 'delete'] },
1043
+ mutation: { methods: ['post', 'put'] },
1069
1044
  }),
1070
1045
  ],
1071
1046
  })
@@ -1385,7 +1360,9 @@ options:
1385
1360
  | --- | --- |
1386
1361
  | `@kubb/plugin-ts` | `resolverTs` |
1387
1362
  | `@kubb/plugin-zod` | `resolverZod` |
1363
+ | `@kubb/plugin-faker` | `resolverFaker` |
1388
1364
  | `@kubb/plugin-cypress` | `resolverCypress` |
1365
+ | `@kubb/plugin-msw` | `resolverMsw` |
1389
1366
  | `@kubb/plugin-mcp` | `resolverMcp` |
1390
1367
  | `@kubb/plugin-client` | `resolverClient` |
1391
1368
  codeBlock:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-react-query",
3
- "version": "5.0.0-beta.31",
3
+ "version": "5.0.0-beta.35",
4
4
  "description": "Generate type-safe TanStack Query (React Query) hooks from your OpenAPI specification. Covers useQuery, useMutation, useInfiniteQuery, and queryOptions with full TypeScript support.",
5
5
  "keywords": [
6
6
  "code-generation",
@@ -68,20 +68,20 @@
68
68
  "registry": "https://registry.npmjs.org/"
69
69
  },
70
70
  "dependencies": {
71
- "@kubb/core": "5.0.0-beta.31",
72
- "@kubb/renderer-jsx": "5.0.0-beta.31",
73
- "remeda": "^2.34.1",
74
- "@kubb/plugin-client": "5.0.0-beta.31",
75
- "@kubb/plugin-ts": "5.0.0-beta.31",
76
- "@kubb/plugin-zod": "5.0.0-beta.31"
71
+ "@kubb/core": "5.0.0-beta.35",
72
+ "@kubb/renderer-jsx": "5.0.0-beta.35",
73
+ "remeda": "^2.37.0",
74
+ "@kubb/plugin-ts": "5.0.0-beta.35",
75
+ "@kubb/plugin-client": "5.0.0-beta.35",
76
+ "@kubb/plugin-zod": "5.0.0-beta.35"
77
77
  },
78
78
  "devDependencies": {
79
- "@internals/shared": "0.0.0",
80
79
  "@internals/tanstack-query": "0.0.0",
80
+ "@internals/shared": "0.0.0",
81
81
  "@internals/utils": "0.0.0"
82
82
  },
83
83
  "peerDependencies": {
84
- "@kubb/renderer-jsx": "5.0.0-beta.31"
84
+ "@kubb/renderer-jsx": "5.0.0-beta.35"
85
85
  },
86
86
  "size-limit": [
87
87
  {
@@ -100,6 +100,7 @@
100
100
  "lint:fix": "oxlint --fix .",
101
101
  "release": "pnpm publish --no-git-check",
102
102
  "release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
103
+ "release:stage": "pnpm stage publish --no-git-check",
103
104
  "start": "tsdown --watch",
104
105
  "test": "vitest --passWithNoTests",
105
106
  "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"