@bitrix24/b24jssdk 1.2.0 → 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 (147) hide show
  1. package/README-AI.md +3 -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 +1 -1
  11. package/dist/esm/core/actions/v2/call-list.mjs +17 -10
  12. package/dist/esm/core/actions/v2/call-list.mjs.map +1 -1
  13. package/dist/esm/core/actions/v2/call.mjs +1 -1
  14. package/dist/esm/core/actions/v2/fetch-list.mjs +17 -10
  15. package/dist/esm/core/actions/v2/fetch-list.mjs.map +1 -1
  16. package/dist/esm/core/actions/v2/manager-v2.mjs +6 -6
  17. package/dist/esm/core/actions/v2/manager-v2.mjs.map +1 -1
  18. package/dist/esm/core/actions/v3/batch-by-chunk.mjs +1 -1
  19. package/dist/esm/core/actions/v3/batch.mjs +1 -1
  20. package/dist/esm/core/actions/v3/call-list.mjs +16 -9
  21. package/dist/esm/core/actions/v3/call-list.mjs.map +1 -1
  22. package/dist/esm/core/actions/v3/call.mjs +1 -1
  23. package/dist/esm/core/actions/v3/fetch-list.mjs +16 -9
  24. package/dist/esm/core/actions/v3/fetch-list.mjs.map +1 -1
  25. package/dist/esm/core/actions/v3/manager-v3.mjs +6 -6
  26. package/dist/esm/core/actions/v3/manager-v3.mjs.map +1 -1
  27. package/dist/esm/core/http/abstract-http.mjs +30 -6
  28. package/dist/esm/core/http/abstract-http.mjs.map +1 -1
  29. package/dist/esm/core/http/ajax-error.mjs +1 -1
  30. package/dist/esm/core/http/ajax-result.mjs +1 -1
  31. package/dist/esm/core/http/limiters/adaptive-delayer.mjs +1 -1
  32. package/dist/esm/core/http/limiters/manager.mjs +2 -1
  33. package/dist/esm/core/http/limiters/manager.mjs.map +1 -1
  34. package/dist/esm/core/http/limiters/operating-limiter.mjs +1 -1
  35. package/dist/esm/core/http/limiters/params-factory.mjs +1 -1
  36. package/dist/esm/core/http/limiters/rate-limiter.mjs +1 -1
  37. package/dist/esm/core/http/redact.mjs +1 -1
  38. package/dist/esm/core/http/v2.mjs +2 -2
  39. package/dist/esm/core/http/v3.mjs +2 -2
  40. package/dist/esm/core/interaction/batch/abstract-interaction-batch.mjs +1 -1
  41. package/dist/esm/core/interaction/batch/parse-row.mjs +1 -1
  42. package/dist/esm/core/interaction/batch/processing/interface-strategy.mjs +1 -1
  43. package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs +1 -1
  44. package/dist/esm/core/interaction/batch/processing/v2/as-array.mjs +1 -1
  45. package/dist/esm/core/interaction/batch/processing/v2/as-object.mjs +1 -1
  46. package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs +1 -1
  47. package/dist/esm/core/interaction/batch/processing/v3/as-array.mjs +1 -1
  48. package/dist/esm/core/interaction/batch/processing/v3/as-object.mjs +1 -1
  49. package/dist/esm/core/interaction/batch/v2.mjs +1 -1
  50. package/dist/esm/core/interaction/batch/v3.mjs +1 -1
  51. package/dist/esm/core/language/list.mjs +1 -1
  52. package/dist/esm/core/request-id-generator.mjs +1 -1
  53. package/dist/esm/core/result.mjs +28 -1
  54. package/dist/esm/core/result.mjs.map +1 -1
  55. package/dist/esm/core/sdk-error.mjs +1 -1
  56. package/dist/esm/core/tools/abstract-tool.mjs +1 -1
  57. package/dist/esm/core/tools/healthcheck.mjs +1 -1
  58. package/dist/esm/core/tools/manager.mjs +3 -3
  59. package/dist/esm/core/tools/manager.mjs.map +1 -1
  60. package/dist/esm/core/tools/ping.mjs +1 -1
  61. package/dist/esm/core/version-manager.mjs +89 -12
  62. package/dist/esm/core/version-manager.mjs.map +1 -1
  63. package/dist/esm/frame/auth.mjs +1 -1
  64. package/dist/esm/frame/b24.mjs +1 -1
  65. package/dist/esm/frame/dialog.mjs +1 -1
  66. package/dist/esm/frame/frame.mjs +1 -1
  67. package/dist/esm/frame/message/commands.mjs +1 -1
  68. package/dist/esm/frame/message/controller.mjs +1 -1
  69. package/dist/esm/frame/options.mjs +1 -1
  70. package/dist/esm/frame/parent.mjs +6 -2
  71. package/dist/esm/frame/parent.mjs.map +1 -1
  72. package/dist/esm/frame/placement.mjs +1 -1
  73. package/dist/esm/frame/slider.mjs +5 -1
  74. package/dist/esm/frame/slider.mjs.map +1 -1
  75. package/dist/esm/helper/abstract-helper.mjs +1 -1
  76. package/dist/esm/helper/app-manager.mjs +1 -1
  77. package/dist/esm/helper/currency-manager.mjs +1 -1
  78. package/dist/esm/helper/helper-manager.mjs +1 -1
  79. package/dist/esm/helper/license-manager.mjs +1 -1
  80. package/dist/esm/helper/options-manager.mjs +1 -1
  81. package/dist/esm/helper/payment-manager.mjs +1 -1
  82. package/dist/esm/helper/profile-manager.mjs +1 -1
  83. package/dist/esm/helper/use-b24-helper.mjs +1 -1
  84. package/dist/esm/hook/auth.mjs +1 -1
  85. package/dist/esm/hook/b24.mjs +1 -1
  86. package/dist/esm/index.d.mts +95 -16
  87. package/dist/esm/index.d.ts +95 -16
  88. package/dist/esm/index.mjs +1 -1
  89. package/dist/esm/loader-b24frame.mjs +1 -1
  90. package/dist/esm/logger/abstract-logger.mjs +1 -1
  91. package/dist/esm/logger/browser.mjs +1 -1
  92. package/dist/esm/logger/formatter/abstract-formatter.mjs +1 -1
  93. package/dist/esm/logger/formatter/json-formatter.mjs +1 -1
  94. package/dist/esm/logger/formatter/line-formatter.mjs +1 -1
  95. package/dist/esm/logger/formatter/telegram-formatter.mjs +1 -1
  96. package/dist/esm/logger/handler/abstract-handler.mjs +1 -1
  97. package/dist/esm/logger/handler/consola-adapter.mjs +1 -1
  98. package/dist/esm/logger/handler/console-handler.mjs +1 -1
  99. package/dist/esm/logger/handler/console-v2-handler.mjs +1 -1
  100. package/dist/esm/logger/handler/memory-handler.mjs +1 -1
  101. package/dist/esm/logger/handler/stream-handler.mjs +1 -1
  102. package/dist/esm/logger/handler/telegram-handler.mjs +1 -1
  103. package/dist/esm/logger/handler/winston-adapter.mjs +1 -1
  104. package/dist/esm/logger/logger-factory.mjs +1 -1
  105. package/dist/esm/logger/logger.mjs +1 -1
  106. package/dist/esm/logger/null-logger.mjs +1 -1
  107. package/dist/esm/logger/processor/memory-usage-processor.mjs +1 -1
  108. package/dist/esm/logger/processor/pid-processor.mjs +1 -1
  109. package/dist/esm/oauth/auth.mjs +1 -1
  110. package/dist/esm/oauth/b24.mjs +1 -1
  111. package/dist/esm/oauth/refresh-token-error.mjs +1 -1
  112. package/dist/esm/pullClient/abstract-connector.mjs +1 -1
  113. package/dist/esm/pullClient/channel-manager.mjs +1 -1
  114. package/dist/esm/pullClient/client.mjs +1 -1
  115. package/dist/esm/pullClient/errors.mjs +1 -1
  116. package/dist/esm/pullClient/json-rpc.mjs +1 -1
  117. package/dist/esm/pullClient/long-polling-connector.mjs +1 -1
  118. package/dist/esm/pullClient/protobuf/index.mjs +1 -1
  119. package/dist/esm/pullClient/protobuf/model.mjs +1 -1
  120. package/dist/esm/pullClient/protobuf/protobuf.mjs +1 -1
  121. package/dist/esm/pullClient/shared-config.mjs +1 -1
  122. package/dist/esm/pullClient/storage-manager.mjs +1 -1
  123. package/dist/esm/pullClient/web-socket-connector.mjs +1 -1
  124. package/dist/esm/tools/browser.mjs +1 -1
  125. package/dist/esm/tools/environment.mjs +1 -1
  126. package/dist/esm/tools/formatters/iban.mjs +1 -1
  127. package/dist/esm/tools/formatters/numbers.mjs +1 -1
  128. package/dist/esm/tools/index.mjs +1 -1
  129. package/dist/esm/tools/scroll-size.mjs +1 -1
  130. package/dist/esm/tools/text.mjs +1 -1
  131. package/dist/esm/tools/type.mjs +1 -1
  132. package/dist/esm/tools/use-formatters.mjs +1 -1
  133. package/dist/esm/tools/uuidv7.mjs +1 -1
  134. package/dist/esm/types/b24-helper.mjs +1 -1
  135. package/dist/esm/types/b24.mjs +1 -1
  136. package/dist/esm/types/bizproc/index.mjs +1 -1
  137. package/dist/esm/types/catalog/index.mjs +1 -1
  138. package/dist/esm/types/common.mjs +1 -1
  139. package/dist/esm/types/crm/entity-type.mjs +1 -1
  140. package/dist/esm/types/crm/productrow.mjs +1 -1
  141. package/dist/esm/types/logger.mjs +1 -1
  142. package/dist/esm/types/pull.mjs +1 -1
  143. package/dist/umd/index.js +231 -66
  144. package/dist/umd/index.js.map +1 -1
  145. package/dist/umd/index.min.js +24 -24
  146. package/dist/umd/index.min.js.map +1 -1
  147. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.2.0
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.2.0
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.2.0
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.2.0
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.2.0
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.2.0
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.2.0
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.2.0
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.2.0
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.2.0
3
+ * @version 1.3.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
package/dist/umd/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @package @bitrix24/b24jssdk
3
- * @version 1.2.0
3
+ * @version 1.3.0
4
4
  * @copyright (c) 2026 Bitrix24
