diff --git a/.github/release/.release-manifest.json b/.github/release/.release-manifest.json index 1857a084d..388e76056 100644 --- a/.github/release/.release-manifest.json +++ b/.github/release/.release-manifest.json @@ -1,14 +1,14 @@ { - ".": "2.0.0-alpha.1", - "packages/ide/jetbrains": "2.0.0-alpha.2", - "packages/language": "2.0.0-alpha.2", - "packages/misc/redwood": "2.0.0-alpha.2", - "packages/plugins/openapi": "2.0.0-alpha.2", - "packages/plugins/swr": "2.0.0-alpha.2", - "packages/plugins/tanstack-query": "2.0.0-alpha.2", - "packages/plugins/trpc": "2.0.0-alpha.2", - "packages/runtime": "2.0.0-alpha.2", - "packages/sdk": "2.0.0-alpha.2", - "packages/server": "2.0.0-alpha.2", - "packages/testtools": "2.0.0-alpha.2" + ".": "2.0.0-alpha.2", + "packages/ide/jetbrains": "2.0.0-alpha.3", + "packages/language": "2.0.0-alpha.3", + "packages/misc/redwood": "2.0.0-alpha.3", + "packages/plugins/openapi": "2.0.0-alpha.3", + "packages/plugins/swr": "2.0.0-alpha.3", + "packages/plugins/tanstack-query": "2.0.0-alpha.3", + "packages/plugins/trpc": "2.0.0-alpha.3", + "packages/runtime": "2.0.0-alpha.3", + "packages/sdk": "2.0.0-alpha.3", + "packages/server": "2.0.0-alpha.3", + "packages/testtools": "2.0.0-alpha.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 14a85cdea..6d8c22ca9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,39 @@ -# 0.5.0 (2022-12-15) +# Changelog + +## [2.0.0-alpha.2](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-03-13) + + +### Bug Fixes + +* `@[@validate](https://github.com/validate)` should ignore fields that are not present ([#1104](https://github.com/zenstackhq/zenstack/issues/1104)) ([79ef57a](https://github.com/zenstackhq/zenstack/commit/79ef57a67cbdf3b015c92f607d86543a4a169bcb)) +* clean up generation of logical prisma client ([#1082](https://github.com/zenstackhq/zenstack/issues/1082)) ([6e7993a](https://github.com/zenstackhq/zenstack/commit/6e7993afa8dde03ae12c44f198bcca04724dbc92)) +* default auth without user context ([#1015](https://github.com/zenstackhq/zenstack/issues/1015)) ([e5b5a0f](https://github.com/zenstackhq/zenstack/commit/e5b5a0fee34e46bee5557229f6f5894629c6ad96)) +* foreign key constraint ambiguity in generated delegate prisma schema ([#1060](https://github.com/zenstackhq/zenstack/issues/1060)) ([ca2a314](https://github.com/zenstackhq/zenstack/commit/ca2a314a927053703e4dbc76542499159b8bf6a8)) +* **hooks:** include delegate base models when calculating models affected by a mutation ([#1121](https://github.com/zenstackhq/zenstack/issues/1121)) ([e34c530](https://github.com/zenstackhq/zenstack/commit/e34c530a93b67a3eda9f5b53a087c7edd4a44999)) +* make sure fields inherited from abstract base models are properly recognized as id ([#1130](https://github.com/zenstackhq/zenstack/issues/1130)) ([4d9d093](https://github.com/zenstackhq/zenstack/commit/4d9d09338ae88eac331ec06ec908ca1256f5b8a5)) +* more robust calculation of default location for code generation ([#1095](https://github.com/zenstackhq/zenstack/issues/1095)) ([d11d4ba](https://github.com/zenstackhq/zenstack/commit/d11d4bade318d5a17d1a5e3860292352e25cc813)) +* **policy:** properly handle array-form of upsert payload ([#1101](https://github.com/zenstackhq/zenstack/issues/1101)) ([e7e1873](https://github.com/zenstackhq/zenstack/commit/e7e1873744ac2d48e118ae48b23e10723d16db44)) +* **polymorphism:** include submodel relations when reading a concrete model ([#1112](https://github.com/zenstackhq/zenstack/issues/1112)) ([557163f](https://github.com/zenstackhq/zenstack/commit/557163f789527aa64627b16fb718da3068dd0052)) +* **polymorphism:** relation name disambiguation ([#1107](https://github.com/zenstackhq/zenstack/issues/1107)) ([9f9d277](https://github.com/zenstackhq/zenstack/commit/9f9d27704c2eecbbbd69e841ece6b1d4d22040f6)) +* **polymorphism:** support `orderBy` with base fields ([#1086](https://github.com/zenstackhq/zenstack/issues/1086)) ([2e81a08](https://github.com/zenstackhq/zenstack/commit/2e81a089a1b57ebf61d25fc49300fa22f0cda06b)) +* **polymorphism:** wrong query result when selecting "_count" ([#1124](https://github.com/zenstackhq/zenstack/issues/1124)) ([dc6901a](https://github.com/zenstackhq/zenstack/commit/dc6901a2d90faf57741ab9b560f8c1eb7088079f)) +* prisma.d.ts is not properly saved ([#1090](https://github.com/zenstackhq/zenstack/issues/1090)) ([d3629be](https://github.com/zenstackhq/zenstack/commit/d3629bef459afc11c16461fb18621d2f77ac35cc)) +* properly handle missing fields when evaluating `@[@validate](https://github.com/validate)` model-level rules ([#1097](https://github.com/zenstackhq/zenstack/issues/1097)) ([e8268d0](https://github.com/zenstackhq/zenstack/commit/e8268d03ae12f3ccbcf1bb1c531a2816b22f6da8)) +* several issues with using `auth()` in `[@default](https://github.com/default)` ([#1088](https://github.com/zenstackhq/zenstack/issues/1088)) ([36e515e](https://github.com/zenstackhq/zenstack/commit/36e515e485c580657b9edbfc52014f3542abfb96)) +* should not reject "update" when there's only field-level override but no model-level policy ([#1052](https://github.com/zenstackhq/zenstack/issues/1052)) ([912c831](https://github.com/zenstackhq/zenstack/commit/912c83176a57ae2e2397c0aab68c0299a6115025)) +* **tanstack:** improve typing of mutation errors ([#1066](https://github.com/zenstackhq/zenstack/issues/1066)) ([a01065c](https://github.com/zenstackhq/zenstack/commit/a01065c0aa791d6591776b908f3e1e3c4d21424b)) +* validate zod schema before update operation is executed ([#1051](https://github.com/zenstackhq/zenstack/issues/1051)) ([9db52db](https://github.com/zenstackhq/zenstack/commit/9db52dbb77650d7c99380308803b7b4b4b7ae42d)) +* vue-query typing issue ([#1009](https://github.com/zenstackhq/zenstack/issues/1009)) ([b2e1635](https://github.com/zenstackhq/zenstack/commit/b2e1635cb1857afebde286a0c077c0f561d0bbec)) +* zenstack cli errors while using bun/bunx during docker build ([#1011](https://github.com/zenstackhq/zenstack/issues/1011)) ([0704f9d](https://github.com/zenstackhq/zenstack/commit/0704f9db945fc922746ecd480ae833fd64415784)) +* **zmodel:** check optionality consistency between relation and fk fields ([#1053](https://github.com/zenstackhq/zenstack/issues/1053)) ([583520e](https://github.com/zenstackhq/zenstack/commit/583520e5dce1d898becf3da9553c6faf08db6343)) +* **zod:** add coercion call when generating schema for DateTime field ([#1068](https://github.com/zenstackhq/zenstack/issues/1068)) ([b60627c](https://github.com/zenstackhq/zenstack/commit/b60627c167706728ac232ce06366d914e3dde23f)) + + +### Performance Improvements + +* improve polymorphism code generation speed ([#1073](https://github.com/zenstackhq/zenstack/issues/1073)) ([5b103ba](https://github.com/zenstackhq/zenstack/commit/5b103badea7876b7dfc1da91c26eca3213ddd413)) + +## 0.5.0 (2022-12-15) ### Features @@ -12,7 +47,7 @@ - Next-auth adapter and helper are moved to a separate package `@zenstackhq/next-auth`. -# 0.4.0 (2022-12-01) +## 0.4.0 (2022-12-01) ### Features @@ -50,7 +85,7 @@ Use @zenstackhq/runtime/types for type definitions shared between client and server, @zenstackhq/runtime/client for client-specific libaries (like React hooks), and @zenstackhq/runtime/server for server-specific libraries. -# 0.3.0 (2022-11-08) +## 0.3.0 (2022-11-08) ### Features @@ -70,7 +105,7 @@ - Better overall documentation -# 0.2.0 (2022-10-29) +## 0.2.0 (2022-10-29) ### Features diff --git a/README.md b/README.md index ed37238f8..d874cfefb 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ - + @@ -142,7 +142,7 @@ The following diagram gives a high-level architecture overview of ZenStack. - [Home](https://zenstack.dev) - [Documentation](https://zenstack.dev/docs) -- [Community chat](https://go.zenstack.dev/chat) +- [Community chat](https://discord.gg/Ykhr738dUe) - [Twitter](https://twitter.com/zenstackhq) - [Blog](https://zenstack.dev/blog) @@ -162,7 +162,7 @@ The following diagram gives a high-level architecture overview of ZenStack. - [SWR](https://github.com/vercel/swr) and [TanStack Query](https://github.com/TanStack/query) hooks generator - OpenAPI specification generator - [tRPC](https://trpc.io) router generator -- 🙋🏻 [Request for a plugin](https://go.zenstack.dev/chat) +- 🙋🏻 [Request for a plugin](https://discord.gg/Ykhr738dUe) ### Framework adapters @@ -171,7 +171,7 @@ The following diagram gives a high-level architecture overview of ZenStack. - [SvelteKit](https://zenstack.dev/docs/reference/server-adapters/sveltekit) - [Fastify](https://zenstack.dev/docs/reference/server-adapters/fastify) - [ExpressJS](https://zenstack.dev/docs/reference/server-adapters/express) -- 🙋🏻 [Request for an adapter](https://go.zenstack.dev/chat) +- 🙋🏻 [Request for an adapter](https://discord.gg/Ykhr738dUe) ### Prisma schema extensions @@ -179,7 +179,7 @@ The following diagram gives a high-level architecture overview of ZenStack. - [Multi-file schema and model inheritance](https://zenstack.dev/docs/guides/multiple-schema) - Strong-typed JSON field (coming soon) - Polymorphism (future) -- 🙋🏻 [Request for an extension](https://go.zenstack.dev/chat) +- 🙋🏻 [Request for an extension](https://discord.gg/Ykhr738dUe) ## Examples diff --git a/package.json b/package.json index ac2d35cbb..febc93264 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zenstack-monorepo", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.2", "description": "", "scripts": { "build": "pnpm -r build", diff --git a/packages/ide/jetbrains/CHANGELOG.md b/packages/ide/jetbrains/CHANGELOG.md index 6f0f0e7ff..94e363e5a 100644 --- a/packages/ide/jetbrains/CHANGELOG.md +++ b/packages/ide/jetbrains/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [2.0.0-alpha.3](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-03-13) + + +### Bug Fixes + +* more robust calculation of default location for code generation ([#1095](https://github.com/zenstackhq/zenstack/issues/1095)) ([d11d4ba](https://github.com/zenstackhq/zenstack/commit/d11d4bade318d5a17d1a5e3860292352e25cc813)) +* prisma.d.ts is not properly saved ([#1090](https://github.com/zenstackhq/zenstack/issues/1090)) ([d3629be](https://github.com/zenstackhq/zenstack/commit/d3629bef459afc11c16461fb18621d2f77ac35cc)) + ## [2.0.0-alpha.2](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-02-21) diff --git a/packages/ide/jetbrains/package.json b/packages/ide/jetbrains/package.json index 19b81ebce..45658df7a 100644 --- a/packages/ide/jetbrains/package.json +++ b/packages/ide/jetbrains/package.json @@ -1,6 +1,6 @@ { "name": "jetbrains", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.3", "displayName": "ZenStack JetBrains IDE Plugin", "description": "ZenStack JetBrains IDE plugin", "homepage": "https://zenstack.dev", diff --git a/packages/language/CHANGELOG.md b/packages/language/CHANGELOG.md index cc2a59fdc..0c63cd14b 100644 --- a/packages/language/CHANGELOG.md +++ b/packages/language/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [2.0.0-alpha.3](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-03-13) + + +### Bug Fixes + +* more robust calculation of default location for code generation ([#1095](https://github.com/zenstackhq/zenstack/issues/1095)) ([d11d4ba](https://github.com/zenstackhq/zenstack/commit/d11d4bade318d5a17d1a5e3860292352e25cc813)) +* prisma.d.ts is not properly saved ([#1090](https://github.com/zenstackhq/zenstack/issues/1090)) ([d3629be](https://github.com/zenstackhq/zenstack/commit/d3629bef459afc11c16461fb18621d2f77ac35cc)) + ## [2.0.0-alpha.2](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-02-21) diff --git a/packages/language/package.json b/packages/language/package.json index 1b98f4062..d1928eb0a 100644 --- a/packages/language/package.json +++ b/packages/language/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/language", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.3", "displayName": "ZenStack modeling language compiler", "description": "ZenStack modeling language compiler", "homepage": "https://zenstack.dev", @@ -23,7 +23,7 @@ "plist2": "^1.1.3" }, "dependencies": { - "langium": "1.3.1" + "langium": "1.3.1" }, "contributes": { "languages": [ diff --git a/packages/misc/redwood/CHANGELOG.md b/packages/misc/redwood/CHANGELOG.md index cc2a59fdc..0c63cd14b 100644 --- a/packages/misc/redwood/CHANGELOG.md +++ b/packages/misc/redwood/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [2.0.0-alpha.3](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-03-13) + + +### Bug Fixes + +* more robust calculation of default location for code generation ([#1095](https://github.com/zenstackhq/zenstack/issues/1095)) ([d11d4ba](https://github.com/zenstackhq/zenstack/commit/d11d4bade318d5a17d1a5e3860292352e25cc813)) +* prisma.d.ts is not properly saved ([#1090](https://github.com/zenstackhq/zenstack/issues/1090)) ([d3629be](https://github.com/zenstackhq/zenstack/commit/d3629bef459afc11c16461fb18621d2f77ac35cc)) + ## [2.0.0-alpha.2](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-02-21) diff --git a/packages/misc/redwood/package.json b/packages/misc/redwood/package.json index c3df79e42..10e4b55fb 100644 --- a/packages/misc/redwood/package.json +++ b/packages/misc/redwood/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/redwood", "displayName": "ZenStack RedwoodJS Integration", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.3", "description": "CLI and runtime for integrating ZenStack with RedwoodJS projects.", "repository": { "type": "git", diff --git a/packages/plugins/openapi/CHANGELOG.md b/packages/plugins/openapi/CHANGELOG.md index cc2a59fdc..6021e3206 100644 --- a/packages/plugins/openapi/CHANGELOG.md +++ b/packages/plugins/openapi/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [2.0.0-alpha.3](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-03-13) + + +### Bug Fixes + +* clean up generation of logical prisma client ([#1082](https://github.com/zenstackhq/zenstack/issues/1082)) ([6e7993a](https://github.com/zenstackhq/zenstack/commit/6e7993afa8dde03ae12c44f198bcca04724dbc92)) +* more robust calculation of default location for code generation ([#1095](https://github.com/zenstackhq/zenstack/issues/1095)) ([d11d4ba](https://github.com/zenstackhq/zenstack/commit/d11d4bade318d5a17d1a5e3860292352e25cc813)) +* prisma.d.ts is not properly saved ([#1090](https://github.com/zenstackhq/zenstack/issues/1090)) ([d3629be](https://github.com/zenstackhq/zenstack/commit/d3629bef459afc11c16461fb18621d2f77ac35cc)) + ## [2.0.0-alpha.2](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-02-21) diff --git a/packages/plugins/openapi/package.json b/packages/plugins/openapi/package.json index fe5034310..b4a539941 100644 --- a/packages/plugins/openapi/package.json +++ b/packages/plugins/openapi/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/openapi", "displayName": "ZenStack Plugin and Runtime for OpenAPI", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.3", "description": "ZenStack plugin and runtime supporting OpenAPI", "main": "index.js", "repository": { diff --git a/packages/plugins/swr/CHANGELOG.md b/packages/plugins/swr/CHANGELOG.md index cc2a59fdc..6021e3206 100644 --- a/packages/plugins/swr/CHANGELOG.md +++ b/packages/plugins/swr/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [2.0.0-alpha.3](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-03-13) + + +### Bug Fixes + +* clean up generation of logical prisma client ([#1082](https://github.com/zenstackhq/zenstack/issues/1082)) ([6e7993a](https://github.com/zenstackhq/zenstack/commit/6e7993afa8dde03ae12c44f198bcca04724dbc92)) +* more robust calculation of default location for code generation ([#1095](https://github.com/zenstackhq/zenstack/issues/1095)) ([d11d4ba](https://github.com/zenstackhq/zenstack/commit/d11d4bade318d5a17d1a5e3860292352e25cc813)) +* prisma.d.ts is not properly saved ([#1090](https://github.com/zenstackhq/zenstack/issues/1090)) ([d3629be](https://github.com/zenstackhq/zenstack/commit/d3629bef459afc11c16461fb18621d2f77ac35cc)) + ## [2.0.0-alpha.2](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-02-21) diff --git a/packages/plugins/swr/package.json b/packages/plugins/swr/package.json index 7dc6fd5e8..327a8dcfc 100644 --- a/packages/plugins/swr/package.json +++ b/packages/plugins/swr/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/swr", "displayName": "ZenStack plugin for generating SWR hooks", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.3", "description": "ZenStack plugin for generating SWR hooks", "main": "index.js", "repository": { diff --git a/packages/plugins/tanstack-query/CHANGELOG.md b/packages/plugins/tanstack-query/CHANGELOG.md index cc2a59fdc..69b2f7b8b 100644 --- a/packages/plugins/tanstack-query/CHANGELOG.md +++ b/packages/plugins/tanstack-query/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [2.0.0-alpha.3](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-03-13) + + +### Bug Fixes + +* clean up generation of logical prisma client ([#1082](https://github.com/zenstackhq/zenstack/issues/1082)) ([6e7993a](https://github.com/zenstackhq/zenstack/commit/6e7993afa8dde03ae12c44f198bcca04724dbc92)) +* more robust calculation of default location for code generation ([#1095](https://github.com/zenstackhq/zenstack/issues/1095)) ([d11d4ba](https://github.com/zenstackhq/zenstack/commit/d11d4bade318d5a17d1a5e3860292352e25cc813)) +* prisma.d.ts is not properly saved ([#1090](https://github.com/zenstackhq/zenstack/issues/1090)) ([d3629be](https://github.com/zenstackhq/zenstack/commit/d3629bef459afc11c16461fb18621d2f77ac35cc)) +* **tanstack:** improve typing of mutation errors ([#1066](https://github.com/zenstackhq/zenstack/issues/1066)) ([a01065c](https://github.com/zenstackhq/zenstack/commit/a01065c0aa791d6591776b908f3e1e3c4d21424b)) + ## [2.0.0-alpha.2](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-02-21) diff --git a/packages/plugins/tanstack-query/package.json b/packages/plugins/tanstack-query/package.json index 4fd444426..8dd0d15d3 100644 --- a/packages/plugins/tanstack-query/package.json +++ b/packages/plugins/tanstack-query/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/tanstack-query", "displayName": "ZenStack plugin for generating tanstack-query hooks", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.3", "description": "ZenStack plugin for generating tanstack-query hooks", "main": "index.js", "exports": { diff --git a/packages/plugins/trpc/CHANGELOG.md b/packages/plugins/trpc/CHANGELOG.md index cc2a59fdc..69b2f7b8b 100644 --- a/packages/plugins/trpc/CHANGELOG.md +++ b/packages/plugins/trpc/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [2.0.0-alpha.3](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-03-13) + + +### Bug Fixes + +* clean up generation of logical prisma client ([#1082](https://github.com/zenstackhq/zenstack/issues/1082)) ([6e7993a](https://github.com/zenstackhq/zenstack/commit/6e7993afa8dde03ae12c44f198bcca04724dbc92)) +* more robust calculation of default location for code generation ([#1095](https://github.com/zenstackhq/zenstack/issues/1095)) ([d11d4ba](https://github.com/zenstackhq/zenstack/commit/d11d4bade318d5a17d1a5e3860292352e25cc813)) +* prisma.d.ts is not properly saved ([#1090](https://github.com/zenstackhq/zenstack/issues/1090)) ([d3629be](https://github.com/zenstackhq/zenstack/commit/d3629bef459afc11c16461fb18621d2f77ac35cc)) +* **tanstack:** improve typing of mutation errors ([#1066](https://github.com/zenstackhq/zenstack/issues/1066)) ([a01065c](https://github.com/zenstackhq/zenstack/commit/a01065c0aa791d6591776b908f3e1e3c4d21424b)) + ## [2.0.0-alpha.2](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-02-21) diff --git a/packages/plugins/trpc/package.json b/packages/plugins/trpc/package.json index d7427347b..e4f8e4a05 100644 --- a/packages/plugins/trpc/package.json +++ b/packages/plugins/trpc/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/trpc", "displayName": "ZenStack plugin for tRPC", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.3", "description": "ZenStack plugin for tRPC", "main": "index.js", "repository": { diff --git a/packages/runtime/CHANGELOG.md b/packages/runtime/CHANGELOG.md index cc2a59fdc..e2a122f97 100644 --- a/packages/runtime/CHANGELOG.md +++ b/packages/runtime/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [2.0.0-alpha.3](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-03-13) + + +### Bug Fixes + +* clean up generation of logical prisma client ([#1082](https://github.com/zenstackhq/zenstack/issues/1082)) ([6e7993a](https://github.com/zenstackhq/zenstack/commit/6e7993afa8dde03ae12c44f198bcca04724dbc92)) +* default auth without user context ([#1015](https://github.com/zenstackhq/zenstack/issues/1015)) ([e5b5a0f](https://github.com/zenstackhq/zenstack/commit/e5b5a0fee34e46bee5557229f6f5894629c6ad96)) +* **hooks:** include delegate base models when calculating models affected by a mutation ([#1121](https://github.com/zenstackhq/zenstack/issues/1121)) ([e34c530](https://github.com/zenstackhq/zenstack/commit/e34c530a93b67a3eda9f5b53a087c7edd4a44999)) +* more robust calculation of default location for code generation ([#1095](https://github.com/zenstackhq/zenstack/issues/1095)) ([d11d4ba](https://github.com/zenstackhq/zenstack/commit/d11d4bade318d5a17d1a5e3860292352e25cc813)) +* **policy:** properly handle array-form of upsert payload ([#1101](https://github.com/zenstackhq/zenstack/issues/1101)) ([e7e1873](https://github.com/zenstackhq/zenstack/commit/e7e1873744ac2d48e118ae48b23e10723d16db44)) +* **polymorphism:** include submodel relations when reading a concrete model ([#1112](https://github.com/zenstackhq/zenstack/issues/1112)) ([557163f](https://github.com/zenstackhq/zenstack/commit/557163f789527aa64627b16fb718da3068dd0052)) +* **polymorphism:** support `orderBy` with base fields ([#1086](https://github.com/zenstackhq/zenstack/issues/1086)) ([2e81a08](https://github.com/zenstackhq/zenstack/commit/2e81a089a1b57ebf61d25fc49300fa22f0cda06b)) +* **polymorphism:** wrong query result when selecting "_count" ([#1124](https://github.com/zenstackhq/zenstack/issues/1124)) ([dc6901a](https://github.com/zenstackhq/zenstack/commit/dc6901a2d90faf57741ab9b560f8c1eb7088079f)) +* prisma.d.ts is not properly saved ([#1090](https://github.com/zenstackhq/zenstack/issues/1090)) ([d3629be](https://github.com/zenstackhq/zenstack/commit/d3629bef459afc11c16461fb18621d2f77ac35cc)) +* several issues with using `auth()` in `[@default](https://github.com/default)` ([#1088](https://github.com/zenstackhq/zenstack/issues/1088)) ([36e515e](https://github.com/zenstackhq/zenstack/commit/36e515e485c580657b9edbfc52014f3542abfb96)) +* should not reject "update" when there's only field-level override but no model-level policy ([#1052](https://github.com/zenstackhq/zenstack/issues/1052)) ([912c831](https://github.com/zenstackhq/zenstack/commit/912c83176a57ae2e2397c0aab68c0299a6115025)) +* validate zod schema before update operation is executed ([#1051](https://github.com/zenstackhq/zenstack/issues/1051)) ([9db52db](https://github.com/zenstackhq/zenstack/commit/9db52dbb77650d7c99380308803b7b4b4b7ae42d)) + ## [2.0.0-alpha.2](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-02-21) diff --git a/packages/runtime/package.json b/packages/runtime/package.json index b3a108019..c80bbca5f 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/runtime", "displayName": "ZenStack Runtime Library", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.3", "description": "Runtime of ZenStack for both client-side and server-side environments.", "repository": { "type": "git", diff --git a/packages/schema/README.md b/packages/schema/README.md index ece352081..2c24ab102 100644 --- a/packages/schema/README.md +++ b/packages/schema/README.md @@ -17,13 +17,13 @@ This VS Code extension provides code editing helpers for authoring ZenStack's sc - [Home](https://zenstack.dev) - [Documentation](https://zenstack.dev/docs) -- [Community chat](https://go.zenstack.dev/chat) +- [Community chat](https://discord.gg/Ykhr738dUe) - [Twitter](https://twitter.com/zenstackhq) - [Blog](https://dev.to/zenstack) ## Community -Join our [discord server](https://go.zenstack.dev/chat) for chat and updates! +Join our [discord server](https://discord.gg/Ykhr738dUe) for chat and updates! ## License diff --git a/packages/schema/tests/schema/validation/datamodel-validation.test.ts b/packages/schema/tests/schema/validation/datamodel-validation.test.ts index 955f315c3..78e31204d 100644 --- a/packages/schema/tests/schema/validation/datamodel-validation.test.ts +++ b/packages/schema/tests/schema/validation/datamodel-validation.test.ts @@ -10,13 +10,13 @@ describe('Data Model Validation Tests', () => { it('duplicated fields', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model M { id String @id x Int x String } - `); + `) expect(result).toMatchObject(errorLike('Duplicated declaration name "x"')); }); @@ -128,14 +128,14 @@ describe('Data Model Validation Tests', () => { it('should error when there are no unique fields', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model M { x Int @@allow('all', x > 0) } - `); + `) expect(result).toMatchObject(errorLike(err)); - }); + }) it('should should use @unique when there is no @id', async () => { const result = await safelyLoadModel(` @@ -147,12 +147,12 @@ describe('Data Model Validation Tests', () => { } `); expect(result).toMatchObject({ status: 'fulfilled' }); - }); + }) // @@unique used as id it('should suceed when @@unique used as id', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model M { x Int @@unique([x]) @@ -160,11 +160,11 @@ describe('Data Model Validation Tests', () => { } `); expect(result).toMatchObject({ status: 'fulfilled' }); - }); + }) it('should succeed when @id is an enum type', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } enum E { A B @@ -174,11 +174,11 @@ describe('Data Model Validation Tests', () => { } `); expect(result).toMatchObject({ status: 'fulfilled' }); - }); + }) it('should succeed when @@id is an enum type', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } enum E { A B @@ -190,135 +190,133 @@ describe('Data Model Validation Tests', () => { } `); expect(result).toMatchObject({ status: 'fulfilled' }); - }); + }) it('should error when there are no id fields, even when denying access', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model M { x Int @@deny('all', x <= 0) } - `); - + `) + expect(result).toMatchObject(errorLike(err)); - }); + }) it('should error when there are not id fields, without access restrictions', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model M { x Int @gt(0) } - `); - + `) + expect(result).toMatchObject(errorLike(err)); - }); + }) it('should error when there is more than one field marked as @id', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model M { x Int @id y Int @id } - `); - expect(result).toMatchObject(errorLike(`Model can include at most one field with @id attribute`)); - }); + `) + expect(result).toMatchObject(errorLike(`Model can include at most one field with @id attribute`)) + }) - it('should error when both @id and @@id are used', async () => { + it('should error when both @id and @@id are used', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model M { x Int @id y Int @@id([x, y]) } - `); - expect(result).toMatchObject( - errorLike(`Model cannot have both field-level @id and model-level @@id attributes`) - ); - }); + `) + expect(result).toMatchObject(errorLike(`Model cannot have both field-level @id and model-level @@id attributes`)) + }) it('should error when @id used on optional field', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model M { x Int? @id } - `); - expect(result).toMatchObject(errorLike(`Field with @id attribute must not be optional`)); - }); + `) + expect(result).toMatchObject(errorLike(`Field with @id attribute must not be optional`)) + }) it('should error when @@id used on optional field', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model M { x Int? @@id([x]) } - `); - expect(result).toMatchObject(errorLike(`Field with @id attribute must not be optional`)); - }); + `) + expect(result).toMatchObject(errorLike(`Field with @id attribute must not be optional`)) + }) it('should error when @id used on list field', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model M { x Int[] @id } - `); - expect(result).toMatchObject(errorLike(`Field with @id attribute must be of scalar or enum type`)); - }); + `) + expect(result).toMatchObject(errorLike(`Field with @id attribute must be of scalar or enum type`)) + }) it('should error when @@id used on list field', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model M { x Int[] @@id([x]) } - `); - expect(result).toMatchObject(errorLike(`Field with @id attribute must be of scalar or enum type`)); - }); + `) + expect(result).toMatchObject(errorLike(`Field with @id attribute must be of scalar or enum type`)) + }) it('should error when @id used on a Json field', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model M { x Json @id } - `); - expect(result).toMatchObject(errorLike(`Field with @id attribute must be of scalar or enum type`)); - }); + `) + expect(result).toMatchObject(errorLike(`Field with @id attribute must be of scalar or enum type`)) + }) it('should error when @@id used on a Json field', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model M { x Json @@id([x]) } - `); - expect(result).toMatchObject(errorLike(`Field with @id attribute must be of scalar or enum type`)); - }); + `) + expect(result).toMatchObject(errorLike(`Field with @id attribute must be of scalar or enum type`)) + }) it('should error when @id used on a reference field', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model Id { id String @id } model M { myId Id @id } - `); - expect(result).toMatchObject(errorLike(`Field with @id attribute must be of scalar or enum type`)); - }); + `) + expect(result).toMatchObject(errorLike(`Field with @id attribute must be of scalar or enum type`)) + }) it('should error when @@id used on a reference field', async () => { const result = await safelyLoadModel(` - ${prelude} + ${ prelude } model Id { id String @id } @@ -326,9 +324,9 @@ describe('Data Model Validation Tests', () => { myId Id @@id([myId]) } - `); - expect(result).toMatchObject(errorLike(`Field with @id attribute must be of scalar or enum type`)); - }); + `) + expect(result).toMatchObject(errorLike(`Field with @id attribute must be of scalar or enum type`)) + }) }); it('relation', async () => { @@ -392,9 +390,7 @@ describe('Data Model Validation Tests', () => { id String @id } `) - ).toMatchObject( - errorLike(`The relation field "b" on model "A" is missing an opposite relation field on model "B"`) - ); + ).toMatchObject(errorLike(`The relation field "b" on model "A" is missing an opposite relation field on model "B"`)); // one-to-one ambiguous expect( @@ -496,11 +492,7 @@ describe('Data Model Validation Tests', () => { aId String } `) - ).toMatchObject( - errorLike( - `Field "aId" is part of a one-to-one relation and must be marked as @unique or be part of a model-level @@unique attribute` - ) - ); + ).toMatchObject(errorLike(`Field "aId" is part of a one-to-one relation and must be marked as @unique or be part of a model-level @@unique attribute`)); // missing @relation expect( @@ -516,11 +508,7 @@ describe('Data Model Validation Tests', () => { a A } `) - ).toMatchObject( - errorLike( - `Field for one side of relation must carry @relation attribute with both "fields" and "references" fields` - ) - ); + ).toMatchObject(errorLike(`Field for one side of relation must carry @relation attribute with both "fields" and "references" fields`)); // wrong relation owner field type expect( @@ -684,9 +672,7 @@ describe('Data Model Validation Tests', () => { } `); - expect(errors).toMatchObject( - errorLike(`Model A cannot be extended because it's neither abstract nor marked as "@@delegate"`) - ); + expect(errors).toMatchObject(errorLike(`Model A cannot be extended because it's not abstract`)); // relation incomplete from multiple level inheritance expect( @@ -710,8 +696,6 @@ describe('Data Model Validation Tests', () => { a String } `) - ).toMatchObject( - errorLike(`The relation field "user" on model "A" is missing an opposite relation field on model "User"`) - ); + ).toMatchObject(errorLike(`The relation field "user" on model "A" is missing an opposite relation field on model "User"`)); }); }); diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index cc2a59fdc..cd6faa331 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [2.0.0-alpha.3](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-03-13) + + +### Bug Fixes + +* clean up generation of logical prisma client ([#1082](https://github.com/zenstackhq/zenstack/issues/1082)) ([6e7993a](https://github.com/zenstackhq/zenstack/commit/6e7993afa8dde03ae12c44f198bcca04724dbc92)) +* make sure fields inherited from abstract base models are properly recognized as id ([#1130](https://github.com/zenstackhq/zenstack/issues/1130)) ([4d9d093](https://github.com/zenstackhq/zenstack/commit/4d9d09338ae88eac331ec06ec908ca1256f5b8a5)) +* more robust calculation of default location for code generation ([#1095](https://github.com/zenstackhq/zenstack/issues/1095)) ([d11d4ba](https://github.com/zenstackhq/zenstack/commit/d11d4bade318d5a17d1a5e3860292352e25cc813)) +* prisma.d.ts is not properly saved ([#1090](https://github.com/zenstackhq/zenstack/issues/1090)) ([d3629be](https://github.com/zenstackhq/zenstack/commit/d3629bef459afc11c16461fb18621d2f77ac35cc)) +* several issues with using `auth()` in `[@default](https://github.com/default)` ([#1088](https://github.com/zenstackhq/zenstack/issues/1088)) ([36e515e](https://github.com/zenstackhq/zenstack/commit/36e515e485c580657b9edbfc52014f3542abfb96)) + ## [2.0.0-alpha.2](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-02-21) diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 02bd6c681..5bdf1dc2b 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/sdk", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.3", "description": "ZenStack plugin development SDK", "main": "index.js", "scripts": { diff --git a/packages/sdk/src/utils.ts b/packages/sdk/src/utils.ts index 641446a02..4c79d4c9c 100644 --- a/packages/sdk/src/utils.ts +++ b/packages/sdk/src/utils.ts @@ -219,11 +219,14 @@ export function isIdField(field: DataModelField) { return true; } + // NOTE: we have to use name to match fields because the fields + // may be inherited from an abstract base and have cloned identities + const model = field.$container as DataModel; // model-level @@id attribute with a list of fields const modelLevelIds = getModelIdFields(model); - if (modelLevelIds.includes(field)) { + if (modelLevelIds.map((f) => f.name).includes(field.name)) { return true; } @@ -235,12 +238,12 @@ export function isIdField(field: DataModelField) { // then, the first field with @unique can be used as id const firstUniqueField = model.fields.find((f) => hasAttribute(f, '@unique')); if (firstUniqueField) { - return firstUniqueField === field; + return firstUniqueField.name === field.name; } // last, the first model level @@unique can be used as id const modelLevelUnique = getModelUniqueFields(model); - if (modelLevelUnique.includes(field)) { + if (modelLevelUnique.map((f) => f.name).includes(field.name)) { return true; } diff --git a/packages/server/CHANGELOG.md b/packages/server/CHANGELOG.md index cc2a59fdc..854dd315c 100644 --- a/packages/server/CHANGELOG.md +++ b/packages/server/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [2.0.0-alpha.3](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-03-13) + + +### Bug Fixes + +* more robust calculation of default location for code generation ([#1095](https://github.com/zenstackhq/zenstack/issues/1095)) ([d11d4ba](https://github.com/zenstackhq/zenstack/commit/d11d4bade318d5a17d1a5e3860292352e25cc813)) +* prisma.d.ts is not properly saved ([#1090](https://github.com/zenstackhq/zenstack/issues/1090)) ([d3629be](https://github.com/zenstackhq/zenstack/commit/d3629bef459afc11c16461fb18621d2f77ac35cc)) +* **zod:** add coercion call when generating schema for DateTime field ([#1068](https://github.com/zenstackhq/zenstack/issues/1068)) ([b60627c](https://github.com/zenstackhq/zenstack/commit/b60627c167706728ac232ce06366d914e3dde23f)) + ## [2.0.0-alpha.2](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-02-21) diff --git a/packages/server/package.json b/packages/server/package.json index a6dd78931..59c01026a 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/server", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.3", "displayName": "ZenStack Server-side Adapters", "description": "ZenStack server-side adapters", "homepage": "https://zenstack.dev", diff --git a/packages/testtools/CHANGELOG.md b/packages/testtools/CHANGELOG.md index cc2a59fdc..54bc90835 100644 --- a/packages/testtools/CHANGELOG.md +++ b/packages/testtools/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [2.0.0-alpha.3](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-03-13) + + +### Bug Fixes + +* clean up generation of logical prisma client ([#1082](https://github.com/zenstackhq/zenstack/issues/1082)) ([6e7993a](https://github.com/zenstackhq/zenstack/commit/6e7993afa8dde03ae12c44f198bcca04724dbc92)) +* more robust calculation of default location for code generation ([#1095](https://github.com/zenstackhq/zenstack/issues/1095)) ([d11d4ba](https://github.com/zenstackhq/zenstack/commit/d11d4bade318d5a17d1a5e3860292352e25cc813)) +* prisma.d.ts is not properly saved ([#1090](https://github.com/zenstackhq/zenstack/issues/1090)) ([d3629be](https://github.com/zenstackhq/zenstack/commit/d3629bef459afc11c16461fb18621d2f77ac35cc)) +* properly handle missing fields when evaluating `@[@validate](https://github.com/validate)` model-level rules ([#1097](https://github.com/zenstackhq/zenstack/issues/1097)) ([e8268d0](https://github.com/zenstackhq/zenstack/commit/e8268d03ae12f3ccbcf1bb1c531a2816b22f6da8)) +* several issues with using `auth()` in `[@default](https://github.com/default)` ([#1088](https://github.com/zenstackhq/zenstack/issues/1088)) ([36e515e](https://github.com/zenstackhq/zenstack/commit/36e515e485c580657b9edbfc52014f3542abfb96)) + ## [2.0.0-alpha.2](https://github.com/zenstackhq/zenstack/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-02-21) diff --git a/packages/testtools/package.json b/packages/testtools/package.json index 13c883dcc..b4741bb63 100644 --- a/packages/testtools/package.json +++ b/packages/testtools/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/testtools", - "version": "2.0.0-alpha.7", + "version": "2.0.0-alpha.3", "description": "ZenStack Test Tools", "main": "index.js", "private": true, diff --git a/tests/integration/tests/regression/issue-1129.test.ts b/tests/integration/tests/regression/issue-1129.test.ts new file mode 100644 index 000000000..49198a5cb --- /dev/null +++ b/tests/integration/tests/regression/issue-1129.test.ts @@ -0,0 +1,87 @@ +import { createPostgresDb, dropPostgresDb, loadSchema } from '@zenstackhq/testtools'; + +describe('Regression for issue 1129', () => { + it('regression', async () => { + let prisma; + const dbUrl = await createPostgresDb('regression-issue-1129'); + + try { + const r = await loadSchema( + ` + model Relation1 { + id String @id @default(cuid()) + field1 String + concrete Concrete[] + @@allow('all', true) + } + + model Relation2 { + id String @id @default(cuid()) + field2 String + concrete Concrete[] + @@allow('all', true) + } + + abstract model WithRelation1 { + relation1Id String + relation1 Relation1 @relation(fields: [relation1Id], references: [id]) + } + abstract model WithRelation2 { + relation2Id String + relation2 Relation2 @relation(fields: [relation2Id], references: [id]) + } + + model Concrete extends WithRelation1, WithRelation2 { + concreteField String + @@id([relation1Id, relation2Id]) + @@allow('all', true) + } + `, + { provider: 'postgresql', dbUrl } + ); + + prisma = r.prisma; + const db = r.enhance(); + + await db.$transaction(async (tx: any) => { + await tx.relation2.createMany({ + data: [ + { + id: 'relation2Id1', + field2: 'field2Value1', + }, + { + id: 'relation2Id2', + field2: 'field2Value2', + }, + ], + }); + + await tx.relation1.create({ + data: { + field1: 'field1Value', + concrete: { + createMany: { + data: [ + { + concreteField: 'concreteFieldValue1', + relation2Id: 'relation2Id1', + }, + { + concreteField: 'concreteFieldValue2', + relation2Id: 'relation2Id2', + }, + ], + }, + }, + }, + }); + }); + } finally { + if (prisma) { + await prisma.$disconnect(); + } + await dropPostgresDb('regression-issue-1129'); + } + }); +});