import type { Agent } from "../Agent"; import { OperationKind } from "../api/Event"; import { getContext } from "../Context"; import type { InterceptorResult } from "./InterceptorResult"; import type { PartialWrapPackageInfo } from "./WrapPackageInfo"; export type InspectArgsInterceptor = (args: unknown[], agent: Agent, subject: unknown) => InterceptorResult | void; export type ModifyArgsInterceptor = (args: unknown[], agent: Agent, subject: unknown) => unknown[]; export type ModifyReturnValueInterceptor = (args: unknown[], returnValue: unknown, agent: Agent, subject: unknown) => unknown; export type InterceptorObject = { inspectArgs?: InspectArgsInterceptor; modifyArgs?: ModifyArgsInterceptor; modifyReturnValue?: ModifyReturnValueInterceptor; kind: OperationKind | undefined; }; /** * Wraps a function with the provided interceptors. * If the function is not part of an object, like default exports, pass undefined as methodName and the function as subject. */ export declare function wrapExport(subject: unknown, methodName: string | undefined, pkgInfo: PartialWrapPackageInfo, interceptors: InterceptorObject): Function | undefined; export declare function inspectArgs(args: unknown[], interceptor: InspectArgsInterceptor, context: ReturnType, agent: Agent, pkgInfo: PartialWrapPackageInfo, methodName: string, kind: OperationKind | undefined): void;