egg
Version:
A web application framework for Node.js
29 lines • 1.23 kB
TypeScript
//#region src/lib/core/utils.d.ts
export declare function convertObject(obj: any, ignore?: string | RegExp | (string | RegExp)[]): any;
export declare function safeParseURL(url: string): URL | null;
export interface CreateTransparentProxyOptions<T> {
/**
* Factory function to lazily create the real object.
* Called at most once, on first property access.
*/
createReal: () => T;
/**
* Whether to bind functions from the real object to the real instance.
* Defaults to true.
*/
bindFunctions?: boolean;
}
/**
* Create a Proxy that behaves like the real object, but remains transparent to
* monkeypatch libraries (e.g. defineProperty-based overrides like egg-mock's `mm()`).
*
* - Lazily creates the real object on first access.
* - Allows overriding properties on the proxy target (overlay) — e.g. via `Object.defineProperty`.
* - Delegates everything else to the real object.
*
* This is used to defer HttpClient construction so plugins can modify
* `config.httpclient.lookup` after the first access to `app.httpClient` but
* before any actual HTTP request is made.
*/
export declare function createTransparentProxy<T extends object>(options: CreateTransparentProxyOptions<T>): T;
//#endregion