Breaking Changes
- [TanStack Query] hooks signature is cleaned up and extra parameters are merged into query/mutation options.
- [SWR] legacy mutation function generation is removed. Use mutation hooks instead.
- [SWR] removed the deprecated
initialData
option. UsefallbackData
instead. - [Server Adapter] the deprecated
useSuperJSON
flag is removed. - [Zod] generated model schemas now follows field optionality as defined in ZModel schema.
Features
- The
enhance
API now generates strong typing for theuser
context, based on the fields access fromauth()
in access policies. - [TanStack Query/SWR] a new
optimisticDataProvider
callback option is added. You can use it to fully control how optimistic update data is computed for each query cache entry. - [Polymorphism] the generated
enhance
API now respects the client extension's typing of theprisma
parameter.
Fixes and Improvements
- [Polymorphism] fixed the problem generated prisma schema may have foreign key constraint ambiguity issue.
- [Polymorphism] fixed the problem that generated auxiliary relations can cause naming conflict.
- [Polymorphism] fixed the problem that fields in base models cannot be used in
orderBy
. - [Polymorphism] return full entity data when queried with a base model.
- [Polymorphism] disallow inheriting from multiple delegate models.
- Fields with
@default
withauth()
are properly generated as TypeScript optional. - More robustly calculate the default location for code generation.
Full Changelog: v2.0.0-alpha.2...v2.0.0-beta.1