You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
To prevent any consumers from altering the fusion instance, wrapping it in a proxy could be a feasible solution.
Describe the solution you'd like
A clear and concise description of what you want to happen.
/** * Wraps an object and all its children objects in a proxy * Handles arrays and objects */functiondeepProxy<TextendsRecord<PropertyKey,any>>(obj: T){Object.keys(obj).filter(key=>typeofobj[key]==="object").filter(key=>obj[key]!==null).forEach(key=>{obj[keyaskeyofT]=deepProxy(obj[key])})returnnewProxy(obj,{set(){returnfalse}})}
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered:
Yeah, I made a solution that handles properties you want to exclude from the proxy trap
typeNestedKeyOf<ObjectTypeextendsobject>={[KeyinkeyofObjectType&(string|number)]: ObjectType[Key]extendsobject ? ObjectType[Key]extendsArray<any> ? `${Key}` : `${Key}` | `${Key}.${NestedKeyOf<ObjectType[Key]>}` : `${Key}`}[keyofObjectType&(string|number)]/** * Wraps an object and all its children objects in a proxy * Handles arrays and objects */functiondeepProxy<TextendsRecord<PropertyKey,any>>(obj: T,ignores?: NestedKeyOf<T>[]){Object.keys(obj).filter(key=>typeofobj[key]==="object").filter(key=>obj[key]!==null).forEach(key=>{obj[keyaskeyofT]=deepProxy(obj[key],ignores?.filter((s: string)=>s.includes(key)&&s.includes(".")).map((s: string)=>s.slice((s.indexOf(".")+1))))})returnnewProxy(obj,{set(target,property,val){if(!ignores?.includes(propertyasNestedKeyOf<T>))returnfalse;target[propertyaskeyofT]=val;returntrue;}})}
Is your feature request related to a problem? Please describe.
To prevent any consumers from altering the fusion instance, wrapping it in a proxy could be a feasible solution.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: