@@ -9,37 +9,67 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
1010### Added
1111
12- - New query options exports for better React Query v5 compatibility
13- - ` {methodName}QueryOptions ` functions for regular queries
14- - ` {methodName}MutationOptions ` functions for mutations
15- - ` {methodName}InfiniteQueryOptions ` functions for infinite queries
16- - Service getter functions (` get{ServiceName}Service ` ) for use in non-React contexts
17- - Query key builder utility for type-safe cache invalidation and queries
12+ - ** New query/mutation/infinite options exports** for React Query v5 compatibility
13+ - ` {methodName}QueryOptions ` functions that return ` queryOptions ` for use with ` useQuery ` /` useSuspenseQuery `
14+ - ` {methodName}MutationOptions ` functions that return ` mutationOptions ` for use with ` useMutation `
15+ - ` {methodName}InfiniteQueryOptions ` functions that return ` infiniteQueryOptions ` for use with ` useInfiniteQuery ` /` useSuspenseInfiniteQuery `
16+ - These exports enable better tree-shaking and composability
17+ - Full TypeScript support with proper generic types
18+ - ** Service getter functions** for non-React contexts
19+ - ` get{ServiceName}Service() ` functions that return service instances without React hooks
20+ - Enables use of API clients outside React components (e.g., in server-side code, scripts, tests)
21+ - ** Query key builder utility** (` query-key-builder.ts ` ) for type-safe cache operations
22+ - ` matchQueryKey() ` function for building type-safe query keys
23+ - ` QueryKeyMap ` , ` ServiceKeys ` , ` OperationKeys ` , and ` OperationParams ` types for full type safety
24+ - Enables precise cache invalidation and query matching
1825
1926### Changed
2027
21- - Generated hooks now use simplified ` @deprecated ` JSDoc tags instead of custom deprecation blocks
22- - Query keys now use a simpler static structure based on interface and method names
23- - Changed from URL-based resource keys to pattern: ` ['interface', 'method', params || {}] `
24- - Interface names in query keys now use camelCase for consistency with JavaScript conventions
25- - Removed complex URL path parsing logic for cleaner, more predictable keys
26- - Refactored internal code generation to use helper functions instead of NameFactory class
28+ - ** Query key structure completely redesigned** for simplicity and consistency
29+ - Changed from complex URL-based patterns (e.g., `` `/widgets/${id}` `` ) to simple arrays: ` ['serviceName', 'methodName', params || {}, metadata?] `
30+ - Infinite queries now differentiated by metadata (` {infinite: true} ` ) instead of key structure
31+ - All queries for an interface can now be invalidated with just ` ['interfaceName'] `
32+ - Removed ` buildResourceKey() ` , ` isCacheParam() ` , and complex path parsing logic
33+ - ** Mutations now invalidate at the interface level** instead of specific resource paths
34+ - Simplified from invalidating multiple specific query keys to just ` queryClient.invalidateQueries({ queryKey: ['interfaceName'] }) `
35+ - More predictable cache invalidation behavior
36+ - ** Refactored naming system** from class-based to function-based
37+ - Replaced ` NameFactory ` class with standalone functions in ` name-helpers.ts `
38+ - Functions: ` buildHookName() ` , ` buildQueryOptionsName() ` , ` buildMutationOptionsName() ` , ` buildInfiniteQueryOptionsName() ` , ` buildServiceName() ` , ` buildServiceHookName() ` , ` buildServiceGetterName() ` , ` buildContextName() ` , ` buildProviderName() `
39+ - ` buildHookName() ` now requires ` service ` parameter for proper context
40+ - ** Context file enhanced** with new capabilities
41+ - Added ` currentContext ` variable for non-hook access to context
42+ - Service getter functions exported alongside hooks for flexibility
43+ - Interfaces sorted alphabetically for consistent output
44+ - Props interface now extends options type with optional fetch
45+ - ** Error handling improved** with ` QueryError ` type
46+ - Changed from ` CompositeError ` throws to structured ` QueryError<Error[]> ` type
47+ - Enables better error discrimination in error handlers
2748
2849### Fixed
2950
30- - Parameter names with special characters (e.g., hyphens) are now properly handled in query keys
31- - All parameter access now uses bracket notation for consistency
32- - Object keys in query key generation are properly quoted
33- - Fixed duplicate function declarations for methods not starting with "get"
34- - Suspense hooks now correctly generate with ` useSuspense ` prefix for all method types
35- - Prevents TypeScript errors from duplicate function names
36- - Fixed invalid TypeScript syntax in query keys where optional parameter syntax (` params? ` ) was incorrectly used in runtime expressions
37- - Fixed infinite query key typo (` inifinite ` → ` infinite ` )
38- - Build configuration now properly excludes snapshot directory from TypeScript compilation
39- - Added README.md to .prettierignore to prevent formatter hanging
51+ - ** TypeScript compilation errors** in generated code
52+ - Fixed ` isRequired() ` parameter access in ` query-key-builder.ts ` (accessing ` p.value ` instead of ` p ` )
53+ - Removed unused ` includeRelayParams ` parameter that was being passed but ignored
54+ - Fixed duplicate imports and missing function exports
55+ - ** Test and snapshot generation issues**
56+ - Updated test utilities to use ` @basketry/ir ` parser instead of inline JSON parsing
57+ - Fixed snapshot file generation that was silently failing
58+ - Cleaned up debug ` console.log ` statements from test utilities
4059
4160### Deprecated
4261
43- - Legacy hook exports (` use{MethodName} ` , ` useSuspense{MethodName} ` , etc.) are now deprecated
44- - These hooks will be removed in a future major version
45- - Users should migrate to the new query options pattern with React Query's built-in hooks
62+ - ** All wrapped hook exports** are now marked as ` @deprecated `
63+ - ` use{MethodName}() ` - query hooks
64+ - ` useSuspense{MethodName}() ` - suspense query hooks
65+ - ` useInfinite{MethodName}() ` - infinite query hooks
66+ - ` useSuspenseInfinite{MethodName}() ` - suspense infinite query hooks
67+ - Hooks remain functional for backward compatibility but display deprecation warnings
68+ - Each deprecation notice includes migration guidance to the new pattern
69+ - Will be removed in the next major version (v1.0.0)
70+
71+ ### Internal
72+
73+ - Added ` xxxx() ` method in ` hook-file.ts ` that needs renaming (analyzes return types for select function generation)
74+ - Removed complex relay parameter handling from query key generation
75+ - Simplified infinite query differentiation using metadata instead of key manipulation
0 commit comments