pagespeed-quest
Version:
A framework for efficient web front-end speed improvement
36 lines (35 loc) • 1.41 kB
TypeScript
import HttpMitmProxy from 'http-mitm-proxy';
import { InventoryRepository } from './inventory.js';
import { Throttle, ThrottlingTransform } from './throttling.js';
import { DependencyInterface, DeviceType } from './types.js';
export interface ProxyOptions extends HttpMitmProxy.IProxyOptions {
inventoryRepository?: InventoryRepository;
throttle?: Throttle;
throttlingRetryIntervalMs?: number;
entryUrl?: string;
deviceType?: DeviceType;
}
export type ProxyDependency = Pick<DependencyInterface, 'logger'>;
export declare abstract class Proxy {
proxyOptions: HttpMitmProxy.IProxyOptions;
proxy: HttpMitmProxy.IProxy;
inventoryRepository: InventoryRepository;
throttle?: Throttle;
throttlingRetryIntervalMs: number;
entryUrl?: string;
deviceType?: DeviceType;
dependency: ProxyDependency;
constructor(options?: ProxyOptions, dependency?: ProxyDependency);
static contextRequest(ctx: HttpMitmProxy.IContext): {
method: string;
url: string;
};
createThrottlingTransform(): ThrottlingTransform | void;
abstract setup(): Promise<void>;
abstract shutdown(): Promise<void>;
start(): Promise<void>;
get port(): number;
get inventoryDirPath(): string;
stop(): Promise<void>;
}
export declare function withProxy<ProxyType extends Proxy>(proxy: ProxyType, fn: (proxy: ProxyType) => Promise<void>): Promise<void>;