@bitrix24/b24jssdk 1.1.2 → 1.3.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.
Files changed (150) hide show
  1. package/README-AI.md +15 -3
  2. package/dist/esm/_virtual/_commonjsHelpers.mjs +1 -1
  3. package/dist/esm/_virtual/protobuf.mjs +1 -1
  4. package/dist/esm/_virtual/protobuf2.mjs +1 -1
  5. package/dist/esm/core/abstract-b24.mjs +1 -1
  6. package/dist/esm/core/actions/abstract-action.mjs +1 -1
  7. package/dist/esm/core/actions/abstract-batch.mjs +1 -1
  8. package/dist/esm/core/actions/manager.mjs +1 -1
  9. package/dist/esm/core/actions/v2/batch-by-chunk.mjs +1 -1
  10. package/dist/esm/core/actions/v2/batch.mjs +4 -4
  11. package/dist/esm/core/actions/v2/batch.mjs.map +1 -1
  12. package/dist/esm/core/actions/v2/call-list.mjs +17 -10
  13. package/dist/esm/core/actions/v2/call-list.mjs.map +1 -1
  14. package/dist/esm/core/actions/v2/call.mjs +1 -1
  15. package/dist/esm/core/actions/v2/fetch-list.mjs +17 -10
  16. package/dist/esm/core/actions/v2/fetch-list.mjs.map +1 -1
  17. package/dist/esm/core/actions/v2/manager-v2.mjs +6 -6
  18. package/dist/esm/core/actions/v2/manager-v2.mjs.map +1 -1
  19. package/dist/esm/core/actions/v3/batch-by-chunk.mjs +1 -1
  20. package/dist/esm/core/actions/v3/batch.mjs +4 -4
  21. package/dist/esm/core/actions/v3/batch.mjs.map +1 -1
  22. package/dist/esm/core/actions/v3/call-list.mjs +16 -9
  23. package/dist/esm/core/actions/v3/call-list.mjs.map +1 -1
  24. package/dist/esm/core/actions/v3/call.mjs +1 -1
  25. package/dist/esm/core/actions/v3/fetch-list.mjs +16 -9
  26. package/dist/esm/core/actions/v3/fetch-list.mjs.map +1 -1
  27. package/dist/esm/core/actions/v3/manager-v3.mjs +6 -6
  28. package/dist/esm/core/actions/v3/manager-v3.mjs.map +1 -1
  29. package/dist/esm/core/http/abstract-http.mjs +30 -6
  30. package/dist/esm/core/http/abstract-http.mjs.map +1 -1
  31. package/dist/esm/core/http/ajax-error.mjs +1 -1
  32. package/dist/esm/core/http/ajax-result.mjs +1 -1
  33. package/dist/esm/core/http/limiters/adaptive-delayer.mjs +1 -1
  34. package/dist/esm/core/http/limiters/manager.mjs +31 -1
  35. package/dist/esm/core/http/limiters/manager.mjs.map +1 -1
  36. package/dist/esm/core/http/limiters/operating-limiter.mjs +1 -1
  37. package/dist/esm/core/http/limiters/params-factory.mjs +1 -1
  38. package/dist/esm/core/http/limiters/rate-limiter.mjs +1 -1
  39. package/dist/esm/core/http/redact.mjs +1 -1
  40. package/dist/esm/core/http/v2.mjs +2 -2
  41. package/dist/esm/core/http/v3.mjs +2 -2
  42. package/dist/esm/core/interaction/batch/abstract-interaction-batch.mjs +1 -1
  43. package/dist/esm/core/interaction/batch/parse-row.mjs +1 -1
  44. package/dist/esm/core/interaction/batch/processing/interface-strategy.mjs +1 -1
  45. package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs +1 -1
  46. package/dist/esm/core/interaction/batch/processing/v2/as-array.mjs +1 -1
  47. package/dist/esm/core/interaction/batch/processing/v2/as-object.mjs +1 -1
  48. package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs +1 -1
  49. package/dist/esm/core/interaction/batch/processing/v3/as-array.mjs +1 -1
  50. package/dist/esm/core/interaction/batch/processing/v3/as-object.mjs +1 -1
  51. package/dist/esm/core/interaction/batch/v2.mjs +1 -1
  52. package/dist/esm/core/interaction/batch/v3.mjs +1 -1
  53. package/dist/esm/core/language/list.mjs +1 -1
  54. package/dist/esm/core/request-id-generator.mjs +1 -1
  55. package/dist/esm/core/result.mjs +28 -1
  56. package/dist/esm/core/result.mjs.map +1 -1
  57. package/dist/esm/core/sdk-error.mjs +1 -1
  58. package/dist/esm/core/tools/abstract-tool.mjs +1 -1
  59. package/dist/esm/core/tools/healthcheck.mjs +1 -1
  60. package/dist/esm/core/tools/manager.mjs +3 -3
  61. package/dist/esm/core/tools/manager.mjs.map +1 -1
  62. package/dist/esm/core/tools/ping.mjs +1 -1
  63. package/dist/esm/core/version-manager.mjs +89 -12
  64. package/dist/esm/core/version-manager.mjs.map +1 -1
  65. package/dist/esm/frame/auth.mjs +1 -1
  66. package/dist/esm/frame/b24.mjs +1 -1
  67. package/dist/esm/frame/dialog.mjs +1 -1
  68. package/dist/esm/frame/frame.mjs +1 -1
  69. package/dist/esm/frame/message/commands.mjs +1 -1
  70. package/dist/esm/frame/message/controller.mjs +1 -1
  71. package/dist/esm/frame/options.mjs +1 -1
  72. package/dist/esm/frame/parent.mjs +6 -2
  73. package/dist/esm/frame/parent.mjs.map +1 -1
  74. package/dist/esm/frame/placement.mjs +1 -1
  75. package/dist/esm/frame/slider.mjs +5 -1
  76. package/dist/esm/frame/slider.mjs.map +1 -1
  77. package/dist/esm/helper/abstract-helper.mjs +1 -1
  78. package/dist/esm/helper/app-manager.mjs +1 -1
  79. package/dist/esm/helper/currency-manager.mjs +1 -1
  80. package/dist/esm/helper/helper-manager.mjs +1 -1
  81. package/dist/esm/helper/license-manager.mjs +1 -1
  82. package/dist/esm/helper/options-manager.mjs +1 -1
  83. package/dist/esm/helper/payment-manager.mjs +1 -1
  84. package/dist/esm/helper/profile-manager.mjs +1 -1
  85. package/dist/esm/helper/use-b24-helper.mjs +1 -1
  86. package/dist/esm/hook/auth.mjs +1 -1
  87. package/dist/esm/hook/b24.mjs +1 -1
  88. package/dist/esm/index.d.mts +101 -22
  89. package/dist/esm/index.d.ts +101 -22
  90. package/dist/esm/index.mjs +1 -1
  91. package/dist/esm/loader-b24frame.mjs +1 -1
  92. package/dist/esm/logger/abstract-logger.mjs +1 -1
  93. package/dist/esm/logger/browser.mjs +1 -1
  94. package/dist/esm/logger/formatter/abstract-formatter.mjs +1 -1
  95. package/dist/esm/logger/formatter/json-formatter.mjs +1 -1
  96. package/dist/esm/logger/formatter/line-formatter.mjs +1 -1
  97. package/dist/esm/logger/formatter/telegram-formatter.mjs +1 -1
  98. package/dist/esm/logger/handler/abstract-handler.mjs +1 -1
  99. package/dist/esm/logger/handler/consola-adapter.mjs +1 -1
  100. package/dist/esm/logger/handler/console-handler.mjs +1 -1
  101. package/dist/esm/logger/handler/console-v2-handler.mjs +1 -1
  102. package/dist/esm/logger/handler/memory-handler.mjs +1 -1
  103. package/dist/esm/logger/handler/stream-handler.mjs +1 -1
  104. package/dist/esm/logger/handler/telegram-handler.mjs +1 -1
  105. package/dist/esm/logger/handler/winston-adapter.mjs +1 -1
  106. package/dist/esm/logger/logger-factory.mjs +1 -1
  107. package/dist/esm/logger/logger.mjs +1 -1
  108. package/dist/esm/logger/null-logger.mjs +1 -1
  109. package/dist/esm/logger/processor/memory-usage-processor.mjs +1 -1
  110. package/dist/esm/logger/processor/pid-processor.mjs +1 -1
  111. package/dist/esm/oauth/auth.mjs +1 -1
  112. package/dist/esm/oauth/b24.mjs +1 -1
  113. package/dist/esm/oauth/refresh-token-error.mjs +1 -1
  114. package/dist/esm/pullClient/abstract-connector.mjs +1 -1
  115. package/dist/esm/pullClient/channel-manager.mjs +1 -1
  116. package/dist/esm/pullClient/client.mjs +1 -1
  117. package/dist/esm/pullClient/errors.mjs +1 -1
  118. package/dist/esm/pullClient/json-rpc.mjs +1 -1
  119. package/dist/esm/pullClient/long-polling-connector.mjs +1 -1
  120. package/dist/esm/pullClient/protobuf/index.mjs +1 -1
  121. package/dist/esm/pullClient/protobuf/model.mjs +1 -1
  122. package/dist/esm/pullClient/protobuf/protobuf.mjs +53 -53
  123. package/dist/esm/pullClient/protobuf/protobuf.mjs.map +1 -1
  124. package/dist/esm/pullClient/shared-config.mjs +1 -1
  125. package/dist/esm/pullClient/storage-manager.mjs +1 -1
  126. package/dist/esm/pullClient/web-socket-connector.mjs +1 -1
  127. package/dist/esm/tools/browser.mjs +1 -1
  128. package/dist/esm/tools/environment.mjs +1 -1
  129. package/dist/esm/tools/formatters/iban.mjs +1 -1
  130. package/dist/esm/tools/formatters/numbers.mjs +1 -1
  131. package/dist/esm/tools/index.mjs +1 -1
  132. package/dist/esm/tools/scroll-size.mjs +1 -1
  133. package/dist/esm/tools/text.mjs +1 -1
  134. package/dist/esm/tools/type.mjs +1 -1
  135. package/dist/esm/tools/use-formatters.mjs +1 -1
  136. package/dist/esm/tools/uuidv7.mjs +1 -1
  137. package/dist/esm/types/b24-helper.mjs +1 -1
  138. package/dist/esm/types/b24.mjs +1 -1
  139. package/dist/esm/types/bizproc/index.mjs +1 -1
  140. package/dist/esm/types/catalog/index.mjs +1 -1
  141. package/dist/esm/types/common.mjs +1 -1
  142. package/dist/esm/types/crm/entity-type.mjs +1 -1
  143. package/dist/esm/types/crm/productrow.mjs +1 -1
  144. package/dist/esm/types/logger.mjs +1 -1
  145. package/dist/esm/types/pull.mjs +1 -1
  146. package/dist/umd/index.js +1899 -1309
  147. package/dist/umd/index.js.map +1 -1
  148. package/dist/umd/index.min.js +28 -28
  149. package/dist/umd/index.min.js.map +1 -1
  150. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.1.2
