export type RequestTracker = { options: RequestTrackerOptions; data: Map; track: (arg0: string, arg1: RequestData) => void; }; export type RequestTrackerOptions = { /** * - enable/disable debug messages */ debug?: boolean | undefined; /** * - If debug enabled, print info using console[debugLogMethod] */ debugLogMethod?: string | undefined; /** * - Log irregular requests using console[logMethod] */ logMethod?: string | undefined; /** * - Check for irregularities/do cleanup periodically */ useInterval?: boolean | undefined; }; export type RequestData = { senderId: string; requestId: string; status?: string | undefined; }; /** * @typedef {object} RequestTracker * @property {RequestTrackerOptions} options * @property {Map} data * @property {function(string, RequestData):void} track */ /** * @typedef {object} RequestTrackerOptions * @property {boolean} [debug] - enable/disable debug messages * @property {string} [debugLogMethod] - If debug enabled, print info using console[debugLogMethod] * @property {string} [logMethod] - Log irregular requests using console[logMethod] * @property {boolean} [useInterval] - Check for irregularities/do cleanup periodically */ /** * @typedef {object} RequestData * @property {string} senderId * @property {string} requestId * @property {string} [status] */ export class RequestTracker { /** * Unterminated records with start date older than this value are cleaned * up and reported */ static "__#8@#CLEANUP_INTERVAL_MS": number; /** * @param {RequestTrackerOptions} options * @param {Console} [logger] */ constructor(options?: RequestTrackerOptions, logger?: Console | undefined); options: { /** * - enable/disable debug messages */ debug: boolean; /** * - If debug enabled, print info using console[debugLogMethod] */ debugLogMethod: string; /** * - Log irregular requests using console[logMethod] */ logMethod: string; /** * - Check for irregularities/do cleanup periodically */ useInterval: boolean; }; data: Map; _log: Console; /** * @param {string} type - 'start' | 'end' * @param {RequestData} data */ track(type: string, data: RequestData): void; _checkForIrregularities(forSenderId?: null): void; _logIrregularity(event: any): void; _cleanup(forSenderId?: null): void; }