import type { Entry, HARFile, LocalUtilsHarLookupParams, LocalUtilsHarLookupResult } from '../types'; export type HarTransformFunction = (harFile: HARFile) => void; export type HarLookupParamsTransformFunction = (params: LocalUtilsHarLookupParams) => LocalUtilsHarLookupParams; export type HarLookupResultTransformFunction = (result: LocalUtilsHarLookupResult, params: LocalUtilsHarLookupParams) => LocalUtilsHarLookupResult | Promise; export type EntryTransformFunction = (entry: Entry) => void; export type FlushTransformFunction = (entries: Entry[]) => Entry[]; export type HarTransformSlots = { open?: HarTransformFunction; lookupParams?: HarLookupParamsTransformFunction; lookupResult?: HarLookupResultTransformFunction; recorder?: EntryTransformFunction; flush?: FlushTransformFunction; }; /** * One latch per legacy `add*Transform` function, matching the historical behaviour: * the first call to a given function wins, later calls are ignored. */ export type LegacyTransformCall = 'lookup' | 'open' | 'recorder' | 'flush'; /** * Registers the transforms of a legacy `add*Transform` call. * Subsequent calls of the same function are ignored, exactly as before, with a * warning when they carry a different function. * * An open transform is consumed when `routeFromHAR()` opens the dump, so it can * no longer apply to a dump that is already open: registering one after a replay * has started in this worker process throws instead of silently doing nothing. */ export declare function registerLegacyTransforms(call: LegacyTransformCall, slots: HarTransformSlots): void; /** * Registers transforms owned by a fixture. Unlike the legacy calls these are * replaced on every registration, so per-test state does not leak between tests. */ export declare function setFixtureHarTransforms(slots: HarTransformSlots): void; export declare function getHarTransforms(): HarTransformSlots; /** Records that a dump has been opened for replay, see `registerLegacyTransforms`. */ export declare function markReplayOpened(): void; /** * Test seam: drops registered transforms. * Pass `{global: true}` to also release the legacy first-call-wins latches. */ export declare function resetHarTransforms({ global }?: { global?: boolean; }): void;