Skip to content

Releases: zenstackhq/zenstack-v3

ZenStack Release v3.3.3

06 Feb 14:17
7dd398c

Choose a tag to compare

What's Changed

  • [orm] Added missing type mapping attributes for mysql
  • [studio] Automatically omit computed fields when starting proxy
  • [orm] Fixed a postgres regression about casting array values #651

Full Changelog: v3.3.2...v3.3.3

ZenStack Release v3.3.2

01 Feb 14:17
bcb323a

Choose a tag to compare

What's Changed

  • Fixed a TypeScript compiler OOM issue when using TanStack Query integration with Next.js #610 by @alexbatis

New Contributors

Thank you for getting this important issue fixed @alexbatis !

Full Changelog: v3.3.1...v3.3.2

ZenStack Release v3.3.1

01 Feb 00:36
2e3b654

Choose a tag to compare

What's Changed

  • [TanStack] Fixed the problem that local imports are missing ".js" extension #607

Full Changelog: v3.3.0...v3.3.1

ZenStack Release v3.3.0

31 Jan 06:49
880d7e4

Choose a tag to compare

New Features

  • MySQL support!

    This is the first preview release, and we'd love to hear your feedback.

    import { createPool } from 'mysql2';
    import { MysqlDialect } from '@zenstackhq/orm/dialects/mysql';
    const db = new ZenStackClient(schema, {
      dialect: new MysqlDialect({ pool: createPool(...) })
    });
  • Plugin: adding new members to the ORM client and new properties to query args.

    const pluginDb = db.$use({
      ...
      client: {
        async $invalidateCache() { ... }
      },
      queryArgs: {
        // introduce an `cache` property to all "read" methods: `findUnique`, `groupBy`, etc.
        $read: { 
          // a zod schema for type inference and runtime validation of the new arg property
          z.object({ cache: z.boolean().optional() }).optional() }
       }
    });
    
    await pluginDb.user.findMany({ where: { ... }, cache: true });
    await pluginDb.$invalidateCache();

    Docs: http://zenstack.dev/docs/orm/plugins/extending-orm-client
    Real-world example: zenstack-cache

  • between filter operator by @sanny-io

    db.user.findMany({ age: { between: [0, 18] } });
  • Excluding fields from triggering @updatedAt fields update by @sanny-io

    model Foo {
      ...
      meta String
    
      // not automatically updated if only `meta` field is updated
      updatedAt DateTime @updatedAt(ignore: [meta])
    }
  • Binding variables in collection predicates by @mwillbanks

    This is a subtle but important addition to the ZModel language. In access policies you can use collection predicate to build a boolean condition from a to-many relation, like: posts?[published]. And, you can nest such expressions to do deep relation traversal, like: posts?[published && comments?[published]].

    See the problem? Both Post and Comment has published field and the reference becomes ambiguous. In this release, you can add "binding" variables to denote the element of the current collection to disambiguate (similar to how you use .map() in JS):
    posts?[p, p.published && comments[c, c.published]]

Performance

This release addressed a high memory usage issue caused by insufficient caching of Zod schemas used to validate query args. You should see big improvements if you have schemas with complex relations. Please keep reporting perf issues and we'll investigate with high priority.

From the Community

You guys are crazy 😆. Thank you for the amazing contributions!

Fixes and Improvements

  • [ORM] Fixed an issue with timezone mess up when using postgres with TIMESTAMPTZ field type #606
  • [ORM] Fixed several issues with handling array values for postgres #595
  • [ZModel] Fixed the issue the fields inherited from mixins defined in imported files cannot be properly resolved #598
  • [Better-Auth] Fixed a schema generation issue when custom fields are defined for better-auth models #592
  • [QaaS] Fixed a regression related to the "externalIdMapping" setting of RESTful API handler by @lsmith77 #611

Full Changelog: v3.2.1...v3.3.0

ZenStack Release v3.2.1

11 Jan 13:16
d150edb

Choose a tag to compare

What's Changed

  • [orm] Fixed the issue that reading back mutation results can cause errors by @mwillbanks #586
  • [zmodel] Improve attribute argument assignability check
  • [orm] Fixed typing issues when "_count" is nested inside "include" clause #570

Full Changelog: v3.2.0...v3.2.1

ZenStack Release v3.2.0

09 Jan 11:35
b0996b4

Choose a tag to compare

🎉 New Features

Lots of cool stuff just landed, guys!

🚀 Custom Procedures

Use the new procedure keyword to define custom procedures in ZModel, and implement them with TypeScript. The procedures are accessible with the ORM client, the QaaS query services, and the TanStack Query hooks.

// get blog post feeds for a given user
procedure getUserFeeds(userId: Int, limit: Int?) : Post[] 

// sign up a new user
mutation procedure signUp(email: String) : User

This powerful feature is implemented by @mwillbanks doc

🚀 Field-level Access Control

Use the @allow and @deny attributes to define "read" or "update" rules for fields. doc

🚀 exists API

Use it to more easily and performantly check if rows matching a condition exist. Available through the ORM client, QaaS, and TanStack Query hooks. This amazing addition is implemented by @sanny-io

await db.post.exists({ where: { published: true } });

🚀 CLI Watch Mode

You can now run the CLI generation in watch mode with zen generate --watch. It detects input changes (the main ZModel and all its imports) and reruns generation automatically. Thanks @DoctorFTB for adding this long-awaited feature!

🚀 Community Package for TRPC

@olup created the zenstack-trpc package for automatically deriving tRPC routers from ZenStack v3 schemas. Compared to ZenStack v2's tRPC integration, this new implementation is much lighter-weight (no code-gen), and provides awesome type-safety. Check the repo for details!

🛠️ Improvements and Fixes

  • Fixed enum array CRUD issues with postgresql #576
  • Preserve zod validation errors when validating custom json types #558 (from v3.1.1)

Full Changelog: v3.1.1...v3.2.0

ZenStack Release v3.1.1

06 Jan 13:22
17d4ff2

Choose a tag to compare

What's Changed

  • [orm] Preserve zod validation errors when validating custom json types #558

Full Changelog: v3.1.0...v3.1.1

ZenStack Release v3.1.0

30 Dec 13:41
de795f5

Choose a tag to compare

Changes in this release

  • Merge pull request #565 from zenstackhq/fix/issue-558

ZenStack Release v3.0.0

24 Dec 10:09
e71bee7

Choose a tag to compare

Changes in this release

v3.0.0 stable release 🎉

  • [orm] Simplified typing of client constructor
  • [zmodel] Stricter validation for views

Full Changelog: v3.0.0-beta.34...v3.0.0

ZenStack Release v3.0.0-beta.34

19 Dec 02:20
e371ec9

Choose a tag to compare

What's Changed

  • CLI can now load TypeScript plugins directly (via jiti).

Full Changelog: v3.0.0-beta.33...v3.0.0-beta.34