5
5
  * @license MIT
6
6
  * @see https://github.com/bitrix24/b24jssdk
@@ -10407,6 +10407,33 @@ If you need to send logs from browser, use a proxy server.`;
10407
10407
  getErrorMessages() {
10408
10408
  return Array.from(this._errors.values(), (e) => e.message);
10409
10409
  }
10410
+ /**
10411
+ * Retrieves all errors as a plain object (a snapshot copy) keyed by their
10412
+ * identifier, preserving which request produced each error. Unlike
10413
+ * {@link Result.getErrors}, the keys are not discarded — useful for batch
10414
+ * calls with `isHaltOnError: false`.
10415
+ *
10416
+ * Keys are meaningful only when the error was added with an explicit key
10417
+ * (e.g. an object / named-command batch). Array-mode batches and
10418
+ * {@link Result.addErrors} fall back to generated UUID keys.
10419
+ *
10420
+ * @returns {Record<string, Error>} A map of error key to Error object.
10421
+ */
10422
+ getErrorsByKey() {
10423
+ return Object.fromEntries(this._errors);
10424
+ }
10425
+ /**
10426
+ * Retrieves all error messages as a plain object (a snapshot copy) keyed by
10427
+ * their identifier. Unlike {@link Result.getErrorMessages}, the keys are
10428
+ * preserved. See {@link Result.getErrorsByKey} for when keys are meaningful.
10429
+ *
10430
+ * @returns {Record<string, string>} A map of error key to error message.
10431
+ */
10432
+ getErrorMessagesByKey() {
10433
+ return Object.fromEntries(
10434
+ Array.from(this._errors, ([key, error]) => [key, error.message])
10435
+ );
10436
+ }
10410
10437
  /**
10411
10438
  * Converts the Result object to a string.
10412
10439
  *
@@ -11817,6 +11844,7 @@ ${this.stack}`;
11817
11844
  "INVALID_REQUEST",
