Skip to content

Commit

Permalink
update proxy handle acl operation
Browse files Browse the repository at this point in the history
  • Loading branch information
trungnotchung committed Dec 30, 2024
1 parent b2a0f38 commit bfda6d6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/object/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ export class DRPObject implements IDRPObject {
const obj = this;
return {
get(target, propKey, receiver) {
if (typeof target[propKey as keyof object] === "function") {
const value = Reflect.get(target, propKey, receiver);

if (typeof value === "function") {
return new Proxy(target[propKey as keyof object], {
apply(applyTarget, thisArg, args) {
if ((thisArg.operations as string[]).includes(propKey as string))
Expand All @@ -118,7 +120,12 @@ export class DRPObject implements IDRPObject {
},
});
}
return Reflect.get(target, propKey, receiver);

if (propKey === "acl" && typeof value === "object" && value !== null) {
return new Proxy(value, this);
}

return value;
},
};
}
Expand Down

0 comments on commit bfda6d6

Please sign in to comment.