Fullstack TypeScript toolkit that enhances Prisma ORM with flexible Authorization layer for RBAC/ABAC/PBAC/ReBAC, offering auto-generated type-safe APIs and frontend hooks.
MIT License
Bot releases are visible (Hide)
Published by ymc9 6 months ago
Full Changelog: https://github.com/zenstackhq/zenstack/compare/v2.0.1...v2.0.2
Published by ymc9 6 months ago
Full Changelog: https://github.com/zenstackhq/zenstack/compare/v2.0.0...v2.0.1
Published by ymc9 6 months ago
Make sure you read the full upgrade guide before upgrading!
You can now model a polymorphic inheritance hierarchy using the "delegated types" pattern. Read more details here.
auth()
Inside @default
AttributeYou can now use the auth()
function call inside @default()
attribute in ZModel. It's very handy for models that should always be connected to the current user during creation. By providing such a default value, you don't need to explicitly connect to the user anymore:
model Post {
...
author User @relation(...)
authorId String @default(auth().id)
}
const db = enhance(prisma, { user: getCurrentUser() });
const post = await db.post.create({ title: 'Post1' }); // no need to connect the `author` field
Special thanks to Augustin for making this feature happen!
The @zenstackhq/runtime
package is compatible with Vercel Edge Runtime and Cloudflare Workers. See here for more details.
An official adapter for using ZenStack with NestJS that plays well with its dependency injection. See here for more details.
Yes, we heard your voices, and here it comes 😄. Please update the VSCode extension and JetBrains plugin to the latest version and enjoy.
You can toggle back to the old behavior in the extension settings (VSCode only).
This release also contains many DX improvements and fixes.
Full Changelog: https://github.com/zenstackhq/zenstack/compare/v1.12.4...v2.0.0
Published by ymc9 6 months ago
@@id
fields. #1271Full Changelog: https://github.com/zenstackhq/zenstack/compare/v1.12.3...v1.12.4
Published by ymc9 6 months ago
zenstack
CLI formats ZModel files with prisma-like indentation style by default. #885zenstack
CLI now auto-format the generated prisma schema by default.auth()
inside @default()
.auth()
is not properly resolved if the auth model is imported. #1257@@index
attribute is incorrectly inherited from the base. #1243Full Changelog: https://github.com/zenstackhq/zenstack/compare/v2.0.0-beta.8...v2.0.0-beta.13
Published by ymc9 6 months ago
enhance
doesn't handle relations of the same type but different names properly #1241Full Changelog: https://github.com/zenstackhq/zenstack/compare/v1.12.2...v1.12.3
Published by ymc9 6 months ago
this
is used in post-update rules.Full Changelog: https://github.com/zenstackhq/zenstack/compare/v1.12.1...v1.12.2
Published by ymc9 6 months ago
Full Changelog: https://github.com/zenstackhq/zenstack/compare/v2.0.0-beta.5...v2.0.0-beta.8
Published by ymc9 6 months ago
@db.Uuid
attribute by @sakgoyalFull Changelog: https://github.com/zenstackhq/zenstack/compare/v1.12.0...v1.12.1
Published by ymc9 7 months ago
This release notes includes cumulated fixes and improvements since the last 1.11.0 release.
enhance
API now has an extra prismaModule
option to allow passing in the Prisma
module when the prisma client is generated into a custom location docs
skipDuplicates
option is specified in a nested createMany
payload #1162Full Changelog: https://github.com/zenstackhq/zenstack/compare/v1.11.0...v1.12.0
Full Changelog: https://github.com/zenstackhq/zenstack/compare/v1.11.0...v1.12.0
Published by ymc9 7 months ago
auth()
field from a base model is not properly resolved #1179Full Changelog: https://github.com/zenstackhq/zenstack/compare/v2.0.0-beta.3...v2.0.0-beta.5
Published by ymc9 7 months ago
@@map
attribute is incorrectly inherited from base models.this
in collection predicate expressions.Full Changelog: https://github.com/zenstackhq/zenstack/compare/v1.11.0...v2.0.0-beta.3
Published by ymc9 7 months ago
initialData
option. Use fallbackData
instead.useSuperJSON
flag is removed.enhance
API now generates strong typing for the user
context, based on the fields access from auth()
in access policies.optimisticDataProvider
callback option is added. You can use it to fully control how optimistic update data is computed for each query cache entry.enhance
API now respects the client extension's typing of the prisma
parameter.orderBy
.@default
with auth()
are properly generated as TypeScript optional.Full Changelog: https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.2...v2.0.0-beta.1
Published by ymc9 7 months ago
You can now import ZModel from packages in node_modules
! Very useful if you want to manage and share ZModel files in a component-based setup. By @TGTGamer
import "@myorg/foo/bar"
import "mypackage/base"
...
This release gives a minor version bump for several fixes made in the "1.10.x" patch releases.
@@validate
model-level rules cause incorrect runtime validation error for updates #1078upsert
with array-form input results in a partial write #1080Full Changelog: https://github.com/zenstackhq/zenstack/compare/v1.10.0...v1.11.0
Published by ymc9 8 months ago
zenstack
CLI errors when running bun/bunx in non-tty environment by @ErikMCM@@fulltext
, @@db.VarBinary
) by @Ustice@trim
, @lower
, @upper
) are not effective for update operations #1005z.coerce.date()
) for DateTime
typed fields #1067error
field of the TanStack Query mutation hooks #1062New quick start guide for NextJS app router.
Welcome @ErikMCM @Ustice and @TGTGamer to becoming our new contributors!
Full Changelog: https://github.com/zenstackhq/zenstack/compare/v1.9.0...v1.10.0
Published by github-actions[bot] 8 months ago
Published by ymc9 8 months ago
auth()
in @default()
by @Azzerty23Check here for a list of breaking changes.
Please make sure to check out the Upgrading to V2 documentation for more details.
Published by ymc9 8 months ago
@trim
, @upper
, @lower
- they make sure values are transformed before storing into the database, and are also generated as corresponding Zod calls by the @core/zod
plugin. By @simonedelmann docs
timeout
, maxWait
, etc.) used internally by ZenStack are configurable #986 docs
@omit
attribute doesn't trim fields included in a nested one-to-many #984useSuspense
and useSuspenseInfinite
query hooks when generating for version "v5" and targeting "react" #857Full Changelog: https://github.com/zenstackhq/zenstack/compare/v1.8.1...v1.9.0
Published by ymc9 9 months ago
Thanks to @Azzerty23 for the contribution!
Full Changelog: https://github.com/zenstackhq/zenstack/compare/v1.7.1...v1.8.0
Published by ymc9 9 months ago
updateMany
or delegeMany
are nested inside update
operation in certain cases #961Full Changelog: https://github.com/zenstackhq/zenstack/compare/v1.7.0...v1.7.1