Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zenstack-monorepo",
"version": "2.22.1",
"version": "2.22.2",
"description": "",
"scripts": {
"build": "pnpm -r --filter=\"!./packages/ide/*\" build",
Expand All @@ -11,10 +11,9 @@
"test-integration": "pnpm run --filter=integration test --silent --forceExit",
"test-regression": "pnpm run --filter=regression test --silent --forceExit",
"test-scaffold": "tsx script/test-scaffold.ts",
"publish-all": "pnpm --filter \"./packages/**\" -r publish --access public",
"publish-all": "pnpm --filter \"./packages/**\" -r publish --access public --tag v2",
"publish-preview": "pnpm --filter \"./packages/**\" -r publish --force --registry https://preview.registry.zenstack.dev/",
"unpublish-preview": "pnpm --recursive --shell-mode exec -- npm unpublish -f --registry https://preview.registry.zenstack.dev/ \"\\$PNPM_PACKAGE_NAME\"",
"publish-next": "pnpm --filter \"./packages/**\" -r publish --access public --tag next",
"publish-preview-next": "pnpm --filter \"./packages/**\" -r publish --force --registry https://preview.registry.zenstack.dev/ --tag next",
"unpublish-preview-next": "pnpm --recursive --shell-mode exec -- npm unpublish -f --registry https://preview.registry.zenstack.dev/ --tag next \"\\$PNPM_PACKAGE_NAME\"",
"publish-test": "pnpm --filter \"./packages/**\" -r publish --access public --tag test"
Expand Down
2 changes: 1 addition & 1 deletion packages/ide/jetbrains/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "dev.zenstack"
version = "2.22.1"
version = "2.22.2"

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion packages/ide/jetbrains/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jetbrains",
"version": "2.22.1",
"version": "2.22.2",
"displayName": "ZenStack JetBrains IDE Plugin",
"description": "ZenStack JetBrains IDE plugin",
"homepage": "https://zenstack.dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/language/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/language",
"version": "2.22.1",
"version": "2.22.2",
"displayName": "ZenStack modeling language compiler",
"description": "ZenStack modeling language compiler",
"homepage": "https://zenstack.dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/misc/redwood/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zenstackhq/redwood",
"displayName": "ZenStack RedwoodJS Integration",
"version": "2.22.1",
"version": "2.22.2",
"description": "CLI and runtime for integrating ZenStack with RedwoodJS projects.",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/openapi/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zenstackhq/openapi",
"displayName": "ZenStack Plugin and Runtime for OpenAPI",
"version": "2.22.1",
"version": "2.22.2",
"description": "ZenStack plugin and runtime supporting OpenAPI",
"main": "index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/swr/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zenstackhq/swr",
"displayName": "ZenStack plugin for generating SWR hooks",
"version": "2.22.1",
"version": "2.22.2",
"description": "ZenStack plugin for generating SWR hooks",
"main": "index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/tanstack-query/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zenstackhq/tanstack-query",
"displayName": "ZenStack plugin for generating tanstack-query hooks",
"version": "2.22.1",
"version": "2.22.2",
"description": "ZenStack plugin for generating tanstack-query hooks",
"main": "index.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/trpc/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zenstackhq/trpc",
"displayName": "ZenStack plugin for tRPC",
"version": "2.22.1",
"version": "2.22.2",
"description": "ZenStack plugin for tRPC",
"main": "index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zenstackhq/runtime",
"displayName": "ZenStack Runtime Library",
"version": "2.22.1",
"version": "2.22.2",
"description": "Runtime of ZenStack for both client-side and server-side environments.",
"repository": {
"type": "git",
Expand Down
17 changes: 13 additions & 4 deletions packages/runtime/src/enhancements/node/policy/policy-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* eslint-disable @typescript-eslint/no-explicit-any */

import deepmerge from 'deepmerge';
import { z, type ZodError, type ZodObject, type ZodSchema } from 'zod';
import type { z, ZodError, ZodObject, ZodSchema } from 'zod';
import { z as zod3 } from 'zod/v3';
import { z as zod4 } from 'zod/v4';
import { CrudFailureReason, PrismaErrorCode } from '../../../constants';
import {
clone,
Expand Down Expand Up @@ -1376,17 +1378,19 @@ export class PolicyUtil extends QueryUtils {
let schema: ZodObject<any> | undefined;

const overridePasswordFields = (schema: z.ZodObject<any>) => {
const useZod: any = schema._def ? zod3 : zod4;

let result = schema;
const modelFields = this.modelMeta.models[lowerCaseFirst(model)]?.fields;
if (modelFields) {
for (const [key, field] of Object.entries(modelFields)) {
if (field.attributes?.some((attr) => attr.name === '@password')) {
// override `@password` field schema with a string schema
let pwFieldSchema: ZodSchema = z.string();
let pwFieldSchema: ZodSchema = useZod.string();
if (field.isOptional) {
pwFieldSchema = pwFieldSchema.nullish();
}
result = result.merge(z.object({ [key]: pwFieldSchema }));
result = result.merge(useZod.object({ [key]: pwFieldSchema }));
}
}
}
Expand Down Expand Up @@ -1540,7 +1544,12 @@ export class PolicyUtil extends QueryUtils {
continue;
}

if (fieldInfo.isDataModel && queryArgs?.include && typeof queryArgs.include === 'object' && !queryArgs.include[field]) {
if (
fieldInfo.isDataModel &&
queryArgs?.include &&
typeof queryArgs.include === 'object' &&
!queryArgs.include[field]
) {
// respect include
delete entityData[field];
continue;
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/src/validation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { z } from 'zod';
import type { z } from 'zod';
import { getZodErrorMessage } from './local-helpers';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/src/zod-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { z as Z } from 'zod';
import type { z as Z } from 'zod';

/**
* A smarter version of `z.union` that decide which candidate to use based on how few unrecognized keys it has.
Expand Down
2 changes: 2 additions & 0 deletions packages/schema/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ZenStack VS Code Extension

> This extension only supports ZenStack v2. For the latest ZenStack v3, please use the [ZenStack V3 Language Tools](https://marketplace.visualstudio.com/items?itemName=zenstack.zenstack-v3) extension instead.

[ZenStack](https://zenstack.dev) is a toolkit that simplifies the development of a web app's backend. It enhances [Prisma ORM](https://prisma.io) with flexible Authorization and auto-generated, type-safe APIs/hooks, simplifying full-stack development.

This VS Code extension provides code editing helpers for authoring ZenStack's schema files (.zmodel files).
Expand Down
4 changes: 2 additions & 2 deletions packages/schema/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "zenstack",
"publisher": "zenstack",
"displayName": "ZenStack Language Tools",
"displayName": "ZenStack V2 Language Tools",
"description": "FullStack enhancement for Prisma ORM: seamless integration from database to UI",
"version": "2.22.1",
"version": "2.22.2",
"author": {
"name": "ZenStack Team"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/sdk",
"version": "2.22.1",
"version": "2.22.2",
"description": "ZenStack plugin development SDK",
"main": "index.js",
"scripts": {
Expand All @@ -20,6 +20,7 @@
"dependencies": {
"@prisma/generator-helper": "6.19.x",
"@prisma/internals": "6.19.x",
"@prisma/internals-v7": "npm:@prisma/internals@7",
"@zenstackhq/language": "workspace:*",
"@zenstackhq/runtime": "workspace:*",
"langium": "1.3.1",
Expand Down
10 changes: 8 additions & 2 deletions packages/sdk/src/prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import type { DMMF } from '@prisma/generator-helper';
import { getDMMF as _getDMMF, type GetDMMFOptions } from '@prisma/internals';
import { getDMMF as _getDMMF7 } from '@prisma/internals-v7';
import { DEFAULT_RUNTIME_LOAD_PATH } from '@zenstackhq/runtime';
import path from 'path';
import semver from 'semver';
import { Model } from './ast';
import { RUNTIME_PACKAGE } from './constants';
import { normalizedRelative } from './path';
import type { PluginOptions } from './types';
import { getDataSourceProvider } from './utils';
import { normalizedRelative } from './path';

/**
* Given an import context directory and plugin options, compute the import spec for the Prisma Client.
Expand Down Expand Up @@ -51,7 +52,12 @@ function normalizePath(p: string) {
* Loads Prisma DMMF
*/
export function getDMMF(options: GetDMMFOptions): Promise<DMMF.Document> {
return _getDMMF(options);
const prismaVersion = getPrismaVersion();
if (prismaVersion && semver.gte(prismaVersion, '7.0.0')) {
return _getDMMF7(options);
} else {
return _getDMMF(options);
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/server",
"version": "2.22.1",
"version": "2.22.2",
"displayName": "ZenStack Server-side Adapters",
"description": "ZenStack server-side adapters",
"homepage": "https://zenstack.dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/testtools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/testtools",
"version": "2.22.1",
"version": "2.22.2",
"description": "ZenStack Test Tools",
"main": "index.js",
"private": true,
Expand Down
Loading
Loading