Skip to content

merge dev to main (v2.13.2) #2072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 7, 2025
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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zenstack-monorepo",
"version": "2.13.1",
"version": "2.13.2",
"description": "",
"scripts": {
"build": "pnpm -r --filter=\"!./packages/ide/*\" build",
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.13.1"
version = "2.13.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.13.1",
"version": "2.13.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.13.1",
"version": "2.13.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.13.1",
"version": "2.13.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.13.1",
"version": "2.13.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.13.1",
"version": "2.13.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.13.1",
"version": "2.13.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.13.1",
"version": "2.13.2",
"description": "ZenStack plugin for tRPC",
"main": "index.js",
"repository": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.13.1",
"version": "2.13.2",
"description": "Runtime of ZenStack for both client-side and server-side environments.",
"repository": {
"type": "git",
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.13.1",
"version": "2.13.2",
"author": {
"name": "ZenStack Team"
},
Expand Down
15 changes: 9 additions & 6 deletions packages/schema/src/plugins/enhancer/enhance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,25 @@ export class EnhancerGenerator {

const prismaImport = getPrismaClientImportSpec(this.outDir, this.options);
let prismaTypesFixed = false;
let resultPrismaImport = prismaImport;
let resultPrismaTypeImport = prismaImport;

if (this.needsLogicalClient) {
prismaTypesFixed = true;
resultPrismaImport = `${LOGICAL_CLIENT_GENERATION_PATH}/index-fixed`;
resultPrismaTypeImport = `${LOGICAL_CLIENT_GENERATION_PATH}/index-fixed`;
const result = await this.generateLogicalPrisma();
dmmf = result.dmmf;
}

// reexport PrismaClient types (original or fixed)
const prismaDts = this.project.createSourceFile(
const modelsDts = this.project.createSourceFile(
path.join(this.outDir, 'models.d.ts'),
`export type * from '${resultPrismaImport}';`,
`export type * from '${resultPrismaTypeImport}';`,
{ overwrite: true }
);
await prismaDts.save();
await modelsDts.save();

// reexport values from the original PrismaClient (enums, etc.)
fs.writeFileSync(path.join(this.outDir, 'models.js'), `module.exports = require('${prismaImport}');`);

const authDecl = getAuthDecl(getDataModelAndTypeDefs(this.model));
const authTypes = authDecl ? generateAuthType(this.model, authDecl) : '';
Expand All @@ -151,7 +154,7 @@ ${

${
prismaTypesFixed
? this.createLogicalPrismaImports(prismaImport, resultPrismaImport, target)
? this.createLogicalPrismaImports(prismaImport, resultPrismaTypeImport, target)
: this.createSimplePrismaImports(prismaImport, target)
}

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.13.1",
"version": "2.13.2",
"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.13.1",
"version": "2.13.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.13.1",
"version": "2.13.2",
"description": "ZenStack Test Tools",
"main": "index.js",
"private": true,
Expand Down
31 changes: 31 additions & 0 deletions tests/regression/tests/issue-2065.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { loadSchema } from '@zenstackhq/testtools';

describe('issue [...]', () => {
it('regression', async () => {
const { zodSchemas } = await loadSchema(
`
enum FooType {
Bar
Baz
}

type Meta {
test String?
}

model Foo {
id String @id @db.Uuid @default(uuid())
type FooType
meta Meta @json

@@validate(type == Bar, "FooType must be Bar")
}
`,
{
provider: 'postgresql',
pushDb: false,
}
);
expect(zodSchemas.models.FooSchema).toBeTruthy();
});
});
36 changes: 36 additions & 0 deletions tests/regression/tests/issue-foo.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { loadSchema } from '@zenstackhq/testtools';

describe('issue [...]', () => {
it('regression', async () => {
const { zodSchemas } = await loadSchema(
`
enum FooType {
Bar
Baz
}
type Meta {
test String?
}
model Foo {
id String @id @db.Uuid @default(uuid())
type FooType
meta Meta @json
@@validate(type == Bar, "FooType must be Bar")
}
`,
{
provider: 'postgresql',
pushDb: false,
}
);
expect(
zodSchemas.models.FooSchema.safeParse({
id: '123e4567-e89b-12d3-a456-426614174000',
type: 'Bar',
meta: { test: 'test' },
})
).toMatchObject({
success: true,
});
});
});
Loading