UNPKG

@bitrix24/b24jssdk

Version:

Bitrix24 REST API JavaScript SDK

1 lines 2.05 kB
{"version":3,"file":"healthcheck.mjs","sources":["../../../../src/core/tools/healthcheck.ts"],"sourcesContent":["import type { ToolOptions } from './abstract-tool'\nimport { AbstractTool } from './abstract-tool'\n\n/**\n * HealthCheck `restApi:v2`\n *\n * @todo use apiVer3\n */\nexport class HealthCheck extends AbstractTool {\n /**\n * Checks the availability of the Bitrix24 REST API.\n * Performs a simple request to the API to verify the service is operational and that the required access rights are present.\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 * @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<false>} Promise that resolves to a Boolean value:\n * - `true`: the API is available and responding\n * - `false`: the API is unavailable, an error occurred, or the required access rights are missing\n *\n * @see {@link Ping} To measure API response speed\n */\n public override async make(options?: ToolOptions & { requestId?: string }): Promise<boolean> {\n try {\n const response = await this._b24.actions.v2.call.make({\n method: 'server.time',\n params: {},\n requestId: options?.requestId\n })\n return response.isSuccess\n } catch {\n return false\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAQO,MAAM,oBAAoB,YAAA,CAAa;AAAA,EAR9C;AAQ8C,IAAA,MAAA,CAAA,IAAA,EAAA,aAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiB5C,MAAsB,KAAK,OAAA,EAAkE;AAC3F,IAAA,IAAI;AACF,MAAA,MAAM,WAAW,MAAM,IAAA,CAAK,KAAK,OAAA,CAAQ,EAAA,CAAG,KAAK,IAAA,CAAK;AAAA,QACpD,MAAA,EAAQ,aAAA;AAAA,QACR,QAAQ,EAAC;AAAA,QACT,WAAW,OAAA,EAAS;AAAA,OACrB,CAAA;AACD,MAAA,OAAO,QAAA,CAAS,SAAA;AAAA,IAClB,CAAA,CAAA,MAAQ;AACN,MAAA,OAAO,KAAA;AAAA,IACT;AAAA,EACF;AACF;;;;"}