Skip to content

Releases: zenstackhq/zenstack

ZenStack Release v3.5.1

25 Mar 04:14
826cc4e

Choose a tag to compare

What's Changed

  • Fixed regression of CLI plugin resolution

Full Changelog: v3.5.0...v3.5.1

ZenStack Release v3.5.0

25 Mar 01:44
49e1fe6

Choose a tag to compare

New Features

  • Client-side computed fields extension by @genu doc
  • OpenAPI specification generator (for RESTful style API only) doc
  • RESTful-style API now supports additional endpoints for nested read and write for related resources by @lsmith77 doc
  • Zod schema generation now supports selecting fields and relations by @marcsigmund doc
  • VSCode extension (v3) now supports generating human-readable documentation for ZModels
    image

Performance

  • ZenStackClient now provides a $diagnostics property containing performance-related metrics doc.
  • Optimized the generated TypeScript schema's typing to improve tsc performance.
  • Eliminated several unnecessary pre-mutation reads to improve mutation performance.
  • Reduced the overhead of post-query data rows processing.
  • Improved many-to-many relation manipulation by batching foreign key updates.

Breaking Changes

  • We've unified field names' casing in ZenStackClient options to "lower-case-first".

    // old
    const db = new ZenStackClient(schema, {
      omit: { User: { ... } },
      computed: { User: { ... } }
    });
    
    // new
    const db = new ZenStackClient(schema, {
      omit: { user: { ... } },
      computed: { user: { ... } }
    });

Fixes and Improvements

  • Unsupported typed fields are now excluded from ORM client since they cannot be represented on the ORM side.
  • Access policy plugin now has an option to allow executing raw SQL (without policy enforcement) by @pkudinov doc
  • Fixed incorrect zod typing for scalar list fields by @haltcase #2499
  • Preserve transaction state when calling $use, $unuse, and $unuseAll by @pkudinov #2494
  • Disallow include on models without relation fields #2488

New Contributors

Welcome @haltcase @elliots @marcsigmund as our new contributors ❤️ !

Full Changelog: v3.4.6...v3.5.0

ZenStack Release v3.4.6

11 Mar 22:13
d4fbb38

Choose a tag to compare

Changes in this release

What's Changed

  • [orm] Field default values with @default(now()) are now generated on the client side for behavioral consistency
  • [orm] Fixed the issue that direct value filter with null is not properly compiled to SQL #2472
  • [orm] Added webpack magic comment to suppress bundler (e.g., Next.js) warnings when they process dynamic import of "pg" package #2470

Full Changelog: v3.4.5...v3.4.6

ZenStack Release v3.4.5

08 Mar 02:27
266106c

Choose a tag to compare

What's Changed

  • [orm] Improved long alias name handling to avoid exceeding PG name length limit by @pkudinov #2424
  • [perf] Use EXISTS instead of COUNT subquery for some/none/every relation filters #2440
  • [orm] Fixed the issue that fields inherited from delegate models originating from mixes are not properly handled #2351
  • [policy] Fixed an assert error when evaluating policies for "create" operation involving optional fields by @pkudinov #2460

New Contributors

  • Welcome @pkudinov as our new contributor ❤️ !

Full Changelog: v3.4.4...v3.4.5

ZenStack Release v3.4.4

05 Mar 04:54
552b634

Choose a tag to compare

What's Changed

  • [proxy] Excluded Unsupported type fields
  • [cli] Report error when plugin module cannot be resolved #2393
  • [orm] Fixed toposort cyclic dependency issue with the $pushSchema test API #2435

Full Changelog: v3.4.3...v3.4.4

ZenStack Release v3.4.3

03 Mar 23:58
51b86db

Choose a tag to compare

What's Changed

  • [cli] Exclude Prisma migrations table from SQLite "db pull" by @svetch
  • [cli] Add "@zenstackhq/schema" package to "npm create zenstack" and "zen init" commands
  • [zod] Fixed the wrong argument handling when processing @length validation attribute #2433

Full Changelog: v3.4.2...v3.4.3

ZenStack Release v3.4.2

02 Mar 15:40
02b0dcc

Choose a tag to compare

What's Changed

  • [ORM] Add an option to skip validating computed fields

Full Changelog: v3.4.0...v3.4.2

ZenStack Release v3.4.1

02 Mar 06:34
c521123

Choose a tag to compare

Changes

  • Fixed an issue that CLI requires "pg" package to be installed.

ZenStack Release v3.4.0

01 Mar 04:21
c521123

Choose a tag to compare

New Features ☀️

Schema Introspection

The new "db pull" command introspects the current database schema and creates an incremental update to your current ZModel. This awesome feature is contributed by @svetch . doc

Slicing ORM API

The new slicing ORM client option allows you to restrict the capabilities of a client - what models to provide, what query operations to allow, what kinds of filtering are supported, etc. doc

const slicedDb = db.$setOptions({
  ...db.$options,
  slicing: {
    // exclude the Comment model entirely
    excludedModels: ['Comment'],
    models: {
      post: {
        // exclude `deleteMany` operation for 'Post' model
        excludedOperations: ['deleteMany'],
        fields: {
          title: {
            // only allow equality filter for "Post.title" field
            includedFilterKinds: ['Equality']
          }
        }
      }
    }
  }
});

Deriving Zod Schemas

This release introduced two Zod schema factories for different validation purposes.

1. Model Validation

A @zenstackhq/zod package is added that provides a factory for creating Zod schemas to validate models, types, and enums as defined in ZModel. doc

This is useful for use cases like using ZModel as the single source of truth for validating form input, etc.

2. ORM Query Args Validation

The ZenStackClient object now exposes a $zod property for creating Zod schemas that validate the input args of ORM API calls, like findUnique, createMany, etc. doc

This is useful for building layers above ZenStack ORM that eventually pass user input to ORM API calls.

Sequential Transaction for RPC API Handler

The RPC API handler now supports sequential transactions via the "$transaction/sequential" endpoint. doc

Fixes and Improvements 🔧

  • Fixed an issue with malformed SQL generation when entity mutation hooks are used with delegate models by @genu .
  • Fixed an issue with malformed SQL generation when calling find APIs with select but without any truthy fields #2344
  • Fixed the issue when "view" is used in ZModel, the Prisma schema generated during migration is not configured with the "views" preview feature #2376
  • Fixed a typing issue that "_count" property is not allowed in nested selection #2343
  • Fixed a malformed SQL generation issue related to field-level policies #2385
  • Fixed the issue that ORM-generated SQL may contain identifiers too long for Postgres #2378
  • Computed fields configuration is validated when creating ZenStackClient by @lsmith77 .
  • Updated several potentially vulnerable dependencies.

Breaking Changes ❗️

  • To make the generated TypeScript schema more portable, the import from "@zenstackhq/orm" is replaced with "@zenstackhq/schema" package. This may cause build errors depending on what package manager you use. It's recommended to explicitly install the "@zenstackhq/schema" package in projects where the TypeScript schema is consumed.

ZenStack Release v2.22.2

29 Dec 12:48
2bc0e5b

Choose a tag to compare

What's Changed

  • Fixed the issue that "url" field in "datasource" block is needed which blocks Prisma 7 usage.
  • Fixed a zod4 compatibility issue when @password attribute is used.

Full Changelog: v2.22.1...v2.22.2