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
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
gradle-home-cache-cleanup: true

- name: Build
run: DEFAULT_NPM_TAG=latest pnpm run build
run: DEFAULT_NPM_TAG=latest pnpm run build-ci

- name: Lint
run: pnpm lint
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "zenstack-monorepo",
"version": "2.10.0",
"version": "2.10.1",
"description": "",
"scripts": {
"build": "pnpm -r build",
"build": "pnpm -r --filter=\"!./packages/ide/*\" build",
"build-ci": "pnpm -r build",
"lint": "pnpm -r lint",
"test": "pnpm -r --parallel run test --silent --forceExit",
"test-ci": "pnpm -r --parallel run --filter=\"./packages/**\" test --silent --forceExit",
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.10.0"
version = "2.10.1"

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.10.0",
"version": "2.10.1",
"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.10.0",
"version": "2.10.1",
"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.10.0",
"version": "2.10.1",
"description": "CLI and runtime for integrating ZenStack with RedwoodJS projects.",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions 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.10.0",
"version": "2.10.1",
"description": "ZenStack plugin and runtime supporting OpenAPI",
"main": "index.js",
"repository": {
Expand Down Expand Up @@ -36,7 +36,7 @@
"ts-pattern": "^4.3.0",
"upper-case-first": "^2.0.2",
"yaml": "^2.2.2",
"zod": "^3.22.4",
"zod": "^3.22.4",
"zod-validation-error": "^1.5.0"
},
"devDependencies": {
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.10.0",
"version": "2.10.1",
"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.10.0",
"version": "2.10.1",
"description": "ZenStack plugin for generating tanstack-query hooks",
"main": "index.js",
"exports": {
Expand Down
8 changes: 5 additions & 3 deletions 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.10.0",
"version": "2.10.1",
"description": "ZenStack plugin for tRPC",
"main": "index.js",
"repository": {
Expand Down Expand Up @@ -31,8 +31,10 @@
"lower-case-first": "^2.0.2",
"ts-morph": "^16.0.0",
"tslib": "^2.4.1",
"upper-case-first": "^2.0.2",
"zod": "^3.22.4"
"upper-case-first": "^2.0.2"
},
"peerDependencies": {
"zod": "^3.22.4"
},
"devDependencies": {
"@trpc/next": "^10.32.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"trpc-nuxt": "^0.10.22",
"vue": "latest",
"vue-router": "latest",
"zod": "^3.23.8"
"zod": "^3.22.4"
},
"devDependencies": {
"esbuild": "^0.24.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"trpc-nuxt": "^0.11.0-beta.1",
"vue": "latest",
"vue-router": "latest",
"zod": "^3.23.8"
"zod": "^3.22.4"
},
"devDependencies": {
"esbuild": "^0.24.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"superjson": "^2.2.1",
"zod": "^3.22.4"
"zod": "^3.22.4"
},
"devDependencies": {
"@types/eslint": "^8.44.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"react-dom": "^18.3.1",
"server-only": "^0.0.1",
"superjson": "^2.2.1",
"zod": "^3.23.3"
"zod": "^3.22.4"
},
"devDependencies": {
"@types/eslint": "^8.56.10",
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.10.0",
"version": "2.10.1",
"description": "Runtime of ZenStack for both client-side and server-side environments.",
"repository": {
"type": "git",
Expand Down
14 changes: 9 additions & 5 deletions packages/runtime/src/zod-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import { z as Z } from 'zod';
* accidentally matching a less-ideal schema candidate.
*
* The helper uses a custom schema to find the candidate that results in the fewest unrecognized keys when parsing the data.
*
* The function uses `any` for parameter and return type to be compatible with various zod versions.
*/
export function smartUnion(z: typeof Z, candidates: Z.ZodSchema[]) {
export function smartUnion(z: any, candidates: any[]): any {
// strip `z.lazy`
const processedCandidates = candidates.map((candidate) => unwrapLazy(z, candidate));
const processedCandidates: Z.ZodSchema[] = candidates.map((candidate) => unwrapLazy(z, candidate));

if (processedCandidates.some((c) => !(c instanceof z.ZodObject || c instanceof z.ZodArray))) {
// fall back to plain union if not all candidates are objects or arrays
Expand All @@ -22,11 +24,13 @@ export function smartUnion(z: typeof Z, candidates: Z.ZodSchema[]) {
let resultData: any;

return z
.custom((data) => {
.custom((data: any) => {
if (Array.isArray(data)) {
const { data: result, success } = smartArrayUnion(
z,
processedCandidates.filter((c) => c instanceof z.ZodArray),
processedCandidates.filter((c) => c instanceof z.ZodArray) as Array<
Z.ZodArray<Z.ZodObject<Z.ZodRawShape>>
>,
data
);
if (success) {
Expand All @@ -36,7 +40,7 @@ export function smartUnion(z: typeof Z, candidates: Z.ZodSchema[]) {
} else {
const { data: result, success } = smartObjectUnion(
z,
processedCandidates.filter((c) => c instanceof z.ZodObject),
processedCandidates.filter((c) => c instanceof z.ZodObject) as Z.ZodObject<Z.ZodRawShape>[],
data
);
if (success) {
Expand Down
2 changes: 1 addition & 1 deletion packages/schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publisher": "zenstack",
"displayName": "ZenStack Language Tools",
"description": "FullStack enhancement for Prisma ORM: seamless integration from database to UI",
"version": "2.10.0",
"version": "2.10.1",
"author": {
"name": "ZenStack Team"
},
Expand Down
1 change: 1 addition & 0 deletions packages/schema/src/plugins/enhancer/enhance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export function enhance(prisma: any, context?: EnhancementContext<${authTypePara
output: logicalPrismaFile,
overrideClientGenerationPath: prismaClientOutDir,
mode: 'logical',
customAttributesAsComments: true,
});

// generate the prisma client
Expand Down
2 changes: 1 addition & 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.10.0",
"version": "2.10.1",
"description": "ZenStack plugin development SDK",
"main": "index.js",
"scripts": {
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.10.0",
"version": "2.10.1",
"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.10.0",
"version": "2.10.1",
"description": "ZenStack Test Tools",
"main": "index.js",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion script/test-scaffold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ function run(cmd: string) {
}

run('npm init -y');
run('npm i --no-audit --no-fund typescript [email protected] @prisma/[email protected] zod decimal.js @types/node');
run('npm i --no-audit --no-fund typescript [email protected] @prisma/[email protected] zod@^3.22.4 decimal.js @types/node');

console.log('Test scaffold setup complete.');
Loading