Releases: zenstackhq/zenstack-v3
ZenStack Release v3.3.3
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
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
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
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 -
betweenfilter operator by @sanny-iodb.user.findMany({ age: { between: [0, 18] } });
-
Excluding fields from triggering
@updatedAtfields update by @sanny-iomodel 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
PostandCommenthaspublishedfield 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
- zenstack-kit by @olup
Drizzle-kit like CLI tooling for ZenStack schemas with Prisma-compatible migrations. - zenstack-live by @sanny-io
Supercharge your ZenStack backend with realtime streaming capabilities. - zenstack-cache by @sanny-io
Reduce response times and database load with query-level caching integrated with the ZenStack ORM. - zenstack-aurex by @mateusp2070
Deterministic, namespace-aware Aurex ID generation for ZenStack v3.
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
TIMESTAMPTZfield 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
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
🎉 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) : UserThis 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
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
Changes in this release
- Merge pull request #565 from zenstackhq/fix/issue-558
ZenStack Release v3.0.0
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
What's Changed
- CLI can now load TypeScript plugins directly (via jiti).
Full Changelog: v3.0.0-beta.33...v3.0.0-beta.34