@aikidosec/firewall
Version:
Zen by Aikido is an embedded Web Application Firewall that autonomously protects Node.js apps against common and critical attacks
20 lines (19 loc) • 1.08 kB
TypeScript
import type { Agent } from "../Agent";
import { OperationKind } from "../api/Event";
import type { InterceptorResult } from "./InterceptorResult";
import type { WrapPackageInfo } from "./WrapPackageInfo";
type InspectArgsInterceptor = (args: unknown[], agent: Agent, subject: unknown) => InterceptorResult | void;
type ModifyArgsInterceptor = (args: unknown[], agent: Agent) => unknown[];
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: WrapPackageInfo, interceptors: InterceptorObject): Function | undefined;
export {};