diff --git a/.gitignore b/.gitignore index 503a4e114..9801ed968 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ dist *.db-journal *.tgz .pnpm-store +*.vsix diff --git a/package.json b/package.json index f30763157..177ae87ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zenstack-v3", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "description": "ZenStack", "packageManager": "pnpm@10.23.0", "type": "module", diff --git a/packages/auth-adapters/better-auth/package.json b/packages/auth-adapters/better-auth/package.json index bb7aafeff..c5a7cdd5d 100644 --- a/packages/auth-adapters/better-auth/package.json +++ b/packages/auth-adapters/better-auth/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/better-auth", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "description": "ZenStack Better Auth Adapter. This adapter is modified from better-auth's Prisma adapter.", "type": "module", "scripts": { diff --git a/packages/cli/package.json b/packages/cli/package.json index c2356c703..b3251bb4c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -3,7 +3,7 @@ "publisher": "zenstack", "displayName": "ZenStack CLI", "description": "FullStack database toolkit with built-in access control and automatic API generation.", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "type": "module", "author": { "name": "ZenStack Team" diff --git a/packages/cli/src/actions/init.ts b/packages/cli/src/actions/init.ts index c0eeac0f8..f44bf1722 100644 --- a/packages/cli/src/actions/init.ts +++ b/packages/cli/src/actions/init.ts @@ -23,9 +23,9 @@ export async function run(projectPath: string) { console.log(colors.gray(`Using package manager: ${pm.agent}`)); for (const pkg of packages) { - const resolved = resolveCommand(pm.agent, 'install', [ + const resolved = resolveCommand(pm.agent, 'add', [ pkg.name, - ...(pkg.dev ? [pm.agent === 'yarn' ? '--dev' : '--save-dev'] : []), + ...(pkg.dev ? [pm.agent.startsWith('yarn') || pm.agent === 'bun' ? '--dev' : '--save-dev'] : []), ]); if (!resolved) { throw new CliError(`Unable to determine how to install package "${pkg.name}". Please install it manually.`); diff --git a/packages/clients/tanstack-query/package.json b/packages/clients/tanstack-query/package.json index 401589cf1..728c460a9 100644 --- a/packages/clients/tanstack-query/package.json +++ b/packages/clients/tanstack-query/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/tanstack-query", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "description": "TanStack Query Client for consuming ZenStack v3's CRUD service", "main": "index.js", "type": "module", diff --git a/packages/common-helpers/package.json b/packages/common-helpers/package.json index 2b3aa8a39..665cdfc7f 100644 --- a/packages/common-helpers/package.json +++ b/packages/common-helpers/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/common-helpers", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "description": "ZenStack Common Helpers", "type": "module", "scripts": { diff --git a/packages/config/eslint-config/package.json b/packages/config/eslint-config/package.json index 43e471528..6b298e198 100644 --- a/packages/config/eslint-config/package.json +++ b/packages/config/eslint-config/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/eslint-config", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "type": "module", "private": true, "license": "MIT" diff --git a/packages/config/typescript-config/package.json b/packages/config/typescript-config/package.json index a08b125f3..51f242afd 100644 --- a/packages/config/typescript-config/package.json +++ b/packages/config/typescript-config/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/typescript-config", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "private": true, "license": "MIT" } diff --git a/packages/config/vitest-config/package.json b/packages/config/vitest-config/package.json index c3f7ebb39..c62550ad0 100644 --- a/packages/config/vitest-config/package.json +++ b/packages/config/vitest-config/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/vitest-config", "type": "module", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "private": true, "license": "MIT", "exports": { diff --git a/packages/create-zenstack/package.json b/packages/create-zenstack/package.json index 1bc4ac611..3374bdf8a 100644 --- a/packages/create-zenstack/package.json +++ b/packages/create-zenstack/package.json @@ -1,6 +1,6 @@ { "name": "create-zenstack", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "description": "Create a new ZenStack project", "type": "module", "scripts": { diff --git a/packages/language/package.json b/packages/language/package.json index 3b62243ca..49d5f6dc4 100644 --- a/packages/language/package.json +++ b/packages/language/package.json @@ -1,7 +1,7 @@ { "name": "@zenstackhq/language", "description": "ZenStack ZModel language specification", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "license": "MIT", "author": "ZenStack Team", "files": [ diff --git a/packages/language/src/validators/expression-validator.ts b/packages/language/src/validators/expression-validator.ts index f455753f8..c2848c145 100644 --- a/packages/language/src/validators/expression-validator.ts +++ b/packages/language/src/validators/expression-validator.ts @@ -12,6 +12,7 @@ import { isReferenceExpr, isThisExpr, MemberAccessExpr, + UnaryExpr, type ExpressionType, } from '../generated/ast'; @@ -67,6 +68,9 @@ export default class ExpressionValidator implements AstValidator { case 'BinaryExpr': this.validateBinaryExpr(expr, accept); break; + case 'UnaryExpr': + this.validateUnaryExpr(expr, accept); + break; } } @@ -245,6 +249,12 @@ export default class ExpressionValidator implements AstValidator { } } + private validateUnaryExpr(expr: UnaryExpr, accept: ValidationAcceptor) { + if (expr.operand.$resolvedType && expr.operand.$resolvedType.decl !== 'Boolean') { + accept('error', `operand of "${expr.operator}" must be of Boolean type`, { node: expr.operand }); + } + } + private validateCollectionPredicate(expr: BinaryExpr, accept: ValidationAcceptor) { if (!expr.$resolvedType) { accept('error', 'collection predicate can only be used on an array of model type', { node: expr }); diff --git a/packages/orm/package.json b/packages/orm/package.json index 083018c15..4f6aef889 100644 --- a/packages/orm/package.json +++ b/packages/orm/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/orm", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "description": "ZenStack ORM", "type": "module", "scripts": { diff --git a/packages/orm/src/client/executor/zenstack-query-executor.ts b/packages/orm/src/client/executor/zenstack-query-executor.ts index 201c3229f..6c1cbd5e9 100644 --- a/packages/orm/src/client/executor/zenstack-query-executor.ts +++ b/packages/orm/src/client/executor/zenstack-query-executor.ts @@ -198,7 +198,7 @@ export class ZenStackQueryExecutor extends DefaultQueryExecutor { if (parameters) { compiled = { ...compiled, parameters }; } - return connection.executeQuery(compiled); + return this.internalExecuteQuery(connection, compiled); } if ( @@ -246,7 +246,7 @@ export class ZenStackQueryExecutor extends DefaultQueryExecutor { queryId, ); - const result = await connection.executeQuery(compiled); + const result = await this.internalExecuteQuery(connection, compiled); if (!this.driver.isTransactionConnection(connection)) { // not in a transaction, just call all after-mutation hooks @@ -470,7 +470,7 @@ export class ZenStackQueryExecutor extends DefaultQueryExecutor { const compiled = this.compileQuery(selectQueryNode, createQueryId()); // execute the query directly with the given connection to avoid triggering // any other side effects - const result = await connection.executeQuery(compiled); + const result = await this.internalExecuteQuery(connection, compiled); return result.rows as Record[]; } @@ -483,4 +483,12 @@ export class ZenStackQueryExecutor extends DefaultQueryExecutor { return condition2; } } + + private async internalExecuteQuery(connection: DatabaseConnection, compiledQuery: CompiledQuery) { + try { + return await connection.executeQuery(compiledQuery); + } catch (err) { + throw createDBQueryError('Failed to execute query', err, compiledQuery.sql, compiledQuery.parameters); + } + } } diff --git a/packages/orm/src/client/options.ts b/packages/orm/src/client/options.ts index 2ec330d0c..64f50b613 100644 --- a/packages/orm/src/client/options.ts +++ b/packages/orm/src/client/options.ts @@ -50,6 +50,8 @@ export type ClientOptions = { /** * Custom function definitions. + * + * @private */ functions?: Record>; diff --git a/packages/orm/src/client/plugin.ts b/packages/orm/src/client/plugin.ts index edf5c86ad..5664abb81 100644 --- a/packages/orm/src/client/plugin.ts +++ b/packages/orm/src/client/plugin.ts @@ -24,8 +24,10 @@ export interface RuntimePlugin { */ description?: string; + // TODO: revisit /** * Custom function implementations. + * @private */ functions?: Record>; diff --git a/packages/plugins/policy/package.json b/packages/plugins/policy/package.json index a5c8c394f..48fa5c3e8 100644 --- a/packages/plugins/policy/package.json +++ b/packages/plugins/policy/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/plugin-policy", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "description": "ZenStack Policy Plugin", "type": "module", "scripts": { diff --git a/packages/schema/package.json b/packages/schema/package.json index 2ab344095..4541c3e55 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/schema", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "description": "ZenStack Runtime Schema", "type": "module", "scripts": { diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 7aaada5b9..ccbb485d4 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/sdk", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "description": "ZenStack SDK", "type": "module", "scripts": { @@ -25,6 +25,16 @@ "types": "./dist/index.d.cts", "default": "./dist/index.cjs" } + }, + "./ast": { + "import": { + "types": "./dist/ast.d.ts", + "default": "./dist/ast.js" + }, + "require": { + "types": "./dist/ast.d.cts", + "default": "./dist/ast.cjs" + } } }, "dependencies": { diff --git a/packages/sdk/src/ast.ts b/packages/sdk/src/ast.ts new file mode 100644 index 000000000..3407e5b41 --- /dev/null +++ b/packages/sdk/src/ast.ts @@ -0,0 +1 @@ +export * from '@zenstackhq/language/ast'; diff --git a/packages/sdk/tsup.config.ts b/packages/sdk/tsup.config.ts index 5a74a9dd1..131257ec3 100644 --- a/packages/sdk/tsup.config.ts +++ b/packages/sdk/tsup.config.ts @@ -3,6 +3,7 @@ import { defineConfig } from 'tsup'; export default defineConfig({ entry: { index: 'src/index.ts', + ast: 'src/ast.ts', }, outDir: 'dist', splitting: false, diff --git a/packages/server/package.json b/packages/server/package.json index 068119de4..eb6654de7 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/server", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "description": "ZenStack automatic CRUD API handlers and server adapters", "type": "module", "scripts": { diff --git a/packages/testtools/package.json b/packages/testtools/package.json index 45d443f32..1293d3237 100644 --- a/packages/testtools/package.json +++ b/packages/testtools/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/testtools", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "description": "ZenStack Test Tools", "type": "module", "scripts": { diff --git a/packages/zod/package.json b/packages/zod/package.json index 187046dd6..7b09b404d 100644 --- a/packages/zod/package.json +++ b/packages/zod/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/zod", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "description": "", "type": "module", "main": "index.js", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8f85a60f4..5a1c8bc17 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40,8 +40,8 @@ catalogs: specifier: 3.5.0 version: 3.5.0 next: - specifier: 16.0.7 - version: 16.0.7 + specifier: 16.0.10 + version: 16.0.10 pg: specifier: ^8.13.1 version: 8.16.3 @@ -621,7 +621,7 @@ importers: version: 4.10.3 next: specifier: 'catalog:' - version: 16.0.7(@babel/core@7.28.5)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + version: 16.0.10(@babel/core@7.28.5)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) nuxt: specifier: ^4.2.0 version: 4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.5.0)(db0@0.3.4(better-sqlite3@12.5.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.9.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1) @@ -739,8 +739,8 @@ importers: specifier: ^2.0.8 version: 2.0.8 next: - specifier: 16.0.7 - version: 16.0.7(@babel/core@7.28.5)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + specifier: 'catalog:' + version: 16.0.10(@babel/core@7.28.5)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) react: specifier: 'catalog:' version: 19.2.0 @@ -1784,56 +1784,56 @@ packages: '@napi-rs/wasm-runtime@1.0.7': resolution: {integrity: sha512-SeDnOO0Tk7Okiq6DbXmmBODgOAb9dp9gjlphokTUxmt8U3liIP1ZsozBahH69j/RJv+Rfs6IwUKHTgQYJ/HBAw==} - '@next/env@16.0.7': - resolution: {integrity: sha512-gpaNgUh5nftFKRkRQGnVi5dpcYSKGcZZkQffZ172OrG/XkrnS7UBTQ648YY+8ME92cC4IojpI2LqTC8sTDhAaw==} + '@next/env@16.0.10': + resolution: {integrity: sha512-8tuaQkyDVgeONQ1MeT9Mkk8pQmZapMKFh5B+OrFUlG3rVmYTXcXlBetBgTurKXGaIZvkoqRT9JL5K3phXcgang==} '@next/eslint-plugin-next@16.0.1': resolution: {integrity: sha512-g4Cqmv/gyFEXNeVB2HkqDlYKfy+YrlM2k8AVIO/YQVEPfhVruH1VA99uT1zELLnPLIeOnx8IZ6Ddso0asfTIdw==} - '@next/swc-darwin-arm64@16.0.7': - resolution: {integrity: sha512-LlDtCYOEj/rfSnEn/Idi+j1QKHxY9BJFmxx7108A6D8K0SB+bNgfYQATPk/4LqOl4C0Wo3LACg2ie6s7xqMpJg==} + '@next/swc-darwin-arm64@16.0.10': + resolution: {integrity: sha512-4XgdKtdVsaflErz+B5XeG0T5PeXKDdruDf3CRpnhN+8UebNa5N2H58+3GDgpn/9GBurrQ1uWW768FfscwYkJRg==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@next/swc-darwin-x64@16.0.7': - resolution: {integrity: sha512-rtZ7BhnVvO1ICf3QzfW9H3aPz7GhBrnSIMZyr4Qy6boXF0b5E3QLs+cvJmg3PsTCG2M1PBoC+DANUi4wCOKXpA==} + '@next/swc-darwin-x64@16.0.10': + resolution: {integrity: sha512-spbEObMvRKkQ3CkYVOME+ocPDFo5UqHb8EMTS78/0mQ+O1nqE8toHJVioZo4TvebATxgA8XMTHHrScPrn68OGw==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@next/swc-linux-arm64-gnu@16.0.7': - resolution: {integrity: sha512-mloD5WcPIeIeeZqAIP5c2kdaTa6StwP4/2EGy1mUw8HiexSHGK/jcM7lFuS3u3i2zn+xH9+wXJs6njO7VrAqww==} + '@next/swc-linux-arm64-gnu@16.0.10': + resolution: {integrity: sha512-uQtWE3X0iGB8apTIskOMi2w/MKONrPOUCi5yLO+v3O8Mb5c7K4Q5KD1jvTpTF5gJKa3VH/ijKjKUq9O9UhwOYw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-musl@16.0.7': - resolution: {integrity: sha512-+ksWNrZrthisXuo9gd1XnjHRowCbMtl/YgMpbRvFeDEqEBd523YHPWpBuDjomod88U8Xliw5DHhekBC3EOOd9g==} + '@next/swc-linux-arm64-musl@16.0.10': + resolution: {integrity: sha512-llA+hiDTrYvyWI21Z0L1GiXwjQaanPVQQwru5peOgtooeJ8qx3tlqRV2P7uH2pKQaUfHxI/WVarvI5oYgGxaTw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-x64-gnu@16.0.7': - resolution: {integrity: sha512-4WtJU5cRDxpEE44Ana2Xro1284hnyVpBb62lIpU5k85D8xXxatT+rXxBgPkc7C1XwkZMWpK5rXLXTh9PFipWsA==} + '@next/swc-linux-x64-gnu@16.0.10': + resolution: {integrity: sha512-AK2q5H0+a9nsXbeZ3FZdMtbtu9jxW4R/NgzZ6+lrTm3d6Zb7jYrWcgjcpM1k8uuqlSy4xIyPR2YiuUr+wXsavA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-linux-x64-musl@16.0.7': - resolution: {integrity: sha512-HYlhqIP6kBPXalW2dbMTSuB4+8fe+j9juyxwfMwCe9kQPPeiyFn7NMjNfoFOfJ2eXkeQsoUGXg+O2SE3m4Qg2w==} + '@next/swc-linux-x64-musl@16.0.10': + resolution: {integrity: sha512-1TDG9PDKivNw5550S111gsO4RGennLVl9cipPhtkXIFVwo31YZ73nEbLjNC8qG3SgTz/QZyYyaFYMeY4BKZR/g==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-win32-arm64-msvc@16.0.7': - resolution: {integrity: sha512-EviG+43iOoBRZg9deGauXExjRphhuYmIOJ12b9sAPy0eQ6iwcPxfED2asb/s2/yiLYOdm37kPaiZu8uXSYPs0Q==} + '@next/swc-win32-arm64-msvc@16.0.10': + resolution: {integrity: sha512-aEZIS4Hh32xdJQbHz121pyuVZniSNoqDVx1yIr2hy+ZwJGipeqnMZBJHyMxv2tiuAXGx6/xpTcQJ6btIiBjgmg==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@next/swc-win32-x64-msvc@16.0.7': - resolution: {integrity: sha512-gniPjy55zp5Eg0896qSrf3yB1dw4F/3s8VK1ephdsZZ129j2n6e1WqCbE2YgcKhW9hPB9TVZENugquWJD5x0ug==} + '@next/swc-win32-x64-msvc@16.0.10': + resolution: {integrity: sha512-E+njfCoFLb01RAFEnGZn6ERoOqhK1Gl3Lfz1Kjnj0Ulfu7oJbuMyvBKNj/bw8XZnenHDASlygTjZICQW+rYW1Q==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -5639,8 +5639,8 @@ packages: resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==} engines: {node: '>= 0.6'} - next@16.0.7: - resolution: {integrity: sha512-3mBRJyPxT4LOxAJI6IsXeFtKfiJUbjCLgvXO02fV8Wy/lIhPvP94Fe7dGhUgHXcQy4sSuYwQNcOLhIfOm0rL0A==} + next@16.0.10: + resolution: {integrity: sha512-RtWh5PUgI+vxlV3HdR+IfWA1UUHu0+Ram/JBO4vWB54cVPentCD0e+lxyAYEsDTqGGMg7qpjhKh6dc6aW7W/sA==} engines: {node: '>=20.9.0'} hasBin: true peerDependencies: @@ -8451,34 +8451,34 @@ snapshots: '@tybys/wasm-util': 0.10.1 optional: true - '@next/env@16.0.7': {} + '@next/env@16.0.10': {} '@next/eslint-plugin-next@16.0.1': dependencies: fast-glob: 3.3.1 - '@next/swc-darwin-arm64@16.0.7': + '@next/swc-darwin-arm64@16.0.10': optional: true - '@next/swc-darwin-x64@16.0.7': + '@next/swc-darwin-x64@16.0.10': optional: true - '@next/swc-linux-arm64-gnu@16.0.7': + '@next/swc-linux-arm64-gnu@16.0.10': optional: true - '@next/swc-linux-arm64-musl@16.0.7': + '@next/swc-linux-arm64-musl@16.0.10': optional: true - '@next/swc-linux-x64-gnu@16.0.7': + '@next/swc-linux-x64-gnu@16.0.10': optional: true - '@next/swc-linux-x64-musl@16.0.7': + '@next/swc-linux-x64-musl@16.0.10': optional: true - '@next/swc-win32-arm64-msvc@16.0.7': + '@next/swc-win32-arm64-msvc@16.0.10': optional: true - '@next/swc-win32-x64-msvc@16.0.7': + '@next/swc-win32-x64-msvc@16.0.10': optional: true '@noble/ciphers@2.0.1': {} @@ -12705,9 +12705,9 @@ snapshots: negotiator@1.0.0: {} - next@16.0.7(@babel/core@7.28.5)(react-dom@19.2.0(react@19.2.0))(react@19.2.0): + next@16.0.10(@babel/core@7.28.5)(react-dom@19.2.0(react@19.2.0))(react@19.2.0): dependencies: - '@next/env': 16.0.7 + '@next/env': 16.0.10 '@swc/helpers': 0.5.15 caniuse-lite: 1.0.30001751 postcss: 8.4.31 @@ -12715,14 +12715,14 @@ snapshots: react-dom: 19.2.0(react@19.2.0) styled-jsx: 5.1.6(@babel/core@7.28.5)(react@19.2.0) optionalDependencies: - '@next/swc-darwin-arm64': 16.0.7 - '@next/swc-darwin-x64': 16.0.7 - '@next/swc-linux-arm64-gnu': 16.0.7 - '@next/swc-linux-arm64-musl': 16.0.7 - '@next/swc-linux-x64-gnu': 16.0.7 - '@next/swc-linux-x64-musl': 16.0.7 - '@next/swc-win32-arm64-msvc': 16.0.7 - '@next/swc-win32-x64-msvc': 16.0.7 + '@next/swc-darwin-arm64': 16.0.10 + '@next/swc-darwin-x64': 16.0.10 + '@next/swc-linux-arm64-gnu': 16.0.10 + '@next/swc-linux-arm64-musl': 16.0.10 + '@next/swc-linux-x64-gnu': 16.0.10 + '@next/swc-linux-x64-musl': 16.0.10 + '@next/swc-win32-arm64-msvc': 16.0.10 + '@next/swc-win32-x64-msvc': 16.0.10 sharp: 0.34.4 transitivePeerDependencies: - '@babel/core' diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 2d0efa782..d4e30a0ff 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -15,7 +15,7 @@ catalog: kysely: ~0.28.8 langium: 3.5.0 langium-cli: 3.5.0 - next: 16.0.7 + next: 16.0.10 pg: ^8.13.1 prisma: ^6.19.0 react: 19.2.0 diff --git a/samples/next.js/package.json b/samples/next.js/package.json index 71d496ece..5bfff9b90 100644 --- a/samples/next.js/package.json +++ b/samples/next.js/package.json @@ -1,6 +1,6 @@ { "name": "next.js", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "private": true, "scripts": { "generate": "zen generate --lite", @@ -18,7 +18,7 @@ "better-sqlite3": "catalog:", "kysely": "catalog:", "lorem-ipsum": "^2.0.8", - "next": "16.0.7", + "next": "catalog:", "react": "catalog:", "react-dom": "catalog:" }, diff --git a/samples/orm/package.json b/samples/orm/package.json index 1aae5022d..dd41d5695 100644 --- a/samples/orm/package.json +++ b/samples/orm/package.json @@ -1,6 +1,6 @@ { "name": "sample-blog", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "description": "", "main": "index.js", "private": true, diff --git a/tests/e2e/package.json b/tests/e2e/package.json index 743bcd0cc..a6d5436ae 100644 --- a/tests/e2e/package.json +++ b/tests/e2e/package.json @@ -1,6 +1,6 @@ { "name": "e2e", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "private": true, "type": "module", "scripts": { diff --git a/tests/regression/package.json b/tests/regression/package.json index 4b99fc7f6..0e37f6a6e 100644 --- a/tests/regression/package.json +++ b/tests/regression/package.json @@ -1,6 +1,6 @@ { "name": "regression", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "private": true, "type": "module", "scripts": { diff --git a/tests/regression/test/issue-503/regression.test.ts b/tests/regression/test/issue-503/regression.test.ts index c31864a70..e901ce426 100644 --- a/tests/regression/test/issue-503/regression.test.ts +++ b/tests/regression/test/issue-503/regression.test.ts @@ -2,7 +2,7 @@ import { createTestClient } from '@zenstackhq/testtools'; import { describe, expect, it } from 'vitest'; import { schema } from './schema'; -describe('Regression tests for issues #503', () => { +describe('Regression tests for issue #503', () => { it('verifies the issue', async () => { const db = await createTestClient(schema); const r = await db.internalChat.create({ diff --git a/tests/regression/test/issue-505.test.ts b/tests/regression/test/issue-505.test.ts index da8482857..bbbca26c9 100644 --- a/tests/regression/test/issue-505.test.ts +++ b/tests/regression/test/issue-505.test.ts @@ -1,7 +1,7 @@ import { createTestClient } from '@zenstackhq/testtools'; import { describe, expect, it } from 'vitest'; -describe('Regression tests for issues 505', () => { +describe('Regression tests for issue 505', () => { it('verifies the issue', async () => { const db = await createTestClient( ` diff --git a/tests/regression/test/issue-510.test.ts b/tests/regression/test/issue-510.test.ts new file mode 100644 index 000000000..1816fe824 --- /dev/null +++ b/tests/regression/test/issue-510.test.ts @@ -0,0 +1,103 @@ +import { createPolicyTestClient } from '@zenstackhq/testtools'; +import { describe, expect, it } from 'vitest'; + +describe('Regression tests for issue 510', () => { + it('verifies the issue', async () => { + const schema = ` +type ID { + id String @id @default(nanoid()) +} + +type Timestamps { + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt +} + +type Base with ID, Timestamps { +} + +type AuthInfo { + id String + username String + role Role + + @@auth +} + +enum Role { + SUPERADMIN + ADMIN + USER +} + +enum FileStatus { + PENDING + UPLOADED + FAILED +} + +model User with Base { + username String @unique + passwordHash String + name String + role Role + + RefreshToken RefreshToken[] + File File[] + Post Post[] + + @@allow('all', auth().id == id) +} + +model File with Timestamps { + key String @id + + userId String + User User @relation(fields: [userId], references: [id]) + + originalFilename String + filename String + contentType String + size Int? + status FileStatus + + Post Post[] + + @@allow('all', auth().id == userId) +} + +model AuditLog { + timestamp DateTime @id @default(now()) + + action String + data Json + + @@deny('all', true) +} + +model RefreshToken with Base { + userId String + User User @relation(fields: [userId], references: [id]) + + revoked Boolean + + @@deny('all', true) +} + +model Post with Base { + userId String + User User @relation(fields: [userId], references: [id]) + + content String + imageKey String? + Image File? @relation(fields: [imageKey], references: [key]) + + @@allow('read', true) + @@allow('create', auth().id == userId && (!Image || auth().id == Image.userId)) + @@allow('update,delete', auth().id == userId) +} +`; + + await expect(createPolicyTestClient(schema)).rejects.toThrow(/operand of "!" must be of Boolean type/); + }); +}); diff --git a/tests/runtimes/bun/package.json b/tests/runtimes/bun/package.json index ded75cafc..4016eb7ef 100644 --- a/tests/runtimes/bun/package.json +++ b/tests/runtimes/bun/package.json @@ -1,6 +1,6 @@ { "name": "bun-e2e", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "private": true, "type": "module", "scripts": { diff --git a/tests/runtimes/edge-runtime/package.json b/tests/runtimes/edge-runtime/package.json index 6a3004a4a..6cd74484b 100644 --- a/tests/runtimes/edge-runtime/package.json +++ b/tests/runtimes/edge-runtime/package.json @@ -1,6 +1,6 @@ { "name": "edge-runtime-e2e", - "version": "3.0.0-beta.32", + "version": "3.0.0-beta.33", "private": true, "type": "module", "scripts": {