From 584af47f092abdcda0d2078778ac4538996fa6bb Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Fri, 14 Jun 2024 22:36:50 +0800 Subject: [PATCH] bump version --- package.json | 2 +- packages/ide/jetbrains/build.gradle.kts | 2 +- packages/ide/jetbrains/package.json | 2 +- packages/language/package.json | 2 +- packages/misc/redwood/package.json | 2 +- packages/plugins/openapi/package.json | 2 +- packages/plugins/swr/package.json | 2 +- packages/plugins/tanstack-query/package.json | 2 +- packages/plugins/trpc/package.json | 2 +- packages/runtime/package.json | 2 +- packages/schema/package.json | 2 +- .../validator/expression-validator.ts | 4 ++- packages/sdk/package.json | 2 +- packages/server/package.json | 2 +- packages/testtools/package.json | 2 +- .../cross-model-field-comparison.test.ts | 31 ++++++++++++++++++- 16 files changed, 47 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 304cb5320..2f21ed022 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zenstack-monorepo", - "version": "2.2.2", + "version": "2.2.3", "description": "", "scripts": { "build": "pnpm -r build", diff --git a/packages/ide/jetbrains/build.gradle.kts b/packages/ide/jetbrains/build.gradle.kts index cece444ae..92880227f 100644 --- a/packages/ide/jetbrains/build.gradle.kts +++ b/packages/ide/jetbrains/build.gradle.kts @@ -9,7 +9,7 @@ plugins { } group = "dev.zenstack" -version = "2.2.2" +version = "2.2.3" repositories { mavenCentral() diff --git a/packages/ide/jetbrains/package.json b/packages/ide/jetbrains/package.json index 401e8bcc2..14928f3cc 100644 --- a/packages/ide/jetbrains/package.json +++ b/packages/ide/jetbrains/package.json @@ -1,6 +1,6 @@ { "name": "jetbrains", - "version": "2.2.2", + "version": "2.2.3", "displayName": "ZenStack JetBrains IDE Plugin", "description": "ZenStack JetBrains IDE plugin", "homepage": "https://zenstack.dev", diff --git a/packages/language/package.json b/packages/language/package.json index df4952d9f..08fc1e2a7 100644 --- a/packages/language/package.json +++ b/packages/language/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/language", - "version": "2.2.2", + "version": "2.2.3", "displayName": "ZenStack modeling language compiler", "description": "ZenStack modeling language compiler", "homepage": "https://zenstack.dev", diff --git a/packages/misc/redwood/package.json b/packages/misc/redwood/package.json index b8988e4d1..19fcdc682 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.2.2", + "version": "2.2.3", "description": "CLI and runtime for integrating ZenStack with RedwoodJS projects.", "repository": { "type": "git", diff --git a/packages/plugins/openapi/package.json b/packages/plugins/openapi/package.json index bc85639cd..6ae9664f8 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.2.2", + "version": "2.2.3", "description": "ZenStack plugin and runtime supporting OpenAPI", "main": "index.js", "repository": { diff --git a/packages/plugins/swr/package.json b/packages/plugins/swr/package.json index 9d20e5bdc..bb8ee9168 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.2.2", + "version": "2.2.3", "description": "ZenStack plugin for generating SWR hooks", "main": "index.js", "repository": { diff --git a/packages/plugins/tanstack-query/package.json b/packages/plugins/tanstack-query/package.json index da0d9b393..884f20c26 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.2.2", + "version": "2.2.3", "description": "ZenStack plugin for generating tanstack-query hooks", "main": "index.js", "exports": { diff --git a/packages/plugins/trpc/package.json b/packages/plugins/trpc/package.json index 16f3f4d39..4572f631d 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.2.2", + "version": "2.2.3", "description": "ZenStack plugin for tRPC", "main": "index.js", "repository": { diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 544582bf9..7ab829c8d 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/runtime", "displayName": "ZenStack Runtime Library", - "version": "2.2.2", + "version": "2.2.3", "description": "Runtime of ZenStack for both client-side and server-side environments.", "repository": { "type": "git", diff --git a/packages/schema/package.json b/packages/schema/package.json index 2119d0fb2..1c5e0d711 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -3,7 +3,7 @@ "publisher": "zenstack", "displayName": "ZenStack Language Tools", "description": "Build scalable web apps with minimum code by defining authorization and validation rules inside the data schema that closer to the database", - "version": "2.2.2", + "version": "2.2.3", "author": { "name": "ZenStack Team" }, diff --git a/packages/schema/src/language-server/validator/expression-validator.ts b/packages/schema/src/language-server/validator/expression-validator.ts index 7f24f1f60..e6eb18c29 100644 --- a/packages/schema/src/language-server/validator/expression-validator.ts +++ b/packages/schema/src/language-server/validator/expression-validator.ts @@ -140,7 +140,9 @@ export default class ExpressionValidator implements AstValidator { accept('error', 'incompatible operand types', { node: expr }); } - this.validateCrossModelFieldComparison(expr, accept); + if (expr.operator !== '&&' && expr.operator !== '||') { + this.validateCrossModelFieldComparison(expr, accept); + } break; } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 5977a3756..2d1229fdb 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/sdk", - "version": "2.2.2", + "version": "2.2.3", "description": "ZenStack plugin development SDK", "main": "index.js", "scripts": { diff --git a/packages/server/package.json b/packages/server/package.json index 3116a3714..730f58d4d 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/server", - "version": "2.2.2", + "version": "2.2.3", "displayName": "ZenStack Server-side Adapters", "description": "ZenStack server-side adapters", "homepage": "https://zenstack.dev", diff --git a/packages/testtools/package.json b/packages/testtools/package.json index f2aec5933..75cd550d0 100644 --- a/packages/testtools/package.json +++ b/packages/testtools/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/testtools", - "version": "2.2.2", + "version": "2.2.3", "description": "ZenStack Test Tools", "main": "index.js", "private": true, diff --git a/tests/integration/tests/enhancements/with-policy/cross-model-field-comparison.test.ts b/tests/integration/tests/enhancements/with-policy/cross-model-field-comparison.test.ts index 75d694f12..1ffb9e35c 100644 --- a/tests/integration/tests/enhancements/with-policy/cross-model-field-comparison.test.ts +++ b/tests/integration/tests/enhancements/with-policy/cross-model-field-comparison.test.ts @@ -1,4 +1,4 @@ -import { loadSchema } from '@zenstackhq/testtools'; +import { loadModel, loadSchema } from '@zenstackhq/testtools'; describe('Cross-model field comparison', () => { it('to-one relation', async () => { @@ -997,4 +997,33 @@ describe('Cross-model field comparison', () => { dbTeam2.asset.update({ where: { id: asset.id }, data: { name: 'Asset2' } }) ).toBeRejectedByPolicy(); }); + + it('with auth case 4', async () => { + await loadModel(` + model User { + id Int @id @default(autoincrement()) + foos Foo[] + bars Bar[] + @@allow('all', true) + } + + model Foo { + id Int @id @default(autoincrement()) + user User @relation(fields: [userId], references: [id]) + userId Int + bar Bar @relation(fields: [barId], references: [id]) + barId Int @unique + @@allow('all', bar.private && bar.user == auth()) + } + + model Bar { + id Int @id @default(autoincrement()) + user User @relation(fields: [userId], references: [id]) + userId Int + foo Foo? + private Boolean + @@allow('all', true) + } + `); + }); });