github zenstackhq/zenstack v2.0.0
ZenStack Release v2.0.0 🎉

latest releases: v2.6.2, v2.6.1, v2.6.0...
5 months ago

Features

Make sure you read the full upgrade guide before upgrading!

1. Polymorphic Relations

You can now model a polymorphic inheritance hierarchy using the "delegated types" pattern. Read more details here.

2. Using auth() Inside @default Attribute

You 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!

3. Edge Runtime Support (Preview)

The @zenstackhq/runtime package is compatible with Vercel Edge Runtime and Cloudflare Workers. See here for more details.

4. Server Adapter for NestJS

An official adapter for using ZenStack with NestJS that plays well with its dependency injection. See here for more details.

5. Formating ZModel in Prisma Style

Yes, we heard your voices, and here it comes 😄. Please update the VSCode extension and JetBrains plugin to the latest version and enjoy.

image

You can toggle back to the old behavior in the extension settings (VSCode only).

Improvements and Fixes

This release also contains many DX improvements and fixes.

Full Changelog: v1.12.4...v2.0.0

Don't miss a new zenstack release

NewReleases is sending notifications on new releases.