Skip to content

merge dev to main (v2.14.0) #2086

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 7 commits into from
Apr 15, 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.3",
"version": "2.14.0",
"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.3"
version = "2.14.0"

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.3",
"version": "2.14.0",
"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.3",
"version": "2.14.0",
"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.3",
"version": "2.14.0",
"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.3",
"version": "2.14.0",
"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.3",
"version": "2.14.0",
"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.3",
"version": "2.14.0",
"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.3",
"version": "2.14.0",
"description": "ZenStack plugin for tRPC",
"main": "index.js",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"postinstall": "nuxt prepare"
},
"dependencies": {
"@prisma/client": "6.5.x",
"@prisma/client": "6.6.x",
"@trpc/client": "^10.45.2",
"@trpc/server": "^10.45.2",
"nuxt": "^3.14.1592",
Expand All @@ -21,7 +21,7 @@
},
"devDependencies": {
"esbuild": "^0.24.0",
"prisma": "6.5.x",
"prisma": "6.6.x",
"typescript": "^5.6.2",
"vue-tsc": "^2.1.10"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"postinstall": "nuxt prepare"
},
"dependencies": {
"@prisma/client": "6.5.x",
"@prisma/client": "6.6.x",
"@trpc/client": "^11.0.0-rc.563",
"@trpc/server": "^11.0.0-rc.563",
"nuxt": "^3.14.1592",
Expand All @@ -21,7 +21,7 @@
},
"devDependencies": {
"esbuild": "^0.24.0",
"prisma": "6.5.x",
"prisma": "6.6s.x",
"typescript": "^5.6.2",
"vue-tsc": "^2.1.10"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/trpc/tests/projects/t3-trpc-v11/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"start": "next start"
},
"dependencies": {
"@prisma/client": "6.5.x",
"@prisma/client": "6.6.x",
"@t3-oss/env-nextjs": "^0.10.1",
"@tanstack/react-query": "^5.50.0",
"@trpc/client": "^11.0.0-rc.446",
Expand All @@ -39,7 +39,7 @@
"@typescript-eslint/parser": "^8.1.0",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.4",
"prisma": "6.5.x",
"prisma": "6.6.x",
"typescript": "^5.5.3"
},
"ct3aMetadata": {
Expand Down
4 changes: 2 additions & 2 deletions 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.3",
"version": "2.14.0",
"description": "Runtime of ZenStack for both client-side and server-side environments.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -116,7 +116,7 @@
"zod-validation-error": "^1.5.0"
},
"peerDependencies": {
"@prisma/client": "5.0.0 - 6.5.x"
"@prisma/client": "5.0.0 - 6.6.x"
},
"author": {
"name": "ZenStack Team"
Expand Down
6 changes: 3 additions & 3 deletions 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.3",
"version": "2.14.0",
"author": {
"name": "ZenStack Team"
},
Expand Down Expand Up @@ -123,10 +123,10 @@
"zod-validation-error": "^1.5.0"
},
"peerDependencies": {
"prisma": "5.0.0 - 6.5.x"
"prisma": "5.0.0 - 6.6.x"
},
"devDependencies": {
"@prisma/client": "6.5.x",
"@prisma/client": "6.6.x",
"@types/async-exit-hook": "^2.0.0",
"@types/pluralize": "^0.0.29",
"@types/semver": "^7.3.13",
Expand Down
24 changes: 11 additions & 13 deletions packages/schema/src/plugins/enhancer/enhance/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ReadonlyDeep } from '@prisma/generator-helper';
import { DELEGATE_AUX_RELATION_PREFIX } from '@zenstackhq/runtime';
import {
PluginError,
Expand Down Expand Up @@ -114,21 +113,18 @@ export class EnhancerGenerator {

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

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

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

const authDecl = getAuthDecl(getDataModelAndTypeDefs(this.model));
const authTypes = authDecl ? generateAuthType(this.model, authDecl) : '';
Expand Down Expand Up @@ -177,7 +173,7 @@ ${
return {
dmmf,
newPrismaClientDtsPath: prismaTypesFixed
? path.resolve(this.outDir, LOGICAL_CLIENT_GENERATION_PATH, 'index-fixed.d.ts')
? path.resolve(this.outDir, LOGICAL_CLIENT_GENERATION_PATH, 'index.d.ts')
: undefined,
};
}
Expand Down Expand Up @@ -422,7 +418,7 @@ export type Enhanced<Client> =
return dmmf;
}

private shouldBeOptional(field: ReadonlyDeep<DMMF.SchemaArg>, dataModel: DataModel) {
private shouldBeOptional(field: DMMF.SchemaArg, dataModel: DataModel) {
const dmField = dataModel.fields.find((f) => f.name === field.name);
if (!dmField) {
return false;
Expand Down Expand Up @@ -457,7 +453,7 @@ export type Enhanced<Client> =
}

private async processClientTypes(prismaClientDir: string) {
// make necessary updates to the generated `index.d.ts` file and save it as `index-fixed.d.ts`
// make necessary updates to the generated `index.d.ts` file and overwrite it
const project = new Project();
const sf = project.addSourceFileAtPath(path.join(prismaClientDir, 'index.d.ts'));

Expand All @@ -472,8 +468,7 @@ export type Enhanced<Client> =
}
});

// transform index.d.ts and save it into a new file (better perf than in-line editing)

// transform index.d.ts and write it into a new file (better perf than in-line editing)
const sfNew = project.createSourceFile(path.join(prismaClientDir, 'index-fixed.d.ts'), undefined, {
overwrite: true,
});
Expand All @@ -483,6 +478,9 @@ export type Enhanced<Client> =
this.generateExtraTypes(sfNew);

sfNew.formatText();

// Save the transformed file over the original
await sfNew.move(sf.getFilePath(), { overwrite: true });
await sfNew.save();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from '@zenstackhq/language/ast';
import { DELEGATE_AUX_RELATION_PREFIX, PolicyOperationKind } from '@zenstackhq/runtime';
import {
CodeWriter,
ExpressionContext,
getFunctionExpressionContext,
getIdFields,
Expand All @@ -37,7 +38,6 @@ import {
} from '@zenstackhq/sdk';
import { lowerCaseFirst } from 'lower-case-first';
import invariant from 'tiny-invariant';
import { CodeBlockWriter } from 'ts-morph';
import { name } from '..';
import { isCheckInvocation } from '../../../utils/ast-utils';

Expand Down Expand Up @@ -77,7 +77,7 @@ export class ExpressionWriter {
/**
* Constructs a new ExpressionWriter
*/
constructor(private readonly writer: CodeBlockWriter, private readonly options: ExpressionWriterOptions) {
constructor(private readonly writer: CodeWriter, private readonly options: ExpressionWriterOptions) {
this.plainExprBuilder = new TypeScriptExpressionTransformer({
context: ExpressionContext.AccessPolicy,
isPostGuard: this.options.isPostGuard,
Expand Down
Loading
Loading