Skip to content

Commit

Permalink
Merge pull request #1489 from kubb-labs/fix/1486-error
Browse files Browse the repository at this point in the history
fix: queryOptions with custom Error type
  • Loading branch information
stijnvanhulle authored Jan 3, 2025
2 parents 2ea0e2d + f484787 commit 2b7a92e
Show file tree
Hide file tree
Showing 151 changed files with 1,348 additions and 771 deletions.
88 changes: 22 additions & 66 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"files": [
"README.md"
],
"files": ["README.md"],
"imageSize": 100,
"commit": false,
"commitConvention": "angular",
Expand All @@ -11,189 +9,147 @@
"name": "Stijn Van Hulle",
"avatar_url": "https://avatars.githubusercontent.com/u/5904681?v=4",
"profile": "http://www.stijnvanhulle.be",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "xPhentom",
"name": "Wouter Roozeleer",
"avatar_url": "https://avatars.githubusercontent.com/u/5096867?v=4",
"profile": "https://fosstodon.org/@xphentom",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "b6pzeusbc54tvhw5jgpyw8pwz2x6gs",
"name": "Alfred",
"avatar_url": "https://avatars.githubusercontent.com/u/15520015?v=4",
"profile": "https://aluc.io/",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "raveclassic",
"name": "Kirill Agalakov",
"avatar_url": "https://avatars.githubusercontent.com/u/1743568?v=4",
"profile": "https://github.com/raveclassic",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "WickyNilliams",
"name": "Nick Williams",
"avatar_url": "https://avatars.githubusercontent.com/u/1091390?v=4",
"profile": "http://wicky.nillia.ms",
"contributions": [
"doc"
]
"contributions": ["doc"]
},
{
"login": "helt",
"name": "helt",
"avatar_url": "https://avatars.githubusercontent.com/u/1732112?v=4",
"profile": "https://github.com/helt",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "Ti-webdev",
"name": "Vasily Mikhaylovsky",
"avatar_url": "https://avatars.githubusercontent.com/u/478565?v=4",
"profile": "https://github.com/Ti-webdev",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "chiptus",
"name": "Chaim Lev-Ari",
"avatar_url": "https://avatars.githubusercontent.com/u/1381655?v=4",
"profile": "https://github.com/chiptus",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "pafnuty",
"name": "Pavel Belousov",
"avatar_url": "https://avatars.githubusercontent.com/u/1635679?v=4",
"profile": "http://projects.pafnuty.name",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "dmitry-blackwave",
"name": "Dmitry Belov",
"avatar_url": "https://avatars.githubusercontent.com/u/5526543?v=4",
"profile": "https://github.com/dmitry-blackwave",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "aburgel",
"name": "Alex Burgel",
"avatar_url": "https://avatars.githubusercontent.com/u/341478?v=4",
"profile": "https://github.com/aburgel",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "dgarciamuria",
"name": "Daniel Garcia",
"avatar_url": "https://avatars.githubusercontent.com/u/8144333?v=4",
"profile": "https://github.com/dgarciamuria",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "wuyuanyi135",
"name": "wuyuanyi135",
"avatar_url": "https://avatars.githubusercontent.com/u/11760870?v=4",
"profile": "https://github.com/wuyuanyi135",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "cjthompson",
"name": "Chris Thompson",
"avatar_url": "https://avatars.githubusercontent.com/u/1958266?v=4",
"profile": "https://github.com/cjthompson",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "hkang1",
"name": "Caleb Hoyoul Kang",
"avatar_url": "https://avatars.githubusercontent.com/u/220971?v=4",
"profile": "https://github.com/hkang1",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "grreeenn",
"name": "Gregory Zhukovsky",
"avatar_url": "https://avatars.githubusercontent.com/u/13204857?v=4",
"profile": "https://github.com/grreeenn",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "ChilloManiac",
"name": "Christoffer Nørbjerg",
"avatar_url": "https://avatars.githubusercontent.com/u/3761964?v=4",
"profile": "https://github.com/ChilloManiac",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "CHE1RON",
"name": "CHE1RON",
"avatar_url": "https://avatars.githubusercontent.com/u/122524301?v=4",
"profile": "https://codefy.de/de/karriere",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "ekaradon",
"name": "ekaradon",
"avatar_url": "https://avatars.githubusercontent.com/u/9439390?v=4",
"profile": "https://github.com/ekaradon",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "Thijmen",
"name": "Thijmen Stavenuiter",
"avatar_url": "https://avatars.githubusercontent.com/u/383903?v=4",
"profile": "https://thijmen.dev",
"contributions": [
"code"
]
"contributions": ["code"]
},
{
"login": "bohdanhusak",
"name": "Bohdan Husak",
"avatar_url": "https://avatars.githubusercontent.com/u/13829370?v=4",
"profile": "https://github.com/bohdanhusak",
"contributions": [
"doc"
]
"contributions": ["doc"]
}
],
"contributorsPerLine": 7,
Expand Down
8 changes: 8 additions & 0 deletions .changeset/soft-planes-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@kubb/plugin-svelte-query": patch
"@kubb/plugin-react-query": patch
"@kubb/plugin-solid-query": patch
"@kubb/plugin-vue-query": patch
---

queryOptions with custom Error type
8 changes: 8 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ title: Changelog

# Changelog

## 3.3.5
- [`plugin-react-query`](/plugins/plugin-react-query/): queryOptions with custom Error type
- [`plugin-svelte-query`](/plugins/plugin-svelte-query/): queryOptions with custom Error type
- [`plugin-vue-query`](/plugins/plugin-vue-query/): queryOptions with custom Error type
- [`plugin-solid-query`](/plugins/plugin-solid-query/): queryOptions with custom Error type
- [`react`](/helpers/react/): importPath without extensions


## 3.3.4
- [`plugin-ts`](/plugins/plugin-ts): minLength, maxLength, pattern as part of the jsdocs
- [`plugin-client`](/plugins/plugin-client): baseURL could be undefined, do not throw error if that is the case
Expand Down
10 changes: 5 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
"serve": "vitepress serve"
},
"dependencies": {
"@shikijs/vitepress-twoslash": "^1.24.2",
"@shikijs/vitepress-twoslash": "^1.26.1",
"mermaid": "^11.4.1",
"sitemap": "^8.0.0",
"vitepress": "^1.5.0",
"vitepress-plugin-group-icons": "^1.3.1",
"vitepress-plugin-group-icons": "^1.3.2",
"vue": "^3.5.13"
},
"devDependencies": {
Expand All @@ -44,14 +44,14 @@
"@kubb/plugin-zod": "workspace:*",
"@kubb/react": "workspace:*",
"@mermaid-js/mermaid-cli": "^11.4.2",
"@types/node": "^20.17.10",
"@types/node": "^20.17.11",
"@types/react": "catalog:",
"cross-env": "^7.0.3",
"react": "catalog:",
"unplugin-kubb": "workspace:^",
"vite": "^6.0.3"
"vite": "^6.0.7"
},
"packageManager": "[email protected].0",
"packageManager": "[email protected].2",
"engines": {
"node": ">=20",
"pnpm": ">=8.15.0"
Expand Down
14 changes: 7 additions & 7 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
"@kubb/plugin-ts": "workspace:*",
"@kubb/plugin-zod": "workspace:*",
"@kubb/react": "workspace:*",
"@tanstack/react-query": "^5.62.7",
"@tanstack/solid-query": "^5.62.7",
"@tanstack/svelte-query": "^5.62.7",
"@tanstack/vue-query": "^5.62.7",
"@tanstack/react-query": "^5.62.12",
"@tanstack/solid-query": "^5.62.12",
"@tanstack/svelte-query": "^5.62.12",
"@tanstack/vue-query": "^5.62.12",
"axios": "^1.7.9",
"msw": "^2.6.9",
"msw": "^2.7.0",
"react": "catalog:",
"solid-js": "^1.9.3",
"svelte": "^3.59.2",
"swr": "^2.2.5",
"swr": "^2.3.0",
"tsup": "catalog:",
"vue": "^3.5.13",
"zod": "^3.24.1"
Expand All @@ -52,7 +52,7 @@
"tsup": "catalog:",
"typescript": "catalog:"
},
"packageManager": "[email protected].0",
"packageManager": "[email protected].2",
"engines": {
"node": ">=20",
"pnpm": ">=8.3.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/advanced/configs/kubb.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ export default defineConfig(() => {
group: { type: 'tag' },
client: {
dataReturnType: 'full',
importPath: '../../../../tanstack-query-client.ts',
importPath: '../../../../tanstack-query-client',
},
query: {
importPath: '../../../../tanstack-query-hook.ts',
importPath: '../../../../tanstack-query-hook',
},
infinite: false,
suspense: false,
Expand Down
18 changes: 9 additions & 9 deletions examples/advanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@
"@kubb/plugin-ts": "workspace:*",
"@kubb/plugin-zod": "workspace:*",
"@kubb/react": "workspace:*",
"@tanstack/query-core": "^5.62.7",
"@tanstack/react-query": "^5.62.7",
"@tanstack/solid-query": "^5.62.7",
"@tanstack/svelte-query": "^5.62.7",
"@tanstack/vue-query": "^5.62.7",
"@types/react": "^19.0.1",
"@tanstack/query-core": "^5.62.12",
"@tanstack/react-query": "^5.62.12",
"@tanstack/solid-query": "^5.62.12",
"@tanstack/svelte-query": "^5.62.12",
"@tanstack/vue-query": "^5.62.12",
"@types/react": "^19.0.2",
"axios": "^1.7.9",
"msw": "^2.6.9",
"msw": "^2.7.0",
"react": "^19.0.0",
"solid-js": "^1.9.3",
"svelte": "^3.59.2",
"swr": "^2.2.5",
"swr": "^2.3.0",
"vue": "^3.5.13",
"zod": "^3.24.1"
},
Expand All @@ -58,7 +58,7 @@
"tsup": "^8.3.5",
"typescript": "^5.7.2"
},
"packageManager": "[email protected].0",
"packageManager": "[email protected].2",
"engines": {
"node": ">=20",
"pnpm": ">=8.15.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import client from '../../../../tanstack-query-client.ts'
import type { RequestConfig, ResponseConfig } from '../../../../tanstack-query-client.ts'
import client from '../../../../tanstack-query-client'
import type { RequestConfig, ResponseConfig } from '../../../../tanstack-query-client'
import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../../../models/ts/petController/AddPet.ts'
import type { UseMutationOptions } from '@tanstack/react-query'
import { addPetMutationResponseSchema } from '../../../zod/petController/addPetSchema.ts'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import client from '../../../../tanstack-query-client.ts'
import type { RequestConfig, ResponseConfig } from '../../../../tanstack-query-client.ts'
import client from '../../../../tanstack-query-client'
import type { RequestConfig, ResponseConfig } from '../../../../tanstack-query-client'
import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../../../models/ts/petController/DeletePet.ts'
import type { UseMutationOptions } from '@tanstack/react-query'
import { deletePetMutationResponseSchema } from '../../../zod/petController/deletePetSchema.ts'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import client from '../../../../tanstack-query-client.ts'
import type { RequestConfig, ResponseConfig } from '../../../../tanstack-query-client.ts'
import type { QueryKey, QueryObserverOptions, UseQueryResult } from '../../../../tanstack-query-hook.ts'
import client from '../../../../tanstack-query-client'
import type { RequestConfig, ResponseConfig } from '../../../../tanstack-query-client'
import type { QueryKey, QueryObserverOptions, UseQueryResult } from '../../../../tanstack-query-hook'
import type { FindPetsByStatusQueryResponse, FindPetsByStatusPathParams, FindPetsByStatus400 } from '../../../models/ts/petController/FindPetsByStatus.ts'
import { queryOptions, useQuery } from '../../../../tanstack-query-hook.ts'
import { queryOptions, useQuery } from '../../../../tanstack-query-hook'
import { findPetsByStatusQueryResponseSchema } from '../../../zod/petController/findPetsByStatusSchema.ts'

export const findPetsByStatusQueryKey = ({ step_id }: { step_id: FindPetsByStatusPathParams['step_id'] }) =>
Expand All @@ -22,7 +22,7 @@ async function findPetsByStatus({ step_id }: { step_id: FindPetsByStatusPathPara

export function findPetsByStatusQueryOptions({ step_id }: { step_id: FindPetsByStatusPathParams['step_id'] }, config: Partial<RequestConfig> = {}) {
const queryKey = findPetsByStatusQueryKey({ step_id })
return queryOptions({
return queryOptions<ResponseConfig<FindPetsByStatusQueryResponse>, FindPetsByStatus400, ResponseConfig<FindPetsByStatusQueryResponse>, typeof queryKey>({
enabled: !!step_id,
queryKey,
queryFn: async ({ signal }) => {
Expand Down
Loading

0 comments on commit 2b7a92e

Please sign in to comment.