import { MaybePromise } from '@whatwg-node/promise-helpers'; export type GenericInstruments = Record MaybePromise) => MaybePromise>; /** * Composes 2 instrumentations together into one instrumentation. * The first one will be the outer call, the second one the inner call. */ export declare function chain(first: First, next: Next): First & Next; /** * Composes a list of instruments together into one instruments object. * The order of execution will respect the order of the array, * the first one being the outter most call, the last one the inner most call. */ export declare function composeInstruments(instruments: T[]): T | undefined; /** * Extract instruments from a list of plugins. * It returns instruments found, and the list of plugins without their insturments. * * You can use this to easily customize the composition of the instruments if the default one * doesn't suits your needs. */ export declare function getInstrumentsAndPlugins(plugins: P[]): { pluginInstruments: T[]; plugins: Omit[]; }; /** * A helper to instrument a function. * * @param payload: The first argument that will be passed to the instruments on each function call * @returns Function and Async Functions factories allowing to wrap a function with a given instrument. */ export declare const getInstrumented: (payload: TPayload) => { /** * Wraps the `wrapped` function with the given `instrument` wrapper. * @returns The wrapped function, or `undefined` if the instrument is `undefined`. */ fn(instrument: ((payload: TPayload, wrapped: () => void) => void) | undefined, wrapped: (...args: TArgs) => TResult): (...args: TArgs) => TResult; /** * Wraps the `wrapped` function with the given `instrument` wrapper. * @returns The wrapped function, or `undefined` if the instrument is `undefined`. */ asyncFn(instrument: ((payload: TPayload, wrapped: () => MaybePromise) => MaybePromise) | undefined, wrapped: (...args: TArgs_1) => MaybePromise): (...args: TArgs_1) => MaybePromise; };