correlation-id-ts
Version:
Add correlation id to your functions context
16 lines (15 loc) • 480 B
TypeScript
interface IDecoratorWithIdFnArgs<T> {
correlationId?: string;
fn: () => T;
}
interface IDecoratorBindArgs<W> {
correlationId?: string;
fn: (...args: any[]) => W;
}
export declare const correlator: {
withId: <S>(args: IDecoratorWithIdFnArgs<S>) => S;
bindId: <W>(args: IDecoratorBindArgs<W>) => (...args: any[]) => W;
getId: () => string | null;
};
export declare function runWithNewCorrelationId(runFunction: (id: string) => unknown): void;
export {};