From b31c3ad61b619ae3802136d876c4c931d18910ba Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Tue, 5 Sep 2023 10:18:34 +0800 Subject: [PATCH] fix: issue with client typing generation in trpc plugin --- packages/plugins/openapi/package.json | 4 ++-- packages/plugins/trpc/package.json | 3 ++- packages/plugins/trpc/src/helpers.ts | 4 ++-- packages/schema/package.json | 2 +- packages/server/package.json | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/plugins/openapi/package.json b/packages/plugins/openapi/package.json index 07c13c831..5ab874b25 100644 --- a/packages/plugins/openapi/package.json +++ b/packages/plugins/openapi/package.json @@ -17,10 +17,10 @@ "build": "pnpm lint && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE dist && copyfiles -u 1 ./src/plugin.zmodel dist && pnpm pack dist --pack-destination '../../../../.build'", "watch": "tsc --watch", "lint": "eslint src --ext ts", - "test": "jest", + "test": "ZENSTACK_TEST=1 jest", "prepublishOnly": "pnpm build" }, - "keywords": [], + "keywords": ["openapi"], "author": "ZenStack Team", "license": "MIT", "dependencies": { diff --git a/packages/plugins/trpc/package.json b/packages/plugins/trpc/package.json index 5fc43d040..57113be2a 100644 --- a/packages/plugins/trpc/package.json +++ b/packages/plugins/trpc/package.json @@ -13,6 +13,7 @@ "build": "pnpm lint && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE 'res/**/*' dist && pnpm pack dist --pack-destination '../../../../.build'", "watch": "tsc --watch", "lint": "eslint src --ext ts", + "test": "ZENSTACK_TEST=1 jest", "prepublishOnly": "pnpm build", "publish-dev": "pnpm publish --tag dev" }, @@ -20,7 +21,7 @@ "directory": "dist", "linkDirectory": true }, - "keywords": [], + "keywords": ["trpc"], "author": "ZenStack Team", "license": "MIT", "dependencies": { diff --git a/packages/plugins/trpc/src/helpers.ts b/packages/plugins/trpc/src/helpers.ts index fadd752b2..c3a776556 100644 --- a/packages/plugins/trpc/src/helpers.ts +++ b/packages/plugins/trpc/src/helpers.ts @@ -111,10 +111,10 @@ function getPrismaOperationTypes(model: string, operation: string) { case 'count': argsType = `Prisma.Subset`; - resultType = `'select' extends keyof T' + resultType = `'select' extends keyof T ? T['select'] extends true ? number - : GetScalarType + : Prisma.GetScalarType : number`; break; diff --git a/packages/schema/package.json b/packages/schema/package.json index 8ca2ff2d5..d285a3268 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -73,7 +73,7 @@ "bundle": "pnpm clean && pnpm lint && node build/bundle.js --minify", "watch": "tsc --watch", "lint": "eslint src tests --ext ts", - "test": "jest", + "test": "ZENSTACK_TEST=1 jest", "prepublishOnly": "pnpm build", "publish-dev": "pnpm publish --registry http://localhost:4873", "postinstall": "node bin/post-install.js" diff --git a/packages/server/package.json b/packages/server/package.json index 0ad355341..ac8422a7f 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -18,7 +18,7 @@ "linkDirectory": true }, "keywords": [ - "fastify" + "fastify", "express", "nextjs", "sveltekit", "nuxtjs" ], "author": "", "license": "MIT",