{"version":3,"file":"ping.mjs","sources":["../../../../src/core/tools/ping.ts"],"sourcesContent":["import type { ToolOptions } from './abstract-tool'\nimport { AbstractTool } from './abstract-tool'\n\n/**\n * Ping `restApi:v2`\n *\n * @todo use apiVer3\n */\nexport class Ping extends AbstractTool {\n  /**\n   * Measures the response speed of the Bitrix24 REST API.\n   * Performs a test request and returns the response time in milliseconds.\n   * Useful for performance monitoring and diagnosing latency issues.\n   *\n   * @note The method uses a minimal API request (`server.time`) to check availability.\n   *   Does not overload the server with large amounts of data.\n   *\n   * @warning Response time may vary depending on server load, network conditions\n   *     and HTTP client settings (timeouts, retries).\n   *\n   * @tip For consistent results, it is recommended to perform multiple measurements\n   *     and use the median value.\n   *\n   * @param options Some options for executing\n   *   - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)\n   *\n   * @returns {Promise<number>} Promise that resolves to a response time in milliseconds:\n   *   - Positive number: time from sending the request to receiving the response\n   *   - In case of an error or timeout: `-1`\n   *\n   * @see {@link HealthCheck} To check API availability\n   */\n  public override async make(options?: ToolOptions & { requestId?: string }): Promise<number> {\n    const startTime = Date.now()\n    try {\n      await this._b24.actions.v2.call.make({\n        method: 'server.time',\n        params: {},\n        requestId: options?.requestId\n      })\n      return Date.now() - startTime\n    } catch {\n      return -1\n    }\n  }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAQO,MAAM,aAAa,YAAA,CAAa;AAAA,EARvC;AAQuC,IAAA,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBrC,MAAsB,KAAK,OAAA,EAAiE;AAC1F,IAAA,MAAM,SAAA,GAAY,KAAK,GAAA,EAAI;AAC3B,IAAA,IAAI;AACF,MAAA,MAAM,IAAA,CAAK,IAAA,CAAK,OAAA,CAAQ,EAAA,CAAG,KAAK,IAAA,CAAK;AAAA,QACnC,MAAA,EAAQ,aAAA;AAAA,QACR,QAAQ,EAAC;AAAA,QACT,WAAW,OAAA,EAAS;AAAA,OACrB,CAAA;AACD,MAAA,OAAO,IAAA,CAAK,KAAI,GAAI,SAAA;AAAA,IACtB,CAAA,CAAA,MAAQ;AACN,MAAA,OAAO,EAAA;AAAA,IACT;AAAA,EACF;AACF;;;;"}