@bitrix24/b24jssdk 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-AI.md +12 -0
- package/dist/esm/_virtual/_commonjsHelpers.mjs +1 -1
- package/dist/esm/_virtual/protobuf.mjs +1 -1
- package/dist/esm/_virtual/protobuf2.mjs +1 -1
- package/dist/esm/core/abstract-b24.mjs +1 -1
- package/dist/esm/core/actions/abstract-action.mjs +1 -1
- package/dist/esm/core/actions/abstract-batch.mjs +1 -1
- package/dist/esm/core/actions/manager.mjs +1 -1
- package/dist/esm/core/actions/v2/batch-by-chunk.mjs +1 -1
- package/dist/esm/core/actions/v2/batch.mjs +4 -4
- package/dist/esm/core/actions/v2/batch.mjs.map +1 -1
- package/dist/esm/core/actions/v2/call-list.mjs +1 -1
- package/dist/esm/core/actions/v2/call.mjs +1 -1
- package/dist/esm/core/actions/v2/fetch-list.mjs +1 -1
- package/dist/esm/core/actions/v2/manager-v2.mjs +1 -1
- package/dist/esm/core/actions/v3/batch-by-chunk.mjs +1 -1
- package/dist/esm/core/actions/v3/batch.mjs +4 -4
- package/dist/esm/core/actions/v3/batch.mjs.map +1 -1
- package/dist/esm/core/actions/v3/call-list.mjs +1 -1
- package/dist/esm/core/actions/v3/call.mjs +1 -1
- package/dist/esm/core/actions/v3/fetch-list.mjs +1 -1
- package/dist/esm/core/actions/v3/manager-v3.mjs +1 -1
- package/dist/esm/core/http/abstract-http.mjs +9 -13
- package/dist/esm/core/http/abstract-http.mjs.map +1 -1
- package/dist/esm/core/http/ajax-error.mjs +9 -5
- package/dist/esm/core/http/ajax-error.mjs.map +1 -1
- package/dist/esm/core/http/ajax-result.mjs +1 -1
- package/dist/esm/core/http/limiters/adaptive-delayer.mjs +1 -1
- package/dist/esm/core/http/limiters/manager.mjs +30 -1
- package/dist/esm/core/http/limiters/manager.mjs.map +1 -1
- package/dist/esm/core/http/limiters/operating-limiter.mjs +1 -1
- package/dist/esm/core/http/limiters/params-factory.mjs +1 -1
- package/dist/esm/core/http/limiters/rate-limiter.mjs +1 -1
- package/dist/esm/core/http/redact.mjs +52 -0
- package/dist/esm/core/http/redact.mjs.map +1 -0
- package/dist/esm/core/http/v2.mjs +2 -2
- package/dist/esm/core/http/v3.mjs +2 -2
- package/dist/esm/core/interaction/batch/abstract-interaction-batch.mjs +1 -1
- package/dist/esm/core/interaction/batch/parse-row.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/interface-strategy.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v2/as-array.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v2/as-object.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v3/as-array.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v3/as-object.mjs +1 -1
- package/dist/esm/core/interaction/batch/v2.mjs +1 -1
- package/dist/esm/core/interaction/batch/v3.mjs +1 -1
- package/dist/esm/core/language/list.mjs +1 -1
- package/dist/esm/core/request-id-generator.mjs +1 -1
- package/dist/esm/core/result.mjs +1 -1
- package/dist/esm/core/sdk-error.mjs +1 -1
- package/dist/esm/core/tools/abstract-tool.mjs +1 -1
- package/dist/esm/core/tools/healthcheck.mjs +1 -1
- package/dist/esm/core/tools/manager.mjs +1 -1
- package/dist/esm/core/tools/ping.mjs +1 -1
- package/dist/esm/core/version-manager.mjs +1 -1
- package/dist/esm/frame/auth.mjs +1 -1
- package/dist/esm/frame/b24.mjs +1 -1
- package/dist/esm/frame/dialog.mjs +1 -1
- package/dist/esm/frame/frame.mjs +1 -1
- package/dist/esm/frame/message/commands.mjs +1 -1
- package/dist/esm/frame/message/controller.mjs +1 -1
- package/dist/esm/frame/options.mjs +1 -1
- package/dist/esm/frame/parent.mjs +1 -1
- package/dist/esm/frame/placement.mjs +1 -1
- package/dist/esm/frame/slider.mjs +1 -1
- package/dist/esm/helper/abstract-helper.mjs +1 -1
- package/dist/esm/helper/app-manager.mjs +1 -1
- package/dist/esm/helper/currency-manager.mjs +1 -1
- package/dist/esm/helper/helper-manager.mjs +1 -1
- package/dist/esm/helper/license-manager.mjs +1 -1
- package/dist/esm/helper/options-manager.mjs +1 -1
- package/dist/esm/helper/payment-manager.mjs +1 -1
- package/dist/esm/helper/profile-manager.mjs +1 -1
- package/dist/esm/helper/use-b24-helper.mjs +1 -1
- package/dist/esm/hook/auth.mjs +1 -1
- package/dist/esm/hook/b24.mjs +1 -1
- package/dist/esm/index.d.mts +9 -13
- package/dist/esm/index.d.ts +9 -13
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/loader-b24frame.mjs +1 -1
- package/dist/esm/logger/abstract-logger.mjs +1 -1
- package/dist/esm/logger/browser.mjs +1 -1
- package/dist/esm/logger/formatter/abstract-formatter.mjs +1 -1
- package/dist/esm/logger/formatter/json-formatter.mjs +1 -1
- package/dist/esm/logger/formatter/line-formatter.mjs +1 -1
- package/dist/esm/logger/formatter/telegram-formatter.mjs +1 -1
- package/dist/esm/logger/handler/abstract-handler.mjs +1 -1
- package/dist/esm/logger/handler/consola-adapter.mjs +1 -1
- package/dist/esm/logger/handler/console-handler.mjs +1 -1
- package/dist/esm/logger/handler/console-v2-handler.mjs +1 -1
- package/dist/esm/logger/handler/memory-handler.mjs +1 -1
- package/dist/esm/logger/handler/stream-handler.mjs +1 -1
- package/dist/esm/logger/handler/telegram-handler.mjs +1 -1
- package/dist/esm/logger/handler/winston-adapter.mjs +1 -1
- package/dist/esm/logger/logger-factory.mjs +1 -1
- package/dist/esm/logger/logger.mjs +1 -1
- package/dist/esm/logger/null-logger.mjs +1 -1
- package/dist/esm/logger/processor/memory-usage-processor.mjs +1 -1
- package/dist/esm/logger/processor/pid-processor.mjs +1 -1
- package/dist/esm/oauth/auth.mjs +1 -1
- package/dist/esm/oauth/b24.mjs +1 -1
- package/dist/esm/oauth/refresh-token-error.mjs +1 -1
- package/dist/esm/pullClient/abstract-connector.mjs +1 -1
- package/dist/esm/pullClient/channel-manager.mjs +1 -1
- package/dist/esm/pullClient/client.mjs +1 -1
- package/dist/esm/pullClient/errors.mjs +1 -1
- package/dist/esm/pullClient/json-rpc.mjs +1 -1
- package/dist/esm/pullClient/long-polling-connector.mjs +1 -1
- package/dist/esm/pullClient/protobuf/index.mjs +1 -1
- package/dist/esm/pullClient/protobuf/model.mjs +1 -1
- package/dist/esm/pullClient/protobuf/protobuf.mjs +53 -53
- package/dist/esm/pullClient/protobuf/protobuf.mjs.map +1 -1
- package/dist/esm/pullClient/shared-config.mjs +1 -1
- package/dist/esm/pullClient/storage-manager.mjs +1 -1
- package/dist/esm/pullClient/web-socket-connector.mjs +1 -1
- package/dist/esm/tools/browser.mjs +1 -1
- package/dist/esm/tools/environment.mjs +1 -1
- package/dist/esm/tools/formatters/iban.mjs +1 -1
- package/dist/esm/tools/formatters/numbers.mjs +1 -1
- package/dist/esm/tools/index.mjs +1 -1
- package/dist/esm/tools/scroll-size.mjs +1 -1
- package/dist/esm/tools/text.mjs +1 -1
- package/dist/esm/tools/type.mjs +1 -1
- package/dist/esm/tools/use-formatters.mjs +1 -1
- package/dist/esm/tools/uuidv7.mjs +1 -1
- package/dist/esm/types/b24-helper.mjs +1 -1
- package/dist/esm/types/b24.mjs +1 -1
- package/dist/esm/types/bizproc/index.mjs +1 -1
- package/dist/esm/types/catalog/index.mjs +1 -1
- package/dist/esm/types/common.mjs +1 -1
- package/dist/esm/types/crm/entity-type.mjs +1 -1
- package/dist/esm/types/crm/productrow.mjs +1 -1
- package/dist/esm/types/logger.mjs +1 -1
- package/dist/esm/types/pull.mjs +1 -1
- package/dist/umd/index.js +1822 -1357
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +30 -30
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +1 -1
package/README-AI.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Bitrix24 JS SDK — AI Guide
|
|
2
2
|
|
|
3
|
+
> ⚠️ **This file is transitional and will be removed.**
|
|
4
|
+
>
|
|
5
|
+
> Its content is being progressively absorbed into [`AGENTS.md`](../../AGENTS.md) (the root agent-facing guide) and the four focused guides under [`.github/contributing/`](../../.github/contributing/). Future PRs will continue migrating sections out of here until the file can be deleted.
|
|
6
|
+
>
|
|
7
|
+
> **Until then:**
|
|
8
|
+
>
|
|
9
|
+
> - When this guide disagrees with `AGENTS.md` or the `.github/contributing/` guides, **`AGENTS.md` wins**. Do not "fix" `AGENTS.md` to match this file.
|
|
10
|
+
> - **Do not add new material here.** New conventions, examples, and patterns belong in `AGENTS.md` or the matching contributing guide.
|
|
11
|
+
> - Bug-fix edits to existing sections are fine (e.g. correcting a stale API name) but should be mirrored into the canonical location as part of the same PR when possible.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
3
15
|
Purpose: give AI agents a precise, code-oriented overview of the SDK to generate working Bitrix24 apps. This SDK lets you:
|
|
4
16
|
|
|
5
17
|
- Call Bitrix24 REST API from apps embedded in Bitrix24 (iframe) and from backend services
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package @bitrix24/b24jssdk
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.2.0
|
|
4
4
|
* @copyright (c) 2026 Bitrix24
|
|
5
5
|
* @license MIT
|
|
6
6
|
* @see https://github.com/bitrix24/b24jssdk
|
|
@@ -61,7 +61,7 @@ class BatchV2 extends AbstractBatch {
|
|
|
61
61
|
* const resultData = (response as Result<AjaxResult<{ item: Contact }>[]>).getData()
|
|
62
62
|
* resultData.forEach((resultRow, index) => {
|
|
63
63
|
* if (resultRow.isSuccess) {
|
|
64
|
-
* console.log(`Item ${index + 1}:`, resultRow.getData()
|
|
64
|
+
* console.log(`Item ${index + 1}:`, resultRow.getData()!.result.item)
|
|
65
65
|
* }
|
|
66
66
|
* })
|
|
67
67
|
*
|
|
@@ -104,8 +104,8 @@ class BatchV2 extends AbstractBatch {
|
|
|
104
104
|
* }
|
|
105
105
|
*
|
|
106
106
|
* const results = response.getData() as Record<string, AjaxResult<{ item: Contact } | { item: Deal }>>
|
|
107
|
-
* console.log('Contact:', results.Contact.getData()
|
|
108
|
-
* console.log('Deal:', results.Deal.getData()
|
|
107
|
+
* console.log('Contact:', results.Contact.getData()?.result.item as Contact)
|
|
108
|
+
* console.log('Deal:', results.Deal.getData()?.result.item as Deal)
|
|
109
109
|
*
|
|
110
110
|
* @warning The maximum number of commands in one batch request is 50.
|
|
111
111
|
* @note A batch request executes faster than sequential single calls,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch.mjs","sources":["../../../../../src/core/actions/v2/batch.ts"],"sourcesContent":["import type { ActionOptions } from '../abstract-action'\nimport type { CallBatchResult, IB24BatchOptions } from '../../../types/b24'\nimport type {\n BatchCommandsArrayUniversal,\n BatchCommandsObjectUniversal,\n BatchNamedCommandsUniversal\n} from '../../../types/http'\nimport { AbstractBatch } from '../abstract-batch'\nimport { ApiVersion } from '../../../types/b24'\n\nexport type ActionBatchV2 = ActionOptions & {\n calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal\n options?: IB24BatchOptions\n}\n\n/**\n * Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50. `restApi:v2`\n * Allows you to execute multiple requests in a single API call, significantly improving performance.\n *\n * @todo add docs\n */\nexport class BatchV2 extends AbstractBatch {\n /**\n * Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50.\n * Allows you to execute multiple requests in a single API call, significantly improving performance.\n *\n * @template T - The data type returned by batch query commands (default is `unknown`)\n *\n * @param {ActionBatchV2} options - parameters for executing the request.\n * - `calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal` - Commands to execute in a batch.\n * Supports several formats:\n * 1. Array of tuples: `[['method1', params1], ['method2', params2], ...]`\n * 2. Array of objects: `[{ method: 'method1', params: params1 }, { method: 'method2', params: params2 }, ...]`\n * 3. An object with named commands: `{ cmd1: { method: 'method1', params: params1 }, cmd2: ['method2', params2], ...}`\n * - `options?: IB24BatchOptions` - Additional options for executing a batch request.\n * - `isHaltOnError?: boolean` - Whether to stop execution on the first error (default: true)\n * - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)\n * - `returnAjaxResult?: boolean` - Whether to return an AjaxResult object instead of data (default: false)\n *\n * @returns {Promise<CallBatchResult<T>>} A promise that is resolved by the result of executing a batch request:\n * - On success: a `Result` object with the command execution results\n * - The structure of the results depends on the format of the `calls` input data:\n * - For an array of commands, an array of results in the same order\n * - For named commands, an object with keys corresponding to the command names\n *\n * @example\n * import { EnumCrmEntityTypeId } from '@bitrix24/b24jssdk'\n *\n * interface Contact { id: number, name: string }\n * const response = await b24.actions.v2.batch.make<{ item: Contact }>({\n * calls: [\n * ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: 1 }],\n * ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: 2 }],\n * ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: 3 }]\n * ],\n * options: {\n * isHaltOnError: true,\n * returnAjaxResult: true,\n * requestId: 'batch-123'\n * }\n * })\n * if (!response.isSuccess) {\n * throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)\n * }\n *\n * const resultData = (response as Result<AjaxResult<{ item: Contact }>[]>).getData()\n * resultData.forEach((resultRow, index) => {\n * if (resultRow.isSuccess) {\n * console.log(`Item ${index + 1}:`, resultRow.getData()
|
|
1
|
+
{"version":3,"file":"batch.mjs","sources":["../../../../../src/core/actions/v2/batch.ts"],"sourcesContent":["import type { ActionOptions } from '../abstract-action'\nimport type { CallBatchResult, IB24BatchOptions } from '../../../types/b24'\nimport type {\n BatchCommandsArrayUniversal,\n BatchCommandsObjectUniversal,\n BatchNamedCommandsUniversal\n} from '../../../types/http'\nimport { AbstractBatch } from '../abstract-batch'\nimport { ApiVersion } from '../../../types/b24'\n\nexport type ActionBatchV2 = ActionOptions & {\n calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal\n options?: IB24BatchOptions\n}\n\n/**\n * Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50. `restApi:v2`\n * Allows you to execute multiple requests in a single API call, significantly improving performance.\n *\n * @todo add docs\n */\nexport class BatchV2 extends AbstractBatch {\n /**\n * Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50.\n * Allows you to execute multiple requests in a single API call, significantly improving performance.\n *\n * @template T - The data type returned by batch query commands (default is `unknown`)\n *\n * @param {ActionBatchV2} options - parameters for executing the request.\n * - `calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal` - Commands to execute in a batch.\n * Supports several formats:\n * 1. Array of tuples: `[['method1', params1], ['method2', params2], ...]`\n * 2. Array of objects: `[{ method: 'method1', params: params1 }, { method: 'method2', params: params2 }, ...]`\n * 3. An object with named commands: `{ cmd1: { method: 'method1', params: params1 }, cmd2: ['method2', params2], ...}`\n * - `options?: IB24BatchOptions` - Additional options for executing a batch request.\n * - `isHaltOnError?: boolean` - Whether to stop execution on the first error (default: true)\n * - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)\n * - `returnAjaxResult?: boolean` - Whether to return an AjaxResult object instead of data (default: false)\n *\n * @returns {Promise<CallBatchResult<T>>} A promise that is resolved by the result of executing a batch request:\n * - On success: a `Result` object with the command execution results\n * - The structure of the results depends on the format of the `calls` input data:\n * - For an array of commands, an array of results in the same order\n * - For named commands, an object with keys corresponding to the command names\n *\n * @example\n * import { EnumCrmEntityTypeId } from '@bitrix24/b24jssdk'\n *\n * interface Contact { id: number, name: string }\n * const response = await b24.actions.v2.batch.make<{ item: Contact }>({\n * calls: [\n * ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: 1 }],\n * ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: 2 }],\n * ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.contact, id: 3 }]\n * ],\n * options: {\n * isHaltOnError: true,\n * returnAjaxResult: true,\n * requestId: 'batch-123'\n * }\n * })\n * if (!response.isSuccess) {\n * throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)\n * }\n *\n * const resultData = (response as Result<AjaxResult<{ item: Contact }>[]>).getData()\n * resultData.forEach((resultRow, index) => {\n * if (resultRow.isSuccess) {\n * console.log(`Item ${index + 1}:`, resultRow.getData()!.result.item)\n * }\n * })\n *\n * @example\n * import { EnumCrmEntityTypeId } from '@bitrix24/b24jssdk'\n *\n * const response = await b24.actions.v2.batch.make({\n * calls: [\n * { method: 'crm.item.get', params: { entityTypeId: EnumCrmEntityTypeId.contact, id: 1 } },\n * { method: 'crm.item.get', params: { entityTypeId: EnumCrmEntityTypeId.contact, id: 2 } }\n * ],\n * options: {\n * isHaltOnError: true,\n * returnAjaxResult: true,\n * requestId: 'batch-123'\n * }\n * })\n * if (!response.isSuccess) {\n * throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)\n * }\n *\n * @example\n * import { EnumCrmEntityTypeId } from '@bitrix24/b24jssdk'\n *\n * interface Contact { id: number, name: string }\n * interface Deal { id: number, title: string }\n * const response = await b24.actions.v2.batch.make<{ item: Contact } | { item: Deal }>({\n * calls: {\n * Contact: { method: 'crm.item.get', params: { entityTypeId: EnumCrmEntityTypeId.contact, id: 1 } },\n * Deal: ['crm.item.get', { entityTypeId: EnumCrmEntityTypeId.deal, id: 2 }]\n * },\n * options: {\n * isHaltOnError: true,\n * returnAjaxResult: true,\n * requestId: 'batch-123'\n * }\n * })\n * if (!response.isSuccess) {\n * throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)\n * }\n *\n * const results = response.getData() as Record<string, AjaxResult<{ item: Contact } | { item: Deal }>>\n * console.log('Contact:', results.Contact.getData()?.result.item as Contact)\n * console.log('Deal:', results.Deal.getData()?.result.item as Deal)\n *\n * @warning The maximum number of commands in one batch request is 50.\n * @note A batch request executes faster than sequential single calls,\n * but if one command fails, the entire batch may fail\n * (depending on API settings and options).\n */\n public override async make<T = unknown>(options: ActionBatchV2): Promise<CallBatchResult<T>> {\n const opts = {\n ...options.options,\n apiVersion: ApiVersion.v2\n }\n\n const response = await this._b24.getHttpClient(ApiVersion.v2).batch<T>(options.calls, opts)\n\n return this._processBatchResponse<T>(response, options.calls, opts)\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAqBO,MAAM,gBAAgB,aAAA,CAAc;AAAA,EArB3C;AAqB2C,IAAA,MAAA,CAAA,IAAA,EAAA,SAAA,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;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;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkGzC,MAAsB,KAAkB,OAAA,EAAqD;AAC3F,IAAA,MAAM,IAAA,GAAO;AAAA,MACX,GAAG,OAAA,CAAQ,OAAA;AAAA,MACX,YAAY,UAAA,CAAW;AAAA,KACzB;AAEA,IAAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,IAAA,CAAK,aAAA,CAAc,UAAA,CAAW,EAAE,CAAA,CAAE,KAAA,CAAS,OAAA,CAAQ,KAAA,EAAO,IAAI,CAAA;AAE1F,IAAA,OAAO,IAAA,CAAK,qBAAA,CAAyB,QAAA,EAAU,OAAA,CAAQ,OAAO,IAAI,CAAA;AAAA,EACpE;AACF;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package @bitrix24/b24jssdk
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.2.0
|
|
4
4
|
* @copyright (c) 2026 Bitrix24
|
|
5
5
|
* @license MIT
|
|
6
6
|
* @see https://github.com/bitrix24/b24jssdk
|
|
@@ -61,7 +61,7 @@ class BatchV3 extends AbstractBatch {
|
|
|
61
61
|
* const resultData = (response as Result<AjaxResult<{ item: TaskItem }>[]>).getData()
|
|
62
62
|
* resultData.forEach((resultRow, index) => {
|
|
63
63
|
* if (resultRow.isSuccess) {
|
|
64
|
-
* console.log(`Item ${index + 1}:`, resultRow.getData()
|
|
64
|
+
* console.log(`Item ${index + 1}:`, resultRow.getData()!.result.item)
|
|
65
65
|
* }
|
|
66
66
|
* })
|
|
67
67
|
*
|
|
@@ -100,8 +100,8 @@ class BatchV3 extends AbstractBatch {
|
|
|
100
100
|
* }
|
|
101
101
|
*
|
|
102
102
|
* const results = response.getData() as Record<string, AjaxResult<{ item: TaskItem } | { items: MainEventLogItem[] }>>
|
|
103
|
-
* console.log('Task:', results.Task.getData()
|
|
104
|
-
* console.log('MainEventLog:', results.MainEventLog.getData()
|
|
103
|
+
* console.log('Task:', results.Task.getData()?.result.item as TaskItem)
|
|
104
|
+
* console.log('MainEventLog:', results.MainEventLog.getData()?.result.items as MainEventLogItem[])
|
|
105
105
|
*
|
|
106
106
|
* @warning The maximum number of commands in one batch request is 50.
|
|
107
107
|
* @note A batch request executes faster than sequential single calls,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch.mjs","sources":["../../../../../src/core/actions/v3/batch.ts"],"sourcesContent":["import type { ActionOptions } from '../abstract-action'\nimport type { CallBatchResult, IB24BatchOptions } from '../../../types/b24'\nimport type {\n BatchCommandsArrayUniversal,\n BatchCommandsObjectUniversal,\n BatchNamedCommandsUniversal\n} from '../../../types/http'\nimport { AbstractBatch } from '../abstract-batch'\nimport { ApiVersion } from '../../../types/b24'\nimport { versionManager } from '../../version-manager'\nimport { SdkError } from '../../sdk-error'\n\nexport type ActionBatchV3 = ActionOptions & {\n calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal\n options?: IB24BatchOptions\n}\n\n/**\n * Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50. `restApi:v3`\n * Allows you to execute multiple requests in a single API call, significantly improving performance.\n *\n * @todo add docs\n */\nexport class BatchV3 extends AbstractBatch {\n /**\n * Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50.\n * Allows you to execute multiple requests in a single API call, significantly improving performance.\n *\n * @template T - The data type returned by batch query commands (default is `unknown`)\n *\n * @param {ActionBatchV3} options - parameters for executing the request.\n * - `calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal` - Commands to execute in a batch.\n * Supports several formats:\n * 1. Array of tuples: `[['method1', params1], ['method2', params2], ...]`\n * 2. Array of objects: `[{ method: 'method1', params: params1 }, { method: 'method2', params: params2 }, ...]`\n * 3. An object with named commands: `{ cmd1: { method: 'method1', params: params1 }, cmd2: ['method2', params2], ...}`\n * - `options?: IB24BatchOptions` - Additional options for executing a batch request.\n * - `isHaltOnError?: boolean` - Whether to stop execution on the first error (default: true)\n * - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)\n * - `returnAjaxResult?: boolean` - Whether to return an AjaxResult object instead of data (default: false)\n *\n * @returns {Promise<CallBatchResult<T>>} A promise that is resolved by the result of executing a batch request:\n * - On success: a `Result` object with the command execution results\n * - The structure of the results depends on the format of the `calls` input data:\n * - For an array of commands, an array of results in the same order\n * - For named commands, an object with keys corresponding to the command names\n *\n * @example\n * interface TaskItem { id: number, title: string }\n * const response = await b24.actions.v3.batch.make<{ item: TaskItem }>({\n * calls: [\n * ['tasks.task.get', { id: 1, select: ['id', 'title'] }],\n * ['tasks.task.get', { id: 2, select: ['id', 'title'] }],\n * ['tasks.task.get', { id: 3, select: ['id', 'title'] }]\n * ],\n * options: {\n * isHaltOnError: true,\n * returnAjaxResult: true,\n * requestId: 'batch-123'\n * }\n * })\n * if (!response.isSuccess) {\n * throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)\n * }\n *\n * const resultData = (response as Result<AjaxResult<{ item: TaskItem }>[]>).getData()\n * resultData.forEach((resultRow, index) => {\n * if (resultRow.isSuccess) {\n * console.log(`Item ${index + 1}:`, resultRow.getData()
|
|
1
|
+
{"version":3,"file":"batch.mjs","sources":["../../../../../src/core/actions/v3/batch.ts"],"sourcesContent":["import type { ActionOptions } from '../abstract-action'\nimport type { CallBatchResult, IB24BatchOptions } from '../../../types/b24'\nimport type {\n BatchCommandsArrayUniversal,\n BatchCommandsObjectUniversal,\n BatchNamedCommandsUniversal\n} from '../../../types/http'\nimport { AbstractBatch } from '../abstract-batch'\nimport { ApiVersion } from '../../../types/b24'\nimport { versionManager } from '../../version-manager'\nimport { SdkError } from '../../sdk-error'\n\nexport type ActionBatchV3 = ActionOptions & {\n calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal\n options?: IB24BatchOptions\n}\n\n/**\n * Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50. `restApi:v3`\n * Allows you to execute multiple requests in a single API call, significantly improving performance.\n *\n * @todo add docs\n */\nexport class BatchV3 extends AbstractBatch {\n /**\n * Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50.\n * Allows you to execute multiple requests in a single API call, significantly improving performance.\n *\n * @template T - The data type returned by batch query commands (default is `unknown`)\n *\n * @param {ActionBatchV3} options - parameters for executing the request.\n * - `calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal` - Commands to execute in a batch.\n * Supports several formats:\n * 1. Array of tuples: `[['method1', params1], ['method2', params2], ...]`\n * 2. Array of objects: `[{ method: 'method1', params: params1 }, { method: 'method2', params: params2 }, ...]`\n * 3. An object with named commands: `{ cmd1: { method: 'method1', params: params1 }, cmd2: ['method2', params2], ...}`\n * - `options?: IB24BatchOptions` - Additional options for executing a batch request.\n * - `isHaltOnError?: boolean` - Whether to stop execution on the first error (default: true)\n * - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging (default: undefined)\n * - `returnAjaxResult?: boolean` - Whether to return an AjaxResult object instead of data (default: false)\n *\n * @returns {Promise<CallBatchResult<T>>} A promise that is resolved by the result of executing a batch request:\n * - On success: a `Result` object with the command execution results\n * - The structure of the results depends on the format of the `calls` input data:\n * - For an array of commands, an array of results in the same order\n * - For named commands, an object with keys corresponding to the command names\n *\n * @example\n * interface TaskItem { id: number, title: string }\n * const response = await b24.actions.v3.batch.make<{ item: TaskItem }>({\n * calls: [\n * ['tasks.task.get', { id: 1, select: ['id', 'title'] }],\n * ['tasks.task.get', { id: 2, select: ['id', 'title'] }],\n * ['tasks.task.get', { id: 3, select: ['id', 'title'] }]\n * ],\n * options: {\n * isHaltOnError: true,\n * returnAjaxResult: true,\n * requestId: 'batch-123'\n * }\n * })\n * if (!response.isSuccess) {\n * throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)\n * }\n *\n * const resultData = (response as Result<AjaxResult<{ item: TaskItem }>[]>).getData()\n * resultData.forEach((resultRow, index) => {\n * if (resultRow.isSuccess) {\n * console.log(`Item ${index + 1}:`, resultRow.getData()!.result.item)\n * }\n * })\n *\n * @example\n * const response = await b24.actions.v3.batch.make({\n * calls: [\n * { method: 'tasks.task.get', params: { id: 1, select: ['id', 'title'] } },\n * { method: 'tasks.task.get', params: { id: 2, select: ['id', 'title'] } }\n * ],\n * options: {\n * isHaltOnError: true,\n * returnAjaxResult: true,\n * requestId: 'batch-123'\n * }\n * })\n * if (!response.isSuccess) {\n * throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)\n * }\n *\n * @example\n * interface TaskItem { id: number, title: string }\n * interface MainEventLogItem { id: number, userId: number }\n * const response = await b24.actions.v3.batch.make<{ item: TaskItem } | { items: MainEventLogItem[] }>({\n * calls: {\n * Task: { method: 'tasks.task.get', params: { id: 1, select: ['id', 'title'] } },\n * MainEventLog: ['main.eventlog.list', { select: ['id', 'userId'], pagination: { limit: 5 } }]\n * },\n * options: {\n * isHaltOnError: true,\n * returnAjaxResult: true,\n * requestId: 'batch-123'\n * }\n * })\n * if (!response.isSuccess) {\n * throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)\n * }\n *\n * const results = response.getData() as Record<string, AjaxResult<{ item: TaskItem } | { items: MainEventLogItem[] }>>\n * console.log('Task:', results.Task.getData()?.result.item as TaskItem)\n * console.log('MainEventLog:', results.MainEventLog.getData()?.result.items as MainEventLogItem[])\n *\n * @warning The maximum number of commands in one batch request is 50.\n * @note A batch request executes faster than sequential single calls,\n * but if one command fails, the entire batch may fail\n * (depending on API settings and options).\n */\n public override async make<T = unknown>(options: ActionBatchV3): Promise<CallBatchResult<T>> {\n const opts = {\n ...options.options,\n apiVersion: ApiVersion.v3\n }\n\n if (versionManager.automaticallyObtainApiVersionForBatch(options.calls) !== opts.apiVersion) {\n throw new SdkError({\n code: 'JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3',\n description: `restApi:v3 not support some methods in calls: ${JSON.stringify(options.calls)}`,\n status: 500\n })\n }\n\n const response = await this._b24.getHttpClient(ApiVersion.v3).batch<T>(options.calls, opts)\n\n return this._processBatchResponse<T>(response, options.calls, opts)\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAuBO,MAAM,gBAAgB,aAAA,CAAc;AAAA,EAvB3C;AAuB2C,IAAA,MAAA,CAAA,IAAA,EAAA,SAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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E;AACF;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package @bitrix24/b24jssdk
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.2.0
|
|
4
4
|
* @copyright (c) 2026 Bitrix24
|
|
5
5
|
* @license MIT
|
|
6
6
|
* @see https://github.com/bitrix24/b24jssdk
|
|
@@ -12,6 +12,7 @@ import { ParamsFactory } from './limiters/params-factory.mjs';
|
|
|
12
12
|
import { RestrictionManager } from './limiters/manager.mjs';
|
|
13
13
|
import { AjaxError } from './ajax-error.mjs';
|
|
14
14
|
import { AjaxResult } from './ajax-result.mjs';
|
|
15
|
+
import { redactSensitiveParams } from './redact.mjs';
|
|
15
16
|
import { Type } from '../../tools/type.mjs';
|
|
16
17
|
import { getEnvironment, Environment } from '../../tools/environment.mjs';
|
|
17
18
|
import { ApiVersion } from '../../types/b24.mjs';
|
|
@@ -44,7 +45,7 @@ class AbstractHttp {
|
|
|
44
45
|
this._logger = LoggerFactory.createNullLogger();
|
|
45
46
|
const defaultHeaders = {};
|
|
46
47
|
if (this.isServerSide()) {
|
|
47
|
-
defaultHeaders["User-Agent"] = "b24-js-sdk/1.
|
|
48
|
+
defaultHeaders["User-Agent"] = "b24-js-sdk/1.2.0";
|
|
48
49
|
}
|
|
49
50
|
this._authActions = authActions;
|
|
50
51
|
this._requestIdGenerator = new RequestIdGenerator();
|
|
@@ -311,7 +312,9 @@ class AbstractHttp {
|
|
|
311
312
|
{
|
|
312
313
|
requestId,
|
|
313
314
|
status: error.status,
|
|
314
|
-
|
|
315
|
+
// Redact in case a future portal response embeds credentials in
|
|
316
|
+
// the error body (today it doesn't, but the channel is open). (#39)
|
|
317
|
+
responseData: JSON.stringify(redactSensitiveParams(error?.response?.data), null, 0)
|
|
315
318
|
}
|
|
316
319
|
);
|
|
317
320
|
}
|
|
@@ -328,14 +331,14 @@ class AbstractHttp {
|
|
|
328
331
|
async _makeAxiosRequest(requestId, method, params, authData) {
|
|
329
332
|
const methodFormatted = this._prepareMethod(requestId, method, this.getBaseUrl());
|
|
330
333
|
const paramsFormatted = this._prepareParams(authData, params);
|
|
331
|
-
const paramsFormattedForLog = JSON.stringify(paramsFormatted, null, 0);
|
|
334
|
+
const paramsFormattedForLog = JSON.stringify(redactSensitiveParams(paramsFormatted), null, 0);
|
|
332
335
|
const maxLogLength = 300;
|
|
333
336
|
const sliceLogLength = 100;
|
|
334
337
|
this.getLogger().info(
|
|
335
338
|
`post/send`,
|
|
336
339
|
{
|
|
337
340
|
requestId,
|
|
338
|
-
method
|
|
341
|
+
method,
|
|
339
342
|
params: paramsFormattedForLog.length > maxLogLength ? paramsFormattedForLog.slice(0, sliceLogLength) + "..." : paramsFormattedForLog
|
|
340
343
|
}
|
|
341
344
|
);
|
|
@@ -428,14 +431,7 @@ class AbstractHttp {
|
|
|
428
431
|
// endregion ////
|
|
429
432
|
// region Log ////
|
|
430
433
|
_sanitizeParams(params) {
|
|
431
|
-
|
|
432
|
-
const sensitiveKeys = ["auth", "password", "token", "secret", "access_token", "refresh_token"];
|
|
433
|
-
sensitiveKeys.forEach((key) => {
|
|
434
|
-
if (key in sanitized && sanitized[key]) {
|
|
435
|
-
sanitized[key] = "***REDACTED***";
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
return sanitized;
|
|
434
|
+
return redactSensitiveParams(params);
|
|
439
435
|
}
|
|
440
436
|
_logRequest(requestId, method, params) {
|
|
441
437
|
this.getLogger().debug(`http request starting`, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-http.mjs","sources":["../../../../src/core/http/abstract-http.ts"],"sourcesContent":["import type { LoggerInterface } from '../../logger'\nimport type {\n TypeCallParams,\n TypeHttp,\n ICallBatchOptions,\n BatchCommandsArrayUniversal,\n BatchCommandsObjectUniversal,\n BatchNamedCommandsUniversal,\n ICallBatchResult\n} from '../../types/http'\nimport type { RestrictionManagerStats, RestrictionParams } from '../../types/limiters'\nimport type { AuthActions, AuthData, TypeDescriptionError, TypeDescriptionErrorV3 } from '../../types/auth'\nimport type { AxiosInstance } from 'axios'\nimport type { Result } from '../result'\nimport type { SuccessPayload } from '../../types/payloads'\nimport axios, { AxiosError } from 'axios'\nimport { LoggerFactory } from '../../logger'\nimport { RequestIdGenerator } from '../request-id-generator'\nimport { ParamsFactory } from './limiters/params-factory'\nimport { RestrictionManager } from './limiters/manager'\nimport { AjaxError } from './ajax-error'\nimport { AjaxResult } from './ajax-result'\nimport { Type } from '../../tools/type'\nimport { Environment, getEnvironment } from '../../tools/environment'\nimport { ApiVersion } from '../../types/b24'\n\nexport type AjaxResponse<T = unknown> = {\n status: number\n payload: SuccessPayload<T>\n}\n\nexport type TypePrepareParams = TypeCallParams & {\n data?: Record<string, any>\n auth?: string\n}\n\n/**\n * Abstract Class for working with RestApi requests via http\n *\n * @link https://bitrix24.github.io/b24jssdk/\n *\n * @todo docs\n */\nexport abstract class AbstractHttp implements TypeHttp {\n protected _clientAxios: AxiosInstance\n protected _authActions: AuthActions\n protected _requestIdGenerator: RequestIdGenerator\n protected _restrictionManager: RestrictionManager\n\n protected _logger: LoggerInterface\n\n protected _isClientSideWarning: boolean = false\n protected _clientSideWarningMessage: string = ''\n\n protected _version: ApiVersion\n\n protected _metrics = {\n totalRequests: 0,\n successfulRequests: 0,\n failedRequests: 0,\n totalDuration: 0,\n byMethod: new Map<string, { count: number, totalDuration: number }>(),\n lastErrors: [] as Array<{ method: string, error: string, timestamp: number }>\n }\n\n constructor(\n authActions: AuthActions,\n options?: null | object,\n restrictionParams?: Partial<RestrictionParams>\n ) {\n this._version = ApiVersion.v2\n\n this._logger = LoggerFactory.createNullLogger()\n\n const defaultHeaders: Record<string, string> = {}\n\n if (this.isServerSide()) {\n defaultHeaders['User-Agent'] = '__SDK_USER_AGENT__/__SDK_VERSION__'\n }\n\n this._authActions = authActions\n this._requestIdGenerator = new RequestIdGenerator()\n\n this._clientAxios = axios.create({\n headers: {\n ...defaultHeaders,\n ...(options ? (options as any).headers : {})\n },\n timeout: 30_000,\n timeoutErrorMessage: 'Request timeout exceeded',\n ...(options && { ...options, headers: undefined })\n })\n\n /**\n * Basic parameters of restrictions\n */\n const params: RestrictionParams = {\n ...ParamsFactory.getDefault(),\n ...restrictionParams\n }\n\n this._restrictionManager = new RestrictionManager(params)\n }\n\n get apiVersion(): ApiVersion {\n return this._version\n }\n\n get ajaxClient(): AxiosInstance {\n return this._clientAxios\n }\n\n // region Logger ////\n public setLogger(logger: LoggerInterface): void {\n this._logger = logger\n this._restrictionManager.setLogger(this._logger)\n }\n\n public getLogger(): LoggerInterface {\n return this._logger\n }\n // endregion ////\n\n // region RestrictionManager ////\n public async setRestrictionManagerParams(params: RestrictionParams): Promise<void> {\n await this._restrictionManager.setConfig(params)\n }\n\n public getRestrictionManagerParams(): RestrictionParams {\n return this._restrictionManager.getParams()\n }\n\n /**\n * @inheritDoc\n */\n public getStats(): RestrictionManagerStats & {\n adaptiveDelayAvg: number\n errorCounts: Record<string, number>\n totalRequests: number\n successfulRequests: number\n failedRequests: number\n totalDuration: number\n byMethod: Map<string, { count: number, totalDuration: number }>\n lastErrors: { method: string, error: string, timestamp: number }[]\n } {\n return {\n ...this._restrictionManager.getStats(),\n totalRequests: this._metrics.totalDuration,\n successfulRequests: this._metrics.successfulRequests,\n failedRequests: this._metrics.failedRequests,\n totalDuration: this._metrics.totalDuration,\n byMethod: this._metrics.byMethod,\n lastErrors: this._metrics.lastErrors\n }\n }\n\n /**\n * @inheritDoc\n */\n public async reset(): Promise<void> {\n this._metrics.totalDuration = 0\n this._metrics.successfulRequests = 0\n this._metrics.failedRequests = 0\n this._metrics.totalDuration = 0\n this._metrics.byMethod.clear()\n this._metrics.lastErrors = []\n\n return this._restrictionManager.reset()\n }\n // endregion ////\n\n // region Metrics ////\n protected _updateMetrics(\n method: string,\n isSuccess: boolean,\n duration: number,\n error?: unknown\n ): void {\n this._metrics.totalRequests++\n\n if (isSuccess) {\n this._metrics.successfulRequests++\n } else {\n this._metrics.failedRequests++\n\n if (error instanceof AjaxError) {\n this._metrics.lastErrors.push({\n method,\n error: error.message,\n timestamp: Date.now()\n })\n\n if (this._metrics.lastErrors.length > 100) {\n this._metrics.lastErrors = this._metrics.lastErrors.slice(-100)\n }\n }\n }\n\n // Metrics by Method\n if (!this._metrics.byMethod.has(method)) {\n this._metrics.byMethod.set(method, { count: 0, totalDuration: 0 })\n }\n\n const methodMetrics = this._metrics.byMethod.get(method)!\n methodMetrics.count++\n methodMetrics.totalDuration += duration\n }\n // endregion ////\n\n // region Actions Call ////\n // region batch ////\n public abstract batch<T = unknown>(\n calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal,\n options?: ICallBatchOptions\n ): Promise<Result<ICallBatchResult<T>>>\n // endregion ////\n\n protected _validateParams(requestId: string, method: string, params: TypeCallParams): void {\n // Checking for cyclic references (especially important when logging)\n try {\n JSON.stringify(params)\n } catch (error) {\n throw new AjaxError({\n code: 'JSSDK_INVALID_PARAMS',\n description: 'Parameters contain circular references',\n status: 400,\n requestInfo: { method, params, requestId },\n originalError: error\n })\n }\n\n // Size check (It is especially important for batch)\n // const paramsSize = JSON.stringify(params).length\n // if (paramsSize > 1024 * 1024) { // 1MB\n // throw new AjaxError({\n // code: 'JSSDK_PARAMS_TOO_LARGE',\n // description: `Parameters too large: ${(paramsSize / 1024 / 1024).toFixed(2)}MB`,\n // status: 400,\n // requestInfo: { method, params, requestId },\n // originalError: null\n // })\n // }\n }\n\n /**\n * Calling the RestApi function\n * @param method - REST API method name\n * @param params - Parameters for the method.\n * @param requestId - Request id\n * @returns Promise with AjaxResult\n */\n public async call<T = unknown>(method: string, params: TypeCallParams, requestId?: string): Promise<AjaxResult<T>> {\n requestId = requestId ?? this._requestIdGenerator.getRequestId()\n const maxRetries = this._restrictionManager.getParams().maxRetries!\n\n this._validateParams(requestId, method, params)\n this._logRequest(requestId, method, params)\n\n let lastError: AjaxError | null = null\n const startTime = Date.now()\n\n for (let attempt = 0; attempt < maxRetries; attempt++) {\n try {\n this._logAttempt(requestId, method, attempt + 1, maxRetries)\n\n // Apply operating limits via the manager\n await this._restrictionManager.applyOperatingLimits(requestId, method, params)\n\n // 3. We execute the request taking into account authorization, rate limit, and update operating statistics.\n const result = await this._executeSingleCall<T>(requestId, method, params)\n const duration = Date.now() - startTime\n\n // 6. Updating statistics\n this._restrictionManager.resetErrors(method)\n this._updateMetrics(method, true, duration)\n\n // Log the results\n this._logSuccessfulRequest(requestId, method, duration)\n return result\n } catch (error: unknown) {\n lastError = this._convertToAjaxError(requestId, error, method, params)\n\n const duration = Date.now() - startTime\n\n this._restrictionManager.incrementError(method)\n this._updateMetrics(method, false, duration, lastError)\n\n // Log the results\n this._logFailedRequest(requestId, method, attempt + 1, maxRetries, lastError)\n\n if (attempt < maxRetries) {\n const waitTime = await this._restrictionManager.handleError(requestId, method, params, lastError, attempt)\n // We don't repeat if waitTime === 0\n if (waitTime > 0) {\n this._restrictionManager.incrementStats('limitHits')\n\n this._logAttemptRetryWaiteDelay(requestId, method, waitTime, attempt + 1, maxRetries)\n await this._restrictionManager.waiteDelay(waitTime)\n\n this._restrictionManager.incrementStats('retries')\n\n continue\n }\n }\n\n if (attempt + 1 === maxRetries) {\n this._logAllAttemptsExhausted(requestId, method, attempt + 1, maxRetries)\n }\n\n /**\n * We decide whether to throw an error in `AjaxResult` or throw an exception.\n */\n if (this._restrictionManager.exceptionCodeForSoft.includes(lastError.code)) {\n return this._createAjaxResultWithErrorFromResponse<T>(lastError, requestId, method, params)\n }\n throw lastError\n }\n }\n\n throw new AjaxError({\n code: 'JSSDK_CALL_ALL_ATTEMPTS_EXHAUSTED',\n description: 'All attempts exhausted',\n status: lastError?.status || 500,\n requestInfo: { method, params, requestId },\n originalError: lastError?.originalError || null\n })\n }\n\n protected _convertToAjaxError(requestId: string, error: unknown, method: string, params: TypeCallParams): AjaxError {\n if (error instanceof AjaxError) {\n return error\n }\n\n if (error instanceof AxiosError) {\n return this._convertAxiosErrorToAjaxError(requestId, error, method, params)\n }\n\n return this._convertUnknownErrorToAjaxError(requestId, error, method, params)\n }\n\n protected _convertAxiosErrorToAjaxError(requestId: string, axiosError: AxiosError, method: string, params: TypeCallParams): AjaxError {\n let errorCode = `${axiosError.code || 'JSSDK_AXIOS_ERROR'}`\n let errorDescription = axiosError.message\n const status = axiosError.response?.status || 0\n\n // Handling network errors\n if (errorCode === 'ERR_NETWORK') {\n return new AjaxError({\n code: 'NETWORK_ERROR',\n description: 'Network connection failed',\n status: 0,\n requestInfo: { method, params, requestId },\n originalError: axiosError\n })\n }\n\n // Handling timeout\n if (errorCode === 'ECONNABORTED' || axiosError.message.includes('timeout')) {\n return new AjaxError({\n code: 'REQUEST_TIMEOUT',\n description: 'Request timeout exceeded',\n status: 408,\n requestInfo: { method, params, requestId },\n originalError: axiosError\n })\n }\n\n /**\n * @todo make single function\n * @see AjaxResult.#processErrors()\n */\n if (axiosError.response?.data && typeof axiosError.response.data === 'object') {\n const responseData = axiosError.response.data as TypeDescriptionError | TypeDescriptionErrorV3\n if (\n responseData.error\n && typeof responseData.error === 'object'\n && 'code' in responseData.error\n ) {\n errorCode = responseData.error.code\n errorDescription = responseData.error.message.trimEnd()\n if (responseData.error.validation) {\n if (errorDescription.length > 0) {\n if (!errorDescription.endsWith('.')) {\n errorDescription += `.`\n }\n errorDescription += ` `\n }\n responseData.error.validation.forEach((row) => {\n errorDescription += `${row?.message || JSON.stringify(row)}`\n })\n }\n } else if (responseData.error && typeof responseData.error === 'string') {\n errorCode = responseData.error !== '0' ? responseData.error : errorCode\n errorDescription = (responseData as TypeDescriptionError)?.error_description ?? errorDescription\n }\n }\n\n return new AjaxError({\n code: errorCode,\n description: errorDescription,\n status,\n requestInfo: { method, params, requestId },\n originalError: axiosError\n })\n }\n\n protected _convertUnknownErrorToAjaxError(requestId: string, error: unknown, method: string, params: TypeCallParams): AjaxError {\n return new AjaxError({\n code: 'JSSDK_UNKNOWN_ERROR',\n description: error instanceof Error ? error.message : String(error),\n status: 0,\n requestInfo: { method, params, requestId },\n originalError: error\n })\n }\n\n // region Execute Single Call ////\n /**\n * Performs a single call with\n * - 401 error handling\n * - rate limit check\n * - updating operating statistics\n */\n protected async _executeSingleCall<T = unknown>(requestId: string, method: string, params: TypeCallParams): Promise<AjaxResult<T>> {\n this._checkClientSideWarning(requestId)\n const authData = await this._ensureAuth(requestId)\n const response = await this._makeRequestWithAuthRetry<T>(requestId, method, params, authData)\n\n return this._createAjaxResultFromResponse<T>(response, requestId, method, params)\n }\n\n // Get/update authorization\n protected async _ensureAuth(requestId: string): Promise<AuthData> {\n let authData = this._authActions.getAuthData()\n if (authData === false) {\n this._logRefreshingAuthToken(requestId)\n authData = await this._authActions.refreshAuth()\n }\n return authData\n }\n\n // Execute the request with 401 error handling\n protected async _makeRequestWithAuthRetry<T>(requestId: string, method: string, params: TypeCallParams, authData: AuthData): Promise<AjaxResponse<T>> {\n try {\n // 4. Apply the rate limit through the manager\n await this._restrictionManager.checkRateLimit(requestId, method)\n\n return await this._makeAxiosRequest<T>(requestId, method, params, authData)\n } catch (error) {\n if (error instanceof AxiosError) {\n this.getLogger().info(\n `post/catchError`, {\n requestId,\n status: error.status,\n responseData: JSON.stringify(error?.response?.data, null, 0)\n }\n )\n }\n\n // If this is an authorization error (401), then we try to update the token and repeat\n if (this._isAuthError(error)) {\n this._logAuthErrorDetected(requestId)\n this._logRefreshingAuthToken(requestId)\n\n const refreshedAuthData = await this._authActions.refreshAuth()\n\n // 4. Apply the rate limit through the manager\n await this._restrictionManager.checkRateLimit(requestId, method)\n\n return await this._makeAxiosRequest<T>(requestId, method, params, refreshedAuthData)\n }\n\n throw error\n }\n }\n\n protected async _makeAxiosRequest<T>(requestId: string, method: string, params: TypeCallParams, authData: AuthData): Promise<AjaxResponse<T>> {\n const methodFormatted = this._prepareMethod(requestId, method, this.getBaseUrl())\n\n const paramsFormatted = this._prepareParams(authData, params)\n const paramsFormattedForLog = JSON.stringify(paramsFormatted, null, 0)\n\n const maxLogLength = 300\n const sliceLogLength = 100\n this.getLogger().info(\n `post/send`, {\n requestId,\n method: methodFormatted,\n params: paramsFormattedForLog.length > maxLogLength ? paramsFormattedForLog.slice(0, sliceLogLength) + '...' : paramsFormattedForLog\n }\n )\n\n const response = await this._clientAxios.post<SuccessPayload<T>>(methodFormatted, paramsFormatted)\n\n const resultFormattedForLog = JSON.stringify(response.data.result, null, 0)\n this.getLogger().info(\n `post/response`, {\n requestId,\n // responseFull: JSON.stringify(response.data, null, 2),\n result: resultFormattedForLog.length > maxLogLength ? resultFormattedForLog.slice(0, sliceLogLength) + '...' : resultFormattedForLog,\n time: JSON.stringify(response.data.time, null, 0)\n }\n )\n\n return {\n status: response.status,\n payload: response.data\n }\n }\n\n protected _isAuthError(error: unknown): boolean {\n if (!(error instanceof AjaxError)) {\n return false\n }\n\n // @todo ! test this\n return (\n error.status === 401\n && ['expired_token', 'invalid_token'].includes(error.code)\n )\n }\n\n protected async _createAjaxResultFromResponse<T>(response: AjaxResponse<T>, requestId: string, method: string, params: TypeCallParams): Promise<AjaxResult<T>> {\n const result = new AjaxResult<T>({\n answer: response.payload,\n query: { method, params, requestId },\n status: response.status\n })\n\n // 5. Update operating statistics\n if (result.isSuccess) {\n const time = result.getData()?.time\n await this._restrictionManager.updateStats(requestId, method, time!)\n }\n\n return result\n }\n\n /**\n * This works in conjunction with the AbstractHttp._convertAxiosErrorToAjaxError function\n */\n protected _createAjaxResultWithErrorFromResponse<T>(ajaxError: AjaxError, requestId: string, method: string, params: TypeCallParams): AjaxResult<T> {\n return new AjaxResult<T>({\n answer: {\n error: {\n code: ajaxError.code,\n message: ajaxError.message\n }\n },\n query: { method, params, requestId },\n status: ajaxError.status\n })\n //\n // result.addError(ajaxError)\n //\n // return result\n }\n // endregion ////\n // endregion ////\n\n // region Prepare ////\n /**\n * Makes the function name safe and adds JSON format\n */\n protected abstract _prepareMethod(requestId: string, method: string, baseUrl: string): string\n\n /**\n * Processes function parameters and adds authorization\n */\n protected _prepareParams(authData: AuthData, params: TypeCallParams): TypePrepareParams {\n const result: TypePrepareParams = { ...params }\n\n /** @memo we skip auth for hook */\n if (authData.refresh_token !== 'hook') {\n result.auth = authData.access_token\n }\n\n if (result?.data && 'start' in result.data) {\n const { start, ...dataWithoutStart } = result.data\n result.data = dataWithoutStart\n }\n\n return result\n }\n\n /**\n * @inheritDoc\n */\n public setClientSideWarning(\n value: boolean,\n message: string\n ): void {\n this._isClientSideWarning = value\n this._clientSideWarningMessage = message\n }\n // endregion ////\n\n // region Tools ////\n /**\n * Tests whether the code is executed on the client side\n * @return {boolean}\n * @protected\n */\n protected isServerSide(): boolean {\n return (getEnvironment() !== Environment.BROWSE)\n }\n\n /**\n * Get the BX24 account address with the path based on the API version\n */\n public getBaseUrl(): string {\n return this._authActions.getTargetOriginWithPath().get(this._version)!\n }\n // endregion ////\n\n // region Log ////\n protected _sanitizeParams(params: TypeCallParams): Record<string, unknown> {\n const sanitized = { ...params }\n const sensitiveKeys = ['auth', 'password', 'token', 'secret', 'access_token', 'refresh_token']\n\n sensitiveKeys.forEach((key) => {\n if (key in sanitized && sanitized[key]) {\n sanitized[key] = '***REDACTED***'\n }\n })\n\n return sanitized\n }\n\n protected _logRequest(requestId: string, method: string, params: TypeCallParams): void {\n this.getLogger().debug(`http request starting`, {\n requestId,\n method,\n params: this._sanitizeParams(params),\n api: this.apiVersion,\n timestamp: Date.now()\n })\n }\n\n protected _logAttempt(requestId: string, method: string, attempt: number, maxRetries: number): void {\n this.getLogger().info(`http request attempt`, {\n requestId,\n method,\n api: this.apiVersion,\n attempt: {\n current: attempt,\n max: maxRetries\n }\n })\n }\n\n protected _logRefreshingAuthToken(requestId: string): void {\n this.getLogger().info(`http refreshing auth token`, {\n requestId,\n api: this.apiVersion\n })\n }\n\n protected _logAuthErrorDetected(requestId: string): void {\n this.getLogger().info(`http auth error detected`, {\n requestId,\n api: this.apiVersion\n })\n }\n\n protected _logSuccessfulRequest(requestId: string, method: string, duration: number): void {\n this.getLogger().debug(`http request successful`, {\n requestId,\n method,\n api: this.apiVersion,\n duration: {\n ms: duration,\n sec: Number.parseFloat((duration / 1000).toFixed(2))\n }\n })\n }\n\n protected _logFailedRequest(\n requestId: string,\n method: string,\n attempt: number,\n maxRetries: number,\n error: AjaxError\n ): void {\n this.getLogger().debug(`http request failed`, {\n requestId,\n method,\n api: this.apiVersion,\n attempt: {\n current: attempt,\n max: maxRetries\n },\n error: {\n code: error.code,\n message: error.message,\n status: error.status\n }\n })\n }\n\n protected _logAttemptRetryWaiteDelay(\n requestId: string,\n method: string,\n wait: number,\n attempt: number,\n maxRetries: number\n ): void {\n this.getLogger().debug(\n `http wait ${(wait / 1000).toFixed(2)} sec.`,\n {\n requestId,\n method,\n api: this.apiVersion,\n wait: wait,\n attempt: {\n current: attempt,\n max: maxRetries\n }\n }\n )\n }\n\n protected _logAllAttemptsExhausted(requestId: string, method: string, attempt: number, maxRetries: number): void {\n this.getLogger().warning(`http all retry attempts exhausted`, {\n requestId,\n method,\n api: this.apiVersion,\n attempt: {\n current: attempt,\n max: maxRetries\n }\n })\n }\n\n protected _logBatchStart(\n requestId: string,\n calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal,\n options: ICallBatchOptions\n ): void {\n const callCount = Array.isArray(calls)\n ? calls.length\n : Object.keys(calls).length\n\n this.getLogger().debug(`http batch request starting `, {\n requestId,\n callCount,\n api: this.apiVersion,\n isHaltOnError: options.isHaltOnError,\n timestamp: Date.now()\n })\n }\n\n protected _logBatchCompletion(requestId: string, total: number, errors: number): void {\n this.getLogger().debug(`http batch request completed`, {\n requestId,\n api: this.apiVersion,\n totalCalls: total,\n successful: total - errors,\n failed: errors,\n successRate: total > 0 ? ((total - errors) / (total) * 100).toFixed(1) + '%' : '??'\n })\n }\n\n // Check client-side warnings\n protected _checkClientSideWarning(requestId: string): void {\n if (\n this._isClientSideWarning\n && !this.isServerSide()\n && Type.isStringFilled(this._clientSideWarningMessage)\n ) {\n LoggerFactory.forcedLog(\n this.getLogger(),\n 'warning',\n this._clientSideWarningMessage,\n {\n requestId,\n code: 'JSSDK_CLIENT_SIDE_WARNING'\n }\n )\n }\n }\n // endregion ////\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2CO,MAAe,YAAA,CAAiC;AAAA,EA3CvD;AA2CuD,IAAA,MAAA,CAAA,IAAA,EAAA,cAAA,CAAA;AAAA;AAAA,EAC3C,YAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA;AAAA,EACA,mBAAA;AAAA,EAEA,OAAA;AAAA,EAEA,oBAAA,GAAgC,KAAA;AAAA,EAChC,yBAAA,GAAoC,EAAA;AAAA,EAEpC,QAAA;AAAA,EAEA,QAAA,GAAW;AAAA,IACnB,aAAA,EAAe,CAAA;AAAA,IACf,kBAAA,EAAoB,CAAA;AAAA,IACpB,cAAA,EAAgB,CAAA;AAAA,IAChB,aAAA,EAAe,CAAA;AAAA,IACf,QAAA,sBAAc,GAAA,EAAsD;AAAA,IACpE,YAAY;AAAC,GACf;AAAA,EAEA,WAAA,CACE,WAAA,EACA,OAAA,EACA,iBAAA,EACA;AACA,IAAA,IAAA,CAAK,WAAW,UAAA,CAAW,EAAA;AAE3B,IAAA,IAAA,CAAK,OAAA,GAAU,cAAc,gBAAA,EAAiB;AAE9C,IAAA,MAAM,iBAAyC,EAAC;AAEhD,IAAA,IAAI,IAAA,CAAK,cAAa,EAAG;AACvB,MAAA,cAAA,CAAe,YAAY,CAAA,GAAI,kBAAA;AAAA,IACjC;AAEA,IAAA,IAAA,CAAK,YAAA,GAAe,WAAA;AACpB,IAAA,IAAA,CAAK,mBAAA,GAAsB,IAAI,kBAAA,EAAmB;AAElD,IAAA,IAAA,CAAK,YAAA,GAAe,MAAM,MAAA,CAAO;AAAA,MAC/B,OAAA,EAAS;AAAA,QACP,GAAG,cAAA;AAAA,QACH,GAAI,OAAA,GAAW,OAAA,CAAgB,OAAA,GAAU;AAAC,OAC5C;AAAA,MACA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AK,oBAAA,IACF,CAAC,IAAA,CAAK,YAAA,MACN,IAAA,CAAK,cAAA,CAAe,IAAA,CAAK,yBAAyB,CAAA,EACrD;AACA,MAAA,aAAA,CAAc,SAAA;AAAA,QACZ,KAAK,SAAA,EAAU;AAAA,QACf,SAAA;AAAA,QACA,IAAA,CAAK,yBAAA;AAAA,QACL;AAAA,UACE,SAAA;AAAA,UACA,IAAA,EAAM;AAAA;AACR,OACF;AAAA,IACF;AAAA,EACF;AAAA;AAEF;;;;"}
|
|
1
|
+
{"version":3,"file":"abstract-http.mjs","sources":["../../../../src/core/http/abstract-http.ts"],"sourcesContent":["import type { LoggerInterface } from '../../logger'\nimport type {\n TypeCallParams,\n TypeHttp,\n ICallBatchOptions,\n BatchCommandsArrayUniversal,\n BatchCommandsObjectUniversal,\n BatchNamedCommandsUniversal,\n ICallBatchResult\n} from '../../types/http'\nimport type { RestrictionManagerStats, RestrictionParams } from '../../types/limiters'\nimport type { AuthActions, AuthData, TypeDescriptionError, TypeDescriptionErrorV3 } from '../../types/auth'\nimport type { AxiosInstance } from 'axios'\nimport type { Result } from '../result'\nimport type { SuccessPayload } from '../../types/payloads'\nimport axios, { AxiosError } from 'axios'\nimport { LoggerFactory } from '../../logger'\nimport { RequestIdGenerator } from '../request-id-generator'\nimport { ParamsFactory } from './limiters/params-factory'\nimport { RestrictionManager } from './limiters/manager'\nimport { AjaxError } from './ajax-error'\nimport { AjaxResult } from './ajax-result'\nimport { redactSensitiveParams } from './redact'\nimport { Type } from '../../tools/type'\nimport { Environment, getEnvironment } from '../../tools/environment'\nimport { ApiVersion } from '../../types/b24'\n\nexport type AjaxResponse<T = unknown> = {\n status: number\n payload: SuccessPayload<T>\n}\n\nexport type TypePrepareParams = TypeCallParams & {\n data?: Record<string, any>\n auth?: string\n}\n\n/**\n * Abstract Class for working with RestApi requests via http\n *\n * @link https://bitrix24.github.io/b24jssdk/\n *\n * @todo docs\n */\nexport abstract class AbstractHttp implements TypeHttp {\n protected _clientAxios: AxiosInstance\n protected _authActions: AuthActions\n protected _requestIdGenerator: RequestIdGenerator\n protected _restrictionManager: RestrictionManager\n\n protected _logger: LoggerInterface\n\n protected _isClientSideWarning: boolean = false\n protected _clientSideWarningMessage: string = ''\n\n protected _version: ApiVersion\n\n protected _metrics = {\n totalRequests: 0,\n successfulRequests: 0,\n failedRequests: 0,\n totalDuration: 0,\n byMethod: new Map<string, { count: number, totalDuration: number }>(),\n lastErrors: [] as Array<{ method: string, error: string, timestamp: number }>\n }\n\n constructor(\n authActions: AuthActions,\n options?: null | object,\n restrictionParams?: Partial<RestrictionParams>\n ) {\n this._version = ApiVersion.v2\n\n this._logger = LoggerFactory.createNullLogger()\n\n const defaultHeaders: Record<string, string> = {}\n\n if (this.isServerSide()) {\n defaultHeaders['User-Agent'] = '__SDK_USER_AGENT__/__SDK_VERSION__'\n }\n\n this._authActions = authActions\n this._requestIdGenerator = new RequestIdGenerator()\n\n this._clientAxios = axios.create({\n headers: {\n ...defaultHeaders,\n ...(options ? (options as any).headers : {})\n },\n timeout: 30_000,\n timeoutErrorMessage: 'Request timeout exceeded',\n ...(options && { ...options, headers: undefined })\n })\n\n /**\n * Basic parameters of restrictions\n */\n const params: RestrictionParams = {\n ...ParamsFactory.getDefault(),\n ...restrictionParams\n }\n\n this._restrictionManager = new RestrictionManager(params)\n }\n\n get apiVersion(): ApiVersion {\n return this._version\n }\n\n get ajaxClient(): AxiosInstance {\n return this._clientAxios\n }\n\n // region Logger ////\n public setLogger(logger: LoggerInterface): void {\n this._logger = logger\n this._restrictionManager.setLogger(this._logger)\n }\n\n public getLogger(): LoggerInterface {\n return this._logger\n }\n // endregion ////\n\n // region RestrictionManager ////\n public async setRestrictionManagerParams(params: RestrictionParams): Promise<void> {\n await this._restrictionManager.setConfig(params)\n }\n\n public getRestrictionManagerParams(): RestrictionParams {\n return this._restrictionManager.getParams()\n }\n\n /**\n * @inheritDoc\n */\n public getStats(): RestrictionManagerStats & {\n adaptiveDelayAvg: number\n errorCounts: Record<string, number>\n totalRequests: number\n successfulRequests: number\n failedRequests: number\n totalDuration: number\n byMethod: Map<string, { count: number, totalDuration: number }>\n lastErrors: { method: string, error: string, timestamp: number }[]\n } {\n return {\n ...this._restrictionManager.getStats(),\n totalRequests: this._metrics.totalDuration,\n successfulRequests: this._metrics.successfulRequests,\n failedRequests: this._metrics.failedRequests,\n totalDuration: this._metrics.totalDuration,\n byMethod: this._metrics.byMethod,\n lastErrors: this._metrics.lastErrors\n }\n }\n\n /**\n * @inheritDoc\n */\n public async reset(): Promise<void> {\n this._metrics.totalDuration = 0\n this._metrics.successfulRequests = 0\n this._metrics.failedRequests = 0\n this._metrics.totalDuration = 0\n this._metrics.byMethod.clear()\n this._metrics.lastErrors = []\n\n return this._restrictionManager.reset()\n }\n // endregion ////\n\n // region Metrics ////\n protected _updateMetrics(\n method: string,\n isSuccess: boolean,\n duration: number,\n error?: unknown\n ): void {\n this._metrics.totalRequests++\n\n if (isSuccess) {\n this._metrics.successfulRequests++\n } else {\n this._metrics.failedRequests++\n\n if (error instanceof AjaxError) {\n this._metrics.lastErrors.push({\n method,\n error: error.message,\n timestamp: Date.now()\n })\n\n if (this._metrics.lastErrors.length > 100) {\n this._metrics.lastErrors = this._metrics.lastErrors.slice(-100)\n }\n }\n }\n\n // Metrics by Method\n if (!this._metrics.byMethod.has(method)) {\n this._metrics.byMethod.set(method, { count: 0, totalDuration: 0 })\n }\n\n const methodMetrics = this._metrics.byMethod.get(method)!\n methodMetrics.count++\n methodMetrics.totalDuration += duration\n }\n // endregion ////\n\n // region Actions Call ////\n // region batch ////\n public abstract batch<T = unknown>(\n calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal,\n options?: ICallBatchOptions\n ): Promise<Result<ICallBatchResult<T>>>\n // endregion ////\n\n protected _validateParams(requestId: string, method: string, params: TypeCallParams): void {\n // Checking for cyclic references (especially important when logging)\n try {\n JSON.stringify(params)\n } catch (error) {\n throw new AjaxError({\n code: 'JSSDK_INVALID_PARAMS',\n description: 'Parameters contain circular references',\n status: 400,\n requestInfo: { method, params, requestId },\n originalError: error\n })\n }\n\n // Size check (It is especially important for batch)\n // const paramsSize = JSON.stringify(params).length\n // if (paramsSize > 1024 * 1024) { // 1MB\n // throw new AjaxError({\n // code: 'JSSDK_PARAMS_TOO_LARGE',\n // description: `Parameters too large: ${(paramsSize / 1024 / 1024).toFixed(2)}MB`,\n // status: 400,\n // requestInfo: { method, params, requestId },\n // originalError: null\n // })\n // }\n }\n\n /**\n * Calling the RestApi function\n * @param method - REST API method name\n * @param params - Parameters for the method.\n * @param requestId - Request id\n * @returns Promise with AjaxResult\n */\n public async call<T = unknown>(method: string, params: TypeCallParams, requestId?: string): Promise<AjaxResult<T>> {\n requestId = requestId ?? this._requestIdGenerator.getRequestId()\n const maxRetries = this._restrictionManager.getParams().maxRetries!\n\n this._validateParams(requestId, method, params)\n this._logRequest(requestId, method, params)\n\n let lastError: AjaxError | null = null\n const startTime = Date.now()\n\n for (let attempt = 0; attempt < maxRetries; attempt++) {\n try {\n this._logAttempt(requestId, method, attempt + 1, maxRetries)\n\n // Apply operating limits via the manager\n await this._restrictionManager.applyOperatingLimits(requestId, method, params)\n\n // 3. We execute the request taking into account authorization, rate limit, and update operating statistics.\n const result = await this._executeSingleCall<T>(requestId, method, params)\n const duration = Date.now() - startTime\n\n // 6. Updating statistics\n this._restrictionManager.resetErrors(method)\n this._updateMetrics(method, true, duration)\n\n // Log the results\n this._logSuccessfulRequest(requestId, method, duration)\n return result\n } catch (error: unknown) {\n lastError = this._convertToAjaxError(requestId, error, method, params)\n\n const duration = Date.now() - startTime\n\n this._restrictionManager.incrementError(method)\n this._updateMetrics(method, false, duration, lastError)\n\n // Log the results\n this._logFailedRequest(requestId, method, attempt + 1, maxRetries, lastError)\n\n if (attempt < maxRetries) {\n const waitTime = await this._restrictionManager.handleError(requestId, method, params, lastError, attempt)\n // We don't repeat if waitTime === 0\n if (waitTime > 0) {\n this._restrictionManager.incrementStats('limitHits')\n\n this._logAttemptRetryWaiteDelay(requestId, method, waitTime, attempt + 1, maxRetries)\n await this._restrictionManager.waiteDelay(waitTime)\n\n this._restrictionManager.incrementStats('retries')\n\n continue\n }\n }\n\n if (attempt + 1 === maxRetries) {\n this._logAllAttemptsExhausted(requestId, method, attempt + 1, maxRetries)\n }\n\n /**\n * We decide whether to throw an error in `AjaxResult` or throw an exception.\n */\n if (this._restrictionManager.exceptionCodeForSoft.includes(lastError.code)) {\n return this._createAjaxResultWithErrorFromResponse<T>(lastError, requestId, method, params)\n }\n throw lastError\n }\n }\n\n throw new AjaxError({\n code: 'JSSDK_CALL_ALL_ATTEMPTS_EXHAUSTED',\n description: 'All attempts exhausted',\n status: lastError?.status || 500,\n requestInfo: { method, params, requestId },\n originalError: lastError?.originalError || null\n })\n }\n\n protected _convertToAjaxError(requestId: string, error: unknown, method: string, params: TypeCallParams): AjaxError {\n if (error instanceof AjaxError) {\n return error\n }\n\n if (error instanceof AxiosError) {\n return this._convertAxiosErrorToAjaxError(requestId, error, method, params)\n }\n\n return this._convertUnknownErrorToAjaxError(requestId, error, method, params)\n }\n\n protected _convertAxiosErrorToAjaxError(requestId: string, axiosError: AxiosError, method: string, params: TypeCallParams): AjaxError {\n let errorCode = `${axiosError.code || 'JSSDK_AXIOS_ERROR'}`\n let errorDescription = axiosError.message\n const status = axiosError.response?.status || 0\n\n // Handling network errors\n if (errorCode === 'ERR_NETWORK') {\n return new AjaxError({\n code: 'NETWORK_ERROR',\n description: 'Network connection failed',\n status: 0,\n requestInfo: { method, params, requestId },\n originalError: axiosError\n })\n }\n\n // Handling timeout\n if (errorCode === 'ECONNABORTED' || axiosError.message.includes('timeout')) {\n return new AjaxError({\n code: 'REQUEST_TIMEOUT',\n description: 'Request timeout exceeded',\n status: 408,\n requestInfo: { method, params, requestId },\n originalError: axiosError\n })\n }\n\n /**\n * @todo make single function\n * @see AjaxResult.#processErrors()\n */\n if (axiosError.response?.data && typeof axiosError.response.data === 'object') {\n const responseData = axiosError.response.data as TypeDescriptionError | TypeDescriptionErrorV3\n if (\n responseData.error\n && typeof responseData.error === 'object'\n && 'code' in responseData.error\n ) {\n errorCode = responseData.error.code\n errorDescription = responseData.error.message.trimEnd()\n if (responseData.error.validation) {\n if (errorDescription.length > 0) {\n if (!errorDescription.endsWith('.')) {\n errorDescription += `.`\n }\n errorDescription += ` `\n }\n responseData.error.validation.forEach((row) => {\n errorDescription += `${row?.message || JSON.stringify(row)}`\n })\n }\n } else if (responseData.error && typeof responseData.error === 'string') {\n errorCode = responseData.error !== '0' ? responseData.error : errorCode\n errorDescription = (responseData as TypeDescriptionError)?.error_description ?? errorDescription\n }\n }\n\n return new AjaxError({\n code: errorCode,\n description: errorDescription,\n status,\n requestInfo: { method, params, requestId },\n originalError: axiosError\n })\n }\n\n protected _convertUnknownErrorToAjaxError(requestId: string, error: unknown, method: string, params: TypeCallParams): AjaxError {\n return new AjaxError({\n code: 'JSSDK_UNKNOWN_ERROR',\n description: error instanceof Error ? error.message : String(error),\n status: 0,\n requestInfo: { method, params, requestId },\n originalError: error\n })\n }\n\n // region Execute Single Call ////\n /**\n * Performs a single call with\n * - 401 error handling\n * - rate limit check\n * - updating operating statistics\n */\n protected async _executeSingleCall<T = unknown>(requestId: string, method: string, params: TypeCallParams): Promise<AjaxResult<T>> {\n this._checkClientSideWarning(requestId)\n const authData = await this._ensureAuth(requestId)\n const response = await this._makeRequestWithAuthRetry<T>(requestId, method, params, authData)\n\n return this._createAjaxResultFromResponse<T>(response, requestId, method, params)\n }\n\n // Get/update authorization\n protected async _ensureAuth(requestId: string): Promise<AuthData> {\n let authData = this._authActions.getAuthData()\n if (authData === false) {\n this._logRefreshingAuthToken(requestId)\n authData = await this._authActions.refreshAuth()\n }\n return authData\n }\n\n // Execute the request with 401 error handling\n protected async _makeRequestWithAuthRetry<T>(requestId: string, method: string, params: TypeCallParams, authData: AuthData): Promise<AjaxResponse<T>> {\n try {\n // 4. Apply the rate limit through the manager\n await this._restrictionManager.checkRateLimit(requestId, method)\n\n return await this._makeAxiosRequest<T>(requestId, method, params, authData)\n } catch (error) {\n if (error instanceof AxiosError) {\n this.getLogger().info(\n `post/catchError`, {\n requestId,\n status: error.status,\n // Redact in case a future portal response embeds credentials in\n // the error body (today it doesn't, but the channel is open). (#39)\n responseData: JSON.stringify(redactSensitiveParams(error?.response?.data), null, 0)\n }\n )\n }\n\n // If this is an authorization error (401), then we try to update the token and repeat\n if (this._isAuthError(error)) {\n this._logAuthErrorDetected(requestId)\n this._logRefreshingAuthToken(requestId)\n\n const refreshedAuthData = await this._authActions.refreshAuth()\n\n // 4. Apply the rate limit through the manager\n await this._restrictionManager.checkRateLimit(requestId, method)\n\n return await this._makeAxiosRequest<T>(requestId, method, params, refreshedAuthData)\n }\n\n throw error\n }\n }\n\n protected async _makeAxiosRequest<T>(requestId: string, method: string, params: TypeCallParams, authData: AuthData): Promise<AjaxResponse<T>> {\n const methodFormatted = this._prepareMethod(requestId, method, this.getBaseUrl())\n\n const paramsFormatted = this._prepareParams(authData, params)\n // `paramsFormatted` carries the OAuth `auth` (access_token) for non-hook flows;\n // log a redacted copy so the secret never enters logger context, while axios\n // still receives the original below. (#39)\n const paramsFormattedForLog = JSON.stringify(redactSensitiveParams(paramsFormatted), null, 0)\n\n const maxLogLength = 300\n const sliceLogLength = 100\n this.getLogger().info(\n `post/send`, {\n requestId,\n method,\n params: paramsFormattedForLog.length > maxLogLength ? paramsFormattedForLog.slice(0, sliceLogLength) + '...' : paramsFormattedForLog\n }\n )\n\n const response = await this._clientAxios.post<SuccessPayload<T>>(methodFormatted, paramsFormatted)\n\n const resultFormattedForLog = JSON.stringify(response.data.result, null, 0)\n this.getLogger().info(\n `post/response`, {\n requestId,\n // responseFull: JSON.stringify(response.data, null, 2),\n result: resultFormattedForLog.length > maxLogLength ? resultFormattedForLog.slice(0, sliceLogLength) + '...' : resultFormattedForLog,\n time: JSON.stringify(response.data.time, null, 0)\n }\n )\n\n return {\n status: response.status,\n payload: response.data\n }\n }\n\n protected _isAuthError(error: unknown): boolean {\n if (!(error instanceof AjaxError)) {\n return false\n }\n\n // @todo ! test this\n return (\n error.status === 401\n && ['expired_token', 'invalid_token'].includes(error.code)\n )\n }\n\n protected async _createAjaxResultFromResponse<T>(response: AjaxResponse<T>, requestId: string, method: string, params: TypeCallParams): Promise<AjaxResult<T>> {\n const result = new AjaxResult<T>({\n answer: response.payload,\n query: { method, params, requestId },\n status: response.status\n })\n\n // 5. Update operating statistics\n if (result.isSuccess) {\n const time = result.getData()?.time\n await this._restrictionManager.updateStats(requestId, method, time!)\n }\n\n return result\n }\n\n /**\n * This works in conjunction with the AbstractHttp._convertAxiosErrorToAjaxError function\n */\n protected _createAjaxResultWithErrorFromResponse<T>(ajaxError: AjaxError, requestId: string, method: string, params: TypeCallParams): AjaxResult<T> {\n return new AjaxResult<T>({\n answer: {\n error: {\n code: ajaxError.code,\n message: ajaxError.message\n }\n },\n query: { method, params, requestId },\n status: ajaxError.status\n })\n //\n // result.addError(ajaxError)\n //\n // return result\n }\n // endregion ////\n // endregion ////\n\n // region Prepare ////\n /**\n * Makes the function name safe and adds JSON format\n */\n protected abstract _prepareMethod(requestId: string, method: string, baseUrl: string): string\n\n /**\n * Processes function parameters and adds authorization\n */\n protected _prepareParams(authData: AuthData, params: TypeCallParams): TypePrepareParams {\n const result: TypePrepareParams = { ...params }\n\n /** @memo we skip auth for hook */\n if (authData.refresh_token !== 'hook') {\n result.auth = authData.access_token\n }\n\n if (result?.data && 'start' in result.data) {\n const { start, ...dataWithoutStart } = result.data\n result.data = dataWithoutStart\n }\n\n return result\n }\n\n /**\n * @inheritDoc\n */\n public setClientSideWarning(\n value: boolean,\n message: string\n ): void {\n this._isClientSideWarning = value\n this._clientSideWarningMessage = message\n }\n // endregion ////\n\n // region Tools ////\n /**\n * Tests whether the code is executed on the client side\n * @return {boolean}\n * @protected\n */\n protected isServerSide(): boolean {\n return (getEnvironment() !== Environment.BROWSE)\n }\n\n /**\n * Get the BX24 account address with the path based on the API version\n */\n public getBaseUrl(): string {\n return this._authActions.getTargetOriginWithPath().get(this._version)!\n }\n // endregion ////\n\n // region Log ////\n protected _sanitizeParams(params: TypeCallParams): Record<string, unknown> {\n return redactSensitiveParams(params)\n }\n\n protected _logRequest(requestId: string, method: string, params: TypeCallParams): void {\n this.getLogger().debug(`http request starting`, {\n requestId,\n method,\n params: this._sanitizeParams(params),\n api: this.apiVersion,\n timestamp: Date.now()\n })\n }\n\n protected _logAttempt(requestId: string, method: string, attempt: number, maxRetries: number): void {\n this.getLogger().info(`http request attempt`, {\n requestId,\n method,\n api: this.apiVersion,\n attempt: {\n current: attempt,\n max: maxRetries\n }\n })\n }\n\n protected _logRefreshingAuthToken(requestId: string): void {\n this.getLogger().info(`http refreshing auth token`, {\n requestId,\n api: this.apiVersion\n })\n }\n\n protected _logAuthErrorDetected(requestId: string): void {\n this.getLogger().info(`http auth error detected`, {\n requestId,\n api: this.apiVersion\n })\n }\n\n protected _logSuccessfulRequest(requestId: string, method: string, duration: number): void {\n this.getLogger().debug(`http request successful`, {\n requestId,\n method,\n api: this.apiVersion,\n duration: {\n ms: duration,\n sec: Number.parseFloat((duration / 1000).toFixed(2))\n }\n })\n }\n\n protected _logFailedRequest(\n requestId: string,\n method: string,\n attempt: number,\n maxRetries: number,\n error: AjaxError\n ): void {\n this.getLogger().debug(`http request failed`, {\n requestId,\n method,\n api: this.apiVersion,\n attempt: {\n current: attempt,\n max: maxRetries\n },\n error: {\n code: error.code,\n message: error.message,\n status: error.status\n }\n })\n }\n\n protected _logAttemptRetryWaiteDelay(\n requestId: string,\n method: string,\n wait: number,\n attempt: number,\n maxRetries: number\n ): void {\n this.getLogger().debug(\n `http wait ${(wait / 1000).toFixed(2)} sec.`,\n {\n requestId,\n method,\n api: this.apiVersion,\n wait: wait,\n attempt: {\n current: attempt,\n max: maxRetries\n }\n }\n )\n }\n\n protected _logAllAttemptsExhausted(requestId: string, method: string, attempt: number, maxRetries: number): void {\n this.getLogger().warning(`http all retry attempts exhausted`, {\n requestId,\n method,\n api: this.apiVersion,\n attempt: {\n current: attempt,\n max: maxRetries\n }\n })\n }\n\n protected _logBatchStart(\n requestId: string,\n calls: BatchCommandsArrayUniversal | BatchCommandsObjectUniversal | BatchNamedCommandsUniversal,\n options: ICallBatchOptions\n ): void {\n const callCount = Array.isArray(calls)\n ? calls.length\n : Object.keys(calls).length\n\n this.getLogger().debug(`http batch request starting `, {\n requestId,\n callCount,\n api: this.apiVersion,\n isHaltOnError: options.isHaltOnError,\n timestamp: Date.now()\n })\n }\n\n protected _logBatchCompletion(requestId: string, total: number, errors: number): void {\n this.getLogger().debug(`http batch request completed`, {\n requestId,\n api: this.apiVersion,\n totalCalls: total,\n successful: total - errors,\n failed: errors,\n successRate: total > 0 ? ((total - errors) / (total) * 100).toFixed(1) + '%' : '??'\n })\n }\n\n // Check client-side warnings\n protected _checkClientSideWarning(requestId: string): void {\n if (\n this._isClientSideWarning\n && !this.isServerSide()\n && Type.isStringFilled(this._clientSideWarningMessage)\n ) {\n LoggerFactory.forcedLog(\n this.getLogger(),\n 'warning',\n this._clientSideWarningMessage,\n {\n requestId,\n code: 'JSSDK_CLIENT_SIDE_WARNING'\n }\n )\n }\n }\n // endregion ////\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4CO,MAAe,YAAA,CAAiC;AAAA,EA5CvD;AA4CuD,IAAA,MAAA,CAAA,IAAA,EAAA,cAAA,CAAA;AAAA;AAAA,EAC3C,YAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA;AAAA,EACA,mBAAA;AAAA,EAEA,OAAA;AAAA,EAEA,oBAAA,GAAgC,KAAA;AAAA,EAChC,yBAAA,GAAoC,EAAA;AAAA,EAEpC,QAAA;AAAA,EAEA,QAAA,GAAW;AAAA,IACnB,aAAA,EAAe,CAAA;AAAA,IACf,kBAAA,EAAoB,CAAA;AAAA,IACpB,cAAA,EAAgB,CAAA;AAAA,IAChB,aAAA,EAAe,CAAA;A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