diff --git a/package.json b/package.json index febc93264..54769b34b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zenstack-monorepo", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.4", "description": "", "scripts": { "build": "pnpm -r build", diff --git a/packages/ide/jetbrains/build.gradle.kts b/packages/ide/jetbrains/build.gradle.kts index 4c8825117..23c8d0b7b 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.0.0-alpha.1" +version = "2.0.0-alpha.4" repositories { mavenCentral() diff --git a/packages/ide/jetbrains/package.json b/packages/ide/jetbrains/package.json index 47dfec1b8..db2daea8d 100644 --- a/packages/ide/jetbrains/package.json +++ b/packages/ide/jetbrains/package.json @@ -1,6 +1,6 @@ { "name": "jetbrains", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.4", "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 0b7ea3673..315e65049 100644 --- a/packages/language/package.json +++ b/packages/language/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/language", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.4", "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 cb75056e7..9886151b4 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.2", + "version": "2.0.0-alpha.4", "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 3ea7a4397..5d191e2ff 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.2", + "version": "2.0.0-alpha.4", "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 7af3405d2..12652665d 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.2", + "version": "2.0.0-alpha.4", "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 1416132c4..3da2d8bf8 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.2", + "version": "2.0.0-alpha.4", "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 4b56afd1c..c21bccd72 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.2", + "version": "2.0.0-alpha.4", "description": "ZenStack plugin for tRPC", "main": "index.js", "repository": { diff --git a/packages/plugins/trpc/tests/projects/t3-trpc-v10/.gitignore b/packages/plugins/trpc/tests/projects/t3-trpc-v10/.gitignore index b9331d6ce..e3f5e79f8 100644 --- a/packages/plugins/trpc/tests/projects/t3-trpc-v10/.gitignore +++ b/packages/plugins/trpc/tests/projects/t3-trpc-v10/.gitignore @@ -40,4 +40,5 @@ yarn-error.log* # typescript *.tsbuildinfo -package-lock.json \ No newline at end of file +package-lock.json +package.json \ No newline at end of file diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 34f6ea0ed..4dcb94daa 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.2", + "version": "2.0.0-alpha.4", "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 762e20089..d2113958a 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.0.0-alpha.2", + "version": "2.0.0-alpha.4", "author": { "name": "ZenStack Team" }, diff --git a/packages/schema/src/plugins/enhancer/enhance/index.ts b/packages/schema/src/plugins/enhancer/enhance/index.ts index 63845ba1c..df14e0826 100644 --- a/packages/schema/src/plugins/enhancer/enhance/index.ts +++ b/packages/schema/src/plugins/enhancer/enhance/index.ts @@ -36,7 +36,9 @@ export async function generate(model: Model, options: PluginOptions, project: Pr let logicalPrismaClientDir: string | undefined; let dmmf: DMMF.Document | undefined; - if (needsLogicalClient(model)) { + const withLogicalClient = needsLogicalClient(model); + + if (withLogicalClient) { // schema contains delegate models, need to generate a logical prisma schema const result = await generateLogicalPrisma(model, options, outDir); @@ -49,7 +51,7 @@ export async function generate(model: Model, options: PluginOptions, project: Pr `export type * from '${logicalPrismaClientDir}/index-fixed';`, { overwrite: true } ); - await saveSourceFile(prismaDts, options); + await prismaDts.save(); } else { // just reexport the prisma client const prismaDts = project.createSourceFile( @@ -57,7 +59,7 @@ export async function generate(model: Model, options: PluginOptions, project: Pr `export type * from '${getPrismaClientImportSpec(outDir, options)}';`, { overwrite: true } ); - await saveSourceFile(prismaDts, options); + await prismaDts.save(); } const enhanceTs = project.createSourceFile( @@ -67,16 +69,18 @@ import modelMeta from './model-meta'; import policy from './policy'; ${options.withZodSchemas ? "import * as zodSchemas from './zod';" : 'const zodSchemas = undefined;'} import { Prisma } from '${getPrismaClientImportSpec(outDir, options)}'; -${logicalPrismaClientDir ? `import { type PrismaClient } from '${logicalPrismaClientDir}/index-fixed';` : ``} +${withLogicalClient ? `import { type PrismaClient } from '${logicalPrismaClientDir}/index-fixed';` : ``} -export function enhance(prisma: DbClient, context?: EnhancementContext, options?: EnhancementOptions) { +export function enhance(prisma: DbClient, context?: EnhancementContext, options?: EnhancementOptions)${ + withLogicalClient ? ': PrismaClient' : '' + } { return createEnhancement(prisma, { modelMeta, policy, zodSchemas: zodSchemas as unknown as (ZodSchemas | undefined), prismaModule: Prisma, ...options - }, context)${logicalPrismaClientDir ? ' as PrismaClient' : ''}; + }, context)${withLogicalClient ? ' as PrismaClient' : ''}; } `, { overwrite: true } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 671f87155..d29ecefe1 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/sdk", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.4", "description": "ZenStack plugin development SDK", "main": "index.js", "scripts": { diff --git a/packages/server/package.json b/packages/server/package.json index f988b0e93..40b660ef5 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/server", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.4", "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 9b9379a8d..35b5078cc 100644 --- a/packages/testtools/package.json +++ b/packages/testtools/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/testtools", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.4", "description": "ZenStack Test Tools", "main": "index.js", "private": true,