Releases: zenstackhq/zenstack
ZenStack Release v2.9.1
What's Changed
- Fixed a CLI warning when generating in a pnpm workspace with custom prisma client output settings #1875
Full Changelog: v2.9.0...v2.9.1
ZenStack Release v2.9.0
New Features
1. Using "type" to define the shape of auth()
In previous versions, the auth()
call in ZModel must be resolved to a User
model or a model marked @@auth
. However, when using auth-as-a-service products like Clerk, you can choose not to store user data in the database. This release allows you to define the auth model as a type
. E.g.:
type User {
id String
...
}
Or
type Auth {
id String
@@auth
}
2. Portable mode for TanStack Query hooks
The @zenstackhq/tanstack-query plugin has a new "portable" option to make the generated code's typing "self-contained". When enabled, PrismaClient's types will be included with the generated code. It's useful when you output the hooks code into a separate project where Prisma/ZenStack is not referenced. Please note that the "@zenstackhq/tanstack-query" package still needs to be referenced in the target project. doc
plugin hooks {
provider = '@zenstackhq/tanstack-query'
output = "../client/src/lib/hooks"
target = "react"
portable = true
}
3. Reducing the size of generated OpenAPI spec
When using the @zenstackhq/openapi plugin to generate API spec for the "rpc" flavor, the result can be huge due to how Prisma allows flexible structures of query and mutation input. This release introduced a omitInputDetails
option to generate the specification with lower fidelity. When the option is turned on, fields in the query/mutation input like where
, select
, data
, etc. will be generated as generic objects. doc
plugin openapi {
provider = '@zenstackhq/openapi'
flavor = 'rpc'
omitInputDetails = true
...
}
Fixes and Improvements
- TanStack Query and SWR hooks now handle nested read data during optimistic updates #1840
- Prisma client extensions now work consistently regardless the order you call
enhance
and$extends
- Generated TS code now includes
// @ts-nocheck
to suppress tsc warnings by @genu - Fixed the issue that unreferenced enums in ZModel cause generation errors #1835
- Fixed compatibility issues with turborepo #1687
- Fixed ZModel validation error when importing enums from a separate schema file #1849
- Fixed runtime error when creating delegate model entities with foreign key fields with default values #1843
- Include
null
into a type's field if the field is optional #1857 - Fixed code generation issue when a
type
is recursive #1868 - Using
@@validate
inside type declarations is now supported - Fixed OpenAPI generation to exclude foreign key fields from mutation payload by @thomassnielsen
New Contributors
- Welcome @genu as our new contributor! ❤️
Full Changelog: v2.8.1...v2.9.0
ZenStack Release v2.8.1
What's Changed
- Fixed incorrect validation errors when using typed JSON fields in a multi-file schema setup #1833
- Support using enums as type declaration fields #1834
Full Changelog: v2.8.0...v2.8.1
ZenStack Release v2.8.0
New Features
Fixes and Improvements
- Cleaned up documentation comments handling in ZModel. Both triple-slash and JS-doc style comments will appear in IDE hover tooltip. Only triple-slash comments are passed along to the generated Prisma schema. doc
- Fixed the issue that
@@index
attribute is incorrectly inherited from delegate base models #1786 - The permission-checking API now respects policies delegated through the
check()
policy function #1612 - Fixed Prisma schema generation error when self-relations are used with delegate models #1764
- Fixed potential null-field-access in hooks
- The
zenstack repl
CLI command now supports loading ZenStack-generated modules from a custom location #1768 docs - Fixed incorrect Prisma query when querying a delegate model with an array
orderBy
clause #1755 - Prisma 5.22 support
Full Changelog: v2.7.5...v2.8.0
ZenStack Release v2.7.5
What's Changed
- Fixed compatibility issues in CloudFlare worker runtime caused by "cross-fetch" used in generated hooks
Full Changelog: v2.7.4...v2.7.5
ZenStack Release v2.7.4
What's Changed
- Next.js 15 support: adapted to the breaking change as mentioned here by @AmruthPillai #1797
- Several improvements about using models with compound ID with RESTful API handler by @thomassnielsen #1801 #1806
Welcome @AmruthPillai as our new contributor ❤️ !
Full Changelog: v2.7.3...v2.7.4
ZenStack Release v2.7.3
What's Changed
- Include relationships in RESTful API handler results from creates and updates by @thomassnielsen
Full Changelog: v2.7.2...v2.7.3
ZenStack Release v2.7.2
What's Changed
- URL-decode entity IDs in RESTful API handler to deal with ID values that include reserved characters by @thomassnielsen
- Fixed missing ZModel type checking errors when
@relation
is used withoutfields
andreferences
properties
Full Changelog: v2.7.1...v2.7.2
ZenStack Release v2.7.1
What's Changed
- Allow configuring separator of compound id values for RESTful API handler by @thomassnielsen
- Clean up unnecessary console log by @chunkerchunker
Full Changelog: v2.7.0...v2.7.1
ZenStack Release v2.7.0
New Features
- Hono server adapter! #1270 by @svetch doc
- RESTful server API handler now supports compound ID fields #1748 by @thomassnielsen doc
- TRPC client helper generation now supports Nuxt #1761 doc
Fixes and Improvements
- Fixed generated code compilation errors when Prisma is set to output to a custom relative output path #1743
- Removed
createManyAndReturn
field from "create" payload of polymorphic models to avoid confusion #1738 - TanStack-Query/SWR hooks optimistic update now supports "upsert" operation #1767 doc
- Added support to use
auth()
function inside policy filter functions (has
,contains
, etc.) - Fixed the problem that TanStack-Query optimistic update interfering with queries not managed by ZenStack #1774
- Added support for boolean fields with default values in generated Zod schemas by @Arkanii
- Generated OpenAPI spec now has all attributes as non-optional for RESTful flavor since all fields are returned #1744 by @thomassnielsen
- Fixed polymorphic model query issues when fields are inherited from an indirect abstract ancestor #1770
- Fixed IDE type-checking issue when importing a zmodel file from an npm package #1760
- Bumped Prisma peer dependency version to 5.21.x
New Contributors
Welcome @svetch @thomassnielsen @Arkanii as our new contributors! ❤️
Full Changelog: v2.6.2...v2.7.0