Skip to content

Commit ea564c9

Browse files
authored
fix: enhanced client doesn't work with client extensions that add new model methods (#851)
2 parents b5929d8 + fed4134 commit ea564c9

File tree

15 files changed

+388
-15
lines changed

15 files changed

+388
-15
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zenstack-monorepo",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "",
55
"scripts": {
66
"build": "pnpm -r build",

Diff for: packages/language/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/language",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"displayName": "ZenStack modeling language compiler",
55
"description": "ZenStack modeling language compiler",
66
"homepage": "https://zenstack.dev",

Diff for: packages/plugins/openapi/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/openapi",
33
"displayName": "ZenStack Plugin and Runtime for OpenAPI",
4-
"version": "1.3.1",
4+
"version": "1.3.2",
55
"description": "ZenStack plugin and runtime supporting OpenAPI",
66
"main": "index.js",
77
"repository": {

Diff for: packages/plugins/swr/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/swr",
33
"displayName": "ZenStack plugin for generating SWR hooks",
4-
"version": "1.3.1",
4+
"version": "1.3.2",
55
"description": "ZenStack plugin for generating SWR hooks",
66
"main": "index.js",
77
"repository": {

Diff for: packages/plugins/tanstack-query/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/tanstack-query",
33
"displayName": "ZenStack plugin for generating tanstack-query hooks",
4-
"version": "1.3.1",
4+
"version": "1.3.2",
55
"description": "ZenStack plugin for generating tanstack-query hooks",
66
"main": "index.js",
77
"exports": {

Diff for: packages/plugins/trpc/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/trpc",
33
"displayName": "ZenStack plugin for tRPC",
4-
"version": "1.3.1",
4+
"version": "1.3.2",
55
"description": "ZenStack plugin for tRPC",
66
"main": "index.js",
77
"repository": {

Diff for: packages/runtime/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@zenstackhq/runtime",
33
"displayName": "ZenStack Runtime Library",
4-
"version": "1.3.1",
4+
"version": "1.3.2",
55
"description": "Runtime of ZenStack for both client-side and server-side environments.",
66
"repository": {
77
"type": "git",

Diff for: packages/runtime/src/enhancements/proxy.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -227,20 +227,22 @@ export function makeProxy<T extends PrismaProxyHandler>(
227227
return propVal;
228228
}
229229

230-
return createHandlerProxy(makeHandler(target, prop));
230+
return createHandlerProxy(makeHandler(target, prop), propVal);
231231
},
232232
});
233233

234234
return proxy;
235235
}
236236

237237
// A proxy for capturing errors and processing stack trace
238-
function createHandlerProxy<T extends PrismaProxyHandler>(handler: T): T {
238+
function createHandlerProxy<T extends PrismaProxyHandler>(handler: T, origTarget: any): T {
239239
return new Proxy(handler, {
240240
get(target, propKey) {
241241
const prop = target[propKey as keyof T];
242242
if (typeof prop !== 'function') {
243-
return prop;
243+
// the proxy handler doesn't have this method, fall back to the original target
244+
// this can happen for new methods added by Prisma Client Extensions
245+
return origTarget[propKey];
244246
}
245247

246248
// eslint-disable-next-line @typescript-eslint/ban-types

Diff for: packages/schema/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"publisher": "zenstack",
44
"displayName": "ZenStack Language Tools",
55
"description": "Build scalable web apps with minimum code by defining authorization and validation rules inside the data schema that closer to the database",
6-
"version": "1.3.1",
6+
"version": "1.3.2",
77
"author": {
88
"name": "ZenStack Team"
99
},

Diff for: packages/sdk/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/sdk",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "ZenStack plugin development SDK",
55
"main": "index.js",
66
"scripts": {

Diff for: packages/server/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/server",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"displayName": "ZenStack Server-side Adapters",
55
"description": "ZenStack server-side adapters",
66
"homepage": "https://zenstack.dev",

Diff for: packages/testtools/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/testtools",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "ZenStack Test Tools",
55
"main": "index.js",
66
"private": true,

Diff for: pnpm-lock.yaml

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: tests/integration/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
"ts-node": "^10.9.1",
3434
"typescript": "^4.6.2",
3535
"uuid": "^9.0.0",
36-
"zenstack": "workspace: *"
36+
"zenstack": "workspace: *",
37+
"prisma-client-internal": "npm:@prisma/client@^5.0.0"
3738
},
3839
"dependencies": {
3940
"@types/node": "^18.0.0",

0 commit comments

Comments
 (0)