v2.0.0-alpha.2
Pre-release
Pre-release
2.0.0-alpha.2 (2024-06-27)
Features
- a better "zod" plugin (#521) (2280f83)
- add "loadPath" options to runtime API and server adapter options (#696) (fc50deb)
- add @@auth option for declaring auth model (#787) (c390de1)
- add
checkhooks generation to tanstack and swr plugins (#1422) (1030770) - add support for comparing fields in the same model (#631) (4776685)
- add switch to zod plugin to control whether unchecked input types are generated (#693) (cea2019)
- add zenstack CLI repl command (#808) (616be65)
- allow comparing fields from different models in mutation policies (#1476) (6610bd0)
- allow specifying zmodel location in package.json (#879) (bb149bd)
- allow to pass in a custom
Prismamodule when callingenhance(#1160) (018d59f) - allow to use custom fetch with generated hooks (#556) (2a6b31a)
- allow users to import from node_modules (#1021) (f8f214d)
- always use superjson to serialize/deserialize in the api layer (#585) (46fec66)
- automatic optimistic update for tanstack hooks (#830) (93dc7df)
- CLI improvements (#694) (eba3390)
- field-level access control (#638) (9a6f39b)
- field-level policy override (#889) (271d568)
- flexible 'createRouter' typings (#654) (e147412)
- fluent API support (#666) (4ae5a96)
- implementing access control for Prisma Pulse (#643) (d8c2e87)
- implementing permission checker (#1411) (0aa6ee9)
- improved automatic query invalidation for tanstack-query (#790) (42d654f)
- include raw zod errors in response (#691) (b5da998)
- infinite query for swr plugin (#680) (757ccb5)
- infinite query support for tanstack-query (#679) (3300499)
- JetBrains plugin for ZModel (#904) (c79be9e)
- make nextjs adapter support next 13 app dir (#483) (a078b23)
- make parameters of transactions configurable (#988) (d0745b1)
- Make ZModel color schema looks cool and consistent (#791) (6dabb02), closes #716
- more flexible "createRouter" typings (#651) (d2bffb6)
- Nuxt server adapter and tanstack-query for "vue" hooks generation (#757) (033d95d)
- optimistic update support for SWR (#860) (0ca4670)
- options for logging queries sent to prisma (#488) (ccfb2b0)
- RedwoodJS integration package (#911) (e4aeee3)
- runtime support for custom
@[@auth](https://github.com/auth)model (#793) (08b9677) - runtime: support for Prisma 5.14's
createManyAndReturn(#1479) (a783800) - support
now()function in policy rules (#480) (7de7623) - support configuring what models to include for zod and trpc plugins (#747) (a5d15a3)
- Support multiple levels inheritance (#863) (2d43692)
- support Prisma v5 (#587) (b0d9154)
- support Prisma view (#579) (af151b7)
- support using collection predicate expression with
auth()(#831) (ff1e8a5) - Support ZModel format command in CLI (#869) (bf85ceb)
- tanstack-query v5 support (#788) (0d04d8e)
- trpc plugin, add "generateModelActions" option to control what operations to generate (#482) (8693852)
- trpc plugin, generate client helpers to provide prisima-like typing (#510) (c41980d)
Bug Fixes
- @omit doesn't remove fields inside to-many relation (#993) (a4d3f15)
- [ZModelCodeGenerator] Remove the extra space between the collection predicate operator (#839) (9a0895b)
@[@validate](https://github.com/validate)should ignore fields that are not present (#1104) (79ef57a)- add "exports" to generated package.json, make trpc code-gen compatible with vite (#677) (df67f30)
- add "interactiveTransactions" preview features for lower version of Prisma (#569) (bd5666a)
- add
CheckSelecttype into code for Prisma version backward compatibility (#619) (3e09a3a) - add enum import to zod generation (#528) (2a4b5cc)
- add eslint ignore to generated trpc helper source (#759) (f7e8a08)
- add IntField as a valid mapping to TinyInt (#822) (db9cc7f)
- add missing "/runtime" exports to tanstack-query (#688) (a3064dc)
- add missing auth export (#1449) (81a2adf)
- add missing exports for the generated .zenstack package (#760) (8ac0915)
- add missing MSSQL related stdlib declarations and parameters (#748) (4e6531e)
- add missing parameters to
[@db](https://github.com/db).Decimal(#475) (8b98e6b) - add package.json exports (#597) (8ccfc93)
- add the missing "count" schema/router for zod/trpc (#667) (6e9a3b3)
- additional fixes and tests related to cross-model field comparison (#1496) (28c2bc8)
- additional fixes for unique constraint conflict detection (#1165) (9f89c7e)
- allow "view" and "import" as identifier (#750) (2e15dfb)
- allow empty expr for dbgenerated() (#1400) (#1401) (4e61a8b)
- allow models without field declarations (#749) (43322e1)
- auth() cannot be resolved if the auth model is marked @@ignore (#844) (73f2cec)
- Auto fix code generate to the wrong place for the imported module (#1377) (f6c6b65)
- automatically enable "@core/zod" plugin when there're validation rules (#535) (0519421)
- avoid generating error log when getting machine id (#977) (c50e013)
- avoid importing prisma-related code into language server (#1441) (b22c6a3)
- avoid return loaded prisma if undefined (#461) (cfca402)
- bug in enhancement proxy for detecting nested transactions (#941) (85a0525)
- bug with NOT clause reduction when condition is an array (#848) (debd35b)
- bugs related to model name casing (#645) (32d5b26)
- build, lint and etc. (#833) (cccbc3c)
- change back to loading from literal ".zenstack" path otherwise Vercel breaks :( (#701) (2d41a9f)
- clean up zod generation (#883) (909281f)
- clean up zod generation (#883) (9d4a8ed)
- client-extension test failures (#874) (f2ab6a5)
- compatibility with pnpm monorepo (#1393) (fc8d03d)
- compatibility with Prisma's "omit" feature (#1432) (296ca25)
- condition error in zod generator (#810) (eb6ef1f)
- conditions hoisted from nested read overwrites toplevel where conditions (#635) (9a35f88)
- cross-model field comparison validation issue (#1509) (9c7527f)
- deal with payload field value with undefined (#778) (e41fc74)
- decimal field zod validation (#660) (522df7a)
- delegate: avoid merging into object of Decimal, Date, etc. (#1489) (ab9d27f)
- delegate: fields from delegate models used in logical groups inside filter are not translated (#1418) (1243422)
- delegate: generated logical prisma schema has errors when abstra& (#1490) (4c74169)
- delegate: make sure concrete fields are included when a polymorphic model field is included in deep nesting (#1524) (b34531d)
- delegate: make sure nested
createManyis converted into regularcreate(#1526) (3e77974) - delegate: null reference when reading an optional relation (#1491) (41880f3)
- delegate: push base-level id assignment to base payload when creating a concrete entity (#1521) (a14bf29)
- delegate: several generation issues (#1417) (153dd4f)
- disable textmate bundle when JetBrains plugin is uninstalled (#918) (7e9cc35)
- don't import unused enum when generating policy guards (#686) (a5c110b)
- duplicated zod schema imported when there're multiple fields with an enum type (#633) (4b70853)
- enable auto completion inside attribute (#949) (20d5bfc)
- enhanced client doesn't work with client extensions that add new model methods (7dec167)
- enhanced client doesn't work with client extensions that add new model methods (#851) (ea564c9)
- expression context check issue on initial loading (#544) (05b5554)
- fastify plugin correctly returning the reply #684 (#685) (7a04ce5)
- field-level access is incorrectly rejected when there're no allow rules (#1510) (484b920)
- fix policy generation for collection predicate expressions (#706) (b8a875e)
- fix the incorrect query args reduction when there're mixed boolean operators (#690) (c0c5a16)
- generate .zenstack with the same level of @zenstackhq (#464) (2bb0b2b)
- generate both cjs and esm builds for swr plugin (#892) (385839f)
- generate foreign key field in zod schemas (#868) (124a0a2)
- generate suspense queries in tanstack-query plugin (#996) (43eb615)
- handle foreign key field-level access check during relation update (#847) (3c8cba7)
- hooks generation emits Provider export for backward compatibility (#594) (ca3ebda)
- improve binary & unary expression applicability check (#589) (eb2d896)
- improve consistency of generated guard code (#616) (1b7b5bd)
- improve error messages (#502) (c8e5724)
- improve stacktrace of errors generated by proxied Prisma methods (#484) (1b67eba)
- incorrect cross-model comparision for && and || expressions (#1512) (908048b)
- incorrect policy code generated when the rule only contains a single field reference (#511) (0ea071b)
- incorrect policy injection for nested to-one relation inside a to-many parent (#777) (876e013)
- incorrect relation owner analysis (bb64b8a)
- incorrect relation owner analysis (#610) (c89012b)
- incorrect reverse query built for to-many relation (d2ad3a5)
- incorrect reverse query built for to-many relation (#815) (2c345e1)
- incorrect validation errors for abstract models with validation rules (#991) (fa0dafb)
- infinite recursion when injecting field selection for field-level permission check (#1452) (29962e0)
- Inherited fields from abstract model should be on the top (#487) (6d1afc1), closes #486
- invalid query sent to Prisma when doing nested update with multi-id (#553) (24760be)
- issue #627 (#628) (2ef93cb)
- issue 599, throw error if the given user context doesn't contain full id fields (#629) (4bc72a8)
- issue 961, incorrect policy injection for nested
updateMany(bf690a0) - issue 961, incorrect policy injection for nested
updateMany(#962) (2b2bfcf) - issue with client typing generation in trpc plugin (#673) (576c4f7)
- issues with cross-model comparison identification and injection (#1508) (665f9b3)
- lint issue in generated swr/tanstack hooks (#877) (4577232)
- make sure Buffer is imported (#596) (76a0bac)
- make sure fields inherited from abstract base models are properly recognized as id (#1130) (4d9d093)
- make sure zod schemas have type annotations (#574) (51985b1)
- model meta generator doesn't correctly identify relation names (#1244) (4c7fbd4)
- more precise Zod refinement types (#678) (1564fe3)
- nested
createManywithskipDuplicatesoption is not handled correctly (#1163) (fef6e83) - nullify field instead of reject when an optional relation field is not readable (#588) (fc16008)
- number literal precision issue (#659) (6275701)
- openapi - do not generate "id" field in create input if the field has default value (#758) (787a244)
- openapi:
CreateManyArgsdoes not take array as input (#1246) (8137481) - optimize generated trpc typing and fix "select" issue (#972) (c0d60a0)
- optimize the way how generated packages are loaded in test environment (#549) (18267f6)
- plugins/prisma: add missing enum value documentations in generated prisma schema (#1390) (ef22b70)
- policy compilation error for deeply nested post-update rules (#1382) (08471d5)
- policy generation error when field-level rules contain "this" expression (#670) (dc106a9)
- Policy generator error for Auth() with multiple level member access (#922) (ecf0c19)
- policy generator fails on Windows for custom output path (#583) (32c7279)
- policy: properly handle array-form of upsert payload (#1101) (e7e1873)
- policy: relation filter should respect field-level policies (#1495) (54e1e02)
- polymorphic logical Prisma schema has identifiers with too long names (#1482) (65443f8)
- post-update rule for id field is not effective if id is updated (#1237) (5fe85ff)
- post-update rules incorrectly reject update (#826) (d921a7c)
- post-update rules incorrectly reject update (#826) (e85831e)
- prisma schema generation issue with calling attribute function with literal (#930) (91fe8e7)
- properly handle missing fields when evaluating
@[@validate](https://github.com/validate)model-level rules (#1097) (e8268d0) - properly handle nullable fields in openapi generator (#906) (0e422ad)
- query injection error when create (in array form) is nested inside an update (#865) (ca55bf6)
- reference resolution issue inside collection predicate expressions (#927) (d8dce13)
- relation fields are included even if they are set
falsein select clause (#1429) (6a71742) - remove warning in vercel environment (#954) (0aa69d9)
- repl in pnpm environment, improve relative path module loading (#866) (e7d29fd)
- report validation error when binary expressions have arrays (#719) (2e9fe67)
- require with default (#546) (1e9fe1c)
- resolve member access expr only in the context of operand type (#761) (ccae413)
- resolve to the correct enum in field attribute when there's ambiguity (#513) (3b07a1e)
- rest api should return error reason (#507) (4b389fb)
- rest-api, wrong links generated for to-one relationship (#481) (21affec)
- runtime: always use id fields to address existing entity during upsert (#1273) (d8c1513)
- should not reject "update" when there's only field-level override but no model-level policy (#1052) (912c831)
- Show the correct incomplete error for multiple level inheritance (#916) (b71c1c5)
- Show validation error for the field comparison not in the same model (#912) (8d5bfe4)
- stricter binary operation operand type compatibility check (#846) (03315cc)
- support default values in generated zod schemas (#914) (0f73e56)
- support for custom prisma client output path (#514) (5f3669e)
- support for string escaping in ZModel (#668) (f034839)
- support loading plugin.zmodel from a relative path (#837) (66ab915)
- support postgres extensions (#718) (cdc98e0)
- support string literal keys for object expressions in ZModel (#752) (22b1bf9)
- supporting using type names as reference target as well (d17a85c)
- supports for complex usage of "@@index" in zmodel (#995) (541cd97)
- swr hooks support no revalidation (#871) (673bdd3)
- tanstack-query build issues and bugs in optimistic update (#843) (08d317d)
- tanstack-query, fix the incorrect query typing when user provides a custom selector (#967) (cc98e30)
- tanstack: improve typing of mutation errors (#1066) (a01065c)
- tanstack: incorrect InfiniteData import for vue-query (#1498) (92f187f)
- tanstack: incorrect typing for svelte query hooks (#1492) (ed5133c)
- tanstack: infinite query typing issues (#1480) (e158372)
- tanstack: make sure vue-query hooks' input is reactive (#1185) (f259d73)
- trpc client helper bugs (#532) (4097915)
- trpc plugin, generate schema for supporting unchecked input in mutation routes (#512) (304979f)
- trpc: make sure "import type" is used for type-only imports (#1425) (3b38311)
- trpc: temp workaround for Node.js importing from CJS module issue (#1436) (d2709f6)
- typing generated for options parameter in the hooks method (#946) (acb23d1)
- typing of policy definition (#640) (acd0753)
- update rule check for connect with implicit many-to-many relation (#565) (ffdad27)
- use zod parse result data as mutation input (#997) (613ac8d)
- User model not found when using policy in the imported model (#457) (dd36959)
- validate zod schema before update operation is executed (#1051) (9db52db)
- Validation error when @@unique attribute is defined in the different model of the relation field (#1430) (23a9bbb)
- Validation errors when using true or false as prefix of id (#530) (551b33d)
- VsCode error textDocument/codeAction failed (#915) (3afe42f)
- vscode language accidentally bundles prisma packages (#625) (f6b68da)
- vscode language accidentally bundles prisma packages (#623) (a81913e)
- vscode: more robustly handle VSCode document URI (#1376) (5cc8f18)
- vue-query typing issue (#1009) (b2e1635)
- when field policy only has deny rule, access should be allowed when the rule doesn't satisfy (#818) (62a8200)
- wrong endpoint requested in generated SWR hooks (#503) (3078e12)
- wrong payload injected for nested create in update (#715) (d8f0954)
- zenstack cli errors while using bun/bunx during docker build (#1011) (0704f9d)
- zenstack generate fails when path contains space (#845) (e99ad2c)
- Zmodel linker doesn't recursively visit base types when building resolution scopes (#992) (da33881)
- zmodel: allow type names to be used as declaration names (#1424) (5806a4d)
- zmodel: check optionality consistency between relation and fk fields (#1053) (583520e)
- zmodel: enum is resolved to wrong element after merging base models (#1437) (6852958)
- zmodel: fix grammar ambiguity (#1433) (2c7c82b)
- zmodel: resolve
auth()from all loaded and reachable documents (#1428) (cb50826) - zod and openapi generation error when "fullTextSearch" is enabled (#658) (0cb7cd1)
- zod schema compilation errors in pnpm environment due to peer dependencies (#568) (858b075)
- zod: add coercion call when generating schema for DateTime field (#1068) (b60627c)
- zod: createMany types shouldn't be generated when Prisma version doesn't support it (#1434) (273c107)
- zod: generate optional field as
z.optional()rather thanz.nullish()to be consistent with Prisma's typing (#1426) (bca13a7) - zod: support
[@default](https://github.com/default)forBigIntvalues (#1486) (ba636c8)