3
+ * @version 1.3.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -22,11 +22,15 @@ class CallListV3 extends AbstractAction {
22
22
  *
23
23
  * @param {ActionCallListV3} options - parameters for executing the request.
24
24
  * - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
25
- * - `params?: Omit<TypeCallParams, 'pagination'>` - Request parameters, excluding the `pagination` parameter,
25
+ * - `params?: Omit<TypeCallParams, 'pagination' | 'order'>` - Request parameters, excluding the `pagination` and `order` parameters,
26
26
  * since the method is designed to obtain all data in one call.
27
27
  * Note: Use `filter`, `order`, and `select` to control the selection.
28
- * - `idKey?: string` - The name of the field containing the unique identifier of the element.
29
- * Default is 'id'. Alternatively, it can be another field, depending on the REST API data structure.
28
+ * - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
29
+ * drives the cursor. Default is 'id'. Set it to match the id field the method returns.
30
+ * - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the
31
+ * `[field, '>', n]` page filter. Defaults to `idKey`. Set it only when the sortable /
32
+ * filterable field name differs from the response field name (e.g. an uppercase request
33
+ * field but a lowercase response id): pass `idKey: 'id', cursorIdKey: 'ID'`.
30
34
  * - `customKeyForResult: string` - A custom key indicating that the response REST API will be
31
35
  * grouped by this field.
32
36
  * Example: `items` to group a list of CRM items.
@@ -65,15 +69,16 @@ class CallListV3 extends AbstractAction {
65
69
  const batchSize = options?.limit ?? 50;
66
70
  const result = new Result();
67
71
  const idKey = options?.idKey ?? "id";
72
+ const cursorIdKey = options?.cursorIdKey ?? idKey;
68
73
  const customKeyForResult = options?.customKeyForResult ?? null;
69
74
  const params = options?.params ?? {};
70
75
  if ("order" in params && params["order"]) {
71
- this._logger.warning("callList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by idKey. Use `filter` to narrow results instead.");
76
+ this._logger.warning("callList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by cursorIdKey. Use `filter` to narrow results instead.");
72
77
  }
73
78
  const { order: _ignoredOrder, ...restParams } = params;
74
79
  const requestParams = {
75
80
  ...restParams,
76
- order: { [idKey]: "ASC" },
81
+ order: { [cursorIdKey]: "ASC" },
77
82
  filter: [...params["filter"] || []],
78
83
  pagination: { page: 0, limit: batchSize }
79
84
  };
@@ -82,7 +87,7 @@ class CallListV3 extends AbstractAction {
82
87
  let nextId = 0;
83
88
  do {
84
89
  const sendParams = { ...requestParams, filter: [...requestParams.filter] };
85
- sendParams.filter.push([idKey, ">", nextId]);
90
+ sendParams.filter.push([cursorIdKey, ">", nextId]);
86
91
  const response = await this._b24.actions.v3.call.make({
87
92
  method: options.method,
88
93
  params: sendParams,
@@ -116,9 +121,11 @@ class CallListV3 extends AbstractAction {
116
121
  break;
117
122
  }
118
123
  const lastItem = resultData[resultData.length - 1];
119
- if (lastItem && typeof lastItem[idKey] !== "undefined") {
120
- nextId = Number.parseInt(lastItem[idKey]);
124
+ const cursorValue = lastItem ? Number.parseInt(lastItem[idKey], 10) : Number.NaN;
125
+ if (Number.isFinite(cursorValue)) {
126
+ nextId = cursorValue;
121
127
  } else {
128
+ this._logger.warning(`callList.make: pagination stops here \u2014 no numeric id could be read from the returned items via idKey "${idKey}". Make sure idKey matches the id field in the response; if the sortable field name differs from it, also set cursorIdKey (e.g. idKey: 'id', cursorIdKey: 'ID').`);
122
129
  isContinue = false;
123
130
  break;
124
131
  }
@@ -1 +1 @@
1
- {"version":3,"file":"call-list.mjs","sources":["../../../../../src/core/actions/v3/call-list.ts"],"sourcesContent":["import type { ActionOptions } from '../abstract-action'\nimport type { TypeCallParams } from '../../../types/http'\nimport type { AjaxResult } from '../../http/ajax-result'\nimport { AbstractAction } from '../abstract-action'\nimport { Result } from '../../result'\n\nexport type ActionCallListV3 = ActionOptions & {\n method: string\n params?: Omit<TypeCallParams, 'pagination' | 'order'>\n idKey?: string\n customKeyForResult: string\n requestId?: string\n limit?: number\n}\n\n/**\n * Fast data retrieval without counting the total number of records. `restApi:v3`\n *\n * @todo add docs\n */\nexport class CallListV3 extends AbstractAction {\n /**\n * Fast data retrieval without counting the total number of records.\n *\n * @template T - The type of the elements of the returned array (default is `unknown`).\n *\n * @param {ActionCallListV3} options - parameters for executing the request.\n * - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)\n * - `params?: Omit<TypeCallParams, 'pagination'>` - Request parameters, excluding the `pagination` parameter,\n * since the method is designed to obtain all data in one call.\n * Note: Use `filter`, `order`, and `select` to control the selection.\n * - `idKey?: string` - The name of the field containing the unique identifier of the element.\n * Default is 'id'. Alternatively, it can be another field, depending on the REST API data structure.\n * - `customKeyForResult: string` - A custom key indicating that the response REST API will be\n * grouped by this field.\n * Example: `items` to group a list of CRM items.\n * - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.\n * - `limit?: number` - How many records to retrieve at a time. Default is `50`. Maximum is `1000`.\n *\n * @returns {Promise<Result<T[]>>} A promise that resolves to the result of an REST API call.\n *\n * @example\n * import { Text } from '@bitrix24/b24jssdk'\n *\n * interface MainEventLogItem { id: number, userId: number }\n * const sixMonthAgo = new Date()\n * sixMonthAgo.setMonth((new Date()).getMonth() - 6)\n * sixMonthAgo.setHours(0, 0, 0)\n * const response = await b24.actions.v3.callList.make<MainEventLogItem>({\n * method: 'main.eventlog.list',\n * params: {\n * filter: [\n * ['timestampX', '>=', Text.toB24Format(sixMonthAgo)] // created at least 6 months ago\n * ],\n * select: ['id', 'userId']\n * },\n * idKey: 'id',\n * customKeyForResult: 'items',\n * requestId: 'eventlog-123',\n * limit: 60\n * })\n * if (!response.isSuccess) {\n * throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)\n * }\n * const list = response.getData()\n * console.log(`Result: ${list?.length}`) // Number of items received\n */\n public override async make<T = unknown>(options: ActionCallListV3): Promise<Result<T[]>> {\n const batchSize = options?.limit ?? 50\n const result: Result<T[]> = new Result()\n\n const idKey = options?.idKey ?? 'id'\n const customKeyForResult = options?.customKeyForResult ?? null\n const params = options?.params ?? {}\n\n // Warn and strip user-provided `order` — cursor pagination requires ordering by idKey only\n if ('order' in params && params['order']) {\n this._logger.warning('callList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by idKey. Use `filter` to narrow results instead.')\n }\n\n const { order: _ignoredOrder, ...restParams } = params as TypeCallParams\n const requestParams: TypeCallParams = {\n ...restParams,\n order: { [idKey]: 'ASC' },\n filter: [...(params['filter'] || [])],\n pagination: { page: 0, limit: batchSize }\n }\n\n let allItems: T[] = []\n let isContinue = true\n let nextId = 0\n do {\n const sendParams = { ...requestParams, filter: [...requestParams.filter] }\n sendParams.filter.push([idKey, '>', nextId])\n const response: AjaxResult<T> = await this._b24.actions.v3.call.make<T>({\n method: options.method,\n params: sendParams,\n requestId: options.requestId\n })\n\n if (!response.isSuccess) {\n this._logger.error('callFastListMethod', {\n method: options.method,\n requestId: options.requestId,\n messages: response.getErrorMessages()\n })\n for (const [index, error] of response.errors) {\n result.addError(error, index)\n }\n isContinue = false\n break\n }\n const responseData = response.getData()\n if (!responseData) {\n isContinue = false\n break\n }\n\n const resultData = (responseData.result as any)[customKeyForResult] as T[]\n if (resultData.length === 0) {\n isContinue = false\n break\n }\n\n allItems = [...allItems, ...resultData]\n\n if (resultData.length < batchSize) {\n isContinue = false\n break\n }\n\n // Update the filter for the next iteration\n const lastItem = resultData[resultData.length - 1] as Record<string, any>\n if (lastItem && typeof lastItem[idKey] !== 'undefined') {\n nextId = Number.parseInt(lastItem[idKey] as string)\n } else {\n isContinue = false\n break\n }\n } while (isContinue)\n\n return result.setData(allItems)\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAoBO,MAAM,mBAAmB,cAAA,CAAe;AAAA,EApB/C;AAoB+C,IAAA,MAAA,CAAA,IAAA,EAAA,YAAA,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,EA+C7C,MAAsB,KAAkB,OAAA,EAAiD;AACvF,IAAA,MAAM,SAAA,GAAY,SAAS,KAAA,IAAS,EAAA;AACpC,IAAA,MAAM,MAAA,GAAsB,IAAI,MAAA,EAAO;AAEvC,IAAA,MAAM,KAAA,GAAQ,SAAS,KAAA,IAAS,IAAA;AAChC,IAAA,MAAM,kBAAA,GAAqB,SAAS,kBAAA,IAAsB,IAAA;AAC1D,IAAA,MAAM,MAAA,GAAS,OAAA,EAAS,MAAA,IAAU,EAAC;AAG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AACD,QAAA,KAAA,MAAW,CAAC,KAAA,EAAO,KAAK,CAAA,IAAK,SAAS,MAAA,EAAQ;AAC5C,UAAA,MAAA,CAAO,QAAA,CAAS,OAAO,KAAK,CAAA;AAAA,QAC9B;AACA,QAAA,UAAA,GAAa,KAAA;AACb,QAAA;AAAA,MACF;AACA,MAAA,MAAM,YAAA,GAAe,SAAS,OAAA,EAAQ;AACtC,MAAA,IAAI,CAAC,YAAA,EAAc;AACjB,QAAA,UAAA,GAAa,KAAA;AACb,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,UAAA,GAAc,YAAA,CAAa,MAAA,CAAe,kBAAkB,CAAA;AAClE,MAAA,IAAI,UAAA,CAAW,WAAW,CAAA,EAAG;AAC3B,QAAA,UAAA,GAAa,KAAA;AACb,QAAA;AAAA,MACF;AAEA,MAAA,QAAA,GAAW,CAAC,GAAG,QAAA,EAAU,GAAG,UAAU,CAAA;AAEtC,MAAA,IAAI,UAAA,CAAW,SAAS,SAAA,EAAW;AACjC,QAAA,UAAA,GAAa,KAAA;AACb,QAAA;AAAA,MACF;AAGA,MAAA,MAAM,QAAA,GAAW,UAAA,CAAW,UAAA,CAAW,MAAA,GAAS,CAAC,CAAA;AACjD,MAAA,IAAI,QAAA,IAAY,OAAO,QAAA,CAAS,KAAK,MAAM,WAAA,EAAa;AACtD,QAAA,MAAA,GAAS,MAAA,CAAO,QAAA,CAAS,QAAA,CAAS,KAAK,CAAW,CAAA;AAAA,MACpD,CAAA,MAAO;AACL,QAAA,UAAA,GAAa,KAAA;AACb,QAAA;AAAA,MACF;AAAA,IACF,CAAA,QAAS,UAAA;AAET,IAAA,OAAO,MAAA,CAAO,QAAQ,QAAQ,CAAA;AAAA,EAChC;AACF;;;;"}
1
+ {"version":3,"file":"call-list.mjs","sources":["../../../../../src/core/actions/v3/call-list.ts"],"sourcesContent":["import type { ActionOptions } from '../abstract-action'\nimport type { TypeCallParams } from '../../../types/http'\nimport type { AjaxResult } from '../../http/ajax-result'\nimport { AbstractAction } from '../abstract-action'\nimport { Result } from '../../result'\n\nexport type ActionCallListV3 = ActionOptions & {\n method: string\n params?: Omit<TypeCallParams, 'pagination' | 'order'>\n idKey?: string\n cursorIdKey?: string\n customKeyForResult: string\n requestId?: string\n limit?: number\n}\n\n/**\n * Fast data retrieval without counting the total number of records. `restApi:v3`\n *\n * @todo add docs\n */\nexport class CallListV3 extends AbstractAction {\n /**\n * Fast data retrieval without counting the total number of records.\n *\n * @template T - The type of the elements of the returned array (default is `unknown`).\n *\n * @param {ActionCallListV3} options - parameters for executing the request.\n * - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)\n * - `params?: Omit<TypeCallParams, 'pagination' | 'order'>` - Request parameters, excluding the `pagination` and `order` parameters,\n * since the method is designed to obtain all data in one call.\n * Note: Use `filter`, `order`, and `select` to control the selection.\n * - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value\n * drives the cursor. Default is 'id'. Set it to match the id field the method returns.\n * - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the\n * `[field, '>', n]` page filter. Defaults to `idKey`. Set it only when the sortable /\n * filterable field name differs from the response field name (e.g. an uppercase request\n * field but a lowercase response id): pass `idKey: 'id', cursorIdKey: 'ID'`.\n * - `customKeyForResult: string` - A custom key indicating that the response REST API will be\n * grouped by this field.\n * Example: `items` to group a list of CRM items.\n * - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.\n * - `limit?: number` - How many records to retrieve at a time. Default is `50`. Maximum is `1000`.\n *\n * @returns {Promise<Result<T[]>>} A promise that resolves to the result of an REST API call.\n *\n * @example\n * import { Text } from '@bitrix24/b24jssdk'\n *\n * interface MainEventLogItem { id: number, userId: number }\n * const sixMonthAgo = new Date()\n * sixMonthAgo.setMonth((new Date()).getMonth() - 6)\n * sixMonthAgo.setHours(0, 0, 0)\n * const response = await b24.actions.v3.callList.make<MainEventLogItem>({\n * method: 'main.eventlog.list',\n * params: {\n * filter: [\n * ['timestampX', '>=', Text.toB24Format(sixMonthAgo)] // created at least 6 months ago\n * ],\n * select: ['id', 'userId']\n * },\n * idKey: 'id',\n * customKeyForResult: 'items',\n * requestId: 'eventlog-123',\n * limit: 60\n * })\n * if (!response.isSuccess) {\n * throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)\n * }\n * const list = response.getData()\n * console.log(`Result: ${list?.length}`) // Number of items received\n */\n public override async make<T = unknown>(options: ActionCallListV3): Promise<Result<T[]>> {\n const batchSize = options?.limit ?? 50\n const result: Result<T[]> = new Result()\n\n const idKey = options?.idKey ?? 'id'\n const cursorIdKey = options?.cursorIdKey ?? idKey\n const customKeyForResult = options?.customKeyForResult ?? null\n const params = options?.params ?? {}\n\n // Warn and strip user-provided `order` — cursor pagination requires ordering by cursorIdKey only\n if ('order' in params && params['order']) {\n this._logger.warning('callList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by cursorIdKey. Use `filter` to narrow results instead.')\n }\n\n const { order: _ignoredOrder, ...restParams } = params as TypeCallParams\n const requestParams: TypeCallParams = {\n ...restParams,\n order: { [cursorIdKey]: 'ASC' },\n filter: [...(params['filter'] || [])],\n pagination: { page: 0, limit: batchSize }\n }\n\n let allItems: T[] = []\n let isContinue = true\n let nextId = 0\n do {\n const sendParams = { ...requestParams, filter: [...requestParams.filter] }\n sendParams.filter.push([cursorIdKey, '>', nextId])\n const response: AjaxResult<T> = await this._b24.actions.v3.call.make<T>({\n method: options.method,\n params: sendParams,\n requestId: options.requestId\n })\n\n if (!response.isSuccess) {\n this._logger.error('callFastListMethod', {\n method: options.method,\n requestId: options.requestId,\n messages: response.getErrorMessages()\n })\n for (const [index, error] of response.errors) {\n result.addError(error, index)\n }\n isContinue = false\n break\n }\n const responseData = response.getData()\n if (!responseData) {\n isContinue = false\n break\n }\n\n const resultData = (responseData.result as any)[customKeyForResult] as T[]\n if (resultData.length === 0) {\n isContinue = false\n break\n }\n\n allItems = [...allItems, ...resultData]\n\n if (resultData.length < batchSize) {\n isContinue = false\n break\n }\n\n // Update the filter for the next iteration\n const lastItem = resultData[resultData.length - 1] as Record<string, any>\n const cursorValue = lastItem ? Number.parseInt(lastItem[idKey], 10) : Number.NaN\n if (Number.isFinite(cursorValue)) {\n nextId = cursorValue\n } else {\n // A full page came back, yet no usable numeric cursor id could be read from\n // its items via `idKey` almost always an `idKey` that doesn't match the\n // response field (e.g. a request that sorts by `ID` while the response\n // carries a lowercase `id`). Without a cursor we can't advance, so stop and\n // tell the caller how to fix it instead of silently truncating.\n this._logger.warning(`callList.make: pagination stops here — no numeric id could be read from the returned items via idKey \"${idKey}\". Make sure idKey matches the id field in the response; if the sortable field name differs from it, also set cursorIdKey (e.g. idKey: 'id', cursorIdKey: 'ID').`)\n isContinue = false\n break\n }\n } while (isContinue)\n\n return result.setData(allItems)\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAqBO,MAAM,mBAAmB,cAAA,CAAe;AAAA,EArB/C;AAqB+C,IAAA,MAAA,CAAA,IAAA,EAAA,YAAA,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,EAmD7C,MAAsB,KAAkB,OAAA,EAAiD;AACvF,IAAA,MAAM,SAAA,GAAY,SAAS,KAAA,IAAS,EAAA;AACpC,IAAA,MAAM,MAAA,GAAsB,IAAI,MAAA,EAAO;AAEvC,IAAA,MAAM,KAAA,GAAQ,SAAS,KAAA,IAAS,IAAA;AAChC,IAAA,MAAM,WAAA,GAAc,SAAS,WAAA,IAAe,KAAA;AAC5C,IAAA,MAAM,kBAAA,GAAqB,SAAS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ACF,CAAA,QAAS,UAAA;AAET,IAAA,OAAO,MAAA,CAAO,QAAQ,QAAQ,CAAA;AAAA,EAChC;AACF;;;;"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.1.2
3
+ * @version 1.3.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.1.2
3
+ * @version 1.3.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -23,11 +23,15 @@ class FetchListV3 extends AbstractAction {
23
23
  *
24
24
  * @param {ActionFetchListV3} options - parameters for executing the request.
25
25
  * - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
26
- * - `params?: Omit<TypeCallParams, 'pagination'>` - Request parameters, excluding the `pagination` parameter,
26
+ * - `params?: Omit<TypeCallParams, 'pagination' | 'order'>` - Request parameters, excluding the `pagination` and `order` parameters,
27
27
  * since the method is designed to obtain all data in one call.
28
28
  * Note: Use `filter`, `order`, and `select` to control the selection.
29
- * - `idKey?: string` - The name of the field containing the unique identifier of the element.
30
- * Default is 'id'. Alternatively, it can be another field, depending on the REST API data structure.
29
+ * - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
30
+ * drives the cursor. Default is 'id'. Set it to match the id field the method returns.
31
+ * - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the
32
+ * `[field, '>', n]` page filter. Defaults to `idKey`. Set it only when the sortable /
33
+ * filterable field name differs from the response field name (e.g. an uppercase request
34
+ * field but a lowercase response id): pass `idKey: 'id', cursorIdKey: 'ID'`.
31
35
  * - `customKeyForResult: string` - A custom key indicating that the response REST API will be
32
36
  * grouped by this field.
33
37
  * Example: `items` to group a list of CRM items.
@@ -66,15 +70,16 @@ class FetchListV3 extends AbstractAction {
66
70
  async *make(options) {
67
71
  const batchSize = options?.limit ?? 50;
68
72
  const idKey = options?.idKey ?? "id";
73
+ const cursorIdKey = options?.cursorIdKey ?? idKey;
69
74
  const customKeyForResult = options?.customKeyForResult ?? null;
70
75
  const params = options?.params ?? {};
71
76
  if ("order" in params && params["order"]) {
72
- this._logger.warning("fetchList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by idKey. Use `filter` to narrow results instead.");
77
+ this._logger.warning("fetchList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by cursorIdKey. Use `filter` to narrow results instead.");
73
78
  }
74
79
  const { order: _ignoredOrder, ...restParams } = params;
75
80
  const requestParams = {
76
81
  ...restParams,
77
- order: { [idKey]: "ASC" },
82
+ order: { [cursorIdKey]: "ASC" },
78
83
  filter: [...params["filter"] || []],
79
84
  pagination: { page: 0, limit: batchSize }
80
85
  };
@@ -82,7 +87,7 @@ class FetchListV3 extends AbstractAction {
82
87
  let nextId = 0;
83
88
  do {
84
89
  const sendParams = { ...requestParams, filter: [...requestParams.filter] };
85
- sendParams.filter.push([idKey, ">", nextId]);
90
+ sendParams.filter.push([cursorIdKey, ">", nextId]);
86
91
  const response = await this._b24.actions.v3.call.make({
87
92
  method: options.method,
88
93
  params: sendParams,
@@ -116,9 +121,11 @@ class FetchListV3 extends AbstractAction {
116
121
  break;
117
122
  }
118
123
  const lastItem = resultData[resultData.length - 1];
119
- if (lastItem && typeof lastItem[idKey] !== "undefined") {
120
- nextId = Number.parseInt(lastItem[idKey]);
124
+ const cursorValue = lastItem ? Number.parseInt(lastItem[idKey], 10) : Number.NaN;
125
+ if (Number.isFinite(cursorValue)) {
126
+ nextId = cursorValue;
121
127
  } else {
128
+ this._logger.warning(`fetchList.make: pagination stops here \u2014 no numeric id could be read from the returned items via idKey "${idKey}". Make sure idKey matches the id field in the response; if the sortable field name differs from it, also set cursorIdKey (e.g. idKey: 'id', cursorIdKey: 'ID').`);
122
129
  isContinue = false;
123
130
  break;
124
131
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-list.mjs","sources":["../../../../../src/core/actions/v3/fetch-list.ts"],"sourcesContent":["import type { ActionOptions } from '../abstract-action'\nimport type { TypeCallParams } from '../../../types/http'\nimport type { AjaxResult } from '../../http/ajax-result'\nimport { AbstractAction } from '../abstract-action'\nimport { SdkError } from '../../sdk-error'\n\nexport type ActionFetchListV3 = ActionOptions & {\n method: string\n params?: Omit<TypeCallParams, 'pagination' | 'order'>\n idKey?: string\n customKeyForResult: string\n requestId?: string\n limit?: number\n}\n\n/**\n * Calls a REST API list method and returns an async generator for efficient large data retrieval. `restApi:v3`\n *\n * @todo add docs\n */\nexport class FetchListV3 extends AbstractAction {\n /**\n * Calls a REST API list method and returns an async generator for efficient large data retrieval.\n * Implements the fast algorithm for iterating over large datasets without loading all data into memory at once.\n *\n * @template T - The type of items in the returned arrays (default is `unknown`).\n *\n * @param {ActionFetchListV3} options - parameters for executing the request.\n * - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)\n * - `params?: Omit<TypeCallParams, 'pagination'>` - Request parameters, excluding the `pagination` parameter,\n * since the method is designed to obtain all data in one call.\n * Note: Use `filter`, `order`, and `select` to control the selection.\n * - `idKey?: string` - The name of the field containing the unique identifier of the element.\n * Default is 'id'. Alternatively, it can be another field, depending on the REST API data structure.\n * - `customKeyForResult: string` - A custom key indicating that the response REST API will be\n * grouped by this field.\n * Example: `items` to group a list of CRM items.\n * - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.\n * - `limit?: number` - How many records to retrieve at a time. Default is `50`. Maximum is `1000`.\n *\n * @returns {AsyncGenerator<T[]>} An async generator that yields chunks of data as arrays of type `T`.\n * Each iteration returns the next page/batch of results until all data is fetched.\n *\n * @example\n * import { Text } from '@bitrix24/b24jssdk'\n *\n * interface MainEventLogItem { id: number, userId: number }\n * const sixMonthAgo = new Date()\n * sixMonthAgo.setMonth((new Date()).getMonth() - 6)\n * sixMonthAgo.setHours(0, 0, 0)\n * const generator = b24.actions.v3.fetchList.make<MainEventLogItem>({\n * method: 'main.eventlog.list',\n * params: {\n * filter: [\n * ['timestampX', '>=', Text.toB24Format(sixMonthAgo)] // created at least 6 months ago\n * ],\n * select: ['id', 'userId']\n * },\n * idKey: 'id',\n * customKeyForResult: 'items',\n * requestId: 'eventlog-123',\n * limit: 60\n * })\n *\n * for await (const chunk of generator) {\n * // Process chunk (e.g., save to database, analyze, etc.)\n * console.log(`Processing ${chunk.length} items`)\n * }\n */\n public override async* make<T = unknown>(options: ActionFetchListV3): AsyncGenerator<T[]> {\n const batchSize = options?.limit ?? 50\n\n const idKey = options?.idKey ?? 'id'\n const customKeyForResult = options?.customKeyForResult ?? null\n const params = options?.params ?? {}\n\n // Warn and strip user-provided `order` — cursor pagination requires ordering by idKey only\n if ('order' in params && params['order']) {\n this._logger.warning('fetchList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by idKey. Use `filter` to narrow results instead.')\n }\n\n const { order: _ignoredOrder, ...restParams } = params as TypeCallParams\n const requestParams: TypeCallParams = {\n ...restParams,\n order: { [idKey]: 'ASC' },\n filter: [...(params['filter'] || [])],\n pagination: { page: 0, limit: batchSize }\n }\n\n let isContinue = true\n let nextId = 0\n do {\n const sendParams = { ...requestParams, filter: [...requestParams.filter] }\n sendParams.filter.push([idKey, '>', nextId])\n\n const response: AjaxResult<T> = await this._b24.actions.v3.call.make<T>({\n method: options.method,\n params: sendParams,\n requestId: options.requestId\n })\n\n if (!response.isSuccess) {\n this._logger.error('fetchListMethod', {\n method: options.method,\n requestId: options.requestId,\n messages: response.getErrorMessages()\n })\n throw new SdkError({\n code: 'JSSDK_CORE_B24_FETCH_LIST_METHOD_API_V3',\n description: `API Error: ${response.getErrorMessages().join('; ')}`,\n status: 500\n })\n }\n const responseData = response.getData()\n if (!responseData) {\n isContinue = false\n break\n }\n\n const resultData: T[] = (responseData.result as any)[customKeyForResult] as T[]\n if (resultData.length === 0) {\n isContinue = false\n break\n }\n\n yield resultData\n\n if (resultData.length < batchSize) {\n isContinue = false\n break\n }\n\n // Update the filter for the next iteration\n const lastItem = resultData[resultData.length - 1] as Record<string, any>\n if (\n lastItem\n && typeof lastItem[idKey] !== 'undefined'\n ) {\n nextId = Number.parseInt(lastItem[idKey] as string)\n } else {\n isContinue = false\n break\n }\n } while (isContinue)\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAoBO,MAAM,oBAAoB,cAAA,CAAe;AAAA,EApBhD;AAoBgD,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;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,EAiD9C,OAAuB,KAAkB,OAAA,EAAiD;AACxF,IAAA,MAAM,SAAA,GAAY,SAAS,KAAA,IAAS,EAAA;AAEpC,IAAA,MAAM,KAAA,GAAQ,SAAS,KAAA,IAAS,IAAA;AAChC,IAAA,MAAM,kBAAA,GAAqB,SAAS,kBAAA,IAAsB,IAAA;AAC1D,IAAA,MAAM,MAAA,GAAS,OAAA,EAAS,MAAA,IAAU,EAAC;AAGnC,IAAA,IAAI,OAAA,IAAW,MAAA,IAAU,MAAA,CAAO,OAAO,CAAA,EAAG;AACxC,MAAA,IAAA,CAAK,OAAA,CAAQ,QAAQ,gKAAgK,CAAA;AAAA,IACvL;AAEA,IAAA,MAAM,EAAE,KAAA,EAAO,aAAA,EAAe,GAAG,YAAW,GAAI,MAAA;AAChD,IAAA,MAAM,aAAA,GAAgC;AAAA,MACpC,GAAG,UAAA;AAAA,MACH,KAAA,EAAO,EAAE,CA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AACb,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,UAAA,GAAmB,YAAA,CAAa,MAAA,CAAe,kBAAkB,CAAA;AACvE,MAAA,IAAI,UAAA,CAAW,WAAW,CAAA,EAAG;AAC3B,QAAA,UAAA,GAAa,KAAA;AACb,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,UAAA;AAEN,MAAA,IAAI,UAAA,CAAW,SAAS,SAAA,EAAW;AACjC,QAAA,UAAA,GAAa,KAAA;AACb,QAAA;AAAA,MACF;AAGA,MAAA,MAAM,QAAA,GAAW,UAAA,CAAW,UAAA,CAAW,MAAA,GAAS,CAAC,CAAA;AACjD,MAAA,IACE,QAAA,IACG,OAAO,QAAA,CAAS,KAAK,MAAM,WAAA,EAC9B;AACA,QAAA,MAAA,GAAS,MAAA,CAAO,QAAA,CAAS,QAAA,CAAS,KAAK,CAAW,CAAA;AAAA,MACpD,CAAA,MAAO;AACL,QAAA,UAAA,GAAa,KAAA;AACb,QAAA;AAAA,MACF;AAAA,IACF,CAAA,QAAS,UAAA;AAAA,EACX;AACF;;;;"}
1
+ {"version":3,"file":"fetch-list.mjs","sources":["../../../../../src/core/actions/v3/fetch-list.ts"],"sourcesContent":["import type { ActionOptions } from '../abstract-action'\nimport type { TypeCallParams } from '../../../types/http'\nimport type { AjaxResult } from '../../http/ajax-result'\nimport { AbstractAction } from '../abstract-action'\nimport { SdkError } from '../../sdk-error'\n\nexport type ActionFetchListV3 = ActionOptions & {\n method: string\n params?: Omit<TypeCallParams, 'pagination' | 'order'>\n idKey?: string\n cursorIdKey?: string\n customKeyForResult: string\n requestId?: string\n limit?: number\n}\n\n/**\n * Calls a REST API list method and returns an async generator for efficient large data retrieval. `restApi:v3`\n *\n * @todo add docs\n */\nexport class FetchListV3 extends AbstractAction {\n /**\n * Calls a REST API list method and returns an async generator for efficient large data retrieval.\n * Implements the fast algorithm for iterating over large datasets without loading all data into memory at once.\n *\n * @template T - The type of items in the returned arrays (default is `unknown`).\n *\n * @param {ActionFetchListV3} options - parameters for executing the request.\n * - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)\n * - `params?: Omit<TypeCallParams, 'pagination' | 'order'>` - Request parameters, excluding the `pagination` and `order` parameters,\n * since the method is designed to obtain all data in one call.\n * Note: Use `filter`, `order`, and `select` to control the selection.\n * - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value\n * drives the cursor. Default is 'id'. Set it to match the id field the method returns.\n * - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the\n * `[field, '>', n]` page filter. Defaults to `idKey`. Set it only when the sortable /\n * filterable field name differs from the response field name (e.g. an uppercase request\n * field but a lowercase response id): pass `idKey: 'id', cursorIdKey: 'ID'`.\n * - `customKeyForResult: string` - A custom key indicating that the response REST API will be\n * grouped by this field.\n * Example: `items` to group a list of CRM items.\n * - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.\n * - `limit?: number` - How many records to retrieve at a time. Default is `50`. Maximum is `1000`.\n *\n * @returns {AsyncGenerator<T[]>} An async generator that yields chunks of data as arrays of type `T`.\n * Each iteration returns the next page/batch of results until all data is fetched.\n *\n * @example\n * import { Text } from '@bitrix24/b24jssdk'\n *\n * interface MainEventLogItem { id: number, userId: number }\n * const sixMonthAgo = new Date()\n * sixMonthAgo.setMonth((new Date()).getMonth() - 6)\n * sixMonthAgo.setHours(0, 0, 0)\n * const generator = b24.actions.v3.fetchList.make<MainEventLogItem>({\n * method: 'main.eventlog.list',\n * params: {\n * filter: [\n * ['timestampX', '>=', Text.toB24Format(sixMonthAgo)] // created at least 6 months ago\n * ],\n * select: ['id', 'userId']\n * },\n * idKey: 'id',\n * customKeyForResult: 'items',\n * requestId: 'eventlog-123',\n * limit: 60\n * })\n *\n * for await (const chunk of generator) {\n * // Process chunk (e.g., save to database, analyze, etc.)\n * console.log(`Processing ${chunk.length} items`)\n * }\n */\n public override async* make<T = unknown>(options: ActionFetchListV3): AsyncGenerator<T[]> {\n const batchSize = options?.limit ?? 50\n\n const idKey = options?.idKey ?? 'id'\n const cursorIdKey = options?.cursorIdKey ?? idKey\n const customKeyForResult = options?.customKeyForResult ?? null\n const params = options?.params ?? {}\n\n // Warn and strip user-provided `order` — cursor pagination requires ordering by cursorIdKey only\n if ('order' in params && params['order']) {\n this._logger.warning('fetchList.make: user-provided `order` parameter is ignored because cursor-based pagination requires ordering by cursorIdKey. Use `filter` to narrow results instead.')\n }\n\n const { order: _ignoredOrder, ...restParams } = params as TypeCallParams\n const requestParams: TypeCallParams = {\n ...restParams,\n order: { [cursorIdKey]: 'ASC' },\n filter: [...(params['filter'] || [])],\n pagination: { page: 0, limit: batchSize }\n }\n\n let isContinue = true\n let nextId = 0\n do {\n const sendParams = { ...requestParams, filter: [...requestParams.filter] }\n sendParams.filter.push([cursorIdKey, '>', nextId])\n\n const response: AjaxResult<T> = await this._b24.actions.v3.call.make<T>({\n method: options.method,\n params: sendParams,\n requestId: options.requestId\n })\n\n if (!response.isSuccess) {\n this._logger.error('fetchListMethod', {\n method: options.method,\n requestId: options.requestId,\n messages: response.getErrorMessages()\n })\n throw new SdkError({\n code: 'JSSDK_CORE_B24_FETCH_LIST_METHOD_API_V3',\n description: `API Error: ${response.getErrorMessages().join('; ')}`,\n status: 500\n })\n }\n const responseData = response.getData()\n if (!responseData) {\n isContinue = false\n break\n }\n\n const resultData: T[] = (responseData.result as any)[customKeyForResult] as T[]\n if (resultData.length === 0) {\n isContinue = false\n break\n }\n\n yield resultData\n\n if (resultData.length < batchSize) {\n isContinue = false\n break\n }\n\n // Update the filter for the next iteration\n const lastItem = resultData[resultData.length - 1] as Record<string, any>\n const cursorValue = lastItem ? Number.parseInt(lastItem[idKey], 10) : Number.NaN\n if (Number.isFinite(cursorValue)) {\n nextId = cursorValue\n } else {\n // A full page came back, yet no usable numeric cursor id could be read from\n // its items via `idKey` almost always an `idKey` that doesn't match the\n // response field (e.g. a request that sorts by `ID` while the response\n // carries a lowercase `id`). Without a cursor we can't advance, so stop and\n // tell the caller how to fix it instead of silently truncating.\n this._logger.warning(`fetchList.make: pagination stops here — no numeric id could be read from the returned items via idKey \"${idKey}\". Make sure idKey matches the id field in the response; if the sortable field name differs from it, also set cursorIdKey (e.g. idKey: 'id', cursorIdKey: 'ID').`)\n isContinue = false\n break\n }\n } while (isContinue)\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAqBO,MAAM,oBAAoB,cAAA,CAAe;AAAA,EArBhD;AAqBgD,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;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,EAqD9C,OAAuB,KAAkB,OAAA,EAAiD;AACxF,IAAA,MAAM,SAAA,GAAY,SAAS,KAAA,IAAS,EAAA;AAEpC,IAAA,MAAM,KAAA,GAAQ,SAAS,KAAA,IAAS,IAAA;AAChC,IAAA,MAAM,WAAA,GAAc,SAAS,WAAA,IAAe,KAAA;AAC5C,IAAA,MAAM,kBAAA,GAAqB,SAAS,kBAAA,IAAsB,IAAA;AAC1D,IAAA,MAAM,MAAA,GAAS,OAAA,EAAS,MAAA,IAAU,EAAC;AAGnC,IAAA,IAAI,OAAA,IAAW,MAAA,IAAU,MAAA,CAAO,OAAO,CAAA,EAAG;AACxC,MAAA,IAAA,CAAK,OAAA,CAAQ,QAAQ,sKAAsK,CAAA;AAAA,IAC7L;AAEA,IAAA,MAAM,EAAE,KAAA,EAAO,aAAA,EAAe,GAAG,YAAW,GAAI,MAAA;AAChD,IAAA,MAAM,aAAA,GAAgC;AAAA,MACpC,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C,YAAA,EAAc;AACjB,QAAA,UAAA,GAAa,KAAA;AACb,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,UAAA,GAAmB,YAAA,CAAa,MAAA,CAAe,kBAAkB,CAAA;AACvE,MAAA,IAAI,UAAA,CAAW,WAAW,CAAA,EAAG;AAC3B,QAAA,UAAA,GAAa,KAAA;AACb,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,UAAA;AAEN,MAAA,IAAI,UAAA,CAAW,SAAS,SAAA,EAAW;AACjC,QAAA,UAAA,GAAa,KAAA;AACb,QAAA;AAAA,MACF;AAGA,MAAA,MAAM,QAAA,GAAW,UAAA,CAAW,UAAA,CAAW,MAAA,GAAS,CAAC,CAAA;AACjD,MAAA,MAAM,WAAA,GAAc,WAAW,MAAA,CAAO,QAAA,CAAS,SAAS,KAAK,CAAA,EAAG,EAAE,CAAA,GAAI,MAAA,CAAO,GAAA;AAC7E,MAAA,IAAI,MAAA,CAAO,QAAA,CAAS,WAAW,CAAA,EAAG;AAChC,QAAA,MAAA,GAAS,WAAA;AAAA,MACX,CAAA,MAAO;AAML,QAAA,IAAA,CAAK,OAAA,CAAQ,OAAA,CAAQ,CAAA,4GAAA,EAA0G,KAAK,CAAA,gKAAA,CAAkK,CAAA;AACtS,QAAA,UAAA,GAAa,KAAA;AACb,QAAA;AAAA,MACF;AAAA,IACF,CAAA,QAAS,UAAA;AAAA,EACX;AACF;;;;"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.1.2
3
+ * @version 1.3.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -15,11 +15,11 @@ import { LoggerFactory } from '../../../logger/logger-factory.mjs';
15
15
 
16
16
  var __defProp = Object.defineProperty;
17
17
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
18
- const callName = Symbol("call_V3");
19
- const callListName = Symbol("callList_V3");
20
- const fetchListName = Symbol("fetchList_V3");
21
- const batchName = Symbol("batch_V3");
22
- const batchByChunkName = Symbol("batchByChunk_V3");
18
+ const callName = /* @__PURE__ */ Symbol("call_V3");
19
+ const callListName = /* @__PURE__ */ Symbol("callList_V3");
20
+ const fetchListName = /* @__PURE__ */ Symbol("fetchList_V3");
21
+ const batchName = /* @__PURE__ */ Symbol("batch_V3");
22
+ const batchByChunkName = /* @__PURE__ */ Symbol("batchByChunk_V3");
23
23
  class ActionsManagerV3 {
24
24
  static {
25
25
  __name(this, "ActionsManagerV3");
@@ -1 +1 @@
1
- {"version":3,"file":"manager-v3.mjs","sources":["../../../../../src/core/actions/v3/manager-v3.ts"],"sourcesContent":["import type { TypeB24 } from '../../../types/b24'\nimport type { LoggerInterface } from '../../../types/logger'\nimport type { AbstractAction } from '../abstract-action'\nimport { LoggerFactory } from '../../../logger'\nimport { CallV3 } from './call'\nimport { CallListV3 } from './call-list'\nimport { FetchListV3 } from './fetch-list'\nimport { BatchV3 } from './batch'\nimport { BatchByChunkV3 } from './batch-by-chunk'\n\nconst callName = Symbol('call_V3')\nconst callListName = Symbol('callList_V3')\nconst fetchListName = Symbol('fetchList_V3')\nconst batchName = Symbol('batch_V3')\nconst batchByChunkName = Symbol('batchByChunk_V3')\n/**\n * Some actions for TypeB24 by Api:v3\n */\nexport class ActionsManagerV3 {\n protected _b24: TypeB24\n protected _logger: LoggerInterface\n\n protected _mapActions: Map<symbol, AbstractAction>\n\n constructor(b24: TypeB24) {\n this._b24 = b24\n this._logger = LoggerFactory.createNullLogger()\n\n this._mapActions = new Map()\n }\n\n public setLogger(logger: LoggerInterface): void {\n this._logger = logger\n }\n\n public getLogger(): LoggerInterface {\n return this._logger\n }\n\n get call(): CallV3 {\n if (!this._mapActions.has(callName)) {\n this._mapActions.set(callName, new CallV3(this._b24, this._logger))\n }\n return this._mapActions.get(callName)! as CallV3\n }\n\n get callList(): CallListV3 {\n if (!this._mapActions.has(callListName)) {\n this._mapActions.set(callListName, new CallListV3(this._b24, this._logger))\n }\n return this._mapActions.get(callListName)! as CallListV3\n }\n\n get fetchList(): FetchListV3 {\n if (!this._mapActions.has(fetchListName)) {\n this._mapActions.set(fetchListName, new FetchListV3(this._b24, this._logger))\n }\n return this._mapActions.get(fetchListName)! as FetchListV3\n }\n\n get batch(): BatchV3 {\n if (!this._mapActions.has(batchName)) {\n this._mapActions.set(batchName, new BatchV3(this._b24, this._logger))\n }\n return this._mapActions.get(batchName)! as BatchV3\n }\n\n get batchByChunk(): BatchByChunkV3 {\n if (!this._mapActions.has(batchByChunkName)) {\n this._mapActions.set(batchByChunkName, new BatchByChunkV3(this._b24, this._logger))\n }\n return this._mapActions.get(batchByChunkName)! as BatchByChunkV3\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAUA,MAAM,QAAA,GAAW,OAAO,SAAS,CAAA;AACjC,MAAM,YAAA,GAAe,OAAO,aAAa,CAAA;AACzC,MAAM,aAAA,GAAgB,OAAO,cAAc,CAAA;AAC3C,MAAM,SAAA,GAAY,OAAO,UAAU,CAAA;AACnC,MAAM,gBAAA,GAAmB,OAAO,iBAAiB,CAAA;AAI1C,MAAM,gBAAA,CAAiB;AAAA,EAlB9B;AAkB8B,IAAA,MAAA,CAAA,IAAA,EAAA,kBAAA,CAAA;AAAA;AAAA,EAClB,IAAA;AAAA,EACA,OAAA;AAAA,EAEA,WAAA;AAAA,EAEV,YAAY,GAAA,EAAc;AACxB,IAAA,IAAA,CAAK,IAAA,GAAO,GAAA;AACZ,IAAA,IAAA,CAAK,OAAA,GAAU,cAAc,gBAAA,EAAiB;AAE9C,IAAA,IAAA,CAAK,WAAA,uBAAkB,GAAA,EAAI;AAAA,EAC7B;AAAA,EAEO,UAAU,MAAA,EAA+B;AAC9C,IAAA,IAAA,CAAK,OAAA,GAAU,MAAA;AAAA,EACjB;AAAA,EAEO,SAAA,GAA6B;AAClC,IAAA,OAAO,IAAA,CAAK,OAAA;AAAA,EACd;AAAA,EAEA,IAAI,IAAA,GAAe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AAS,CAAA;AAAA,EACvC;AAAA,EAEA,IAAI,YAAA,GAA+B;AACjC,IAAA,IAAI,CAAC,IAAA,CAAK,WAAA,CAAY,GAAA,CAAI,gBAAgB,CAAA,EAAG;AAC3C,MAAA,IAAA,CAAK,WAAA,CAAY,IAAI,gBAAA,EAAkB,IAAI,eAAe,IAAA,CAAK,IAAA,EAAM,IAAA,CAAK,OAAO,CAAC,CAAA;AAAA,IACpF;AACA,IAAA,OAAO,IAAA,CAAK,WAAA,CAAY,GAAA,CAAI,gBAAgB,CAAA;AAAA,EAC9C;AACF;;;;"}
1
+ {"version":3,"file":"manager-v3.mjs","sources":["../../../../../src/core/actions/v3/manager-v3.ts"],"sourcesContent":["import type { TypeB24 } from '../../../types/b24'\nimport type { LoggerInterface } from '../../../types/logger'\nimport type { AbstractAction } from '../abstract-action'\nimport { LoggerFactory } from '../../../logger'\nimport { CallV3 } from './call'\nimport { CallListV3 } from './call-list'\nimport { FetchListV3 } from './fetch-list'\nimport { BatchV3 } from './batch'\nimport { BatchByChunkV3 } from './batch-by-chunk'\n\nconst callName = Symbol('call_V3')\nconst callListName = Symbol('callList_V3')\nconst fetchListName = Symbol('fetchList_V3')\nconst batchName = Symbol('batch_V3')\nconst batchByChunkName = Symbol('batchByChunk_V3')\n/**\n * Some actions for TypeB24 by Api:v3\n */\nexport class ActionsManagerV3 {\n protected _b24: TypeB24\n protected _logger: LoggerInterface\n\n protected _mapActions: Map<symbol, AbstractAction>\n\n constructor(b24: TypeB24) {\n this._b24 = b24\n this._logger = LoggerFactory.createNullLogger()\n\n this._mapActions = new Map()\n }\n\n public setLogger(logger: LoggerInterface): void {\n this._logger = logger\n }\n\n public getLogger(): LoggerInterface {\n return this._logger\n }\n\n get call(): CallV3 {\n if (!this._mapActions.has(callName)) {\n this._mapActions.set(callName, new CallV3(this._b24, this._logger))\n }\n return this._mapActions.get(callName)! as CallV3\n }\n\n get callList(): CallListV3 {\n if (!this._mapActions.has(callListName)) {\n this._mapActions.set(callListName, new CallListV3(this._b24, this._logger))\n }\n return this._mapActions.get(callListName)! as CallListV3\n }\n\n get fetchList(): FetchListV3 {\n if (!this._mapActions.has(fetchListName)) {\n this._mapActions.set(fetchListName, new FetchListV3(this._b24, this._logger))\n }\n return this._mapActions.get(fetchListName)! as FetchListV3\n }\n\n get batch(): BatchV3 {\n if (!this._mapActions.has(batchName)) {\n this._mapActions.set(batchName, new BatchV3(this._b24, this._logger))\n }\n return this._mapActions.get(batchName)! as BatchV3\n }\n\n get batchByChunk(): BatchByChunkV3 {\n if (!this._mapActions.has(batchByChunkName)) {\n this._mapActions.set(batchByChunkName, new BatchByChunkV3(this._b24, this._logger))\n }\n return this._mapActions.get(batchByChunkName)! as BatchByChunkV3\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAUA,MAAM,QAAA,0BAAkB,SAAS,CAAA;AACjC,MAAM,YAAA,0BAAsB,aAAa,CAAA;AACzC,MAAM,aAAA,0BAAuB,cAAc,CAAA;AAC3C,MAAM,SAAA,0BAAmB,UAAU,CAAA;AACnC,MAAM,gBAAA,0BAA0B,iBAAiB,CAAA;AAI1C,MAAM,gBAAA,CAAiB;AAAA,EAlB9B;AAkB8B,IAAA,MAAA,CAAA,IAAA,EAAA,kBAAA,CAAA;AAAA;AAAA,EAClB,IAAA;AAAA,EACA,OAAA;AAAA,EAEA,WAAA;AAAA,EAEV,YAAY,GAAA,EAAc;AACxB,IAAA,IAAA,CAAK,IAAA,GAAO,GAAA;AACZ,IAAA,IAAA,CAAK,OAAA,GAAU,cAAc,gBAAA,EAAiB;AAE9C,IAAA,IAAA,CAAK,WAAA,uBAAkB,GAAA,EAAI;AAAA,EAC7B;AAAA,EAEO,UAAU,MAAA,EAA+B;AAC9C,IAAA,IAAA,CAAK,OAAA,GAAU,MAAA;AAAA,EACjB;AAAA,EAEO,SAAA,GAA6B;AAClC,IAAA,OAAO,IAAA,CAAK,OAAA;AAAA,EACd;AAAA,EAEA,IAAI,IAAA,GAAe;AACj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CAAA;AAAA,EACvC;AAAA,EAEA,IAAI,YAAA,GAA+B;AACjC,IAAA,IAAI,CAAC,IAAA,CAAK,WAAA,CAAY,GAAA,CAAI,gBAAgB,CAAA,EAAG;AAC3C,MAAA,IAAA,CAAK,WAAA,CAAY,IAAI,gBAAA,EAAkB,IAAI,eAAe,IAAA,CAAK,IAAA,EAAM,IAAA,CAAK,OAAO,CAAC,CAAA;AAAA,IACpF;AACA,IAAA,OAAO,IAAA,CAAK,WAAA,CAAY,GAAA,CAAI,gBAAgB,CAAA;AAAA,EAC9C;AACF;;;;"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.1.2
3
+ * @version 1.3.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -28,6 +28,12 @@ class AbstractHttp {
28
28
  _authActions;
29
29
  _requestIdGenerator;
30
30
  _restrictionManager;
31
+ /**
32
+ * In-flight token refresh, shared so concurrent 401s coalesce into a single
33
+ * `refreshAuth()` round-trip — avoids OAuth refresh-token reuse errors when a
34
+ * burst of requests expires together. (#182)
35
+ */
36
+ _pendingRefresh = null;
31
37
  _logger;
32
38
  _isClientSideWarning = false;
33
39
  _clientSideWarningMessage = "";
@@ -45,7 +51,7 @@ class AbstractHttp {
45
51
  this._logger = LoggerFactory.createNullLogger();
46
52
  const defaultHeaders = {};
47
53
  if (this.isServerSide()) {
48
- defaultHeaders["User-Agent"] = "b24-js-sdk/1.1.2";
54
+ defaultHeaders["User-Agent"] = "b24-js-sdk/1.3.0";
49
55
  }
50
56
  this._authActions = authActions;
51
57
  this._requestIdGenerator = new RequestIdGenerator();
@@ -296,10 +302,27 @@ class AbstractHttp {
296
302
  let authData = this._authActions.getAuthData();
297
303
  if (authData === false) {
298
304
  this._logRefreshingAuthToken(requestId);
299
- authData = await this._authActions.refreshAuth();
305
+ authData = await this._refreshAuth();
300
306
  }
301
307
  return authData;
302
308
  }
309
+ /**
310
+ * Refresh the auth token, coalescing concurrent callers onto a single
311
+ * in-flight `refreshAuth()` so a burst of 401s triggers exactly one refresh
312
+ * round-trip. The slot clears once the refresh settles. (#182)
313
+ */
314
+ _refreshAuth() {
315
+ if (this._pendingRefresh) {
316
+ return this._pendingRefresh;
317
+ }
318
+ const refresh = this._authActions.refreshAuth();
319
+ this._pendingRefresh = refresh;
320
+ refresh.finally(() => {
321
+ this._pendingRefresh = null;
322
+ }).catch(() => {
323
+ });
324
+ return refresh;
325
+ }
303
326
  // Execute the request with 401 error handling
304
327
  async _makeRequestWithAuthRetry(requestId, method, params, authData) {
305
328
  try {
@@ -318,14 +341,15 @@ class AbstractHttp {
318
341
  }
319
342
  );
320
343
  }
321
- if (this._isAuthError(error)) {
344
+ const ajaxError = this._convertToAjaxError(requestId, error, method, params);
345
+ if (this._isAuthError(ajaxError)) {
322
346
  this._logAuthErrorDetected(requestId);
323
347
  this._logRefreshingAuthToken(requestId);
324
- const refreshedAuthData = await this._authActions.refreshAuth();
348
+ const refreshedAuthData = await this._refreshAuth();
325
349
  await this._restrictionManager.checkRateLimit(requestId, method);
326
350
  return await this._makeAxiosRequest(requestId, method, params, refreshedAuthData);
327
351
  }
328
- throw error;
352
+ throw ajaxError;
329
353
  }
330
354
  }
331
355
  async _makeAxiosRequest(requestId, method, params, authData) {
@@ -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 { 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 requ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cesContent":["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 /**\n * In-flight token refresh, shared so concurrent 401s coalesce into a single\n * `refreshAuth()` round-trip — avoids OAuth refresh-token reuse errors when a\n * burst of requests expires together. (#182)\n */\n protected _pendingRefresh: Promise<AuthData> | null = null\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._refreshAuth()\n }\n return authData\n }\n\n /**\n * Refresh the auth token, coalescing concurrent callers onto a single\n * in-flight `refreshAuth()` so a burst of 401s triggers exactly one refresh\n * round-trip. The slot clears once the refresh settles. (#182)\n */\n protected _refreshAuth(): Promise<AuthData> {\n if (this._pendingRefresh) {\n return this._pendingRefresh\n }\n const refresh = this._authActions.refreshAuth()\n this._pendingRefresh = refresh\n // Clear the slot once settled; the extra no-op catch keeps this cleanup\n // chain from surfacing as an unhandled rejection — callers still receive\n // the rejection through the returned promise.\n refresh.finally(() => {\n this._pendingRefresh = null\n }).catch(() => {})\n return refresh\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 // Normalize to AjaxError first: axios throws a raw AxiosError here, whose\n // Bitrix `code` (e.g. `expired_token`) is only populated by conversion. The\n // 401 auth-retry check must run against the converted error — otherwise the\n // `instanceof AjaxError` guard in `_isAuthError` is always false and the\n // refresh-and-retry branch below is dead code. (#182)\n const ajaxError = this._convertToAjaxError(requestId, error, method, params)\n\n // If this is an authorization error (401), then we try to update the token and repeat\n if (this._isAuthError(ajaxError)) {\n this._logAuthErrorDetected(requestId)\n this._logRefreshingAuthToken(requestId)\n\n const refreshedAuthData = await this._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 // Non-auth error: rethrow the already-converted AjaxError (idempotent in\n // `call()`'s catch) instead of the raw AxiosError. (#182)\n throw ajaxError\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 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;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wB,SAAA,EAAyB;AACzD,IAAA,IACE,IAAA,CAAK,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,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.1.2
3
+ * @version 1.3.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.1.2
3
+ * @version 1.3.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.1.2
3
+ * @version 1.3.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk