Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support for dataReturnType data #747

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/perfect-gifts-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kubb/swagger-tanstack-query": patch
---

support for dataReturnType `data`
12 changes: 7 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"prettier.configPath": "configs/prettier.config.cjs",
"editor.defaultFormatter": "dprint.dprint",
"[json]": {
"editor.defaultFormatter": "dprint.dprint"
},
"files.exclude": {
"**/.git": true,
"**/.svn": true,
Expand All @@ -20,9 +25,6 @@
"*.tmp.txt": true,
"**/.turbo": true,
"**/.next": true,
"**/node_modules": true
},
"prettier.configPath": "configs/prettier.config.cjs",
"editor.defaultFormatter": "dprint.dprint",
"references.preferredLocation": "peek"
"**/node_modules": false
}
}
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"dependencies": {
"@vercel/analytics": "^1.1.1",
"sitemap": "^7.1.1",
"vitepress": "^1.0.0-rc.32",
"vitepress": "1.0.0-rc.32",
"vue": "^3.3.13"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
"@kubb/swagger-ts": "workspace:*",
"@kubb/swagger-zod": "workspace:*",
"@kubb/swagger-zodios": "workspace:*",
"@tanstack/react-query": "^5.14.2",
"@tanstack/react-query": "^5.14.6",
"@tanstack/solid-query": "^5.14.2",
"@tanstack/svelte-query": "^5.14.2",
"@tanstack/vue-query": "^5.14.4",
"@tanstack/svelte-query": "^5.14.6",
"@tanstack/vue-query": "^5.14.6",
"@zodios/core": "^10.9.6",
"axios": "^1.6.2",
"msw": "^1.3.2",
Expand All @@ -51,7 +51,7 @@
"@kubb/ts-config": "workspace:*",
"@kubb/tsup-config": "workspace:*",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
"typescript": "~5.2.2"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"devDependencies": {
"@kubb/ts-config": "workspace:*",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
"typescript": "~5.2.2"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion examples/msw-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"devDependencies": {
"@kubb/ts-config": "workspace:*",
"@types/express": "^4.17.21",
"typescript": "^5.3.3"
"typescript": "~5.2.2"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion examples/msw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"devDependencies": {
"@kubb/ts-config": "workspace:*",
"typescript": "^5.3.3"
"typescript": "~5.2.2"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions examples/react-query-v5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@kubb/swagger-client": "workspace:*",
"@kubb/swagger-tanstack-query": "workspace:*",
"@kubb/swagger-ts": "workspace:*",
"@tanstack/react-query": "^5.14.2",
"@tanstack/react-query": "^5.14.6",
"@tanstack/react-query-devtools": "5.0.0",
"axios": "^1.6.2",
"react": "^18.2.0",
Expand All @@ -40,7 +40,7 @@
"@types/react-dom": "^18.2.18",
"@vitejs/plugin-react": "^4.2.1",
"msw": "^1.3.2",
"typescript": "^5.3.3",
"typescript": "~5.2.2",
"vite": "^4.5.1"
},
"packageManager": "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion examples/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@types/react-dom": "^18.2.18",
"@vitejs/plugin-react": "^4.2.1",
"msw": "^1.3.2",
"typescript": "^5.3.3",
"typescript": "~5.2.2",
"vite": "^4.5.1"
},
"packageManager": "[email protected]",
Expand Down
4 changes: 2 additions & 2 deletions examples/vue-query-v5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
"@kubb/swagger-tanstack-query": "workspace:*",
"@kubb/swagger-ts": "workspace:*",
"@kubb/swagger-zod": "workspace:*",
"@tanstack/vue-query": "^5.14.4",
"@tanstack/vue-query": "^5.14.6",
"axios": "^1.6.2",
"vue": "^3.3.13"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.5.2",
"msw": "^1.3.2",
"tsup": "^8.0.1",
"typescript": "^5.3.3",
"typescript": "~5.2.2",
"vite": "^4.5.1"
},
"packageManager": "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion examples/vue-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@vitejs/plugin-vue": "^4.5.2",
"msw": "^1.3.2",
"tsup": "^8.0.1",
"typescript": "^5.3.3",
"typescript": "~5.2.2",
"vite": "^4.5.1"
},
"packageManager": "[email protected]",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
"@types/node": "^20.10.5",
"@vitest/coverage-v8": "^1.1.0",
"@vitest/ui": "^1.1.0",
"bun-types": "^1.0.18",
"dprint": "^0.43.2",
"bun-types": "^1.0.19",
"dprint": "^0.44.0",
"prettier": "^3.1.1",
"prettier-eslint": "^16.2.0",
"rimraf": "^5.0.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"cosmiconfig": "^9.0.0",
"esbuild": "^0.19.10",
"execa": "^8.0.1",
"ora": "^7.0.1",
"ora": "^8.0.1",
"pretty-error": "^4.0.0",
"string-argv": "^0.3.2",
"tinyrainbow": "^1.1.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/config/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
},
"dependencies": {
"@eslint/js": "^8.56.0",
"@types/eslint": "~8.44.9",
"@types/eslint": "~8.56.0",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "~6.13.2",
"@typescript-eslint/parser": "~6.15.0",
"eslint-config-prettier": "~9.1.0",
"eslint-config-turbo": "^1.11.2",
"eslint-formatter-pretty": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/tsup-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"tsup": "^8.0.1"
},
"peerDependencies": {
"tsup": "^8.0.0"
"tsup": "^8.0.1"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"@types/semver": "^7.5.6",
"eslint": "^8.56.0",
"lodash.isequal": "^4.5.0",
"ora": "^7.0.1",
"ora": "^8.0.1",
"tinyrainbow": "^1.1.1",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/swagger-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"typescript": "^5.3.3"
},
"peerDependencies": {
"axios": "^1.4.0",
"axios": "^1.6.2",
"@kubb/react": "workspace:*"
},
"peerDependenciesMeta": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,19 @@
const queryOptions = [
isV5 && !!infinite ? `initialPageParam: ${infinite.initialPageParam}` : undefined,
isV5 && !!infinite && !!infinite.cursorParam
? `getNextPageParam: (lastPage) => lastPage['${infinite.cursorParam}']`

Check warning on line 84 in packages/swagger-tanstack-query/src/components/QueryOptions.tsx

View check run for this annotation

Codecov / codecov/patch

packages/swagger-tanstack-query/src/components/QueryOptions.tsx#L84

Added line #L84 was not covered by tests
: undefined,
isV5 && !!infinite && !!infinite.cursorParam
? `getPreviousPageParam: (firstPage) => firstPage['${infinite.cursorParam}']`

Check warning on line 87 in packages/swagger-tanstack-query/src/components/QueryOptions.tsx

View check run for this annotation

Codecov / codecov/patch

packages/swagger-tanstack-query/src/components/QueryOptions.tsx#L87

Added line #L87 was not covered by tests
: undefined,
isV5 && !!infinite && !infinite.cursorParam
isV5 && !!infinite && !infinite.cursorParam && dataReturnType === 'full'
? `getNextPageParam: (lastPage, allPages, lastPageParam) => lastPage.data.length === 0 ? undefined : lastPageParam + 1`

Check warning on line 90 in packages/swagger-tanstack-query/src/components/QueryOptions.tsx

View check run for this annotation

Codecov / codecov/patch

packages/swagger-tanstack-query/src/components/QueryOptions.tsx#L90

Added line #L90 was not covered by tests
: undefined,
isV5 && !!infinite && !infinite.cursorParam && dataReturnType === 'data'
? `getNextPageParam: (lastPage, allPages, lastPageParam) => lastPage.length === 0 ? undefined : lastPageParam + 1`

Check warning on line 93 in packages/swagger-tanstack-query/src/components/QueryOptions.tsx

View check run for this annotation

Codecov / codecov/patch

packages/swagger-tanstack-query/src/components/QueryOptions.tsx#L93

Added line #L93 was not covered by tests
: undefined,
isV5 && !!infinite && !infinite.cursorParam
? `getPreviousPageParam: (firstPage, allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1`

Check warning on line 96 in packages/swagger-tanstack-query/src/components/QueryOptions.tsx

View check run for this annotation

Codecov / codecov/patch

packages/swagger-tanstack-query/src/components/QueryOptions.tsx#L96

Added line #L96 was not covered by tests
: undefined,
].filter(Boolean)

Expand Down
2 changes: 1 addition & 1 deletion packages/swagger-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@kubb/swagger": "workspace:*",
"@kubb/types": "workspace:*",
"hotscript": "^1.0.13",
"json-schema-to-ts": "^2.12.0",
"json-schema-to-ts": "^3.0.0",
"ts-toolbelt": "^9.6.0"
},
"devDependencies": {
Expand Down
Loading
Loading