github zenstackhq/zenstack v1.4.0
ZenStack Release v1.4.0

latest releases: v2.9.1, v2.9.0, v2.8.1...
11 months ago

New Features

  • SWR plugin now generates mutation as hooks (they were plain async functions in the previous versions) and supports automatic optimistic update docs

    Old mutation usage:

    const { createPost } = useMutatePost();
    async function onCreate() {
        await createPost(...);
    }

    New mutation hooks:

    const { trigger: create, isMutating } = useCreatePost();
    function onCreate() {
        create(...);
    }
  • New zenstack format CLI command for formatting ZModel files. Useful for people who are using non-VSCode IDE.

Breaking Changes

  • Field-level access policy for "update" and "all" kinds are not allowed on relation fields anymore. It wasn't clear if the rule guards updates to the relation or the entity linked by the relation. To guard the update of a relation, put rules on the foreign key fields instead. I.e., change:

    model Post {
        ...
        author User @relation(fields: [authorId], references: [id]) @allow('update', ...)
        authorId String
    }

    to:

    model Post {
        ...
        author User @relation(fields: [authorId], references: [id])
        authorId String @allow('update', ...)
    }

Fixes and Improvements

  • Support for multi-level model inheritance #540
  • Zod plugin now generates foreign key fields into the schemas #828
  • Stricter type compatibility check to binary operations in policy rules #804
  • Cosmetic updates to REPL, and fixed compatibility with pnpm environment #854
  • Fixed compatibility with Prisma Client Extensions that add new methods to models #852
  • Fixed a query injection problem when a create is nested inside of an update in array form #864
  • Fixed tanstack-query plugin's runtime compatibility with tanstack v5
  • Fixed the problem that auth() cannot be resolved when User model is marked @@ignore #840

Full Changelog: v1.3.2...v1.4.0

Don't miss a new zenstack release

NewReleases is sending notifications on new releases.