The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.
TypeScript b2b-marketplacecomposable-commerceecommerceenterpriseheadless-commercemarketplacemedusamedusajsmulti-vendortypescript
export type ProxyCallback = (path: string[], args: unknown[]) => unknown;
export function createRecursiveProxy(callback: ProxyCallback, path: string[] = []): any {
return new Proxy(function () { }, {
get(_, prop) {
if (typeof prop !== "string") {
return undefined;
}
if (prop === "then" || prop === "catch" || prop === "finally") {
return undefined;
}
return createRecursiveProxy(callback, [...path, prop]);
},
apply(_, __, args) {
return callback(path, args);
},
});
}