From 05ab0ca6cc52285ec2b372537c23abebe7085b32 Mon Sep 17 00:00:00 2001 From: Aleksandr Batalov Date: Sat, 7 Jun 2025 13:45:08 +0400 Subject: [PATCH 01/11] chore(tanstack-query-react-types): add legacy `UseSuspenseInfiniteQueryOptions` for the TanStack Query prior to 5.80.0 --- .../tanstack-query-react-types/package.json | 5 ++++ ...5_80_0_UseSuspenseInfiniteQueryOptions.ts} | 23 ++++--------------- ...erviceOperationUseSuspenseInfiniteQuery.ts | 2 +- .../src/shared/index.ts | 1 - 4 files changed, 11 insertions(+), 20 deletions(-) rename packages/tanstack-query-react-types/src/{shared/UseSuspenseInfiniteQueryOptions.ts => legacy/Lt_5_80_0_UseSuspenseInfiniteQueryOptions.ts} (50%) diff --git a/packages/tanstack-query-react-types/package.json b/packages/tanstack-query-react-types/package.json index c928824ca..99aa33775 100644 --- a/packages/tanstack-query-react-types/package.json +++ b/packages/tanstack-query-react-types/package.json @@ -21,6 +21,11 @@ "import": "./dist/esm/shared/*.js", "require": "./dist/cjs/shared/*.cjs" }, + "./legacy/*": { + "types": "./dist/types/legacy/*.d.ts", + "import": "./dist/esm/legacy/*.js", + "require": "./dist/cjs/legacy/*.cjs" + }, "./package.json": "./package.json" }, "typesVersions": { diff --git a/packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts b/packages/tanstack-query-react-types/src/legacy/Lt_5_80_0_UseSuspenseInfiniteQueryOptions.ts similarity index 50% rename from packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts rename to packages/tanstack-query-react-types/src/legacy/Lt_5_80_0_UseSuspenseInfiniteQueryOptions.ts index 600973383..e4e922b69 100644 --- a/packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts +++ b/packages/tanstack-query-react-types/src/legacy/Lt_5_80_0_UseSuspenseInfiniteQueryOptions.ts @@ -8,25 +8,12 @@ export type UseSuspenseInfiniteQueryOptions< TQueryKey extends QueryKey = QueryKey, TPageParam = unknown, > = + // @ts-expect-error - TanStack Query prior to 5.80.0 has 6 arguments for the UseSuspenseInfiniteQueryOptions UseSuspenseInfiniteQueryOptionsVendor< TQueryFnData, TError, TData, - TQueryKey - > extends { queryKey: TQueryKey } - ? UseSuspenseInfiniteQueryOptionsVendor< - TQueryFnData, - TError, - TData, - TQueryKey, - TPageParam - > - : // @ts-expect-error - the compatibility layer with @tanstack/react-query <= 5.79.2 - UseSuspenseInfiniteQueryOptionsVendor< - TQueryFnData, - TError, - TData, - TQueryFnData, - TQueryKey, - TPageParam - >; + TQueryFnData, + TQueryKey, + TPageParam + >; diff --git a/packages/tanstack-query-react-types/src/service-operation/ServiceOperationUseSuspenseInfiniteQuery.ts b/packages/tanstack-query-react-types/src/service-operation/ServiceOperationUseSuspenseInfiniteQuery.ts index 8586029dc..52f6b0d4e 100644 --- a/packages/tanstack-query-react-types/src/service-operation/ServiceOperationUseSuspenseInfiniteQuery.ts +++ b/packages/tanstack-query-react-types/src/service-operation/ServiceOperationUseSuspenseInfiniteQuery.ts @@ -5,10 +5,10 @@ import type { OperationInfiniteData, PartialParameters, ServiceOperationInfiniteQueryKey, - UseSuspenseInfiniteQueryOptions, } from '@openapi-qraft/tanstack-query-react-types'; import type { InfiniteQueryPageParamsOptions, + UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, } from '@tanstack/react-query'; diff --git a/packages/tanstack-query-react-types/src/shared/index.ts b/packages/tanstack-query-react-types/src/shared/index.ts index ff828b9b7..5aa59b405 100644 --- a/packages/tanstack-query-react-types/src/shared/index.ts +++ b/packages/tanstack-query-react-types/src/shared/index.ts @@ -13,7 +13,6 @@ export type * from './ServiceOperationMutation.js'; export type * from './ServiceOperationQuery.js'; export type * from './UseQueryOptionsForUseQueries.js'; export type * from './UseQueryOptionsForUseSuspenseQuery.js'; -export type * from './UseSuspenseInfiniteQueryOptions.js'; export type * from './WithOptional.js'; export type * from './QraftServiceOperationsToken.js'; export type * from './OperationError.js'; From ca79337f7ba0be9ac2a91542a473a82a360bfedb Mon Sep 17 00:00:00 2001 From: Aleksandr Batalov Date: Sat, 7 Jun 2025 14:19:02 +0400 Subject: [PATCH 02/11] chore(tanstack-query-react-plugin): add `--tanstack-query-version` support --- packages/plugin/src/lib/QraftCommand.ts | 2 +- packages/react-client/redocly.yaml | 1 + .../src/lib/isSemverLessThan.spec.ts | 116 ++++++++++++++++++ .../src/lib/isSemverLessThan.ts | 34 +++++ .../tanstack-query-react-plugin/src/plugin.ts | 30 +++++ .../src/ts-factory/getServiceFactory.ts | 18 ++- 6 files changed, 198 insertions(+), 3 deletions(-) create mode 100644 packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.spec.ts create mode 100644 packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.ts diff --git a/packages/plugin/src/lib/QraftCommand.ts b/packages/plugin/src/lib/QraftCommand.ts index 752f7bf47..b2ee633a4 100644 --- a/packages/plugin/src/lib/QraftCommand.ts +++ b/packages/plugin/src/lib/QraftCommand.ts @@ -32,7 +32,7 @@ import { writeGeneratorFiles } from './writeGeneratorFiles.js'; export class QraftCommand extends Command { static spinner = ora(); - protected readonly cwd: URL; + public readonly cwd: URL; protected registeredPluginActions: QraftCommandActionCallback[] = []; /** diff --git a/packages/react-client/redocly.yaml b/packages/react-client/redocly.yaml index 3a73e5a3b..e8efbcda0 100644 --- a/packages/react-client/redocly.yaml +++ b/packages/react-client/redocly.yaml @@ -16,6 +16,7 @@ apis: enum-values: true explicit-import-extensions: true openapi-types-file-name: openapi.ts + tanstack-query-version: 5.79.2 filter-services: - '/approval_policies/**' - '/entities/**' diff --git a/packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.spec.ts b/packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.spec.ts new file mode 100644 index 000000000..918537f0e --- /dev/null +++ b/packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.spec.ts @@ -0,0 +1,116 @@ +import { describe, expect, it } from 'vitest'; +import { isSemverLessThan } from './isSemverLessThan.js'; + +describe('isSemverLessThan', () => { + describe('basic version comparison', () => { + it('should return true when first version is less than second', () => { + expect(isSemverLessThan('5.79.0', '5.80.0')).toBe(true); + expect(isSemverLessThan('4.29.1', '5.0.0')).toBe(true); + expect(isSemverLessThan('1.0.0', '2.0.0')).toBe(true); + }); + + it('should return false when versions are equal', () => { + expect(isSemverLessThan('5.80.0', '5.80.0')).toBe(false); + expect(isSemverLessThan('1.0.0', '1.0.0')).toBe(false); + expect(isSemverLessThan('10.15.3', '10.15.3')).toBe(false); + }); + + it('should return false when first version is greater than second', () => { + expect(isSemverLessThan('5.81.0', '5.80.0')).toBe(false); + expect(isSemverLessThan('6.0.0', '5.99.99')).toBe(false); + expect(isSemverLessThan('2.0.0', '1.99.99')).toBe(false); + }); + }); + + describe('major version comparison', () => { + it('should correctly compare different major versions', () => { + expect(isSemverLessThan('4.99.99', '5.0.0')).toBe(true); + expect(isSemverLessThan('5.0.0', '4.99.99')).toBe(false); + expect(isSemverLessThan('1.0.0', '10.0.0')).toBe(true); + expect(isSemverLessThan('10.0.0', '2.0.0')).toBe(false); + }); + }); + + describe('minor version comparison', () => { + it('should correctly compare different minor versions with same major', () => { + expect(isSemverLessThan('5.79.99', '5.80.0')).toBe(true); + expect(isSemverLessThan('5.80.0', '5.79.99')).toBe(false); + expect(isSemverLessThan('3.14.15', '3.15.0')).toBe(true); + }); + }); + + describe('patch version comparison', () => { + it('should correctly compare different patch versions', () => { + expect(isSemverLessThan('5.80.0', '5.80.1')).toBe(true); + expect(isSemverLessThan('5.80.1', '5.80.0')).toBe(false); + expect(isSemverLessThan('1.2.3', '1.2.4')).toBe(true); + }); + }); + + describe('versions with different lengths', () => { + it('should treat missing parts as 0', () => { + expect(isSemverLessThan('5.80', '5.80.0')).toBe(false); + expect(isSemverLessThan('5.80.0', '5.80')).toBe(false); + expect(isSemverLessThan('5.79', '5.80.0')).toBe(true); + expect(isSemverLessThan('5.81', '5.80.0')).toBe(false); + }); + + it('should handle single version numbers', () => { + expect(isSemverLessThan('5', '6.0.0')).toBe(true); + expect(isSemverLessThan('6', '5.99.99')).toBe(false); + expect(isSemverLessThan('5', '5.0.0')).toBe(false); + }); + + it('should handle versions with many parts', () => { + expect(isSemverLessThan('1.2.3.4.5', '1.2.3.4.6')).toBe(true); + expect(isSemverLessThan('1.2.3.4.6', '1.2.3.4.5')).toBe(false); + expect(isSemverLessThan('1.2.3.4', '1.2.3.4.1')).toBe(true); + }); + }); + + describe('edge cases', () => { + it('should handle zero versions', () => { + expect(isSemverLessThan('0.0.0', '0.0.1')).toBe(true); + expect(isSemverLessThan('0.0.1', '0.0.0')).toBe(false); + expect(isSemverLessThan('0.0.0', '1.0.0')).toBe(true); + }); + + it('should handle large version numbers', () => { + expect(isSemverLessThan('999.999.999', '1000.0.0')).toBe(true); + expect(isSemverLessThan('1000.0.0', '999.999.999')).toBe(false); + }); + }); + + describe('real-world TanStack Query versions', () => { + it('should correctly identify versions prior to 5.80.0', () => { + const priorVersions = [ + '5.79.0', + '5.79.1', + '5.50.1', + '5.0.0', + '4.29.0', + '4.36.1', + '3.39.3', + ]; + + priorVersions.forEach((version) => { + expect(isSemverLessThan(version, '5.80.0')).toBe(true); + }); + }); + + it('should correctly identify versions equal to or after 5.80.0', () => { + const laterVersions = [ + '5.80.0', + '5.80.1', + '5.81.0', + '5.90.0', + '6.0.0', + '6.1.0', + ]; + + laterVersions.forEach((version) => { + expect(isSemverLessThan(version, '5.80.0')).toBe(false); + }); + }); + }); +}); diff --git a/packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.ts b/packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.ts new file mode 100644 index 000000000..702a378e3 --- /dev/null +++ b/packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.ts @@ -0,0 +1,34 @@ +/** + * Compares two versions in semver format and determines whether the first version is smaller than the second. + * + * @param version - Comparison version + * @param targetVersion - Target version for comparison + * @returns true, if the version is less than the targetVersion, otherwise false + * + * @example + * ```ts + * isSemverLessThan('5.79.0', '5.80.0'); // true + * isSemverLessThan('5.80.0', '5.80.0'); // false + * isSemverLessThan('5.81.0', '5.80.0'); // false + * isSemverLessThan('4.29.1', '5.0.0'); // true + * ``` + */ +export const isSemverLessThan = ( + version: string, + targetVersion: string +): boolean => { + const parseVersion = (v: string) => v.split('.').map(Number); + + const versionParts = parseVersion(version); + const targetParts = parseVersion(targetVersion); + + for (let i = 0; i < Math.max(versionParts.length, targetParts.length); i++) { + const vPart = versionParts[i] || 0; + const tPart = targetParts[i] || 0; + + if (vPart < tPart) return true; + if (vPart > tPart) return false; + } + + return false; +}; diff --git a/packages/tanstack-query-react-plugin/src/plugin.ts b/packages/tanstack-query-react-plugin/src/plugin.ts index 8f2e20bac..17dff6a7c 100644 --- a/packages/tanstack-query-react-plugin/src/plugin.ts +++ b/packages/tanstack-query-react-plugin/src/plugin.ts @@ -1,4 +1,6 @@ import type { OverrideImportType } from './ts-factory/OverrideImportType.js'; +import { readFileSync } from 'node:fs'; +import { URL } from 'node:url'; import { fileHeader } from '@openapi-qraft/plugin/lib/fileHeader'; import { createPredefinedParametersGlobs, @@ -60,6 +62,14 @@ export const plugin: QraftCommandPlugin = { 'Override import paths for specific types in generated files. This allows using custom type implementations instead of the default ones. Expected format: filepath originalModule:importTypeName:customImportPath' ).argParser(parseOverrideImportType) ) + .addOption( + new Option( + '--tanstack-query-version [semver]', + 'TanStack Query version to use (automatically detected if not specified)' + ) + .default(getTanStackQueryVersion(command.cwd)) + .makeOptionMandatory() + ) .action(async ({ spinner, output, args, services, schema }, resolve) => { return void (await generateCode({ spinner, @@ -67,6 +77,7 @@ export const plugin: QraftCommandPlugin = { serviceOptions: { openapiTypesImportPath: args.openapiTypesImportPath, queryableWriteOperations: args.queryableWriteOperations, + tanstackQueryVersion: args.tanstackQueryVersion, }, overrideImportType: Array.isArray(args.overrideImportType) ? args.overrideImportType[0] @@ -276,3 +287,22 @@ const createApiClientFnDefault = [ }, ], ] as const; + +function getTanStackQueryVersion(cwd: URL): string | void { + const packagesToCheck = ['@tanstack/react-query', '@tanstack/query-core']; + + for (const packageName of packagesToCheck) { + try { + const packageJsonUrl = import.meta.resolve( + `${packageName}/package.json`, + cwd.href + ); + const packageJsonPath = new URL(packageJsonUrl); + const packageJsonContent = readFileSync(packageJsonPath, 'utf-8'); + const packageJson = JSON.parse(packageJsonContent); + return packageJson.version; + } catch { + continue; + } + } +} diff --git a/packages/tanstack-query-react-plugin/src/ts-factory/getServiceFactory.ts b/packages/tanstack-query-react-plugin/src/ts-factory/getServiceFactory.ts index 16c8411b3..b0b5ffd4c 100644 --- a/packages/tanstack-query-react-plugin/src/ts-factory/getServiceFactory.ts +++ b/packages/tanstack-query-react-plugin/src/ts-factory/getServiceFactory.ts @@ -4,6 +4,7 @@ import { ServiceOperation } from '@openapi-qraft/plugin/lib/open-api/OpenAPIServ import camelCase from 'camelcase'; import ts from 'typescript'; import { createOperationCommonTSDoc } from '../lib/createOperationCommonTSDoc.js'; +import { isSemverLessThan } from '../lib/isSemverLessThan.js'; import { filterUnusedTypes } from './filterUnusedTypes.js'; import { getOverriddenImportDeclarationsFactory } from './getOverriddenImportDeclarationsFactory.js'; import { @@ -17,6 +18,7 @@ const factory = ts.factory; export type ServiceFactoryOptions = { openapiTypesImportPath: string; queryableWriteOperations: boolean; + tanstackQueryVersion: string; }; type Service = { typeName: string; variableName: string }; @@ -55,7 +57,8 @@ export const getServiceFactory = ( getOpenAPISchemaImportsFactory(options.openapiTypesImportPath), ...getServiceOperationImportsFactory( moduleTypeImports, - serviceImportTypeOverrides + serviceImportTypeOverrides, + options.tanstackQueryVersion ), ]; @@ -86,9 +89,20 @@ const getServiceOperationImportsFactory = ( moduleImports: Record, serviceImportTypeOverrides: | OverrideImportType[keyof OverrideImportType] - | undefined + | undefined, + tanstackQueryVersion: string ) => { const factory = ts.factory; + if (isSemverLessThan(tanstackQueryVersion, '5.80.0')) { + serviceImportTypeOverrides = { + ...serviceImportTypeOverrides, + '@tanstack/react-query': { + UseSuspenseInfiniteQueryOptions: + '@openapi-qraft/tanstack-query-react-types/legacy/Lt_5_80_0_UseSuspenseInfiniteQueryOptions', + ...serviceImportTypeOverrides?.['@tanstack/react-query'], + }, + }; + } const standardImports = Object.entries(moduleImports) .map(([moduleName, importSpecifierNames]) => { From 035cea2b804ceb2fa8be7dcd9ecc45562460f47d Mon Sep 17 00:00:00 2001 From: Aleksandr Batalov Date: Sat, 7 Jun 2025 14:47:38 +0400 Subject: [PATCH 03/11] docs: update docs with new `--tanstack-query-version` option --- packages/cli/README.md | 2 ++ website/docs/codegen/CLI/cli.mdx | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/cli/README.md b/packages/cli/README.md index b95af15a0..22967bad9 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -72,6 +72,8 @@ Options: --exclude-deprecated Exclude deprecated types --no-blob-from-binary If this option is enabled, binary format fields will not be converted to Blob types, preserving the native representation --explicit-component-exports Enabling this option will export API components as separate type aliases, alongside `components` interface + --tanstack-query-version [semver] TanStack Query version to use (automatically detected if not specified) + -h, --help display help for command ``` diff --git a/website/docs/codegen/CLI/cli.mdx b/website/docs/codegen/CLI/cli.mdx index 73e42a34c..ce90dc5e4 100644 --- a/website/docs/codegen/CLI/cli.mdx +++ b/website/docs/codegen/CLI/cli.mdx @@ -192,6 +192,7 @@ It is possible to use multiple plugins at the same time. For example, `--plugin building a **minimal bundle size** client where you explicitly control which services and callbacks to include. - `--create-api-client-fn createCustomClient filename:create-custom-api services:none callbacks:setQueryData,getQueryData` - creates the `createCustomClient()` function in the `create-custom-api.ts` file with no default services and only `setQueryData()` and `getQueryData()` callbacks +- **`--tanstack-query-version [semver]`**: Specify the version of TanStack Query to use. If not provided, it will be automatically detected from your project dependencies. ::::tip When generating multiple API client functions with different parameters, it might be more convenient to use a configuration file From 67b42f16be35ca74065bacd592359e43de6fe86f Mon Sep 17 00:00:00 2001 From: Aleksandr Batalov Date: Sat, 7 Jun 2025 17:26:45 +0400 Subject: [PATCH 04/11] Revert "docs: update docs with new `--tanstack-query-version` option" This reverts commit 035cea2b804ceb2fa8be7dcd9ecc45562460f47d. --- packages/cli/README.md | 2 -- website/docs/codegen/CLI/cli.mdx | 1 - 2 files changed, 3 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 22967bad9..b95af15a0 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -72,8 +72,6 @@ Options: --exclude-deprecated Exclude deprecated types --no-blob-from-binary If this option is enabled, binary format fields will not be converted to Blob types, preserving the native representation --explicit-component-exports Enabling this option will export API components as separate type aliases, alongside `components` interface - --tanstack-query-version [semver] TanStack Query version to use (automatically detected if not specified) - -h, --help display help for command ``` diff --git a/website/docs/codegen/CLI/cli.mdx b/website/docs/codegen/CLI/cli.mdx index ce90dc5e4..73e42a34c 100644 --- a/website/docs/codegen/CLI/cli.mdx +++ b/website/docs/codegen/CLI/cli.mdx @@ -192,7 +192,6 @@ It is possible to use multiple plugins at the same time. For example, `--plugin building a **minimal bundle size** client where you explicitly control which services and callbacks to include. - `--create-api-client-fn createCustomClient filename:create-custom-api services:none callbacks:setQueryData,getQueryData` - creates the `createCustomClient()` function in the `create-custom-api.ts` file with no default services and only `setQueryData()` and `getQueryData()` callbacks -- **`--tanstack-query-version [semver]`**: Specify the version of TanStack Query to use. If not provided, it will be automatically detected from your project dependencies. ::::tip When generating multiple API client functions with different parameters, it might be more convenient to use a configuration file From af828d8889fbc3c69553f659525b13cc95aac516 Mon Sep 17 00:00:00 2001 From: Aleksandr Batalov Date: Sat, 7 Jun 2025 17:26:45 +0400 Subject: [PATCH 05/11] Revert "chore(tanstack-query-react-plugin): add `--tanstack-query-version` support" This reverts commit ca79337f7ba0be9ac2a91542a473a82a360bfedb. --- packages/plugin/src/lib/QraftCommand.ts | 2 +- packages/react-client/redocly.yaml | 1 - .../src/lib/isSemverLessThan.spec.ts | 116 ------------------ .../src/lib/isSemverLessThan.ts | 34 ----- .../tanstack-query-react-plugin/src/plugin.ts | 30 ----- .../src/ts-factory/getServiceFactory.ts | 18 +-- 6 files changed, 3 insertions(+), 198 deletions(-) delete mode 100644 packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.spec.ts delete mode 100644 packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.ts diff --git a/packages/plugin/src/lib/QraftCommand.ts b/packages/plugin/src/lib/QraftCommand.ts index b2ee633a4..752f7bf47 100644 --- a/packages/plugin/src/lib/QraftCommand.ts +++ b/packages/plugin/src/lib/QraftCommand.ts @@ -32,7 +32,7 @@ import { writeGeneratorFiles } from './writeGeneratorFiles.js'; export class QraftCommand extends Command { static spinner = ora(); - public readonly cwd: URL; + protected readonly cwd: URL; protected registeredPluginActions: QraftCommandActionCallback[] = []; /** diff --git a/packages/react-client/redocly.yaml b/packages/react-client/redocly.yaml index e8efbcda0..3a73e5a3b 100644 --- a/packages/react-client/redocly.yaml +++ b/packages/react-client/redocly.yaml @@ -16,7 +16,6 @@ apis: enum-values: true explicit-import-extensions: true openapi-types-file-name: openapi.ts - tanstack-query-version: 5.79.2 filter-services: - '/approval_policies/**' - '/entities/**' diff --git a/packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.spec.ts b/packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.spec.ts deleted file mode 100644 index 918537f0e..000000000 --- a/packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.spec.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { describe, expect, it } from 'vitest'; -import { isSemverLessThan } from './isSemverLessThan.js'; - -describe('isSemverLessThan', () => { - describe('basic version comparison', () => { - it('should return true when first version is less than second', () => { - expect(isSemverLessThan('5.79.0', '5.80.0')).toBe(true); - expect(isSemverLessThan('4.29.1', '5.0.0')).toBe(true); - expect(isSemverLessThan('1.0.0', '2.0.0')).toBe(true); - }); - - it('should return false when versions are equal', () => { - expect(isSemverLessThan('5.80.0', '5.80.0')).toBe(false); - expect(isSemverLessThan('1.0.0', '1.0.0')).toBe(false); - expect(isSemverLessThan('10.15.3', '10.15.3')).toBe(false); - }); - - it('should return false when first version is greater than second', () => { - expect(isSemverLessThan('5.81.0', '5.80.0')).toBe(false); - expect(isSemverLessThan('6.0.0', '5.99.99')).toBe(false); - expect(isSemverLessThan('2.0.0', '1.99.99')).toBe(false); - }); - }); - - describe('major version comparison', () => { - it('should correctly compare different major versions', () => { - expect(isSemverLessThan('4.99.99', '5.0.0')).toBe(true); - expect(isSemverLessThan('5.0.0', '4.99.99')).toBe(false); - expect(isSemverLessThan('1.0.0', '10.0.0')).toBe(true); - expect(isSemverLessThan('10.0.0', '2.0.0')).toBe(false); - }); - }); - - describe('minor version comparison', () => { - it('should correctly compare different minor versions with same major', () => { - expect(isSemverLessThan('5.79.99', '5.80.0')).toBe(true); - expect(isSemverLessThan('5.80.0', '5.79.99')).toBe(false); - expect(isSemverLessThan('3.14.15', '3.15.0')).toBe(true); - }); - }); - - describe('patch version comparison', () => { - it('should correctly compare different patch versions', () => { - expect(isSemverLessThan('5.80.0', '5.80.1')).toBe(true); - expect(isSemverLessThan('5.80.1', '5.80.0')).toBe(false); - expect(isSemverLessThan('1.2.3', '1.2.4')).toBe(true); - }); - }); - - describe('versions with different lengths', () => { - it('should treat missing parts as 0', () => { - expect(isSemverLessThan('5.80', '5.80.0')).toBe(false); - expect(isSemverLessThan('5.80.0', '5.80')).toBe(false); - expect(isSemverLessThan('5.79', '5.80.0')).toBe(true); - expect(isSemverLessThan('5.81', '5.80.0')).toBe(false); - }); - - it('should handle single version numbers', () => { - expect(isSemverLessThan('5', '6.0.0')).toBe(true); - expect(isSemverLessThan('6', '5.99.99')).toBe(false); - expect(isSemverLessThan('5', '5.0.0')).toBe(false); - }); - - it('should handle versions with many parts', () => { - expect(isSemverLessThan('1.2.3.4.5', '1.2.3.4.6')).toBe(true); - expect(isSemverLessThan('1.2.3.4.6', '1.2.3.4.5')).toBe(false); - expect(isSemverLessThan('1.2.3.4', '1.2.3.4.1')).toBe(true); - }); - }); - - describe('edge cases', () => { - it('should handle zero versions', () => { - expect(isSemverLessThan('0.0.0', '0.0.1')).toBe(true); - expect(isSemverLessThan('0.0.1', '0.0.0')).toBe(false); - expect(isSemverLessThan('0.0.0', '1.0.0')).toBe(true); - }); - - it('should handle large version numbers', () => { - expect(isSemverLessThan('999.999.999', '1000.0.0')).toBe(true); - expect(isSemverLessThan('1000.0.0', '999.999.999')).toBe(false); - }); - }); - - describe('real-world TanStack Query versions', () => { - it('should correctly identify versions prior to 5.80.0', () => { - const priorVersions = [ - '5.79.0', - '5.79.1', - '5.50.1', - '5.0.0', - '4.29.0', - '4.36.1', - '3.39.3', - ]; - - priorVersions.forEach((version) => { - expect(isSemverLessThan(version, '5.80.0')).toBe(true); - }); - }); - - it('should correctly identify versions equal to or after 5.80.0', () => { - const laterVersions = [ - '5.80.0', - '5.80.1', - '5.81.0', - '5.90.0', - '6.0.0', - '6.1.0', - ]; - - laterVersions.forEach((version) => { - expect(isSemverLessThan(version, '5.80.0')).toBe(false); - }); - }); - }); -}); diff --git a/packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.ts b/packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.ts deleted file mode 100644 index 702a378e3..000000000 --- a/packages/tanstack-query-react-plugin/src/lib/isSemverLessThan.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Compares two versions in semver format and determines whether the first version is smaller than the second. - * - * @param version - Comparison version - * @param targetVersion - Target version for comparison - * @returns true, if the version is less than the targetVersion, otherwise false - * - * @example - * ```ts - * isSemverLessThan('5.79.0', '5.80.0'); // true - * isSemverLessThan('5.80.0', '5.80.0'); // false - * isSemverLessThan('5.81.0', '5.80.0'); // false - * isSemverLessThan('4.29.1', '5.0.0'); // true - * ``` - */ -export const isSemverLessThan = ( - version: string, - targetVersion: string -): boolean => { - const parseVersion = (v: string) => v.split('.').map(Number); - - const versionParts = parseVersion(version); - const targetParts = parseVersion(targetVersion); - - for (let i = 0; i < Math.max(versionParts.length, targetParts.length); i++) { - const vPart = versionParts[i] || 0; - const tPart = targetParts[i] || 0; - - if (vPart < tPart) return true; - if (vPart > tPart) return false; - } - - return false; -}; diff --git a/packages/tanstack-query-react-plugin/src/plugin.ts b/packages/tanstack-query-react-plugin/src/plugin.ts index 17dff6a7c..8f2e20bac 100644 --- a/packages/tanstack-query-react-plugin/src/plugin.ts +++ b/packages/tanstack-query-react-plugin/src/plugin.ts @@ -1,6 +1,4 @@ import type { OverrideImportType } from './ts-factory/OverrideImportType.js'; -import { readFileSync } from 'node:fs'; -import { URL } from 'node:url'; import { fileHeader } from '@openapi-qraft/plugin/lib/fileHeader'; import { createPredefinedParametersGlobs, @@ -62,14 +60,6 @@ export const plugin: QraftCommandPlugin = { 'Override import paths for specific types in generated files. This allows using custom type implementations instead of the default ones. Expected format: filepath originalModule:importTypeName:customImportPath' ).argParser(parseOverrideImportType) ) - .addOption( - new Option( - '--tanstack-query-version [semver]', - 'TanStack Query version to use (automatically detected if not specified)' - ) - .default(getTanStackQueryVersion(command.cwd)) - .makeOptionMandatory() - ) .action(async ({ spinner, output, args, services, schema }, resolve) => { return void (await generateCode({ spinner, @@ -77,7 +67,6 @@ export const plugin: QraftCommandPlugin = { serviceOptions: { openapiTypesImportPath: args.openapiTypesImportPath, queryableWriteOperations: args.queryableWriteOperations, - tanstackQueryVersion: args.tanstackQueryVersion, }, overrideImportType: Array.isArray(args.overrideImportType) ? args.overrideImportType[0] @@ -287,22 +276,3 @@ const createApiClientFnDefault = [ }, ], ] as const; - -function getTanStackQueryVersion(cwd: URL): string | void { - const packagesToCheck = ['@tanstack/react-query', '@tanstack/query-core']; - - for (const packageName of packagesToCheck) { - try { - const packageJsonUrl = import.meta.resolve( - `${packageName}/package.json`, - cwd.href - ); - const packageJsonPath = new URL(packageJsonUrl); - const packageJsonContent = readFileSync(packageJsonPath, 'utf-8'); - const packageJson = JSON.parse(packageJsonContent); - return packageJson.version; - } catch { - continue; - } - } -} diff --git a/packages/tanstack-query-react-plugin/src/ts-factory/getServiceFactory.ts b/packages/tanstack-query-react-plugin/src/ts-factory/getServiceFactory.ts index b0b5ffd4c..16c8411b3 100644 --- a/packages/tanstack-query-react-plugin/src/ts-factory/getServiceFactory.ts +++ b/packages/tanstack-query-react-plugin/src/ts-factory/getServiceFactory.ts @@ -4,7 +4,6 @@ import { ServiceOperation } from '@openapi-qraft/plugin/lib/open-api/OpenAPIServ import camelCase from 'camelcase'; import ts from 'typescript'; import { createOperationCommonTSDoc } from '../lib/createOperationCommonTSDoc.js'; -import { isSemverLessThan } from '../lib/isSemverLessThan.js'; import { filterUnusedTypes } from './filterUnusedTypes.js'; import { getOverriddenImportDeclarationsFactory } from './getOverriddenImportDeclarationsFactory.js'; import { @@ -18,7 +17,6 @@ const factory = ts.factory; export type ServiceFactoryOptions = { openapiTypesImportPath: string; queryableWriteOperations: boolean; - tanstackQueryVersion: string; }; type Service = { typeName: string; variableName: string }; @@ -57,8 +55,7 @@ export const getServiceFactory = ( getOpenAPISchemaImportsFactory(options.openapiTypesImportPath), ...getServiceOperationImportsFactory( moduleTypeImports, - serviceImportTypeOverrides, - options.tanstackQueryVersion + serviceImportTypeOverrides ), ]; @@ -89,20 +86,9 @@ const getServiceOperationImportsFactory = ( moduleImports: Record, serviceImportTypeOverrides: | OverrideImportType[keyof OverrideImportType] - | undefined, - tanstackQueryVersion: string + | undefined ) => { const factory = ts.factory; - if (isSemverLessThan(tanstackQueryVersion, '5.80.0')) { - serviceImportTypeOverrides = { - ...serviceImportTypeOverrides, - '@tanstack/react-query': { - UseSuspenseInfiniteQueryOptions: - '@openapi-qraft/tanstack-query-react-types/legacy/Lt_5_80_0_UseSuspenseInfiniteQueryOptions', - ...serviceImportTypeOverrides?.['@tanstack/react-query'], - }, - }; - } const standardImports = Object.entries(moduleImports) .map(([moduleName, importSpecifierNames]) => { From 5a4a59f94cee4cf1b1411d5e87c7ebf7aacb1340 Mon Sep 17 00:00:00 2001 From: Aleksandr Batalov Date: Sat, 7 Jun 2025 17:26:45 +0400 Subject: [PATCH 06/11] Revert "chore(tanstack-query-react-types): add legacy `UseSuspenseInfiniteQueryOptions` for the TanStack Query prior to 5.80.0" This reverts commit 05ab0ca6cc52285ec2b372537c23abebe7085b32. --- .../tanstack-query-react-types/package.json | 5 ---- .../UseSuspenseInfiniteQueryOptions.ts} | 23 +++++++++++++++---- .../src/shared/index.ts | 1 + 3 files changed, 19 insertions(+), 10 deletions(-) rename packages/tanstack-query-react-types/src/{legacy/Lt_5_80_0_UseSuspenseInfiniteQueryOptions.ts => shared/UseSuspenseInfiniteQueryOptions.ts} (50%) diff --git a/packages/tanstack-query-react-types/package.json b/packages/tanstack-query-react-types/package.json index 99aa33775..c928824ca 100644 --- a/packages/tanstack-query-react-types/package.json +++ b/packages/tanstack-query-react-types/package.json @@ -21,11 +21,6 @@ "import": "./dist/esm/shared/*.js", "require": "./dist/cjs/shared/*.cjs" }, - "./legacy/*": { - "types": "./dist/types/legacy/*.d.ts", - "import": "./dist/esm/legacy/*.js", - "require": "./dist/cjs/legacy/*.cjs" - }, "./package.json": "./package.json" }, "typesVersions": { diff --git a/packages/tanstack-query-react-types/src/legacy/Lt_5_80_0_UseSuspenseInfiniteQueryOptions.ts b/packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts similarity index 50% rename from packages/tanstack-query-react-types/src/legacy/Lt_5_80_0_UseSuspenseInfiniteQueryOptions.ts rename to packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts index e4e922b69..600973383 100644 --- a/packages/tanstack-query-react-types/src/legacy/Lt_5_80_0_UseSuspenseInfiniteQueryOptions.ts +++ b/packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts @@ -8,12 +8,25 @@ export type UseSuspenseInfiniteQueryOptions< TQueryKey extends QueryKey = QueryKey, TPageParam = unknown, > = - // @ts-expect-error - TanStack Query prior to 5.80.0 has 6 arguments for the UseSuspenseInfiniteQueryOptions UseSuspenseInfiniteQueryOptionsVendor< TQueryFnData, TError, TData, - TQueryFnData, - TQueryKey, - TPageParam - >; + TQueryKey + > extends { queryKey: TQueryKey } + ? UseSuspenseInfiniteQueryOptionsVendor< + TQueryFnData, + TError, + TData, + TQueryKey, + TPageParam + > + : // @ts-expect-error - the compatibility layer with @tanstack/react-query <= 5.79.2 + UseSuspenseInfiniteQueryOptionsVendor< + TQueryFnData, + TError, + TData, + TQueryFnData, + TQueryKey, + TPageParam + >; diff --git a/packages/tanstack-query-react-types/src/shared/index.ts b/packages/tanstack-query-react-types/src/shared/index.ts index 5aa59b405..ff828b9b7 100644 --- a/packages/tanstack-query-react-types/src/shared/index.ts +++ b/packages/tanstack-query-react-types/src/shared/index.ts @@ -13,6 +13,7 @@ export type * from './ServiceOperationMutation.js'; export type * from './ServiceOperationQuery.js'; export type * from './UseQueryOptionsForUseQueries.js'; export type * from './UseQueryOptionsForUseSuspenseQuery.js'; +export type * from './UseSuspenseInfiniteQueryOptions.js'; export type * from './WithOptional.js'; export type * from './QraftServiceOperationsToken.js'; export type * from './OperationError.js'; From 26d33c1ff33c8a0e4634ddf8055411c882d22b13 Mon Sep 17 00:00:00 2001 From: Aleksandr Batalov Date: Sat, 7 Jun 2025 16:43:02 +0400 Subject: [PATCH 07/11] feat(e2e): deopt support for TanStack Query versions prior to 5.80.0 BREAKING CHANGE: Due to the fact that by default, the latest version of TanStack Query will always be installed, it doesn't make sense to support the old version of TanStack Query, since the new one doesn't have any breaking changes compared to the previous ones. --- .../.gitignore | 3 - .../package.json | 26 ----- .../src/index.ts | 108 ------------------ .../tsconfig.json | 14 --- 4 files changed, 151 deletions(-) delete mode 100644 e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/.gitignore delete mode 100644 e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/package.json delete mode 100644 e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/src/index.ts delete mode 100644 e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/tsconfig.json diff --git a/e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/.gitignore b/e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/.gitignore deleted file mode 100644 index 8e3b4b7ef..000000000 --- a/e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/package-lock.json -node_modules -/src/api diff --git a/e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/package.json b/e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/package.json deleted file mode 100644 index be2f6e35f..000000000 --- a/e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "typescript-nodenext-nodenext-tanstack-query-5-79-2", - "description": "This test verifies that the current version of OpenAPI Qraft is compatible with TanStack Query 5.79.2 or earlier, due to the removal of TQueryData for UseSuspenseInfiniteQueryOptions in TanStack Query 5.80.0", - "private": true, - "version": "1.0.0", - "main": "dist/index.js", - "type": "module", - "scripts": { - "build": "tsc", - "codegen": "openapi-qraft --plugin tanstack-query-react --plugin openapi-typescript https://raw.githubusercontent.com/swagger-api/swagger-petstore/7767363b841961221a38c0be9c6b1066a5120051/src/main/resources/openapi.yaml --clean -o src/api --openapi-types-import-path '../schema.js' --explicit-import-extensions --openapi-types-file-name schema.ts", - "e2e:pre-build": "npm run codegen", - "e2e:post-build": "node ./dist/index.js" - }, - "dependencies": { - "@openapi-qraft/cli": "latest", - "@openapi-qraft/react": "latest", - "@tanstack/react-query": "5.79.2", - "@tanstack/query-core": "5.79.2", - "@types/node": "latest", - "typescript": "latest" - }, - "repository": { - "type": "git", - "url": "https://github.com/OpenAPI-Qraft/openapi-qraft.git" - } -} diff --git a/e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/src/index.ts b/e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/src/index.ts deleted file mode 100644 index bbdfbe6ec..000000000 --- a/e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/src/index.ts +++ /dev/null @@ -1,108 +0,0 @@ -import type { components, paths } from './api/index.js'; -import { requestFn } from '@openapi-qraft/react'; -import * as callbacksIndex from '@openapi-qraft/react/callbacks'; -import * as callbacks from '@openapi-qraft/react/callbacks/index'; -import { useMutation } from '@openapi-qraft/react/callbacks/useMutation'; -import { useQuery } from '@openapi-qraft/react/callbacks/useQuery'; -import { - createSecureRequestFn, - QraftSecureRequestFn, -} from '@openapi-qraft/react/Unstable_QraftSecureRequestFn'; -import { QueryClient } from '@tanstack/react-query'; -import { createAPIClient as createAPIClientMjs } from './api/index.js'; - -console.log({} satisfies Partial); -console.log({} satisfies Partial); - -if (typeof createAPIClientMjs !== 'undefined') { - console.log('Client is imported successfully from esm project.'); -} else { - console.error('Client is not imported from esm project.'); - process.exit(1); -} - -if (typeof callbacks !== 'undefined') { - console.log('Callbacks are imported successfully from esm project.'); -} else { - console.error('Callbacks are not imported from esm project.'); - process.exit(1); -} - -if (typeof callbacksIndex !== 'undefined') { - console.log('Callbacks index is imported successfully from esm project.'); -} else { - console.error('Callbacks index is not imported from esm project.'); - process.exit(1); -} - -if (typeof useMutation !== 'undefined') { - console.log('useMutation is imported successfully from esm project.'); -} else { - console.error('useMutation is not imported from esm project.'); - process.exit(1); -} - -if (typeof useQuery !== 'undefined') { - console.log('useQuery is imported successfully from esm project.'); -} else { - console.error('useQuery is not imported from esm project.'); - process.exit(1); -} - -if (typeof createSecureRequestFn !== 'undefined') { - console.log( - 'createSecureRequestFn is imported successfully from esm project.' - ); -} else { - console.error('createSecureRequestFn is not imported from esm project.'); - process.exit(1); -} - -if (typeof QraftSecureRequestFn !== 'undefined') { - console.log( - 'QraftSecureRequestFn is imported successfully from esm project.' - ); -} else { - console.error('QraftSecureRequestFn is not imported from esm project.'); - process.exit(1); -} - -function useTsCheck() { - const client = createAPIClientMjs({ - baseUrl: 'https://api.example.com', - queryClient: new QueryClient(), - requestFn, - }); - - const query = client.pet.findPetsByStatus.useSuspenseInfiniteQuery( - {}, - { - initialPageParam: { - query: { - status: 'sold', - }, - }, - getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) => { - // @ts-expect-error - should not be never or any - lastPageParam.query?.status satisfies never; - lastPageParam.query?.status satisfies - | undefined - | 'sold' - | 'available' - | 'pending'; - - return lastPageParam.query?.status === 'sold' - ? { - query: { - status: 'sold', - }, - } - : undefined; - }, - } - ); - - query.data.pages[0] satisfies typeof client.pet.findPetsByStatus.types.data; - // @ts-expect-error - should not be never or any - query.data.pages[0] satisfies never; -} diff --git a/e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/tsconfig.json b/e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/tsconfig.json deleted file mode 100644 index 87a77e396..000000000 --- a/e2e/projects/typescript-nodenext-nodenext-tanstack-query-5.79.2/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "compilerOptions": { - "outDir": "./dist", - "rootDir": "./src", - "target": "es2016", - "module": "NodeNext", - "moduleResolution": "NodeNext", - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "skipLibCheck": true, - "verbatimModuleSyntax": true - } -} From 1b04e93dc4850955393474bf8ff2852e766bf3ba Mon Sep 17 00:00:00 2001 From: Aleksandr Batalov Date: Sat, 7 Jun 2025 16:39:37 +0400 Subject: [PATCH 08/11] feat: remove `@tanstack/query-core` from the `peerDependencies` in favour of simplified installation --- packages/react-client/package.json | 2 -- packages/react-client/src/callbacks/cancelQueries.ts | 2 +- .../react-client/src/callbacks/ensureInfiniteQueryData.ts | 2 +- packages/react-client/src/callbacks/ensureQueryData.ts | 2 +- packages/react-client/src/callbacks/fetchInfiniteQuery.ts | 2 +- packages/react-client/src/callbacks/fetchQuery.ts | 2 +- .../react-client/src/callbacks/getInfiniteQueryData.ts | 2 +- packages/react-client/src/callbacks/getInfiniteQueryKey.ts | 2 +- .../react-client/src/callbacks/getInfiniteQueryState.ts | 2 +- packages/react-client/src/callbacks/getMutationKey.ts | 2 +- packages/react-client/src/callbacks/getQueriesData.ts | 2 +- packages/react-client/src/callbacks/getQueryKey.ts | 2 +- packages/react-client/src/callbacks/getQueryState.ts | 2 +- packages/react-client/src/callbacks/invalidateQueries.ts | 2 +- packages/react-client/src/callbacks/isFetching.ts | 2 +- packages/react-client/src/callbacks/isMutating.ts | 2 +- .../react-client/src/callbacks/prefetchInfiniteQuery.ts | 2 +- packages/react-client/src/callbacks/prefetchQuery.ts | 2 +- packages/react-client/src/callbacks/refetchQueries.ts | 2 +- packages/react-client/src/callbacks/removeQueries.ts | 2 +- packages/react-client/src/callbacks/resetQueries.ts | 2 +- .../react-client/src/callbacks/setInfiniteQueryData.ts | 2 +- packages/react-client/src/callbacks/setQueriesData.ts | 2 +- packages/react-client/src/callbacks/useInfiniteQuery.ts | 7 +++++-- packages/react-client/src/callbacks/useIsMutating.ts | 3 +-- packages/react-client/src/callbacks/useMutation.ts | 3 +-- packages/react-client/src/callbacks/useMutationState.ts | 3 +-- packages/react-client/src/callbacks/useQueries.ts | 3 +-- packages/react-client/src/callbacks/useQuery.ts | 3 +-- .../react-client/src/callbacks/useSuspenseInfiniteQuery.ts | 7 +++++-- packages/react-client/src/callbacks/useSuspenseQueries.ts | 6 ++++-- packages/react-client/src/callbacks/useSuspenseQuery.ts | 3 +-- .../react-client/src/lib/callQueryClientFetchMethod.ts | 2 +- .../src/lib/callQueryClientMethodWithMutationFilters.ts | 2 +- .../src/lib/callQueryClientMethodWithQueryFilters.ts | 2 +- .../src/lib/callQueryClientMethodWithQueryKey.ts | 2 +- packages/react-client/src/lib/useComposeUseQueryOptions.ts | 3 +-- packages/react-client/src/qraftAPIClient.ts | 2 +- .../tests/createAPIClient.const-parameters.types-test.ts | 2 +- .../src/tests/createAPIOperationClient.test.tsx | 2 +- .../qraftAPIClient.queryable-write-operations.test.tsx | 3 +-- packages/react-client/src/tests/qraftAPIClient.test.tsx | 2 +- .../react-client/src/tests/qraftAPIClient.types-test.ts | 2 +- packages/tanstack-query-react-types/package.json | 2 -- .../src/shared/UseSuspenseInfiniteQueryOptions.ts | 7 +++++-- yarn.lock | 6 +----- 46 files changed, 59 insertions(+), 64 deletions(-) diff --git a/packages/react-client/package.json b/packages/react-client/package.json index e10331b49..cd5b2a1c7 100644 --- a/packages/react-client/package.json +++ b/packages/react-client/package.json @@ -18,7 +18,6 @@ "@openapi-qraft/tanstack-query-react-types": "workspace:*" }, "peerDependencies": { - "@tanstack/query-core": "^5.0.0", "@tanstack/react-query": "^5.0.0", "react": "^18 || ^19" }, @@ -29,7 +28,6 @@ "@openapi-qraft/rollup-config": "workspace:*", "@openapi-qraft/tanstack-query-react-plugin": "workspace:*", "@openapi-qraft/test-fixtures": "workspace:*", - "@tanstack/query-core": "^5.80.6", "@tanstack/react-query": "^5.80.6", "@testing-library/dom": "^10.4.0", "@testing-library/react": "^16.2.0", diff --git a/packages/react-client/src/callbacks/cancelQueries.ts b/packages/react-client/src/callbacks/cancelQueries.ts index 56ed28e70..8e95db3a1 100644 --- a/packages/react-client/src/callbacks/cancelQueries.ts +++ b/packages/react-client/src/callbacks/cancelQueries.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationCancelQueries, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js'; diff --git a/packages/react-client/src/callbacks/ensureInfiniteQueryData.ts b/packages/react-client/src/callbacks/ensureInfiniteQueryData.ts index a1d9a7545..6ea9d50e8 100644 --- a/packages/react-client/src/callbacks/ensureInfiniteQueryData.ts +++ b/packages/react-client/src/callbacks/ensureInfiniteQueryData.ts @@ -1,5 +1,5 @@ import type { ServiceOperationFetchInfiniteQuery } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientFetchMethod.js'; diff --git a/packages/react-client/src/callbacks/ensureQueryData.ts b/packages/react-client/src/callbacks/ensureQueryData.ts index 617a8a7d8..387a1fce0 100644 --- a/packages/react-client/src/callbacks/ensureQueryData.ts +++ b/packages/react-client/src/callbacks/ensureQueryData.ts @@ -1,5 +1,5 @@ import type { ServiceOperationFetchQuery } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientFetchMethod.js'; diff --git a/packages/react-client/src/callbacks/fetchInfiniteQuery.ts b/packages/react-client/src/callbacks/fetchInfiniteQuery.ts index aae3bf8b7..33ea6c379 100644 --- a/packages/react-client/src/callbacks/fetchInfiniteQuery.ts +++ b/packages/react-client/src/callbacks/fetchInfiniteQuery.ts @@ -1,5 +1,5 @@ import type { ServiceOperationFetchInfiniteQuery } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientFetchMethod.js'; diff --git a/packages/react-client/src/callbacks/fetchQuery.ts b/packages/react-client/src/callbacks/fetchQuery.ts index 0be1aded9..6833b26f1 100644 --- a/packages/react-client/src/callbacks/fetchQuery.ts +++ b/packages/react-client/src/callbacks/fetchQuery.ts @@ -1,5 +1,5 @@ import type { ServiceOperationFetchQuery } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientFetchMethod.js'; diff --git a/packages/react-client/src/callbacks/getInfiniteQueryData.ts b/packages/react-client/src/callbacks/getInfiniteQueryData.ts index d770c692d..1062cb38f 100644 --- a/packages/react-client/src/callbacks/getInfiniteQueryData.ts +++ b/packages/react-client/src/callbacks/getInfiniteQueryData.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationGetInfiniteQueryData, } from '@openapi-qraft/tanstack-query-react-types'; -import type { InfiniteData } from '@tanstack/query-core'; +import type { InfiniteData } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js'; diff --git a/packages/react-client/src/callbacks/getInfiniteQueryKey.ts b/packages/react-client/src/callbacks/getInfiniteQueryKey.ts index 8beafd183..22e04c3f3 100644 --- a/packages/react-client/src/callbacks/getInfiniteQueryKey.ts +++ b/packages/react-client/src/callbacks/getInfiniteQueryKey.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationUseInfiniteQuery, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIBasicClientOptions } from '../qraftAPIClient.js'; import { composeInfiniteQueryKey } from '../lib/composeInfiniteQueryKey.js'; diff --git a/packages/react-client/src/callbacks/getInfiniteQueryState.ts b/packages/react-client/src/callbacks/getInfiniteQueryState.ts index b212c9f2e..2975182e4 100644 --- a/packages/react-client/src/callbacks/getInfiniteQueryState.ts +++ b/packages/react-client/src/callbacks/getInfiniteQueryState.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationGetQueryState, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js'; diff --git a/packages/react-client/src/callbacks/getMutationKey.ts b/packages/react-client/src/callbacks/getMutationKey.ts index 3c94af791..be01395c5 100644 --- a/packages/react-client/src/callbacks/getMutationKey.ts +++ b/packages/react-client/src/callbacks/getMutationKey.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationUseMutation, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIBasicClientOptions } from '../qraftAPIClient.js'; import { composeMutationKey } from '../lib/composeMutationKey.js'; diff --git a/packages/react-client/src/callbacks/getQueriesData.ts b/packages/react-client/src/callbacks/getQueriesData.ts index df41ab36f..f91b9f179 100644 --- a/packages/react-client/src/callbacks/getQueriesData.ts +++ b/packages/react-client/src/callbacks/getQueriesData.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationGetQueriesData, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js'; diff --git a/packages/react-client/src/callbacks/getQueryKey.ts b/packages/react-client/src/callbacks/getQueryKey.ts index bfdba0d72..c2394cf49 100644 --- a/packages/react-client/src/callbacks/getQueryKey.ts +++ b/packages/react-client/src/callbacks/getQueryKey.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationUseQuery, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIBasicClientOptions } from '../qraftAPIClient.js'; import { composeQueryKey } from '../lib/composeQueryKey.js'; diff --git a/packages/react-client/src/callbacks/getQueryState.ts b/packages/react-client/src/callbacks/getQueryState.ts index 5443a9273..0eb4b0573 100644 --- a/packages/react-client/src/callbacks/getQueryState.ts +++ b/packages/react-client/src/callbacks/getQueryState.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationGetQueryState, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js'; diff --git a/packages/react-client/src/callbacks/invalidateQueries.ts b/packages/react-client/src/callbacks/invalidateQueries.ts index b5e2438fa..765fd092b 100644 --- a/packages/react-client/src/callbacks/invalidateQueries.ts +++ b/packages/react-client/src/callbacks/invalidateQueries.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationInvalidateQueries, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js'; diff --git a/packages/react-client/src/callbacks/isFetching.ts b/packages/react-client/src/callbacks/isFetching.ts index e7daae740..fea98df9f 100644 --- a/packages/react-client/src/callbacks/isFetching.ts +++ b/packages/react-client/src/callbacks/isFetching.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationIsFetchingQueries, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js'; diff --git a/packages/react-client/src/callbacks/isMutating.ts b/packages/react-client/src/callbacks/isMutating.ts index a5a506251..0161ad1cf 100644 --- a/packages/react-client/src/callbacks/isMutating.ts +++ b/packages/react-client/src/callbacks/isMutating.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationIsMutatingQueries, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithMutationFilters } from '../lib/callQueryClientMethodWithMutationFilters.js'; diff --git a/packages/react-client/src/callbacks/prefetchInfiniteQuery.ts b/packages/react-client/src/callbacks/prefetchInfiniteQuery.ts index ae1cb9c9f..2412fe7ad 100644 --- a/packages/react-client/src/callbacks/prefetchInfiniteQuery.ts +++ b/packages/react-client/src/callbacks/prefetchInfiniteQuery.ts @@ -1,5 +1,5 @@ import type { ServiceOperationFetchInfiniteQuery } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientFetchMethod.js'; diff --git a/packages/react-client/src/callbacks/prefetchQuery.ts b/packages/react-client/src/callbacks/prefetchQuery.ts index 4aef3e67b..196eec3a1 100644 --- a/packages/react-client/src/callbacks/prefetchQuery.ts +++ b/packages/react-client/src/callbacks/prefetchQuery.ts @@ -1,5 +1,5 @@ import type { ServiceOperationFetchQuery } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientFetchMethod.js'; diff --git a/packages/react-client/src/callbacks/refetchQueries.ts b/packages/react-client/src/callbacks/refetchQueries.ts index dfbd0df7c..ca045080c 100644 --- a/packages/react-client/src/callbacks/refetchQueries.ts +++ b/packages/react-client/src/callbacks/refetchQueries.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationRefetchQueries, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js'; diff --git a/packages/react-client/src/callbacks/removeQueries.ts b/packages/react-client/src/callbacks/removeQueries.ts index fdbba8999..3cc4243d6 100644 --- a/packages/react-client/src/callbacks/removeQueries.ts +++ b/packages/react-client/src/callbacks/removeQueries.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationRemoveQueries, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js'; diff --git a/packages/react-client/src/callbacks/resetQueries.ts b/packages/react-client/src/callbacks/resetQueries.ts index 650a70d09..4ff97f64c 100644 --- a/packages/react-client/src/callbacks/resetQueries.ts +++ b/packages/react-client/src/callbacks/resetQueries.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationResetQueries, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js'; diff --git a/packages/react-client/src/callbacks/setInfiniteQueryData.ts b/packages/react-client/src/callbacks/setInfiniteQueryData.ts index c86c4180f..e881cdebe 100644 --- a/packages/react-client/src/callbacks/setInfiniteQueryData.ts +++ b/packages/react-client/src/callbacks/setInfiniteQueryData.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationSetInfiniteQueryData, } from '@openapi-qraft/tanstack-query-react-types'; -import type { InfiniteData } from '@tanstack/query-core'; +import type { InfiniteData } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryKey } from '../lib/callQueryClientMethodWithQueryKey.js'; diff --git a/packages/react-client/src/callbacks/setQueriesData.ts b/packages/react-client/src/callbacks/setQueriesData.ts index 1d14d163a..64efc42c1 100644 --- a/packages/react-client/src/callbacks/setQueriesData.ts +++ b/packages/react-client/src/callbacks/setQueriesData.ts @@ -2,7 +2,7 @@ import type { OperationSchema, ServiceOperationSetQueriesData, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; +import type { DefaultError } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { callQueryClientMethodWithQueryFilters } from '../lib/callQueryClientMethodWithQueryFilters.js'; diff --git a/packages/react-client/src/callbacks/useInfiniteQuery.ts b/packages/react-client/src/callbacks/useInfiniteQuery.ts index 9e28ee3c6..9de9097ee 100644 --- a/packages/react-client/src/callbacks/useInfiniteQuery.ts +++ b/packages/react-client/src/callbacks/useInfiniteQuery.ts @@ -4,8 +4,11 @@ import type { OperationSchema, ServiceOperationUseInfiniteQuery, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError, InfiniteData } from '@tanstack/query-core'; -import type { UseInfiniteQueryResult } from '@tanstack/react-query'; +import type { + DefaultError, + InfiniteData, + UseInfiniteQueryResult, +} from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { useInfiniteQuery as useInfiniteQueryBase } from '@tanstack/react-query'; import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js'; diff --git a/packages/react-client/src/callbacks/useIsMutating.ts b/packages/react-client/src/callbacks/useIsMutating.ts index b183c3457..036037798 100644 --- a/packages/react-client/src/callbacks/useIsMutating.ts +++ b/packages/react-client/src/callbacks/useIsMutating.ts @@ -4,8 +4,7 @@ import type { OperationSchema, ServiceOperationUseIsMutating, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; -import type { UseMutationResult } from '@tanstack/react-query'; +import type { DefaultError, UseMutationResult } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { useIsMutating as useIsMutatingStateTanstack } from '@tanstack/react-query'; import { composeMutationFilters } from '../lib/composeMutationFilters.js'; diff --git a/packages/react-client/src/callbacks/useMutation.ts b/packages/react-client/src/callbacks/useMutation.ts index f58166e95..72808bd61 100644 --- a/packages/react-client/src/callbacks/useMutation.ts +++ b/packages/react-client/src/callbacks/useMutation.ts @@ -5,8 +5,7 @@ import type { ServiceOperationMutationKey, ServiceOperationUseMutation, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; -import type { UseMutationResult } from '@tanstack/react-query'; +import type { DefaultError, UseMutationResult } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { useMutation as useMutationBase } from '@tanstack/react-query'; import { composeMutationKey } from '../lib/composeMutationKey.js'; diff --git a/packages/react-client/src/callbacks/useMutationState.ts b/packages/react-client/src/callbacks/useMutationState.ts index 61c68b55e..6fa9f19c9 100644 --- a/packages/react-client/src/callbacks/useMutationState.ts +++ b/packages/react-client/src/callbacks/useMutationState.ts @@ -4,8 +4,7 @@ import type { OperationSchema, ServiceOperationUseMutationState, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; -import type { UseMutationResult } from '@tanstack/react-query'; +import type { DefaultError, UseMutationResult } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { useMutationState as useMutationStateTanstack } from '@tanstack/react-query'; import { composeMutationFilters } from '../lib/composeMutationFilters.js'; diff --git a/packages/react-client/src/callbacks/useQueries.ts b/packages/react-client/src/callbacks/useQueries.ts index 9f50333a4..c5e1540bb 100644 --- a/packages/react-client/src/callbacks/useQueries.ts +++ b/packages/react-client/src/callbacks/useQueries.ts @@ -4,8 +4,7 @@ import type { OperationSchema, ServiceOperationUseQueries, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; -import type { QueriesResults } from '@tanstack/react-query'; +import type { DefaultError, QueriesResults } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { useQueries as useQueriesTanstack } from '@tanstack/react-query'; import { composeQueryKey } from '../lib/composeQueryKey.js'; diff --git a/packages/react-client/src/callbacks/useQuery.ts b/packages/react-client/src/callbacks/useQuery.ts index 17da36fe3..6f56e91c7 100644 --- a/packages/react-client/src/callbacks/useQuery.ts +++ b/packages/react-client/src/callbacks/useQuery.ts @@ -4,8 +4,7 @@ import type { OperationSchema, ServiceOperationUseQuery, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; -import type { UseQueryResult } from '@tanstack/react-query'; +import type { DefaultError, UseQueryResult } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { useQuery as useQueryTanstack } from '@tanstack/react-query'; import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js'; diff --git a/packages/react-client/src/callbacks/useSuspenseInfiniteQuery.ts b/packages/react-client/src/callbacks/useSuspenseInfiniteQuery.ts index 582a470e2..e12201a69 100644 --- a/packages/react-client/src/callbacks/useSuspenseInfiniteQuery.ts +++ b/packages/react-client/src/callbacks/useSuspenseInfiniteQuery.ts @@ -4,8 +4,11 @@ import type { OperationSchema, ServiceOperationUseSuspenseInfiniteQuery, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError, InfiniteData } from '@tanstack/query-core'; -import type { UseSuspenseInfiniteQueryResult } from '@tanstack/react-query'; +import type { + DefaultError, + InfiniteData, + UseSuspenseInfiniteQueryResult, +} from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { useSuspenseInfiniteQuery as useSuspenseInfiniteQueryTanstack } from '@tanstack/react-query'; import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js'; diff --git a/packages/react-client/src/callbacks/useSuspenseQueries.ts b/packages/react-client/src/callbacks/useSuspenseQueries.ts index 9997ea771..f81c5f41e 100644 --- a/packages/react-client/src/callbacks/useSuspenseQueries.ts +++ b/packages/react-client/src/callbacks/useSuspenseQueries.ts @@ -4,8 +4,10 @@ import type { OperationSchema, ServiceOperationUseSuspenseQueries, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; -import type { SuspenseQueriesResults } from '@tanstack/react-query'; +import type { + DefaultError, + SuspenseQueriesResults, +} from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { useSuspenseQueries as useSuspenseQueriesTanstack } from '@tanstack/react-query'; import { composeQueryKey } from '../lib/composeQueryKey.js'; diff --git a/packages/react-client/src/callbacks/useSuspenseQuery.ts b/packages/react-client/src/callbacks/useSuspenseQuery.ts index 141226736..9284d4b87 100644 --- a/packages/react-client/src/callbacks/useSuspenseQuery.ts +++ b/packages/react-client/src/callbacks/useSuspenseQuery.ts @@ -4,8 +4,7 @@ import type { OperationSchema, ServiceOperationUseSuspenseQuery, } from '@openapi-qraft/tanstack-query-react-types'; -import type { DefaultError } from '@tanstack/query-core'; -import type { UseQueryResult } from '@tanstack/react-query'; +import type { DefaultError, UseQueryResult } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import { useSuspenseQuery as useSuspenseQueryTanstack } from '@tanstack/react-query'; import { useComposeUseQueryOptions } from '../lib/useComposeUseQueryOptions.js'; diff --git a/packages/react-client/src/lib/callQueryClientFetchMethod.ts b/packages/react-client/src/lib/callQueryClientFetchMethod.ts index 6247e2d07..0f97479cc 100644 --- a/packages/react-client/src/lib/callQueryClientFetchMethod.ts +++ b/packages/react-client/src/lib/callQueryClientFetchMethod.ts @@ -1,4 +1,4 @@ -import type { QueryClient } from '@tanstack/query-core'; +import type { QueryClient } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import type { OperationSchema, RequestFn } from './requestFn.js'; import { composeInfiniteQueryKey } from './composeInfiniteQueryKey.js'; diff --git a/packages/react-client/src/lib/callQueryClientMethodWithMutationFilters.ts b/packages/react-client/src/lib/callQueryClientMethodWithMutationFilters.ts index a02463730..46615062f 100644 --- a/packages/react-client/src/lib/callQueryClientMethodWithMutationFilters.ts +++ b/packages/react-client/src/lib/callQueryClientMethodWithMutationFilters.ts @@ -1,4 +1,4 @@ -import type { QueryClient } from '@tanstack/query-core'; +import type { QueryClient } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import type { OperationSchema } from './requestFn.js'; import { composeMutationFilters } from './composeMutationFilters.js'; diff --git a/packages/react-client/src/lib/callQueryClientMethodWithQueryFilters.ts b/packages/react-client/src/lib/callQueryClientMethodWithQueryFilters.ts index 19e8b8253..878cd992e 100644 --- a/packages/react-client/src/lib/callQueryClientMethodWithQueryFilters.ts +++ b/packages/react-client/src/lib/callQueryClientMethodWithQueryFilters.ts @@ -1,4 +1,4 @@ -import type { QueryClient } from '@tanstack/query-core'; +import type { QueryClient } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import type { OperationSchema } from './requestFn.js'; import { composeQueryFilters } from './composeQueryFilters.js'; diff --git a/packages/react-client/src/lib/callQueryClientMethodWithQueryKey.ts b/packages/react-client/src/lib/callQueryClientMethodWithQueryKey.ts index 20e626d9c..20133e19e 100644 --- a/packages/react-client/src/lib/callQueryClientMethodWithQueryKey.ts +++ b/packages/react-client/src/lib/callQueryClientMethodWithQueryKey.ts @@ -1,4 +1,4 @@ -import type { QueryClient } from '@tanstack/query-core'; +import type { QueryClient } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import type { OperationSchema } from './requestFn.js'; import { composeInfiniteQueryKey } from './composeInfiniteQueryKey.js'; diff --git a/packages/react-client/src/lib/useComposeUseQueryOptions.ts b/packages/react-client/src/lib/useComposeUseQueryOptions.ts index c695a331d..de0415e55 100644 --- a/packages/react-client/src/lib/useComposeUseQueryOptions.ts +++ b/packages/react-client/src/lib/useComposeUseQueryOptions.ts @@ -1,8 +1,7 @@ 'use client'; import type { ServiceOperationQueryKey } from '@openapi-qraft/tanstack-query-react-types'; -import type { QueryClient } from '@tanstack/query-core'; -import type { UseQueryOptions } from '@tanstack/react-query'; +import type { QueryClient, UseQueryOptions } from '@tanstack/react-query'; import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js'; import type { OperationSchema } from './requestFn.js'; import { composeInfiniteQueryKey } from './composeInfiniteQueryKey.js'; diff --git a/packages/react-client/src/qraftAPIClient.ts b/packages/react-client/src/qraftAPIClient.ts index b832617e4..f85df9fcd 100644 --- a/packages/react-client/src/qraftAPIClient.ts +++ b/packages/react-client/src/qraftAPIClient.ts @@ -1,5 +1,5 @@ import type { QraftServiceOperationsToken } from '@openapi-qraft/tanstack-query-react-types'; -import type { QueryClient } from '@tanstack/query-core'; +import type { QueryClient } from '@tanstack/react-query'; import type * as callbacks from './callbacks/index.js'; import type * as operationInvokeModule from './callbacks/operationInvokeFn.js'; import type { diff --git a/packages/react-client/src/tests/createAPIClient.const-parameters.types-test.ts b/packages/react-client/src/tests/createAPIClient.const-parameters.types-test.ts index 57100f67d..17425f086 100644 --- a/packages/react-client/src/tests/createAPIClient.const-parameters.types-test.ts +++ b/packages/react-client/src/tests/createAPIClient.const-parameters.types-test.ts @@ -1,4 +1,4 @@ -import { QueryClient } from '@tanstack/query-core'; +import { QueryClient } from '@tanstack/react-query'; import { requestFn } from '../index.js'; import { createAPIClient } from './fixtures/api/index.js'; diff --git a/packages/react-client/src/tests/createAPIOperationClient.test.tsx b/packages/react-client/src/tests/createAPIOperationClient.test.tsx index 0c3fcc93c..fe34b40df 100644 --- a/packages/react-client/src/tests/createAPIOperationClient.test.tsx +++ b/packages/react-client/src/tests/createAPIOperationClient.test.tsx @@ -3,7 +3,7 @@ import { getInfiniteQueryKey, getQueryKey, } from '@openapi-qraft/react/callbacks/index'; -import { QueryClient } from '@tanstack/query-core'; +import { QueryClient } from '@tanstack/react-query'; import { describe, expect, it, vi } from 'vitest'; import { createInternalReactAPIClient as createAPIOperationClient, diff --git a/packages/react-client/src/tests/qraftAPIClient.queryable-write-operations.test.tsx b/packages/react-client/src/tests/qraftAPIClient.queryable-write-operations.test.tsx index 7603d9f7e..70c864589 100644 --- a/packages/react-client/src/tests/qraftAPIClient.queryable-write-operations.test.tsx +++ b/packages/react-client/src/tests/qraftAPIClient.queryable-write-operations.test.tsx @@ -1,6 +1,5 @@ import type { paths } from './fixtures/api/index.js'; -import { QueryClient } from '@tanstack/query-core'; -import { QueryClientProvider } from '@tanstack/react-query'; +import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { renderHook, waitFor } from '@testing-library/react'; import React from 'react'; import { describe, expect, it } from 'vitest'; diff --git a/packages/react-client/src/tests/qraftAPIClient.test.tsx b/packages/react-client/src/tests/qraftAPIClient.test.tsx index 55bc5e0f3..61d8960f9 100644 --- a/packages/react-client/src/tests/qraftAPIClient.test.tsx +++ b/packages/react-client/src/tests/qraftAPIClient.test.tsx @@ -1,3 +1,4 @@ +import type { QueryClientConfig } from '@tanstack/react-query'; import type { ReactNode } from 'react'; import type { CreateAPIQueryClientOptions } from '../index.js'; import type { @@ -11,7 +12,6 @@ import { operationInvokeFn, useQuery, } from '@openapi-qraft/react/callbacks/index'; -import { type QueryClientConfig } from '@tanstack/query-core'; import { hashKey, QueryClient, diff --git a/packages/react-client/src/tests/qraftAPIClient.types-test.ts b/packages/react-client/src/tests/qraftAPIClient.types-test.ts index 2b62d3d63..39b1baf76 100644 --- a/packages/react-client/src/tests/qraftAPIClient.types-test.ts +++ b/packages/react-client/src/tests/qraftAPIClient.types-test.ts @@ -2,7 +2,7 @@ import { qraftAPIClient, requestFn } from '@openapi-qraft/react'; import * as callbacks from '@openapi-qraft/react/callbacks/index'; -import { QueryClient } from '@tanstack/query-core'; +import { QueryClient } from '@tanstack/react-query'; import { services } from './fixtures/api/index.js'; import { deleteFiles, diff --git a/packages/tanstack-query-react-types/package.json b/packages/tanstack-query-react-types/package.json index c928824ca..ee03f9b8b 100644 --- a/packages/tanstack-query-react-types/package.json +++ b/packages/tanstack-query-react-types/package.json @@ -31,14 +31,12 @@ } }, "peerDependencies": { - "@tanstack/query-core": "^5.0.0", "@tanstack/react-query": "^5.0.0", "react": "^18 || ^19" }, "devDependencies": { "@openapi-qraft/eslint-config": "workspace:*", "@openapi-qraft/rollup-config": "workspace:*", - "@tanstack/query-core": "^5.80.6", "@tanstack/react-query": "^5.80.6", "eslint": "^9.24.0", "rimraf": "^5.0.10", diff --git a/packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts b/packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts index 600973383..151aa20ef 100644 --- a/packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts +++ b/packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts @@ -1,5 +1,8 @@ -import type { DefaultError, QueryKey } from '@tanstack/query-core'; -import type { UseSuspenseInfiniteQueryOptions as UseSuspenseInfiniteQueryOptionsVendor } from '@tanstack/react-query'; +import type { + DefaultError, + QueryKey, + UseSuspenseInfiniteQueryOptions as UseSuspenseInfiniteQueryOptionsVendor, +} from '@tanstack/react-query'; export type UseSuspenseInfiniteQueryOptions< TQueryFnData = unknown, diff --git a/yarn.lock b/yarn.lock index 0c90b10be..645c4e997 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6077,7 +6077,6 @@ __metadata: "@openapi-qraft/tanstack-query-react-plugin": "workspace:*" "@openapi-qraft/tanstack-query-react-types": "workspace:*" "@openapi-qraft/test-fixtures": "workspace:*" - "@tanstack/query-core": "npm:^5.80.6" "@tanstack/react-query": "npm:^5.80.6" "@testing-library/dom": "npm:^10.4.0" "@testing-library/react": "npm:^16.2.0" @@ -6101,7 +6100,6 @@ __metadata: typescript: "npm:^5.6.2" vitest: "npm:^3.0.5" peerDependencies: - "@tanstack/query-core": ^5.0.0 "@tanstack/react-query": ^5.0.0 react: ^18 || ^19 languageName: unknown @@ -6156,14 +6154,12 @@ __metadata: dependencies: "@openapi-qraft/eslint-config": "workspace:*" "@openapi-qraft/rollup-config": "workspace:*" - "@tanstack/query-core": "npm:^5.80.6" "@tanstack/react-query": "npm:^5.80.6" eslint: "npm:^9.24.0" rimraf: "npm:^5.0.10" rollup: "npm:~4.22.4" typescript: "npm:^5.6.2" peerDependencies: - "@tanstack/query-core": ^5.0.0 "@tanstack/react-query": ^5.0.0 react: ^18 || ^19 languageName: unknown @@ -7019,7 +7015,7 @@ __metadata: languageName: node linkType: hard -"@tanstack/query-core@npm:5.80.6, @tanstack/query-core@npm:^5.80.6": +"@tanstack/query-core@npm:5.80.6": version: 5.80.6 resolution: "@tanstack/query-core@npm:5.80.6" checksum: 10c0/ce52d962036bf84845c9dafb654075bbc8eafd9236069b7c234b7f72a30e4e61daf222940d9f28b4359858277cc1e1d08dd1f8e6cc0adac72acc083fc5c0195c From a631277e1e6d9ae706b02ba6914bcd7df674b21c Mon Sep 17 00:00:00 2001 From: Aleksandr Batalov Date: Sat, 7 Jun 2025 17:32:24 +0400 Subject: [PATCH 09/11] feat(react-client): deopt support for TanStack Query versions prior to 5.80.0 BREAKING CHANGE: Due to the fact that by default, the latest version of TanStack Query will always be installed, it doesn't make sense to support the old version of TanStack Query, since the new one doesn't have any breaking changes compared to the previous ones. --- packages/react-client/package.json | 2 +- .../tanstack-query-react-types/package.json | 2 +- .../shared/UseSuspenseInfiniteQueryOptions.ts | 35 ------------------- .../src/shared/index.ts | 1 - yarn.lock | 4 +-- 5 files changed, 4 insertions(+), 40 deletions(-) delete mode 100644 packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts diff --git a/packages/react-client/package.json b/packages/react-client/package.json index cd5b2a1c7..32568c245 100644 --- a/packages/react-client/package.json +++ b/packages/react-client/package.json @@ -18,7 +18,7 @@ "@openapi-qraft/tanstack-query-react-types": "workspace:*" }, "peerDependencies": { - "@tanstack/react-query": "^5.0.0", + "@tanstack/react-query": "^5.80.0", "react": "^18 || ^19" }, "devDependencies": { diff --git a/packages/tanstack-query-react-types/package.json b/packages/tanstack-query-react-types/package.json index ee03f9b8b..1f2294891 100644 --- a/packages/tanstack-query-react-types/package.json +++ b/packages/tanstack-query-react-types/package.json @@ -31,7 +31,7 @@ } }, "peerDependencies": { - "@tanstack/react-query": "^5.0.0", + "@tanstack/react-query": "^5.80.0", "react": "^18 || ^19" }, "devDependencies": { diff --git a/packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts b/packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts deleted file mode 100644 index 151aa20ef..000000000 --- a/packages/tanstack-query-react-types/src/shared/UseSuspenseInfiniteQueryOptions.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { - DefaultError, - QueryKey, - UseSuspenseInfiniteQueryOptions as UseSuspenseInfiniteQueryOptionsVendor, -} from '@tanstack/react-query'; - -export type UseSuspenseInfiniteQueryOptions< - TQueryFnData = unknown, - TError = DefaultError, - TData = TQueryFnData, - TQueryKey extends QueryKey = QueryKey, - TPageParam = unknown, -> = - UseSuspenseInfiniteQueryOptionsVendor< - TQueryFnData, - TError, - TData, - TQueryKey - > extends { queryKey: TQueryKey } - ? UseSuspenseInfiniteQueryOptionsVendor< - TQueryFnData, - TError, - TData, - TQueryKey, - TPageParam - > - : // @ts-expect-error - the compatibility layer with @tanstack/react-query <= 5.79.2 - UseSuspenseInfiniteQueryOptionsVendor< - TQueryFnData, - TError, - TData, - TQueryFnData, - TQueryKey, - TPageParam - >; diff --git a/packages/tanstack-query-react-types/src/shared/index.ts b/packages/tanstack-query-react-types/src/shared/index.ts index ff828b9b7..5aa59b405 100644 --- a/packages/tanstack-query-react-types/src/shared/index.ts +++ b/packages/tanstack-query-react-types/src/shared/index.ts @@ -13,7 +13,6 @@ export type * from './ServiceOperationMutation.js'; export type * from './ServiceOperationQuery.js'; export type * from './UseQueryOptionsForUseQueries.js'; export type * from './UseQueryOptionsForUseSuspenseQuery.js'; -export type * from './UseSuspenseInfiniteQueryOptions.js'; export type * from './WithOptional.js'; export type * from './QraftServiceOperationsToken.js'; export type * from './OperationError.js'; diff --git a/yarn.lock b/yarn.lock index 645c4e997..c4d48309d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6100,7 +6100,7 @@ __metadata: typescript: "npm:^5.6.2" vitest: "npm:^3.0.5" peerDependencies: - "@tanstack/react-query": ^5.0.0 + "@tanstack/react-query": ^5.80.0 react: ^18 || ^19 languageName: unknown linkType: soft @@ -6160,7 +6160,7 @@ __metadata: rollup: "npm:~4.22.4" typescript: "npm:^5.6.2" peerDependencies: - "@tanstack/react-query": ^5.0.0 + "@tanstack/react-query": ^5.80.0 react: ^18 || ^19 languageName: unknown linkType: soft From 6419f64e76a0c9d80742edffb90c8539961ef820 Mon Sep 17 00:00:00 2001 From: Aleksandr Batalov Date: Sat, 7 Jun 2025 17:40:16 +0400 Subject: [PATCH 10/11] docs(changeset): Update `peerDependency` to `@tanstack/react-query@^5.80.0` due to breaking changes in the `UseSuspenseInfiniteQueryOptions` interface. --- .changeset/kind-words-wonder.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/kind-words-wonder.md diff --git a/.changeset/kind-words-wonder.md b/.changeset/kind-words-wonder.md new file mode 100644 index 000000000..7dbcde9b2 --- /dev/null +++ b/.changeset/kind-words-wonder.md @@ -0,0 +1,6 @@ +--- +'@openapi-qraft/tanstack-query-react-types': minor +'@openapi-qraft/react': minor +--- + +Update `peerDependency` to `@tanstack/react-query@^5.80.0` due to breaking changes in the `UseSuspenseInfiniteQueryOptions` interface. From 58bb1d83ff7af2a02a6dfa49d77f7f955991a381 Mon Sep 17 00:00:00 2001 From: Aleksandr Batalov Date: Sat, 7 Jun 2025 19:13:47 +0400 Subject: [PATCH 11/11] chore(tanstack-query-react-plugin): update test snapshots due to deopt of support for TanStack Query versions prior to 5.80.0 --- .../services/ApprovalPoliciesService.ts.snapshot.ts | 4 ++-- .../services/FilesService.ts.snapshot.ts | 4 ++-- .../services/ApprovalPoliciesService.ts.snapshot.ts | 4 ++-- .../services/ApprovalPoliciesService.ts.snapshot.ts | 4 ++-- .../services/FilesService.ts.snapshot.ts | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/tanstack-query-react-plugin/src/__snapshots__/explicit-import-extensions/services/ApprovalPoliciesService.ts.snapshot.ts b/packages/tanstack-query-react-plugin/src/__snapshots__/explicit-import-extensions/services/ApprovalPoliciesService.ts.snapshot.ts index 822f74e5f..af0377226 100644 --- a/packages/tanstack-query-react-plugin/src/__snapshots__/explicit-import-extensions/services/ApprovalPoliciesService.ts.snapshot.ts +++ b/packages/tanstack-query-react-plugin/src/__snapshots__/explicit-import-extensions/services/ApprovalPoliciesService.ts.snapshot.ts @@ -4,8 +4,8 @@ */ import type { paths } from "../../openapi.js"; -import type { DeepReadonly, InvalidateQueryFilters, MutationFiltersByMutationKey, MutationFiltersByParameters, MutationVariables, OperationError, OperationInfiniteData, PartialParameters, QueryFiltersByParameters, QueryFiltersByQueryKey, QueryFnOptionsByParameters, QueryFnOptionsByQueryKey, RequestFnResponse, ServiceOperationEnsureInfiniteQueryDataOptions, ServiceOperationEnsureQueryDataOptions, ServiceOperationFetchInfiniteQueryOptions, ServiceOperationFetchQueryOptions, ServiceOperationInfiniteQueryKey, ServiceOperationMutationFnOptions, ServiceOperationMutationKey, ServiceOperationQueryKey, ServiceOperationUseMutationOptions, UseQueryOptionsForUseQueries, UseQueryOptionsForUseSuspenseQuery, UseSuspenseInfiniteQueryOptions, WithOptional, QraftServiceOperationsToken } from "@openapi-qraft/tanstack-query-react-types"; -import type { CancelOptions, DefinedInitialDataInfiniteOptions, DefinedInitialDataOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, InfiniteQueryPageParamsOptions, InvalidateOptions, Mutation, MutationState, NoInfer, QueryState, RefetchOptions, ResetOptions, SetDataOptions, UndefinedInitialDataInfiniteOptions, UndefinedInitialDataOptions, Updater, UseInfiniteQueryResult, UseMutationResult, UseQueryResult, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import type { DeepReadonly, InvalidateQueryFilters, MutationFiltersByMutationKey, MutationFiltersByParameters, MutationVariables, OperationError, OperationInfiniteData, PartialParameters, QueryFiltersByParameters, QueryFiltersByQueryKey, QueryFnOptionsByParameters, QueryFnOptionsByQueryKey, RequestFnResponse, ServiceOperationEnsureInfiniteQueryDataOptions, ServiceOperationEnsureQueryDataOptions, ServiceOperationFetchInfiniteQueryOptions, ServiceOperationFetchQueryOptions, ServiceOperationInfiniteQueryKey, ServiceOperationMutationFnOptions, ServiceOperationMutationKey, ServiceOperationQueryKey, ServiceOperationUseMutationOptions, UseQueryOptionsForUseQueries, UseQueryOptionsForUseSuspenseQuery, WithOptional, QraftServiceOperationsToken } from "@openapi-qraft/tanstack-query-react-types"; +import type { CancelOptions, DefinedInitialDataInfiniteOptions, DefinedInitialDataOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, InfiniteQueryPageParamsOptions, InvalidateOptions, Mutation, MutationState, NoInfer, QueryState, RefetchOptions, ResetOptions, SetDataOptions, UndefinedInitialDataInfiniteOptions, UndefinedInitialDataOptions, Updater, UseInfiniteQueryResult, UseMutationResult, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; export interface ApprovalPoliciesService { /** * @summary Get an approval policy by ID diff --git a/packages/tanstack-query-react-plugin/src/__snapshots__/explicit-import-extensions/services/FilesService.ts.snapshot.ts b/packages/tanstack-query-react-plugin/src/__snapshots__/explicit-import-extensions/services/FilesService.ts.snapshot.ts index 859cd0996..b02b00381 100644 --- a/packages/tanstack-query-react-plugin/src/__snapshots__/explicit-import-extensions/services/FilesService.ts.snapshot.ts +++ b/packages/tanstack-query-react-plugin/src/__snapshots__/explicit-import-extensions/services/FilesService.ts.snapshot.ts @@ -4,8 +4,8 @@ */ import type { paths } from "../../openapi.js"; -import type { DeepReadonly, InvalidateQueryFilters, MutationFiltersByMutationKey, MutationFiltersByParameters, MutationVariables, OperationError, OperationInfiniteData, PartialParameters, QueryFiltersByParameters, QueryFiltersByQueryKey, QueryFnOptionsByParameters, QueryFnOptionsByQueryKey, RequestFnResponse, ServiceOperationEnsureInfiniteQueryDataOptions, ServiceOperationEnsureQueryDataOptions, ServiceOperationFetchInfiniteQueryOptions, ServiceOperationFetchQueryOptions, ServiceOperationInfiniteQueryKey, ServiceOperationMutationFnOptions, ServiceOperationMutationKey, ServiceOperationQueryKey, ServiceOperationUseMutationOptions, UseQueryOptionsForUseQueries, UseQueryOptionsForUseSuspenseQuery, UseSuspenseInfiniteQueryOptions, WithOptional, QraftServiceOperationsToken } from "@openapi-qraft/tanstack-query-react-types"; -import type { CancelOptions, DefinedInitialDataInfiniteOptions, DefinedInitialDataOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, InfiniteQueryPageParamsOptions, InvalidateOptions, Mutation, MutationState, NoInfer, QueryState, RefetchOptions, ResetOptions, SetDataOptions, UndefinedInitialDataInfiniteOptions, UndefinedInitialDataOptions, Updater, UseInfiniteQueryResult, UseMutationResult, UseQueryResult, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import type { DeepReadonly, InvalidateQueryFilters, MutationFiltersByMutationKey, MutationFiltersByParameters, MutationVariables, OperationError, OperationInfiniteData, PartialParameters, QueryFiltersByParameters, QueryFiltersByQueryKey, QueryFnOptionsByParameters, QueryFnOptionsByQueryKey, RequestFnResponse, ServiceOperationEnsureInfiniteQueryDataOptions, ServiceOperationEnsureQueryDataOptions, ServiceOperationFetchInfiniteQueryOptions, ServiceOperationFetchQueryOptions, ServiceOperationInfiniteQueryKey, ServiceOperationMutationFnOptions, ServiceOperationMutationKey, ServiceOperationQueryKey, ServiceOperationUseMutationOptions, UseQueryOptionsForUseQueries, UseQueryOptionsForUseSuspenseQuery, WithOptional, QraftServiceOperationsToken } from "@openapi-qraft/tanstack-query-react-types"; +import type { CancelOptions, DefinedInitialDataInfiniteOptions, DefinedInitialDataOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, InfiniteQueryPageParamsOptions, InvalidateOptions, Mutation, MutationState, NoInfer, QueryState, RefetchOptions, ResetOptions, SetDataOptions, UndefinedInitialDataInfiniteOptions, UndefinedInitialDataOptions, Updater, UseInfiniteQueryResult, UseMutationResult, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; export interface FilesService { /** @summary Get a files by ID */ getFiles: { diff --git a/packages/tanstack-query-react-plugin/src/__snapshots__/override-import-type/services/ApprovalPoliciesService.ts.snapshot.ts b/packages/tanstack-query-react-plugin/src/__snapshots__/override-import-type/services/ApprovalPoliciesService.ts.snapshot.ts index e73ba4ddf..c727aad6e 100644 --- a/packages/tanstack-query-react-plugin/src/__snapshots__/override-import-type/services/ApprovalPoliciesService.ts.snapshot.ts +++ b/packages/tanstack-query-react-plugin/src/__snapshots__/override-import-type/services/ApprovalPoliciesService.ts.snapshot.ts @@ -4,8 +4,8 @@ */ import type { paths } from "../../openapi.d.ts"; -import type { DeepReadonly, InvalidateQueryFilters, MutationFiltersByMutationKey, MutationFiltersByParameters, MutationVariables, OperationInfiniteData, PartialParameters, QueryFiltersByParameters, QueryFiltersByQueryKey, QueryFnOptionsByParameters, QueryFnOptionsByQueryKey, RequestFnResponse, ServiceOperationEnsureInfiniteQueryDataOptions, ServiceOperationEnsureQueryDataOptions, ServiceOperationFetchInfiniteQueryOptions, ServiceOperationFetchQueryOptions, ServiceOperationInfiniteQueryKey, ServiceOperationMutationFnOptions, ServiceOperationMutationKey, ServiceOperationQueryKey, ServiceOperationUseMutationOptions, UseQueryOptionsForUseQueries, UseQueryOptionsForUseSuspenseQuery, UseSuspenseInfiniteQueryOptions, WithOptional, QraftServiceOperationsToken } from "@openapi-qraft/tanstack-query-react-types"; -import type { CancelOptions, DefinedInitialDataInfiniteOptions, DefinedInitialDataOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, InfiniteQueryPageParamsOptions, InvalidateOptions, Mutation, MutationState, NoInfer, QueryState, RefetchOptions, ResetOptions, SetDataOptions, UndefinedInitialDataInfiniteOptions, UndefinedInitialDataOptions, Updater, UseMutationResult, UseQueryResult, UseSuspenseInfiniteQueryResult } from "@tanstack/react-query"; +import type { DeepReadonly, InvalidateQueryFilters, MutationFiltersByMutationKey, MutationFiltersByParameters, MutationVariables, OperationInfiniteData, PartialParameters, QueryFiltersByParameters, QueryFiltersByQueryKey, QueryFnOptionsByParameters, QueryFnOptionsByQueryKey, RequestFnResponse, ServiceOperationEnsureInfiniteQueryDataOptions, ServiceOperationEnsureQueryDataOptions, ServiceOperationFetchInfiniteQueryOptions, ServiceOperationFetchQueryOptions, ServiceOperationInfiniteQueryKey, ServiceOperationMutationFnOptions, ServiceOperationMutationKey, ServiceOperationQueryKey, ServiceOperationUseMutationOptions, UseQueryOptionsForUseQueries, UseQueryOptionsForUseSuspenseQuery, WithOptional, QraftServiceOperationsToken } from "@openapi-qraft/tanstack-query-react-types"; +import type { CancelOptions, DefinedInitialDataInfiniteOptions, DefinedInitialDataOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, InfiniteQueryPageParamsOptions, InvalidateOptions, Mutation, MutationState, NoInfer, QueryState, RefetchOptions, ResetOptions, SetDataOptions, UndefinedInitialDataInfiniteOptions, UndefinedInitialDataOptions, Updater, UseMutationResult, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult } from "@tanstack/react-query"; import type { OperationError } from "../../type-overrides/operation-error.js"; import type { UseInfiniteQueryResult } from "../../type-overrides/use-infinite-query-result.js"; import type { UseSuspenseQueryOptions, UseSuspenseQueryResult } from "../../type-overrides/suspense-query.js"; diff --git a/packages/tanstack-query-react-plugin/src/__snapshots__/queryable-write-operations/services/ApprovalPoliciesService.ts.snapshot.ts b/packages/tanstack-query-react-plugin/src/__snapshots__/queryable-write-operations/services/ApprovalPoliciesService.ts.snapshot.ts index e5e855736..69888e868 100644 --- a/packages/tanstack-query-react-plugin/src/__snapshots__/queryable-write-operations/services/ApprovalPoliciesService.ts.snapshot.ts +++ b/packages/tanstack-query-react-plugin/src/__snapshots__/queryable-write-operations/services/ApprovalPoliciesService.ts.snapshot.ts @@ -4,8 +4,8 @@ */ import type { paths } from "../../openapi.d.ts"; -import type { DeepReadonly, InvalidateQueryFilters, MutationFiltersByMutationKey, MutationFiltersByParameters, MutationVariables, OperationError, OperationInfiniteData, PartialParameters, QueryFiltersByParameters, QueryFiltersByQueryKey, QueryFnOptionsByParameters, QueryFnOptionsByQueryKey, RequestFnResponse, ServiceOperationEnsureInfiniteQueryDataOptions, ServiceOperationEnsureQueryDataOptions, ServiceOperationFetchInfiniteQueryOptions, ServiceOperationFetchQueryOptions, ServiceOperationInfiniteQueryKey, ServiceOperationMutationFnOptions, ServiceOperationMutationKey, ServiceOperationQueryKey, ServiceOperationUseMutationOptions, UseQueryOptionsForUseQueries, UseQueryOptionsForUseSuspenseQuery, UseSuspenseInfiniteQueryOptions, WithOptional, QraftServiceOperationsToken } from "@openapi-qraft/tanstack-query-react-types"; -import type { CancelOptions, DefinedInitialDataInfiniteOptions, DefinedInitialDataOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, InfiniteQueryPageParamsOptions, InvalidateOptions, Mutation, MutationState, NoInfer, QueryState, RefetchOptions, ResetOptions, SetDataOptions, UndefinedInitialDataInfiniteOptions, UndefinedInitialDataOptions, Updater, UseInfiniteQueryResult, UseMutationResult, UseQueryResult, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import type { DeepReadonly, InvalidateQueryFilters, MutationFiltersByMutationKey, MutationFiltersByParameters, MutationVariables, OperationError, OperationInfiniteData, PartialParameters, QueryFiltersByParameters, QueryFiltersByQueryKey, QueryFnOptionsByParameters, QueryFnOptionsByQueryKey, RequestFnResponse, ServiceOperationEnsureInfiniteQueryDataOptions, ServiceOperationEnsureQueryDataOptions, ServiceOperationFetchInfiniteQueryOptions, ServiceOperationFetchQueryOptions, ServiceOperationInfiniteQueryKey, ServiceOperationMutationFnOptions, ServiceOperationMutationKey, ServiceOperationQueryKey, ServiceOperationUseMutationOptions, UseQueryOptionsForUseQueries, UseQueryOptionsForUseSuspenseQuery, WithOptional, QraftServiceOperationsToken } from "@openapi-qraft/tanstack-query-react-types"; +import type { CancelOptions, DefinedInitialDataInfiniteOptions, DefinedInitialDataOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, InfiniteQueryPageParamsOptions, InvalidateOptions, Mutation, MutationState, NoInfer, QueryState, RefetchOptions, ResetOptions, SetDataOptions, UndefinedInitialDataInfiniteOptions, UndefinedInitialDataOptions, Updater, UseInfiniteQueryResult, UseMutationResult, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; export interface ApprovalPoliciesService { /** * @summary Get an approval policy by ID diff --git a/packages/tanstack-query-react-plugin/src/__snapshots__/queryable-write-operations/services/FilesService.ts.snapshot.ts b/packages/tanstack-query-react-plugin/src/__snapshots__/queryable-write-operations/services/FilesService.ts.snapshot.ts index 16aa20171..0dd761907 100644 --- a/packages/tanstack-query-react-plugin/src/__snapshots__/queryable-write-operations/services/FilesService.ts.snapshot.ts +++ b/packages/tanstack-query-react-plugin/src/__snapshots__/queryable-write-operations/services/FilesService.ts.snapshot.ts @@ -4,8 +4,8 @@ */ import type { paths } from "../../openapi.d.ts"; -import type { DeepReadonly, InvalidateQueryFilters, MutationFiltersByMutationKey, MutationFiltersByParameters, MutationVariables, OperationError, OperationInfiniteData, PartialParameters, QueryFiltersByParameters, QueryFiltersByQueryKey, QueryFnOptionsByParameters, QueryFnOptionsByQueryKey, RequestFnResponse, ServiceOperationEnsureInfiniteQueryDataOptions, ServiceOperationEnsureQueryDataOptions, ServiceOperationFetchInfiniteQueryOptions, ServiceOperationFetchQueryOptions, ServiceOperationInfiniteQueryKey, ServiceOperationMutationFnOptions, ServiceOperationMutationKey, ServiceOperationQueryKey, ServiceOperationUseMutationOptions, UseQueryOptionsForUseQueries, UseQueryOptionsForUseSuspenseQuery, UseSuspenseInfiniteQueryOptions, WithOptional, QraftServiceOperationsToken } from "@openapi-qraft/tanstack-query-react-types"; -import type { CancelOptions, DefinedInitialDataInfiniteOptions, DefinedInitialDataOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, InfiniteQueryPageParamsOptions, InvalidateOptions, Mutation, MutationState, NoInfer, QueryState, RefetchOptions, ResetOptions, SetDataOptions, UndefinedInitialDataInfiniteOptions, UndefinedInitialDataOptions, Updater, UseInfiniteQueryResult, UseMutationResult, UseQueryResult, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import type { DeepReadonly, InvalidateQueryFilters, MutationFiltersByMutationKey, MutationFiltersByParameters, MutationVariables, OperationError, OperationInfiniteData, PartialParameters, QueryFiltersByParameters, QueryFiltersByQueryKey, QueryFnOptionsByParameters, QueryFnOptionsByQueryKey, RequestFnResponse, ServiceOperationEnsureInfiniteQueryDataOptions, ServiceOperationEnsureQueryDataOptions, ServiceOperationFetchInfiniteQueryOptions, ServiceOperationFetchQueryOptions, ServiceOperationInfiniteQueryKey, ServiceOperationMutationFnOptions, ServiceOperationMutationKey, ServiceOperationQueryKey, ServiceOperationUseMutationOptions, UseQueryOptionsForUseQueries, UseQueryOptionsForUseSuspenseQuery, WithOptional, QraftServiceOperationsToken } from "@openapi-qraft/tanstack-query-react-types"; +import type { CancelOptions, DefinedInitialDataInfiniteOptions, DefinedInitialDataOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, InfiniteQueryPageParamsOptions, InvalidateOptions, Mutation, MutationState, NoInfer, QueryState, RefetchOptions, ResetOptions, SetDataOptions, UndefinedInitialDataInfiniteOptions, UndefinedInitialDataOptions, Updater, UseInfiniteQueryResult, UseMutationResult, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; export interface FilesService { /** @summary Get a files by ID */ getFiles: {