11818
11845
  "OVERLOAD_LIMIT",
11819
11846
  "expired_token",
11847
+ "invalid_token",
11820
11848
  "ACCESS_DENIED",
11821
11849
  "INVALID_CREDENTIALS",
11822
11850
  "user_access_error",
@@ -12059,6 +12087,7 @@ ${JSON.stringify({
12059
12087
  #supportMethods;
12060
12088
  constructor() {
12061
12089
  this.#supportMethods = [
12090
+ // --- infrastructure ---
12062
12091
  "/batch",
12063
12092
  // done
12064
12093
  "/scopes",
@@ -12067,6 +12096,7 @@ ${JSON.stringify({
12067
12096
  // done
12068
12097
  "/rest.documentation.openapi",
12069
12098
  "/documentation",
12099
+ // --- main ---
12070
12100
  /** @see /settings/configs/event_log.php */
12071
12101
  "/main.eventlog.list",
12072
12102
  // done
@@ -12074,21 +12104,96 @@ ${JSON.stringify({
12074
12104
  // done
12075
12105
  "/main.eventlog.tail",
12076
12106
  // done
12077
- "/tasks.task.chat.message.send",
12078
- "/tasks.task.access.get",
12079
- "/tasks.task.file.attach",
12107
+ "/main.eventlog.field.list",
12108
+ "/main.eventlog.field.get",
12109
+ // --- mail (rest-v3) ---
12110
+ "/mail.mailbox.list",
12111
+ "/mail.mailbox.get",
12112
+ "/mail.mailbox.senders",
12113
+ "/mail.mailbox.field.list",
12114
+ "/mail.mailbox.field.get",
12115
+ "/mail.message.list",
12116
+ "/mail.message.get",
12117
+ "/mail.message.thread",
12118
+ "/mail.message.send",
12119
+ "/mail.message.reply",
12120
+ "/mail.message.forward",
12121
+ "/mail.message.movetofolder",
12122
+ "/mail.message.createcrmactivity",
12123
+ "/mail.message.removecrmactivity",
12124
+ "/mail.message.createtask",
12125
+ "/mail.message.createcalendarevent",
12126
+ "/mail.message.createchat",
12127
+ "/mail.message.createfeedpost",
12128
+ "/mail.message.field.list",
12129
+ "/mail.message.field.get",
12130
+ "/mail.recipient.listcontacts",
12131
+ "/mail.recipient.listemployees",
12132
+ "/mail.recipient.field.list",
12133
+ "/mail.recipient.field.get",
12134
+ // --- humanresources (rest-v3) ---
12135
+ "/humanresources.node.add",
12136
+ "/humanresources.node.edit",
12137
+ "/humanresources.node.get",
12138
+ "/humanresources.node.list",
12139
+ "/humanresources.node.search",
12140
+ "/humanresources.node.children",
12141
+ "/humanresources.node.count",
12142
+ "/humanresources.node.move",
12143
+ "/humanresources.node.field.list",
12144
+ "/humanresources.node.field.get",
12145
+ "/humanresources.node.member.add",
12146
+ "/humanresources.node.member.set",
12147
+ "/humanresources.node.member.move",
12148
+ "/humanresources.node.member.remove",
12149
+ "/humanresources.node.communication.edit",
12150
+ "/humanresources.node.communication.list",
12151
+ "/humanresources.employee.search",
12152
+ "/humanresources.employee.subordinates",
12153
+ "/humanresources.employee.count",
12154
+ "/humanresources.employee.multidepartment",
12155
+ "/humanresources.employee.field.list",
12156
+ "/humanresources.employee.field.get",
12157
+ // --- tasks (rest-v3) ---
12158
+ "/tasks.task.add",
12159
+ "/tasks.task.get",
12160
+ // done
12080
12161
  "/tasks.task.update",
12081
12162
  // done
12082
12163
  "/tasks.task.delete",
12083
- "/tasks.task.add",
12084
- "/tasks.task.get"
12085
- // done
12164
+ "/tasks.task.access.get",
12165
+ "/tasks.task.file.attach",
12166
+ "/tasks.task.chat.message.send",
12167
+ "/tasks.task.result.add",
12168
+ "/tasks.task.result.addfromchatmessage",
12169
+ "/tasks.task.result.update",
12170
+ "/tasks.task.result.list",
12171
+ "/tasks.task.result.delete",
12172
+ "/tasks.task.field.list",
12173
+ "/tasks.task.field.get",
12174
+ "/tasks.task.access.field.list",
12175
+ "/tasks.task.access.field.get",
12176
+ "/tasks.task.file.field.list",
12177
+ "/tasks.task.file.field.get",
12178
+ "/tasks.task.chat.message.field.list",
12179
+ "/tasks.task.chat.message.field.get",
12180
+ // --- timeman (rest-v3) — read-only in v3 (no record.get / add / update / delete) ---
12181
+ "/timeman.record.list",
12182
+ "/timeman.record.field.list",
12183
+ "/timeman.record.field.get"
12184
+ // Cross-module methods are cross-referenced from the rest-v3 pages above but
12185
+ // belong to modules not actualized here — add them when those modules land:
12186
+ // user.get — user module (seen on humanresources + timeman)
12187
+ // im.message.update / im.message.delete / im.dialog.messages.get — im module (seen on tasks)
12188
+ // disk.storage.uploadfile / disk.folder.uploadfile /
12189
+ // disk.storage.getchildren / disk.folder.getchildren — disk module (seen on tasks)
12190
+ //
12086
12191
  // @todo When API.v3 arrives - change in AuthOAuthManager.initIsAdmin()
12087
- // '/profile' // waite
12088
- // '/main.message.get' // waite
12089
- // '/main.chat.update' // waite
12090
- // '/main.chat.list' // waite
12091
- // '/main.user.list' // waite
12192
+ // '/profile' // wait
12193
+ // '/main.message.get' // wait
12194
+ // '/main.chat.update' // wait
12195
+ // '/main.chat.list' // wait
12196
+ // '/main.user.list' // wait
12092
12197
  ];
12093
12198
  }
12094
12199
  static create() {
@@ -12232,12 +12337,16 @@ ${JSON.stringify({
12232
12337
  *
12233
12338
  * @param {ActionCallListV2} options - parameters for executing the request.
12234
12339
  * - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
12235
- * - `params?: Omit<TypeCallParams, 'start'>` - Request parameters, excluding the `start` parameter,
12340
+ * - `params?: Omit<TypeCallParams, 'start' | 'order'>` - Request parameters, excluding the `start` and `order` parameters,
12236
12341
  * since the method is designed to obtain all data in one call.
12237
12342
  * Note: Use `filter`, `order`, and `select` to control the selection.
12238
- * - `idKey?: string` - The name of the field containing the unique identifier of the element.
12239
- * Default is 'ID' (uppercase). Alternatively, it can be 'id' (lowercase).
12240
- * or another field, depending on the REST API data structure.
12343
+ * - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
12344
+ * drives the cursor. Default is 'ID' (uppercase). For methods that return a lowercase /
12345
+ * camelCase id (for example `tasks.task.list` returns `id`), set `idKey: 'id'`.
12346
+ * - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the `>` page
12347
+ * filter. Defaults to `idKey`. Set it only when the sortable / filterable field name differs
12348
+ * from the response field name — e.g. `tasks.task.list` sorts and filters by `ID` (uppercase)
12349
+ * but returns `id` (lowercase): pass `idKey: 'id', cursorIdKey: 'ID'`.
12241
12350
  * - `customKeyForResult?: string` - A custom key indicating that the response REST API will be
12242
12351
  * grouped by this field.
12243
12352
  * Example: `items` to group a list of CRM items.
@@ -12276,16 +12385,17 @@ ${JSON.stringify({
12276
12385
  const batchSize = 50;
12277
12386
  const result = new Result();
12278
12387
  const idKey = options?.idKey ?? "ID";
12388
+ const cursorIdKey = options?.cursorIdKey ?? idKey;
12279
12389
  const customKeyForResult = options?.customKeyForResult ?? null;
12280
12390
  const params = options?.params ?? {};
12281
12391
  if ("order" in params && params["order"]) {
12282
- 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.");
12392
+ 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.");
12283
12393
  }
12284
- const moreIdKey = `>${idKey}`;
12394
+ const moreIdKey = `>${cursorIdKey}`;
12285
12395
  const { order: _ignoredOrder, ...restParams } = params;
12286
12396
  const requestParams = {
12287
12397
  ...restParams,
12288
- order: { [idKey]: "ASC" },
12398
+ order: { [cursorIdKey]: "ASC" },
12289
12399
  filter: { ...params["filter"] || {}, [moreIdKey]: 0 },
12290
12400
  start: -1
12291
12401
  };
@@ -12330,9 +12440,11 @@ ${JSON.stringify({
12330
12440
  break;
12331
12441
  }
12332
12442
  const lastItem = resultData[resultData.length - 1];
12333
- if (lastItem && typeof lastItem[idKey] !== "undefined") {
12334
- requestParams.filter[moreIdKey] = Number.parseInt(lastItem[idKey]);
12443
+ const cursorValue = lastItem ? Number.parseInt(lastItem[idKey], 10) : Number.NaN;
12444
+ if (Number.isFinite(cursorValue)) {
12445
+ requestParams.filter[moreIdKey] = cursorValue;
12335
12446
  } else {
12447
+ 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').`);
12336
12448
  isContinue = false;
12337
12449
  break;
12338
12450
  }
@@ -12355,12 +12467,16 @@ ${JSON.stringify({
12355
12467
  *
12356
12468
  * @param {ActionFetchListV2} options - parameters for executing the request.
12357
12469
  * - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
12358
- * - `params?: Omit<TypeCallParams, 'start'>` - Request parameters, excluding the `start` parameter,
12470
+ * - `params?: Omit<TypeCallParams, 'start' | 'order'>` - Request parameters, excluding the `start` and `order` parameters,
12359
12471
  * since the method is designed to obtain all data in one call.
12360
12472
  * Note: Use `filter`, `order`, and `select` to control the selection.
12361
- * - `idKey?: string` - The name of the field containing the unique identifier of the element.
12362
- * Default is 'ID' (uppercase). Alternatively, it can be 'id' (lowercase).
12363
- * or another field, depending on the REST API data structure.
12473
+ * - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
12474
+ * drives the cursor. Default is 'ID' (uppercase). For methods that return a lowercase /
12475
+ * camelCase id (for example `tasks.task.list` returns `id`), set `idKey: 'id'`.
12476
+ * - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the `>` page
12477
+ * filter. Defaults to `idKey`. Set it only when the sortable / filterable field name differs
12478
+ * from the response field name — e.g. `tasks.task.list` sorts and filters by `ID` (uppercase)
12479
+ * but returns `id` (lowercase): pass `idKey: 'id', cursorIdKey: 'ID'`.
12364
12480
  * - `customKeyForResult?: string` - A custom key indicating that the response REST API will be
12365
12481
  * grouped by this field.
12366
12482
  * Example: `items` to group a list of CRM items.
@@ -12401,16 +12517,17 @@ ${JSON.stringify({
12401
12517
  async *make(options) {
12402
12518
  const batchSize = 50;
12403
12519
  const idKey = options?.idKey ?? "ID";
12520
+ const cursorIdKey = options?.cursorIdKey ?? idKey;
12404
12521
  const customKeyForResult = options?.customKeyForResult ?? null;
12405
12522
  const params = options?.params ?? {};
12406
12523
  if ("order" in params && params["order"]) {
12407
- 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.");
12524
+ 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.");
12408
12525
  }
12409
- const moreIdKey = `>${idKey}`;
12526
+ const moreIdKey = `>${cursorIdKey}`;
12410
12527
  const { order: _ignoredOrder, ...restParams } = params;
12411
12528
  const requestParams = {
12412
12529
  ...restParams,
12413
- order: { [idKey]: "ASC" },
12530
+ order: { [cursorIdKey]: "ASC" },
12414
12531
  filter: { ...params["filter"] || {}, [moreIdKey]: 0 },
12415
12532
  start: -1
12416
12533
  };
@@ -12454,9 +12571,11 @@ ${JSON.stringify({
12454
12571
  break;
12455
12572
  }
12456
12573
  const lastItem = resultData[resultData.length - 1];
12457
- if (lastItem && typeof lastItem[idKey] !== "undefined") {
12458
- requestParams.filter[moreIdKey] = Number.parseInt(lastItem[idKey]);
12574
+ const cursorValue = lastItem ? Number.parseInt(lastItem[idKey], 10) : Number.NaN;
12575
+ if (Number.isFinite(cursorValue)) {
12576
+ requestParams.filter[moreIdKey] = cursorValue;
12459
12577
  } else {
12578
+ 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').`);
12460
12579
  isContinue = false;
12461
12580
  break;
12462
12581
  }
@@ -12740,11 +12859,11 @@ ${JSON.stringify({
12740
12859
 
12741
12860
  var __defProp$10 = Object.defineProperty;
12742
12861
  var __name$10 = (target, value) => __defProp$10(target, "name", { value, configurable: true });
12743
- const callName$1 = Symbol("call_V2");
12744
- const callListName$1 = Symbol("callList_V2");
12745
- const fetchListName$1 = Symbol("fetchList_V2");
12746
- const batchName$1 = Symbol("batch_V2");
12747
- const batchByChunkName$1 = Symbol("batchByChunk_V2");
12862
+ const callName$1 = /* @__PURE__ */ Symbol("call_V2");
12863
+ const callListName$1 = /* @__PURE__ */ Symbol("callList_V2");
12864
+ const fetchListName$1 = /* @__PURE__ */ Symbol("fetchList_V2");
12865
+ const batchName$1 = /* @__PURE__ */ Symbol("batch_V2");
12866
+ const batchByChunkName$1 = /* @__PURE__ */ Symbol("batchByChunk_V2");
12748
12867
  class ActionsManagerV2 {
12749
12868
  static {
12750
12869
  __name$10(this, "ActionsManagerV2");
@@ -12851,11 +12970,15 @@ ${JSON.stringify({
12851
12970
  *
12852
12971
  * @param {ActionCallListV3} options - parameters for executing the request.
12853
12972
  * - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
12854
- * - `params?: Omit<TypeCallParams, 'pagination'>` - Request parameters, excluding the `pagination` parameter,
12973
+ * - `params?: Omit<TypeCallParams, 'pagination' | 'order'>` - Request parameters, excluding the `pagination` and `order` parameters,
12855
12974
  * since the method is designed to obtain all data in one call.
12856
12975
  * Note: Use `filter`, `order`, and `select` to control the selection.
12857
- * - `idKey?: string` - The name of the field containing the unique identifier of the element.
12858
- * Default is 'id'. Alternatively, it can be another field, depending on the REST API data structure.
12976
+ * - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
12977
+ * drives the cursor. Default is 'id'. Set it to match the id field the method returns.
12978
+ * - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the
12979
+ * `[field, '>', n]` page filter. Defaults to `idKey`. Set it only when the sortable /
12980
+ * filterable field name differs from the response field name (e.g. an uppercase request
12981
+ * field but a lowercase response id): pass `idKey: 'id', cursorIdKey: 'ID'`.
12859
12982
  * - `customKeyForResult: string` - A custom key indicating that the response REST API will be
12860
12983
  * grouped by this field.
12861
12984
  * Example: `items` to group a list of CRM items.
@@ -12894,15 +13017,16 @@ ${JSON.stringify({
12894
13017
  const batchSize = options?.limit ?? 50;
12895
13018
  const result = new Result();
12896
13019
  const idKey = options?.idKey ?? "id";
13020
+ const cursorIdKey = options?.cursorIdKey ?? idKey;
12897
13021
  const customKeyForResult = options?.customKeyForResult ?? null;
12898
13022
  const params = options?.params ?? {};
12899
13023
  if ("order" in params && params["order"]) {
12900
- 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.");
13024
+ 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.");
12901
13025
  }
12902
13026
  const { order: _ignoredOrder, ...restParams } = params;
12903
13027
  const requestParams = {
12904
13028
  ...restParams,
12905
- order: { [idKey]: "ASC" },
13029
+ order: { [cursorIdKey]: "ASC" },
12906
13030
  filter: [...params["filter"] || []],
12907
13031
  pagination: { page: 0, limit: batchSize }
12908
13032
  };
@@ -12911,7 +13035,7 @@ ${JSON.stringify({
12911
13035
  let nextId = 0;
12912
13036
  do {
12913
13037
  const sendParams = { ...requestParams, filter: [...requestParams.filter] };
12914
- sendParams.filter.push([idKey, ">", nextId]);
13038
+ sendParams.filter.push([cursorIdKey, ">", nextId]);
12915
13039
  const response = await this._b24.actions.v3.call.make({
12916
13040
  method: options.method,
12917
13041
  params: sendParams,
@@ -12945,9 +13069,11 @@ ${JSON.stringify({
12945
13069
  break;
12946
13070
  }
12947
13071
  const lastItem = resultData[resultData.length - 1];
12948
- if (lastItem && typeof lastItem[idKey] !== "undefined") {
12949
- nextId = Number.parseInt(lastItem[idKey]);
13072
+ const cursorValue = lastItem ? Number.parseInt(lastItem[idKey], 10) : Number.NaN;
13073
+ if (Number.isFinite(cursorValue)) {
13074
+ nextId = cursorValue;
12950
13075
  } else {
13076
+ 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').`);
12951
13077
  isContinue = false;
12952
13078
  break;
12953
13079
  }
@@ -12970,11 +13096,15 @@ ${JSON.stringify({
12970
13096
  *
12971
13097
  * @param {ActionFetchListV3} options - parameters for executing the request.
12972
13098
  * - `method: string` - The name of the REST API method that returns a list of data (for example: `crm.item.list`, `tasks.task.list`)
12973
- * - `params?: Omit<TypeCallParams, 'pagination'>` - Request parameters, excluding the `pagination` parameter,
13099
+ * - `params?: Omit<TypeCallParams, 'pagination' | 'order'>` - Request parameters, excluding the `pagination` and `order` parameters,
12974
13100
  * since the method is designed to obtain all data in one call.
12975
13101
  * Note: Use `filter`, `order`, and `select` to control the selection.
12976
- * - `idKey?: string` - The name of the field containing the unique identifier of the element.
12977
- * Default is 'id'. Alternatively, it can be another field, depending on the REST API data structure.
13102
+ * - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
13103
+ * drives the cursor. Default is 'id'. Set it to match the id field the method returns.
13104
+ * - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the
13105
+ * `[field, '>', n]` page filter. Defaults to `idKey`. Set it only when the sortable /
13106
+ * filterable field name differs from the response field name (e.g. an uppercase request
13107
+ * field but a lowercase response id): pass `idKey: 'id', cursorIdKey: 'ID'`.
12978
13108
  * - `customKeyForResult: string` - A custom key indicating that the response REST API will be
12979
13109
  * grouped by this field.
12980
13110
  * Example: `items` to group a list of CRM items.
@@ -13013,15 +13143,16 @@ ${JSON.stringify({
13013
13143
  async *make(options) {
13014
13144
  const batchSize = options?.limit ?? 50;
13015
13145
  const idKey = options?.idKey ?? "id";
13146
+ const cursorIdKey = options?.cursorIdKey ?? idKey;
13016
13147
  const customKeyForResult = options?.customKeyForResult ?? null;
13017
13148
  const params = options?.params ?? {};
13018
13149
  if ("order" in params && params["order"]) {
13019
- 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.");
13150
+ 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.");
13020
13151
  }
13021
13152
  const { order: _ignoredOrder, ...restParams } = params;
13022
13153
  const requestParams = {
13023
13154
  ...restParams,
13024
- order: { [idKey]: "ASC" },
13155
+ order: { [cursorIdKey]: "ASC" },
13025
13156
  filter: [...params["filter"] || []],
13026
13157
  pagination: { page: 0, limit: batchSize }
13027
13158
  };
@@ -13029,7 +13160,7 @@ ${JSON.stringify({
13029
13160
  let nextId = 0;
13030
13161
  do {
13031
13162
  const sendParams = { ...requestParams, filter: [...requestParams.filter] };
13032
- sendParams.filter.push([idKey, ">", nextId]);
13163
+ sendParams.filter.push([cursorIdKey, ">", nextId]);
13033
13164
  const response = await this._b24.actions.v3.call.make({
13034
13165
  method: options.method,
13035
13166
  params: sendParams,
@@ -13063,9 +13194,11 @@ ${JSON.stringify({
13063
13194
  break;
13064
13195
  }
13065
13196
  const lastItem = resultData[resultData.length - 1];
13066
- if (lastItem && typeof lastItem[idKey] !== "undefined") {
13067
- nextId = Number.parseInt(lastItem[idKey]);
13197
+ const cursorValue = lastItem ? Number.parseInt(lastItem[idKey], 10) : Number.NaN;
13198
+ if (Number.isFinite(cursorValue)) {
13199
+ nextId = cursorValue;
13068
13200
  } else {
13201
+ 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').`);
13069
13202
  isContinue = false;
13070
13203
  break;
13071
13204
  }
@@ -13266,11 +13399,11 @@ ${JSON.stringify({
13266
13399
 
13267
13400
  var __defProp$W = Object.defineProperty;
13268
13401
  var __name$W = (target, value) => __defProp$W(target, "name", { value, configurable: true });
13269
- const callName = Symbol("call_V3");
13270
- const callListName = Symbol("callList_V3");
13271
- const fetchListName = Symbol("fetchList_V3");
13272
- const batchName = Symbol("batch_V3");
13273
- const batchByChunkName = Symbol("batchByChunk_V3");
13402
+ const callName = /* @__PURE__ */ Symbol("call_V3");
13403
+ const callListName = /* @__PURE__ */ Symbol("callList_V3");
13404
+ const fetchListName = /* @__PURE__ */ Symbol("fetchList_V3");
13405
+ const batchName = /* @__PURE__ */ Symbol("batch_V3");
13406
+ const batchByChunkName = /* @__PURE__ */ Symbol("batchByChunk_V3");
13274
13407
  class ActionsManagerV3 {
13275
13408
  static {
13276
13409
  __name$W(this, "ActionsManagerV3");
@@ -13455,8 +13588,8 @@ ${JSON.stringify({
13455
13588
 
13456
13589
  var __defProp$R = Object.defineProperty;
13457
13590
  var __name$R = (target, value) => __defProp$R(target, "name", { value, configurable: true });
13458
- const pingName = Symbol("ping");
13459
- const healthCheckName = Symbol("healthCheck");
13591
+ const pingName = /* @__PURE__ */ Symbol("ping");
13592
+ const healthCheckName = /* @__PURE__ */ Symbol("healthCheck");
13460
13593
  class ToolsManager {
13461
13594
  static {
13462
13595
  __name$R(this, "ToolsManager");
@@ -18616,6 +18749,12 @@ ${JSON.stringify({
18616
18749
  _authActions;
18617
18750
  _requestIdGenerator;
18618
18751
  _restrictionManager;
18752
+ /**
18753
+ * In-flight token refresh, shared so concurrent 401s coalesce into a single
18754
+ * `refreshAuth()` round-trip — avoids OAuth refresh-token reuse errors when a
18755
+ * burst of requests expires together. (#182)
18756
+ */
18757
+ _pendingRefresh = null;
18619
18758
  _logger;
18620
18759
  _isClientSideWarning = false;
18621
18760
  _clientSideWarningMessage = "";
@@ -18633,7 +18772,7 @@ ${JSON.stringify({
18633
18772
  this._logger = LoggerFactory.createNullLogger();
18634
18773
  const defaultHeaders = {};
18635
18774
  if (this.isServerSide()) {
18636
- defaultHeaders["User-Agent"] = "b24-js-sdk/1.2.0";
18775
+ defaultHeaders["User-Agent"] = "b24-js-sdk/1.3.0";
18637
18776
  }
18638
18777
  this._authActions = authActions;
18639
18778
  this._requestIdGenerator = new RequestIdGenerator();
@@ -18884,10 +19023,27 @@ ${JSON.stringify({
18884
19023
  let authData = this._authActions.getAuthData();
18885
19024
  if (authData === false) {
18886
19025
  this._logRefreshingAuthToken(requestId);
18887
- authData = await this._authActions.refreshAuth();
19026
+ authData = await this._refreshAuth();
18888
19027
  }
18889
19028
  return authData;
18890
19029
  }
19030
+ /**
19031
+ * Refresh the auth token, coalescing concurrent callers onto a single
19032
+ * in-flight `refreshAuth()` so a burst of 401s triggers exactly one refresh
19033
+ * round-trip. The slot clears once the refresh settles. (#182)
19034
+ */
19035
+ _refreshAuth() {
19036
+ if (this._pendingRefresh) {
19037
+ return this._pendingRefresh;
19038
+ }
19039
+ const refresh = this._authActions.refreshAuth();
19040
+ this._pendingRefresh = refresh;
19041
+ refresh.finally(() => {
19042
+ this._pendingRefresh = null;
19043
+ }).catch(() => {
19044
+ });
19045
+ return refresh;
19046
+ }
18891
19047
  // Execute the request with 401 error handling
18892
19048
  async _makeRequestWithAuthRetry(requestId, method, params, authData) {
18893
19049
  try {
@@ -18906,14 +19062,15 @@ ${JSON.stringify({
18906
19062
  }
18907
19063
  );
18908
19064
  }
18909
- if (this._isAuthError(error)) {
19065
+ const ajaxError = this._convertToAjaxError(requestId, error, method, params);
19066
+ if (this._isAuthError(ajaxError)) {
18910
19067
  this._logAuthErrorDetected(requestId);
18911
19068
  this._logRefreshingAuthToken(requestId);
18912
- const refreshedAuthData = await this._authActions.refreshAuth();
19069
+ const refreshedAuthData = await this._refreshAuth();
18913
19070
  await this._restrictionManager.checkRateLimit(requestId, method);
18914
19071
  return await this._makeAxiosRequest(requestId, method, params, refreshedAuthData);
18915
19072
  }
18916
- throw error;
19073
+ throw ajaxError;
18917
19074
  }
18918
19075
  }
18919
19076
  async _makeAxiosRequest(requestId, method, params, authData) {
@@ -19881,7 +20038,7 @@ ${JSON.stringify({
19881
20038
  }
19882
20039
  const queryParams = new URLSearchParams({
19883
20040
  [this._requestIdGenerator.getQueryStringParameterName()]: requestId,
19884
- [this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.2.0",
20041
+ [this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.3.0",
19885
20042
  [this._requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
19886
20043
  });
19887
20044
  return `${baseUrl}${methodUrl}?${queryParams.toString()}`;
@@ -20135,7 +20292,7 @@ ${JSON.stringify({
20135
20292
  const methodUrl = `/${encodeURIComponent(method)}`;
20136
20293
  const queryParams = new URLSearchParams({
20137
20294
  [this._requestIdGenerator.getQueryStringParameterName()]: requestId,
20138
- [this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.2.0",
20295
+ [this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.3.0",
20139
20296
  [this._requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
20140
20297
  });
20141
20298
  return `${baseUrl}${methodUrl}?${queryParams.toString()}`;
@@ -21627,7 +21784,11 @@ ${JSON.stringify({
21627
21784
  });
21628
21785
  }
21629
21786
  /**
21630
- * Set Page Title
21787
+ * Sets the in-layout page title (the `#pagetitle` element the portal renders around the app).
21788
+ *
21789
+ * Does NOT change the browser tab title (`document.title`): the portal applies this command to
21790
+ * `#pagetitle`, never to the tab. To set the browser tab title, open the view as a slider via
21791
+ * `SliderManager.openSliderAppPage` with a `bx24_title` option.
21631
21792
  *
21632
21793
  * @param {string} title
21633
21794
  *
@@ -21944,6 +22105,10 @@ ${JSON.stringify({
21944
22105
  /**
21945
22106
  * When the method is called, a pop-up window with the application frame will be opened.
21946
22107
  *
22108
+ * Settings are passed via `bx24_`-prefixed keys (e.g. `bx24_title`, `bx24_width`).
22109
+ * `bx24_title` sets the slider title; the portal also reflects it to the browser tab title
22110
+ * (`document.title`) — unlike `ParentManager.setTitle`, which only updates the in-layout `#pagetitle`.
22111
+ *
21947
22112
  * @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-application.html
21948
22113
  */
21949
22114
  async openSliderAppPage(params = {}) {