@bitrix24/b24jssdk 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-AI.md +6 -5
- package/README.md +2 -0
- package/dist/cjs/_virtual/_commonjsHelpers.cjs +19 -0
- package/dist/cjs/_virtual/_commonjsHelpers.cjs.map +1 -0
- package/dist/cjs/_virtual/protobuf.cjs +20 -0
- package/dist/cjs/_virtual/protobuf.cjs.map +1 -0
- package/dist/cjs/_virtual/protobuf2.cjs +14 -0
- package/dist/cjs/_virtual/protobuf2.cjs.map +1 -0
- package/dist/cjs/core/abstract-b24.cjs +357 -0
- package/dist/cjs/core/abstract-b24.cjs.map +1 -0
- package/dist/cjs/core/actions/abstract-action.cjs +26 -0
- package/dist/cjs/core/actions/abstract-action.cjs.map +1 -0
- package/dist/cjs/core/actions/abstract-batch.cjs +97 -0
- package/dist/cjs/core/actions/abstract-batch.cjs.map +1 -0
- package/dist/cjs/core/actions/manager.cjs +55 -0
- package/dist/cjs/core/actions/manager.cjs.map +1 -0
- package/dist/cjs/core/actions/v2/batch-by-chunk.cjs +95 -0
- package/dist/cjs/core/actions/v2/batch-by-chunk.cjs.map +1 -0
- package/dist/cjs/core/actions/v2/batch.cjs +128 -0
- package/dist/cjs/core/actions/v2/batch.cjs.map +1 -0
- package/dist/cjs/core/actions/v2/call-list.cjs +144 -0
- package/dist/cjs/core/actions/v2/call-list.cjs.map +1 -0
- package/dist/cjs/core/actions/v2/call.cjs +56 -0
- package/dist/cjs/core/actions/v2/call.cjs.map +1 -0
- package/dist/cjs/core/actions/v2/fetch-list.cjs +145 -0
- package/dist/cjs/core/actions/v2/fetch-list.cjs.map +1 -0
- package/dist/cjs/core/actions/v2/manager-v2.cjs +76 -0
- package/dist/cjs/core/actions/v2/manager-v2.cjs.map +1 -0
- package/dist/cjs/core/actions/v3/_keyset-paginate.cjs +69 -0
- package/dist/cjs/core/actions/v3/_keyset-paginate.cjs.map +1 -0
- package/dist/cjs/core/actions/v3/aggregate.cjs +96 -0
- package/dist/cjs/core/actions/v3/aggregate.cjs.map +1 -0
- package/dist/cjs/core/actions/v3/batch-by-chunk.cjs +93 -0
- package/dist/cjs/core/actions/v3/batch-by-chunk.cjs.map +1 -0
- package/dist/cjs/core/actions/v3/batch.cjs +122 -0
- package/dist/cjs/core/actions/v3/batch.cjs.map +1 -0
- package/dist/cjs/core/actions/v3/call-list.cjs +126 -0
- package/dist/cjs/core/actions/v3/call-list.cjs.map +1 -0
- package/dist/cjs/core/actions/v3/call-tail.cjs +118 -0
- package/dist/cjs/core/actions/v3/call-tail.cjs.map +1 -0
- package/dist/cjs/core/actions/v3/call.cjs +51 -0
- package/dist/cjs/core/actions/v3/call.cjs.map +1 -0
- package/dist/cjs/core/actions/v3/fetch-list.cjs +122 -0
- package/dist/cjs/core/actions/v3/fetch-list.cjs.map +1 -0
- package/dist/cjs/core/actions/v3/fetch-tail.cjs +112 -0
- package/dist/cjs/core/actions/v3/fetch-tail.cjs.map +1 -0
- package/dist/cjs/core/actions/v3/manager-v3.cjs +100 -0
- package/dist/cjs/core/actions/v3/manager-v3.cjs.map +1 -0
- package/dist/cjs/core/http/abstract-http.cjs +641 -0
- package/dist/cjs/core/http/abstract-http.cjs.map +1 -0
- package/dist/cjs/core/http/ajax-error.cjs +113 -0
- package/dist/cjs/core/http/ajax-error.cjs.map +1 -0
- package/dist/cjs/core/http/ajax-result.cjs +219 -0
- package/dist/cjs/core/http/ajax-result.cjs.map +1 -0
- package/dist/cjs/core/http/limiters/adaptive-delayer.cjs +137 -0
- package/dist/cjs/core/http/limiters/adaptive-delayer.cjs.map +1 -0
- package/dist/cjs/core/http/limiters/manager.cjs +373 -0
- package/dist/cjs/core/http/limiters/manager.cjs.map +1 -0
- package/dist/cjs/core/http/limiters/operating-limiter.cjs +173 -0
- package/dist/cjs/core/http/limiters/operating-limiter.cjs.map +1 -0
- package/dist/cjs/core/http/limiters/params-factory.cjs +124 -0
- package/dist/cjs/core/http/limiters/params-factory.cjs.map +1 -0
- package/dist/cjs/core/http/limiters/rate-limiter.cjs +404 -0
- package/dist/cjs/core/http/limiters/rate-limiter.cjs.map +1 -0
- package/dist/cjs/core/http/redact.cjs +85 -0
- package/dist/cjs/core/http/redact.cjs.map +1 -0
- package/dist/cjs/core/http/v2.cjs +85 -0
- package/dist/cjs/core/http/v2.cjs.map +1 -0
- package/dist/cjs/core/http/v3.cjs +82 -0
- package/dist/cjs/core/http/v3.cjs.map +1 -0
- package/dist/cjs/core/interaction/batch/abstract-interaction-batch.cjs +71 -0
- package/dist/cjs/core/interaction/batch/abstract-interaction-batch.cjs.map +1 -0
- package/dist/cjs/core/interaction/batch/parse-row.cjs +69 -0
- package/dist/cjs/core/interaction/batch/parse-row.cjs.map +1 -0
- package/dist/cjs/core/interaction/batch/processing/interface-strategy.cjs +87 -0
- package/dist/cjs/core/interaction/batch/processing/interface-strategy.cjs.map +1 -0
- package/dist/cjs/core/interaction/batch/processing/v2/abstract-processing.cjs +138 -0
- package/dist/cjs/core/interaction/batch/processing/v2/abstract-processing.cjs.map +1 -0
- package/dist/cjs/core/interaction/batch/processing/v2/as-array.cjs +34 -0
- package/dist/cjs/core/interaction/batch/processing/v2/as-array.cjs.map +1 -0
- package/dist/cjs/core/interaction/batch/processing/v2/as-object.cjs +34 -0
- package/dist/cjs/core/interaction/batch/processing/v2/as-object.cjs.map +1 -0
- package/dist/cjs/core/interaction/batch/processing/v3/abstract-processing.cjs +115 -0
- package/dist/cjs/core/interaction/batch/processing/v3/abstract-processing.cjs.map +1 -0
- package/dist/cjs/core/interaction/batch/processing/v3/as-array.cjs +34 -0
- package/dist/cjs/core/interaction/batch/processing/v3/as-array.cjs.map +1 -0
- package/dist/cjs/core/interaction/batch/processing/v3/as-object.cjs +34 -0
- package/dist/cjs/core/interaction/batch/processing/v3/as-object.cjs.map +1 -0
- package/dist/cjs/core/interaction/batch/v2.cjs +47 -0
- package/dist/cjs/core/interaction/batch/v2.cjs.map +1 -0
- package/dist/cjs/core/interaction/batch/v3.cjs +45 -0
- package/dist/cjs/core/interaction/batch/v3.cjs.map +1 -0
- package/dist/cjs/core/language/list.cjs +59 -0
- package/dist/cjs/core/language/list.cjs.map +1 -0
- package/dist/cjs/core/request-id-generator.cjs +44 -0
- package/dist/cjs/core/request-id-generator.cjs.map +1 -0
- package/dist/cjs/core/result.cjs +137 -0
- package/dist/cjs/core/result.cjs.map +1 -0
- package/dist/cjs/core/sdk-error.cjs +85 -0
- package/dist/cjs/core/sdk-error.cjs.map +1 -0
- package/dist/cjs/core/tools/abstract-tool.cjs +26 -0
- package/dist/cjs/core/tools/abstract-tool.cjs.map +1 -0
- package/dist/cjs/core/tools/healthcheck.cjs +50 -0
- package/dist/cjs/core/tools/healthcheck.cjs.map +1 -0
- package/dist/cjs/core/tools/manager.cjs +52 -0
- package/dist/cjs/core/tools/manager.cjs.map +1 -0
- package/dist/cjs/core/tools/ping.cjs +58 -0
- package/dist/cjs/core/tools/ping.cjs.map +1 -0
- package/dist/cjs/core/version-manager.cjs +57 -0
- package/dist/cjs/core/version-manager.cjs.map +1 -0
- package/dist/cjs/frame/auth.cjs +100 -0
- package/dist/cjs/frame/auth.cjs.map +1 -0
- package/dist/cjs/frame/b24.cjs +178 -0
- package/dist/cjs/frame/b24.cjs.map +1 -0
- package/dist/cjs/frame/dialog.cjs +120 -0
- package/dist/cjs/frame/dialog.cjs.map +1 -0
- package/dist/cjs/frame/frame.cjs +103 -0
- package/dist/cjs/frame/frame.cjs.map +1 -0
- package/dist/cjs/frame/message/commands.cjs +39 -0
- package/dist/cjs/frame/message/commands.cjs.map +1 -0
- package/dist/cjs/frame/message/controller.cjs +191 -0
- package/dist/cjs/frame/message/controller.cjs.map +1 -0
- package/dist/cjs/frame/options.cjs +108 -0
- package/dist/cjs/frame/options.cjs.map +1 -0
- package/dist/cjs/frame/parent.cjs +259 -0
- package/dist/cjs/frame/parent.cjs.map +1 -0
- package/dist/cjs/frame/placement.cjs +156 -0
- package/dist/cjs/frame/placement.cjs.map +1 -0
- package/dist/cjs/frame/slider.cjs +162 -0
- package/dist/cjs/frame/slider.cjs.map +1 -0
- package/dist/cjs/helper/abstract-helper.cjs +55 -0
- package/dist/cjs/helper/abstract-helper.cjs.map +1 -0
- package/dist/cjs/helper/app-manager.cjs +39 -0
- package/dist/cjs/helper/app-manager.cjs.map +1 -0
- package/dist/cjs/helper/currency-manager.cjs +215 -0
- package/dist/cjs/helper/currency-manager.cjs.map +1 -0
- package/dist/cjs/helper/helper-manager.cjs +397 -0
- package/dist/cjs/helper/helper-manager.cjs.map +1 -0
- package/dist/cjs/helper/license-manager.cjs +52 -0
- package/dist/cjs/helper/license-manager.cjs.map +1 -0
- package/dist/cjs/helper/options-manager.cjs +205 -0
- package/dist/cjs/helper/options-manager.cjs.map +1 -0
- package/dist/cjs/helper/payment-manager.cjs +35 -0
- package/dist/cjs/helper/payment-manager.cjs.map +1 -0
- package/dist/cjs/helper/profile-manager.cjs +35 -0
- package/dist/cjs/helper/profile-manager.cjs.map +1 -0
- package/dist/cjs/helper/use-b24-helper.cjs +85 -0
- package/dist/cjs/helper/use-b24-helper.cjs.map +1 -0
- package/dist/cjs/hook/auth.cjs +79 -0
- package/dist/cjs/hook/auth.cjs.map +1 -0
- package/dist/cjs/hook/b24.cjs +117 -0
- package/dist/cjs/hook/b24.cjs.map +1 -0
- package/dist/cjs/index.cjs +176 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +6415 -0
- package/dist/cjs/index.d.mts +6415 -0
- package/dist/cjs/index.d.ts +6415 -0
- package/dist/cjs/loader-b24frame.cjs +103 -0
- package/dist/cjs/loader-b24frame.cjs.map +1 -0
- package/dist/cjs/logger/abstract-logger.cjs +71 -0
- package/dist/cjs/logger/abstract-logger.cjs.map +1 -0
- package/dist/cjs/logger/browser.cjs +165 -0
- package/dist/cjs/logger/browser.cjs.map +1 -0
- package/dist/cjs/logger/formatter/abstract-formatter.cjs +36 -0
- package/dist/cjs/logger/formatter/abstract-formatter.cjs.map +1 -0
- package/dist/cjs/logger/formatter/json-formatter.cjs +36 -0
- package/dist/cjs/logger/formatter/json-formatter.cjs.map +1 -0
- package/dist/cjs/logger/formatter/line-formatter.cjs +43 -0
- package/dist/cjs/logger/formatter/line-formatter.cjs.map +1 -0
- package/dist/cjs/logger/formatter/telegram-formatter.cjs +105 -0
- package/dist/cjs/logger/formatter/telegram-formatter.cjs.map +1 -0
- package/dist/cjs/logger/handler/abstract-handler.cjs +41 -0
- package/dist/cjs/logger/handler/abstract-handler.cjs.map +1 -0
- package/dist/cjs/logger/handler/consola-adapter.cjs +64 -0
- package/dist/cjs/logger/handler/consola-adapter.cjs.map +1 -0
- package/dist/cjs/logger/handler/console-handler.cjs +100 -0
- package/dist/cjs/logger/handler/console-handler.cjs.map +1 -0
- package/dist/cjs/logger/handler/console-v2-handler.cjs +53 -0
- package/dist/cjs/logger/handler/console-v2-handler.cjs.map +1 -0
- package/dist/cjs/logger/handler/memory-handler.cjs +50 -0
- package/dist/cjs/logger/handler/memory-handler.cjs.map +1 -0
- package/dist/cjs/logger/handler/stream-handler.cjs +75 -0
- package/dist/cjs/logger/handler/stream-handler.cjs.map +1 -0
- package/dist/cjs/logger/handler/telegram-handler.cjs +159 -0
- package/dist/cjs/logger/handler/telegram-handler.cjs.map +1 -0
- package/dist/cjs/logger/handler/winston-adapter.cjs +59 -0
- package/dist/cjs/logger/handler/winston-adapter.cjs.map +1 -0
- package/dist/cjs/logger/logger-factory.cjs +69 -0
- package/dist/cjs/logger/logger-factory.cjs.map +1 -0
- package/dist/cjs/logger/logger.cjs +78 -0
- package/dist/cjs/logger/logger.cjs.map +1 -0
- package/dist/cjs/logger/null-logger.cjs +34 -0
- package/dist/cjs/logger/null-logger.cjs.map +1 -0
- package/dist/cjs/logger/processor/memory-usage-processor.cjs +22 -0
- package/dist/cjs/logger/processor/memory-usage-processor.cjs.map +1 -0
- package/dist/cjs/logger/processor/pid-processor.cjs +22 -0
- package/dist/cjs/logger/processor/pid-processor.cjs.map +1 -0
- package/dist/cjs/oauth/auth.cjs +214 -0
- package/dist/cjs/oauth/auth.cjs.map +1 -0
- package/dist/cjs/oauth/b24.cjs +119 -0
- package/dist/cjs/oauth/b24.cjs.map +1 -0
- package/dist/cjs/oauth/refresh-token-error.cjs +22 -0
- package/dist/cjs/oauth/refresh-token-error.cjs.map +1 -0
- package/dist/cjs/pullClient/abstract-connector.cjs +80 -0
- package/dist/cjs/pullClient/abstract-connector.cjs.map +1 -0
- package/dist/cjs/pullClient/channel-manager.cjs +91 -0
- package/dist/cjs/pullClient/channel-manager.cjs.map +1 -0
- package/dist/cjs/pullClient/client.cjs +2177 -0
- package/dist/cjs/pullClient/client.cjs.map +1 -0
- package/dist/cjs/pullClient/errors.cjs +34 -0
- package/dist/cjs/pullClient/errors.cjs.map +1 -0
- package/dist/cjs/pullClient/json-rpc.cjs +213 -0
- package/dist/cjs/pullClient/json-rpc.cjs.map +1 -0
- package/dist/cjs/pullClient/long-polling-connector.cjs +159 -0
- package/dist/cjs/pullClient/long-polling-connector.cjs.map +1 -0
- package/dist/cjs/pullClient/protobuf/index.cjs +22 -0
- package/dist/cjs/pullClient/protobuf/index.cjs.map +1 -0
- package/dist/cjs/pullClient/protobuf/model.cjs +1060 -0
- package/dist/cjs/pullClient/protobuf/model.cjs.map +1 -0
- package/dist/cjs/pullClient/protobuf/protobuf.cjs +4655 -0
- package/dist/cjs/pullClient/protobuf/protobuf.cjs.map +1 -0
- package/dist/cjs/pullClient/shared-config.cjs +135 -0
- package/dist/cjs/pullClient/shared-config.cjs.map +1 -0
- package/dist/cjs/pullClient/storage-manager.cjs +74 -0
- package/dist/cjs/pullClient/storage-manager.cjs.map +1 -0
- package/dist/cjs/pullClient/web-socket-connector.cjs +131 -0
- package/dist/cjs/pullClient/web-socket-connector.cjs.map +1 -0
- package/dist/cjs/tools/batch-ref-v3.cjs +54 -0
- package/dist/cjs/tools/batch-ref-v3.cjs.map +1 -0
- package/dist/cjs/tools/browser.cjs +156 -0
- package/dist/cjs/tools/browser.cjs.map +1 -0
- package/dist/cjs/tools/environment.cjs +32 -0
- package/dist/cjs/tools/environment.cjs.map +1 -0
- package/dist/cjs/tools/filter-v3.cjs +139 -0
- package/dist/cjs/tools/filter-v3.cjs.map +1 -0
- package/dist/cjs/tools/formatters/iban.cjs +307 -0
- package/dist/cjs/tools/formatters/iban.cjs.map +1 -0
- package/dist/cjs/tools/formatters/numbers.cjs +68 -0
- package/dist/cjs/tools/formatters/numbers.cjs.map +1 -0
- package/dist/cjs/tools/index.cjs +42 -0
- package/dist/cjs/tools/index.cjs.map +1 -0
- package/dist/cjs/tools/scroll-size.cjs +29 -0
- package/dist/cjs/tools/scroll-size.cjs.map +1 -0
- package/dist/cjs/tools/text.cjs +210 -0
- package/dist/cjs/tools/text.cjs.map +1 -0
- package/dist/cjs/tools/type.cjs +339 -0
- package/dist/cjs/tools/type.cjs.map +1 -0
- package/dist/cjs/tools/use-formatters.cjs +462 -0
- package/dist/cjs/tools/use-formatters.cjs.map +1 -0
- package/dist/cjs/tools/uuidv7.cjs +58 -0
- package/dist/cjs/tools/uuidv7.cjs.map +1 -0
- package/dist/cjs/types/b24-helper.cjs +62 -0
- package/dist/cjs/types/b24-helper.cjs.map +1 -0
- package/dist/cjs/types/b24.cjs +18 -0
- package/dist/cjs/types/b24.cjs.map +1 -0
- package/dist/cjs/types/bizproc/index.cjs +195 -0
- package/dist/cjs/types/bizproc/index.cjs.map +1 -0
- package/dist/cjs/types/catalog/index.cjs +39 -0
- package/dist/cjs/types/catalog/index.cjs.map +1 -0
- package/dist/cjs/types/common.cjs +33 -0
- package/dist/cjs/types/common.cjs.map +1 -0
- package/dist/cjs/types/crm/entity-type.cjs +62 -0
- package/dist/cjs/types/crm/entity-type.cjs.map +1 -0
- package/dist/cjs/types/crm/productrow.cjs +19 -0
- package/dist/cjs/types/crm/productrow.cjs.map +1 -0
- package/dist/cjs/types/logger.cjs +24 -0
- package/dist/cjs/types/logger.cjs.map +1 -0
- package/dist/cjs/types/pull.cjs +94 -0
- package/dist/cjs/types/pull.cjs.map +1 -0
- package/dist/esm/_virtual/_commonjsHelpers.mjs +1 -1
- package/dist/esm/_virtual/protobuf.mjs +1 -1
- package/dist/esm/_virtual/protobuf2.mjs +1 -1
- package/dist/esm/core/abstract-b24.mjs +1 -1
- package/dist/esm/core/actions/abstract-action.mjs +1 -1
- package/dist/esm/core/actions/abstract-batch.mjs +1 -1
- package/dist/esm/core/actions/manager.mjs +1 -1
- package/dist/esm/core/actions/v2/batch-by-chunk.mjs +1 -1
- package/dist/esm/core/actions/v2/batch.mjs +1 -1
- package/dist/esm/core/actions/v2/call-list.mjs +17 -10
- package/dist/esm/core/actions/v2/call-list.mjs.map +1 -1
- package/dist/esm/core/actions/v2/call.mjs +1 -15
- package/dist/esm/core/actions/v2/call.mjs.map +1 -1
- package/dist/esm/core/actions/v2/fetch-list.mjs +17 -10
- package/dist/esm/core/actions/v2/fetch-list.mjs.map +1 -1
- package/dist/esm/core/actions/v2/manager-v2.mjs +6 -6
- package/dist/esm/core/actions/v2/manager-v2.mjs.map +1 -1
- package/dist/esm/core/actions/v3/_keyset-paginate.mjs +66 -0
- package/dist/esm/core/actions/v3/_keyset-paginate.mjs.map +1 -0
- package/dist/esm/core/actions/v3/aggregate.mjs +94 -0
- package/dist/esm/core/actions/v3/aggregate.mjs.map +1 -0
- package/dist/esm/core/actions/v3/batch-by-chunk.mjs +1 -1
- package/dist/esm/core/actions/v3/batch.mjs +1 -10
- package/dist/esm/core/actions/v3/batch.mjs.map +1 -1
- package/dist/esm/core/actions/v3/call-list.mjs +40 -47
- package/dist/esm/core/actions/v3/call-list.mjs.map +1 -1
- package/dist/esm/core/actions/v3/call-tail.mjs +116 -0
- package/dist/esm/core/actions/v3/call-tail.mjs.map +1 -0
- package/dist/esm/core/actions/v3/call.mjs +1 -10
- package/dist/esm/core/actions/v3/call.mjs.map +1 -1
- package/dist/esm/core/actions/v3/fetch-list.mjs +34 -44
- package/dist/esm/core/actions/v3/fetch-list.mjs.map +1 -1
- package/dist/esm/core/actions/v3/fetch-tail.mjs +110 -0
- package/dist/esm/core/actions/v3/fetch-tail.mjs.map +1 -0
- package/dist/esm/core/actions/v3/manager-v3.mjs +30 -6
- package/dist/esm/core/actions/v3/manager-v3.mjs.map +1 -1
- package/dist/esm/core/http/abstract-http.mjs +96 -21
- package/dist/esm/core/http/abstract-http.mjs.map +1 -1
- package/dist/esm/core/http/ajax-error.mjs +1 -1
- package/dist/esm/core/http/ajax-result.mjs +9 -8
- package/dist/esm/core/http/ajax-result.mjs.map +1 -1
- package/dist/esm/core/http/limiters/adaptive-delayer.mjs +1 -1
- package/dist/esm/core/http/limiters/manager.mjs +2 -1
- package/dist/esm/core/http/limiters/manager.mjs.map +1 -1
- package/dist/esm/core/http/limiters/operating-limiter.mjs +1 -1
- package/dist/esm/core/http/limiters/params-factory.mjs +1 -1
- package/dist/esm/core/http/limiters/rate-limiter.mjs +1 -1
- package/dist/esm/core/http/redact.mjs +41 -13
- package/dist/esm/core/http/redact.mjs.map +1 -1
- package/dist/esm/core/http/v2.mjs +1 -18
- package/dist/esm/core/http/v2.mjs.map +1 -1
- package/dist/esm/core/http/v3.mjs +1 -15
- package/dist/esm/core/http/v3.mjs.map +1 -1
- package/dist/esm/core/interaction/batch/abstract-interaction-batch.mjs +1 -1
- package/dist/esm/core/interaction/batch/parse-row.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/interface-strategy.mjs +44 -1
- package/dist/esm/core/interaction/batch/processing/interface-strategy.mjs.map +1 -1
- package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs +7 -6
- package/dist/esm/core/interaction/batch/processing/v2/abstract-processing.mjs.map +1 -1
- package/dist/esm/core/interaction/batch/processing/v2/as-array.mjs +3 -3
- package/dist/esm/core/interaction/batch/processing/v2/as-array.mjs.map +1 -1
- package/dist/esm/core/interaction/batch/processing/v2/as-object.mjs +1 -1
- package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs +7 -19
- package/dist/esm/core/interaction/batch/processing/v3/abstract-processing.mjs.map +1 -1
- package/dist/esm/core/interaction/batch/processing/v3/as-array.mjs +3 -3
- package/dist/esm/core/interaction/batch/processing/v3/as-array.mjs.map +1 -1
- package/dist/esm/core/interaction/batch/processing/v3/as-object.mjs +1 -1
- package/dist/esm/core/interaction/batch/v2.mjs +1 -1
- package/dist/esm/core/interaction/batch/v3.mjs +1 -1
- package/dist/esm/core/language/list.mjs +1 -1
- package/dist/esm/core/request-id-generator.mjs +1 -1
- package/dist/esm/core/result.mjs +35 -1
- package/dist/esm/core/result.mjs.map +1 -1
- package/dist/esm/core/sdk-error.mjs +1 -1
- package/dist/esm/core/tools/abstract-tool.mjs +1 -1
- package/dist/esm/core/tools/healthcheck.mjs +1 -1
- package/dist/esm/core/tools/manager.mjs +3 -3
- package/dist/esm/core/tools/manager.mjs.map +1 -1
- package/dist/esm/core/tools/ping.mjs +1 -1
- package/dist/esm/core/version-manager.mjs +19 -80
- package/dist/esm/core/version-manager.mjs.map +1 -1
- package/dist/esm/frame/auth.mjs +1 -1
- package/dist/esm/frame/b24.mjs +8 -2
- package/dist/esm/frame/b24.mjs.map +1 -1
- package/dist/esm/frame/dialog.mjs +1 -1
- package/dist/esm/frame/frame.mjs +1 -1
- package/dist/esm/frame/message/commands.mjs +1 -1
- package/dist/esm/frame/message/controller.mjs +17 -6
- package/dist/esm/frame/message/controller.mjs.map +1 -1
- package/dist/esm/frame/options.mjs +1 -1
- package/dist/esm/frame/parent.mjs +6 -2
- package/dist/esm/frame/parent.mjs.map +1 -1
- package/dist/esm/frame/placement.mjs +1 -1
- package/dist/esm/frame/slider.mjs +5 -1
- package/dist/esm/frame/slider.mjs.map +1 -1
- package/dist/esm/helper/abstract-helper.mjs +1 -1
- package/dist/esm/helper/app-manager.mjs +1 -1
- package/dist/esm/helper/currency-manager.mjs +1 -1
- package/dist/esm/helper/helper-manager.mjs +1 -1
- package/dist/esm/helper/license-manager.mjs +1 -1
- package/dist/esm/helper/options-manager.mjs +1 -1
- package/dist/esm/helper/payment-manager.mjs +1 -1
- package/dist/esm/helper/profile-manager.mjs +1 -1
- package/dist/esm/helper/use-b24-helper.mjs +1 -1
- package/dist/esm/hook/auth.mjs +1 -1
- package/dist/esm/hook/b24.mjs +3 -3
- package/dist/esm/hook/b24.mjs.map +1 -1
- package/dist/esm/index.d.mts +501 -49
- package/dist/esm/index.d.ts +501 -49
- package/dist/esm/index.mjs +3 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/loader-b24frame.mjs +1 -1
- package/dist/esm/logger/abstract-logger.mjs +1 -1
- package/dist/esm/logger/browser.mjs +1 -1
- package/dist/esm/logger/formatter/abstract-formatter.mjs +1 -1
- package/dist/esm/logger/formatter/json-formatter.mjs +1 -1
- package/dist/esm/logger/formatter/line-formatter.mjs +1 -1
- package/dist/esm/logger/formatter/telegram-formatter.mjs +1 -1
- package/dist/esm/logger/handler/abstract-handler.mjs +1 -1
- package/dist/esm/logger/handler/consola-adapter.mjs +1 -1
- package/dist/esm/logger/handler/console-handler.mjs +1 -1
- package/dist/esm/logger/handler/console-v2-handler.mjs +1 -1
- package/dist/esm/logger/handler/memory-handler.mjs +1 -1
- package/dist/esm/logger/handler/stream-handler.mjs +1 -1
- package/dist/esm/logger/handler/telegram-handler.mjs +1 -1
- package/dist/esm/logger/handler/winston-adapter.mjs +1 -1
- package/dist/esm/logger/logger-factory.mjs +1 -1
- package/dist/esm/logger/logger.mjs +1 -1
- package/dist/esm/logger/null-logger.mjs +1 -1
- package/dist/esm/logger/processor/memory-usage-processor.mjs +1 -1
- package/dist/esm/logger/processor/pid-processor.mjs +1 -1
- package/dist/esm/oauth/auth.mjs +13 -16
- package/dist/esm/oauth/auth.mjs.map +1 -1
- package/dist/esm/oauth/b24.mjs +1 -1
- package/dist/esm/oauth/refresh-token-error.mjs +1 -1
- package/dist/esm/pullClient/abstract-connector.mjs +1 -1
- package/dist/esm/pullClient/channel-manager.mjs +1 -1
- package/dist/esm/pullClient/client.mjs +141 -30
- package/dist/esm/pullClient/client.mjs.map +1 -1
- package/dist/esm/pullClient/errors.mjs +1 -1
- package/dist/esm/pullClient/json-rpc.mjs +5 -4
- package/dist/esm/pullClient/json-rpc.mjs.map +1 -1
- package/dist/esm/pullClient/long-polling-connector.mjs +1 -1
- package/dist/esm/pullClient/protobuf/index.mjs +1 -1
- package/dist/esm/pullClient/protobuf/model.mjs +1 -1
- package/dist/esm/pullClient/protobuf/protobuf.mjs +1 -1
- package/dist/esm/pullClient/shared-config.mjs +1 -1
- package/dist/esm/pullClient/storage-manager.mjs +1 -1
- package/dist/esm/pullClient/web-socket-connector.mjs +1 -1
- package/dist/esm/tools/batch-ref-v3.mjs +52 -0
- package/dist/esm/tools/batch-ref-v3.mjs.map +1 -0
- package/dist/esm/tools/browser.mjs +1 -1
- package/dist/esm/tools/environment.mjs +1 -1
- package/dist/esm/tools/filter-v3.mjs +137 -0
- package/dist/esm/tools/filter-v3.mjs.map +1 -0
- package/dist/esm/tools/formatters/iban.mjs +1 -1
- package/dist/esm/tools/formatters/numbers.mjs +1 -1
- package/dist/esm/tools/index.mjs +1 -1
- package/dist/esm/tools/scroll-size.mjs +1 -1
- package/dist/esm/tools/text.mjs +1 -1
- package/dist/esm/tools/type.mjs +1 -1
- package/dist/esm/tools/use-formatters.mjs +1 -1
- package/dist/esm/tools/uuidv7.mjs +1 -1
- package/dist/esm/types/b24-helper.mjs +1 -1
- package/dist/esm/types/b24.mjs +1 -1
- package/dist/esm/types/bizproc/index.mjs +1 -1
- package/dist/esm/types/catalog/index.mjs +1 -1
- package/dist/esm/types/common.mjs +1 -1
- package/dist/esm/types/crm/entity-type.mjs +1 -1
- package/dist/esm/types/crm/productrow.mjs +1 -1
- package/dist/esm/types/logger.mjs +1 -1
- package/dist/esm/types/pull.mjs +1 -1
- package/dist/umd/index.js +1384 -680
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.min.js +26 -26
- package/dist/umd/index.min.js.map +1 -1
- package/dist/umd/package.json +3 -0
- package/package.json +12 -4
|
@@ -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
|
|
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 { AbstractAction } from '../abstract-action'\nimport { SdkError } from '../../sdk-error'\nimport { keysetPaginate, KeysetPaginationError } from './_keyset-paginate'\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 try {\n yield* keysetPaginate<T>(this._b24, this._logger, {\n method: options.method,\n requestId: options.requestId,\n customKeyForResult,\n initialCursor: 0,\n // Emulated keyset: append the `[cursorIdKey, '>', cursor]` page filter.\n buildParams: cursor => ({ ...requestParams, filter: [...requestParams.filter, [cursorIdKey, '>', cursor]] }),\n // Advance by the numeric id read from the last item via `idKey`. A\n // non-numeric value (almost always an `idKey` that doesn't match the\n // response field — e.g. sorting by `ID` while the response carries a\n // lowercase `id`) stops the walk instead of silently truncating.\n readNextCursor: (lastItem) => {\n const value = Number.parseInt(lastItem[idKey], 10)\n return Number.isFinite(value) ? value : null\n },\n noCursorWarning: `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 errorLabel: 'fetchListMethod'\n })\n } catch (error) {\n if (error instanceof KeysetPaginationError) {\n throw new SdkError({\n code: 'JSSDK_CORE_B24_FETCH_LIST_METHOD_API_V3',\n description: `API Error: ${error.messages.join('; ')}`,\n status: 500\n })\n }\n throw error\n }\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;AA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AA,CAAS,QAAA,CAAS,KAAK,GAAG,EAAE,CAAA;AACjD,UAAA,OAAO,MAAA,CAAO,QAAA,CAAS,KAAK,CAAA,GAAI,KAAA,GAAQ,IAAA;AAAA,QAC1C,CAAA,EAHgB,gBAAA,CAAA;AAAA,QAIhB,eAAA,EAAiB,+GAA0G,KAAK,CAAA,gKAAA,CAAA;AAAA,QAChI,UAAA,EAAY;AAAA,OACb,CAAA;AAAA,IACH,SAAS,KAAA,EAAO;AACd,MAAA,IAAI,iBAAiB,qBAAA,EAAuB;AAC1C,QAAA,MAAM,IAAI,QAAA,CAAS;AAAA,UACjB,IAAA,EAAM,yCAAA;AAAA,UACN,aAAa,CAAA,WAAA,EAAc,KAAA,CAAM,QAAA,CAAS,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA;AAAA,UACpD,MAAA,EAAQ;AAAA,SACT,CAAA;AAAA,MACH;AACA,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF;AACF;;;;"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @package @bitrix24/b24jssdk
|
|
3
|
+
* @version 2.0.0
|
|
4
|
+
* @copyright (c) 2026 Bitrix24
|
|
5
|
+
* @license MIT
|
|
6
|
+
* @see https://github.com/bitrix24/b24jssdk
|
|
7
|
+
* @see https://bitrix24.github.io/b24jssdk/
|
|
8
|
+
*/
|
|
9
|
+
import { AbstractAction } from '../abstract-action.mjs';
|
|
10
|
+
import { SdkError } from '../../sdk-error.mjs';
|
|
11
|
+
import { keysetPaginate, KeysetPaginationError } from './_keyset-paginate.mjs';
|
|
12
|
+
|
|
13
|
+
var __defProp = Object.defineProperty;
|
|
14
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
15
|
+
class FetchTailV3 extends AbstractAction {
|
|
16
|
+
static {
|
|
17
|
+
__name(this, "FetchTailV3");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Streams every record of a `tail` method as chunks, advancing the keyset
|
|
21
|
+
* cursor between requests.
|
|
22
|
+
*
|
|
23
|
+
* @template T - The type of items in the returned arrays (default is `unknown`).
|
|
24
|
+
*
|
|
25
|
+
* @param {ActionFetchTailV3} options - parameters for executing the request.
|
|
26
|
+
* - `method: string` - A REST API `tail` method name (for example: `main.eventlog.tail`).
|
|
27
|
+
* - `params?: Omit<TypeCallParams, 'pagination' | 'order' | 'cursor'>` - Request parameters.
|
|
28
|
+
* Use `filter` and `select` to control the selection. `pagination`, `order` and `cursor`
|
|
29
|
+
* are managed by this helper and must not be passed. The cursor field must NOT be used in `filter`.
|
|
30
|
+
* - `cursorField?: string` - The DTO field that drives the cursor. Must be monotonic and
|
|
31
|
+
* preferably unique, and present in `select`. Default is `id`.
|
|
32
|
+
* - `order?: 'ASC' | 'DESC'` - Cursor direction. Default is `ASC`. For `DESC` you MUST pass
|
|
33
|
+
* `initialValue` (the server pages by `field < value`, so the default `0` returns nothing).
|
|
34
|
+
* - `customKeyForResult?: string` - The key the response groups rows under. Default is `items`.
|
|
35
|
+
* - `requestId?: string` - Unique request identifier for tracking.
|
|
36
|
+
* - `limit?: number` - How many records to retrieve at a time. Default is `50`. Maximum is `1000`.
|
|
37
|
+
* - `initialValue?: number | string` - Cursor start value for the first page. Default is `0`
|
|
38
|
+
* (valid for ascending numeric fields); required for `DESC` and for non-numeric fields.
|
|
39
|
+
*
|
|
40
|
+
* @returns {AsyncGenerator<T[]>} An async generator that yields chunks of data as arrays of type `T`.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* const generator = b24.actions.v3.fetchTail.make<{ id: string }>({
|
|
44
|
+
* method: 'main.eventlog.tail',
|
|
45
|
+
* params: { select: ['id', 'auditType'] },
|
|
46
|
+
* cursorField: 'id',
|
|
47
|
+
* customKeyForResult: 'items'
|
|
48
|
+
* })
|
|
49
|
+
* for await (const chunk of generator) {
|
|
50
|
+
* console.log(`Processing ${chunk.length} items`)
|
|
51
|
+
* }
|
|
52
|
+
*/
|
|
53
|
+
async *make(options) {
|
|
54
|
+
const batchSize = options?.limit ?? 50;
|
|
55
|
+
const cursorField = options?.cursorField ?? "id";
|
|
56
|
+
const order = options?.order ?? "ASC";
|
|
57
|
+
const customKeyForResult = options?.customKeyForResult ?? "items";
|
|
58
|
+
const params = options?.params ?? {};
|
|
59
|
+
if (/desc/i.test(order) && options?.initialValue === void 0) {
|
|
60
|
+
throw new SdkError({
|
|
61
|
+
code: "JSSDK_CORE_B24_FETCH_TAIL_DESC_REQUIRES_INITIAL_VALUE",
|
|
62
|
+
description: 'fetchTail.make: order "DESC" requires an explicit `initialValue` (the server pages by `field < value`, so the default 0 returns nothing). Pass `initialValue` set to the type maximum / newest value.',
|
|
63
|
+
status: 500
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (Array.isArray(params["filter"]) && params["filter"].some((c) => Array.isArray(c) && c[0] === cursorField)) {
|
|
67
|
+
this._logger.warning(`fetchTail.make: the cursor field "${cursorField}" must not appear in \`filter\` \u2014 the server orders and pages by it and will reject a filter on the same field (INVALIDFILTEREXCEPTION). Remove it from \`filter\`.`);
|
|
68
|
+
}
|
|
69
|
+
let select = params["select"];
|
|
70
|
+
if (Array.isArray(select)) {
|
|
71
|
+
if (!select.includes(cursorField)) {
|
|
72
|
+
select = [...select, cursorField];
|
|
73
|
+
}
|
|
74
|
+
} else if (cursorField !== "id") {
|
|
75
|
+
this._logger.warning(`fetchTail.make: no \`select\` provided with a non-default cursorField "${cursorField}" \u2014 make sure it is in the server's default field set, otherwise pass \`select\` including "${cursorField}" so the cursor can advance.`);
|
|
76
|
+
}
|
|
77
|
+
const { select: _ignoredSelect, ...restParams } = params;
|
|
78
|
+
try {
|
|
79
|
+
yield* keysetPaginate(this._b24, this._logger, {
|
|
80
|
+
method: options.method,
|
|
81
|
+
requestId: options.requestId,
|
|
82
|
+
customKeyForResult,
|
|
83
|
+
initialCursor: options?.initialValue ?? 0,
|
|
84
|
+
// Native keyset: drive the server's `cursor: { field, value, order, limit }`.
|
|
85
|
+
buildParams: /* @__PURE__ */ __name((cursor) => ({
|
|
86
|
+
...restParams,
|
|
87
|
+
...select ? { select } : {},
|
|
88
|
+
cursor: { field: cursorField, value: cursor, order, limit: batchSize }
|
|
89
|
+
}), "buildParams"),
|
|
90
|
+
// Advance by the raw cursor-field value from the last item; a missing
|
|
91
|
+
// value (cursorField not selected / wrong name) stops the walk.
|
|
92
|
+
readNextCursor: /* @__PURE__ */ __name((lastItem) => lastItem[cursorField] ?? null, "readNextCursor"),
|
|
93
|
+
noCursorWarning: `fetchTail.make: pagination stops here \u2014 no value could be read from the returned items via cursorField "${cursorField}". Make sure cursorField matches a field present in the response (and in \`select\`).`,
|
|
94
|
+
errorLabel: "fetchTailMethod"
|
|
95
|
+
});
|
|
96
|
+
} catch (error) {
|
|
97
|
+
if (error instanceof KeysetPaginationError) {
|
|
98
|
+
throw new SdkError({
|
|
99
|
+
code: "JSSDK_CORE_B24_FETCH_TAIL_METHOD_API_V3",
|
|
100
|
+
description: `API Error: ${error.messages.join("; ")}`,
|
|
101
|
+
status: 500
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { FetchTailV3 };
|
|
110
|
+
//# sourceMappingURL=fetch-tail.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-tail.mjs","sources":["../../../../../src/core/actions/v3/fetch-tail.ts"],"sourcesContent":["import type { ActionOptions } from '../abstract-action'\nimport type { TypeCallParams } from '../../../types/http'\nimport { AbstractAction } from '../abstract-action'\nimport { SdkError } from '../../sdk-error'\nimport { keysetPaginate, KeysetPaginationError } from './_keyset-paginate'\n\nexport type ActionFetchTailV3 = ActionOptions & {\n method: string\n params?: Omit<TypeCallParams, 'pagination' | 'order' | 'cursor'>\n cursorField?: string\n order?: 'ASC' | 'DESC' | 'asc' | 'desc' | string\n customKeyForResult?: string\n requestId?: string\n limit?: number\n initialValue?: number | string\n}\n\n/**\n * Calls a REST API `tail` method (native keyset cursor) and returns an async\n * generator for efficient large data retrieval. `restApi:v3`\n *\n * Unlike `fetchList`, which emulates keyset pagination on top of the `list`\n * action by injecting a `[field, '>', n]` filter, this helper drives the server\n * `tail` action with its native `cursor: { field, value, order, limit }`\n * parameter (see the v3 reference §6.2). The server itself adds `field > value`\n * (asc) / `field < value` (desc) and sorts by `field`, so the cursor field\n * MUST NOT appear in `filter` (the server rejects it with\n * `INVALIDFILTEREXCEPTION`).\n */\nexport class FetchTailV3 extends AbstractAction {\n /**\n * Streams every record of a `tail` method as chunks, advancing the keyset\n * cursor between requests.\n *\n * @template T - The type of items in the returned arrays (default is `unknown`).\n *\n * @param {ActionFetchTailV3} options - parameters for executing the request.\n * - `method: string` - A REST API `tail` method name (for example: `main.eventlog.tail`).\n * - `params?: Omit<TypeCallParams, 'pagination' | 'order' | 'cursor'>` - Request parameters.\n * Use `filter` and `select` to control the selection. `pagination`, `order` and `cursor`\n * are managed by this helper and must not be passed. The cursor field must NOT be used in `filter`.\n * - `cursorField?: string` - The DTO field that drives the cursor. Must be monotonic and\n * preferably unique, and present in `select`. Default is `id`.\n * - `order?: 'ASC' | 'DESC'` - Cursor direction. Default is `ASC`. For `DESC` you MUST pass\n * `initialValue` (the server pages by `field < value`, so the default `0` returns nothing).\n * - `customKeyForResult?: string` - The key the response groups rows under. Default is `items`.\n * - `requestId?: string` - Unique request identifier for tracking.\n * - `limit?: number` - How many records to retrieve at a time. Default is `50`. Maximum is `1000`.\n * - `initialValue?: number | string` - Cursor start value for the first page. Default is `0`\n * (valid for ascending numeric fields); required for `DESC` and for non-numeric fields.\n *\n * @returns {AsyncGenerator<T[]>} An async generator that yields chunks of data as arrays of type `T`.\n *\n * @example\n * const generator = b24.actions.v3.fetchTail.make<{ id: string }>({\n * method: 'main.eventlog.tail',\n * params: { select: ['id', 'auditType'] },\n * cursorField: 'id',\n * customKeyForResult: 'items'\n * })\n * for await (const chunk of generator) {\n * console.log(`Processing ${chunk.length} items`)\n * }\n */\n public override async* make<T = unknown>(options: ActionFetchTailV3): AsyncGenerator<T[]> {\n const batchSize = options?.limit ?? 50\n const cursorField = options?.cursorField ?? 'id'\n const order = options?.order ?? 'ASC'\n const customKeyForResult = options?.customKeyForResult ?? 'items'\n const params = options?.params ?? {}\n\n // DESC keyset needs an explicit start: the server pages by `field < value`,\n // so the default first-page value 0 would match nothing for a non-negative\n // field. Require `initialValue` (the type maximum / newest value) for DESC.\n if (/desc/i.test(order) && options?.initialValue === undefined) {\n throw new SdkError({\n code: 'JSSDK_CORE_B24_FETCH_TAIL_DESC_REQUIRES_INITIAL_VALUE',\n description: 'fetchTail.make: order \"DESC\" requires an explicit `initialValue` (the server pages by `field < value`, so the default 0 returns nothing). Pass `initialValue` set to the type maximum / newest value.',\n status: 500\n })\n }\n\n // The cursor field cannot also live in `filter` — the server forces ordering\n // and the `> value` condition on it and rejects a duplicate with\n // INVALIDFILTEREXCEPTION. Warn instead of letting the server 400. (Detection\n // covers only the short-form `[field, op, value]` triples the SDK emits.)\n if (Array.isArray(params['filter']) && params['filter'].some((c: any) => Array.isArray(c) && c[0] === cursorField)) {\n this._logger.warning(`fetchTail.make: the cursor field \"${cursorField}\" must not appear in \\`filter\\` — the server orders and pages by it and will reject a filter on the same field (INVALIDFILTEREXCEPTION). Remove it from \\`filter\\`.`)\n }\n\n // The cursor field must be readable in the response to advance. Append it to\n // an explicit `select`; when `select` is omitted we rely on the server's\n // default field set — warn for a non-default cursorField, which may not be\n // in those defaults (the per-page guard below would otherwise stop silently).\n let select = params['select'] as string[] | undefined\n if (Array.isArray(select)) {\n if (!select.includes(cursorField)) {\n select = [...select, cursorField]\n }\n } else if (cursorField !== 'id') {\n this._logger.warning(`fetchTail.make: no \\`select\\` provided with a non-default cursorField \"${cursorField}\" — make sure it is in the server's default field set, otherwise pass \\`select\\` including \"${cursorField}\" so the cursor can advance.`)\n }\n\n const { select: _ignoredSelect, ...restParams } = params as TypeCallParams\n\n try {\n yield* keysetPaginate<T>(this._b24, this._logger, {\n method: options.method,\n requestId: options.requestId,\n customKeyForResult,\n initialCursor: options?.initialValue ?? 0,\n // Native keyset: drive the server's `cursor: { field, value, order, limit }`.\n buildParams: cursor => ({\n ...restParams,\n ...(select ? { select } : {}),\n cursor: { field: cursorField, value: cursor, order, limit: batchSize }\n }),\n // Advance by the raw cursor-field value from the last item; a missing\n // value (cursorField not selected / wrong name) stops the walk.\n readNextCursor: lastItem => lastItem[cursorField] ?? null,\n noCursorWarning: `fetchTail.make: pagination stops here — no value could be read from the returned items via cursorField \"${cursorField}\". Make sure cursorField matches a field present in the response (and in \\`select\\`).`,\n errorLabel: 'fetchTailMethod'\n })\n } catch (error) {\n if (error instanceof KeysetPaginationError) {\n throw new SdkError({\n code: 'JSSDK_CORE_B24_FETCH_TAIL_METHOD_API_V3',\n description: `API Error: ${error.messages.join('; ')}`,\n status: 500\n })\n }\n throw error\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA6BO,MAAM,oBAAoB,cAAA,CAAe;AAAA,EA7BhD;AA6BgD,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,EAmC9C,OAAuB,KAAkB,OAAA,EAAiD;AACxF,IAAA,MAAM,SAAA,GAAY,SAAS,KAAA,IAAS,EAAA;AACpC,IAAA,MAAM,WAAA,GAAc,SAAS,WAAA,IAAe,IAAA;AAC5C,IAAA,MAAM,KAAA,GAAQ,SAAS,KAAA,IAAS,KAAA;AAChC,IAAA,MAAM,kBAAA,GAAqB,SAAS,kBAAA,IAAsB,OAAA;AAC1D,IAA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AAA,QAChD,QAAQ,OAAA,CAAQ,MAAA;AAAA,QAChB,WAAW,OAAA,CAAQ,SAAA;AAAA,QACnB,kBAAA;AAAA,QACA,aAAA,EAAe,SAAS,YAAA,IAAgB,CAAA;AAAA;AAAA,QAExC,6BAAa,MAAA,CAAA,CAAA,MAAA,MAAW;AAAA,UACtB,GAAG,UAAA;AAAA,UACH,GAAI,MAAA,GAAS,EAAE,MAAA,KAAW,EAAC;AAAA,UAC3B,MAAA,EAAQ,EAAE,KAAA,EAAO,WAAA,EAAa,OAAO,MAAA,EAAQ,KAAA,EAAO,OAAO,SAAA;AAAU,SACvE,CAAA,EAJa,aAAA,CAAA;AAAA;AAAA;AAAA,QAOb,cAAA,kBAAgB,MAAA,CAAA,CAAA,QAAA,KAAY,QAAA,CAAS,WAAW,KAAK,IAAA,EAArC,gBAAA,CAAA;AAAA,QAChB,eAAA,EAAiB,gHAA2G,WAAW,CAAA,qFAAA,CAAA;AAAA,QACvI,UAAA,EAAY;AAAA,OACb,CAAA;AAAA,IACH,SAAS,KAAA,EAAO;AACd,MAAA,IAAI,iBAAiB,qBAAA,EAAuB;AAC1C,QAAA,MAAM,IAAI,QAAA,CAAS;AAAA,UACjB,IAAA,EAAM,yCAAA;AAAA,UACN,aAAa,CAAA,WAAA,EAAc,KAAA,CAAM,QAAA,CAAS,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA;AAAA,UACpD,MAAA,EAAQ;AAAA,SACT,CAAA;AAAA,MACH;AACA,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF;AACF;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @package @bitrix24/b24jssdk
|
|
3
|
-
* @version
|
|
3
|
+
* @version 2.0.0
|
|
4
4
|
* @copyright (c) 2026 Bitrix24
|
|
5
5
|
* @license MIT
|
|
6
6
|
* @see https://github.com/bitrix24/b24jssdk
|
|
@@ -9,17 +9,23 @@
|
|
|
9
9
|
import { CallV3 } from './call.mjs';
|
|
10
10
|
import { CallListV3 } from './call-list.mjs';
|
|
11
11
|
import { FetchListV3 } from './fetch-list.mjs';
|
|
12
|
+
import { CallTailV3 } from './call-tail.mjs';
|
|
13
|
+
import { FetchTailV3 } from './fetch-tail.mjs';
|
|
14
|
+
import { AggregateV3 } from './aggregate.mjs';
|
|
12
15
|
import { BatchV3 } from './batch.mjs';
|
|
13
16
|
import { BatchByChunkV3 } from './batch-by-chunk.mjs';
|
|
14
17
|
import { LoggerFactory } from '../../../logger/logger-factory.mjs';
|
|
15
18
|
|
|
16
19
|
var __defProp = Object.defineProperty;
|
|
17
20
|
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
|
|
22
|
-
const
|
|
21
|
+
const callName = /* @__PURE__ */ Symbol("call_V3");
|
|
22
|
+
const callListName = /* @__PURE__ */ Symbol("callList_V3");
|
|
23
|
+
const fetchListName = /* @__PURE__ */ Symbol("fetchList_V3");
|
|
24
|
+
const callTailName = /* @__PURE__ */ Symbol("callTail_V3");
|
|
25
|
+
const fetchTailName = /* @__PURE__ */ Symbol("fetchTail_V3");
|
|
26
|
+
const aggregateName = /* @__PURE__ */ Symbol("aggregate_V3");
|
|
27
|
+
const batchName = /* @__PURE__ */ Symbol("batch_V3");
|
|
28
|
+
const batchByChunkName = /* @__PURE__ */ Symbol("batchByChunk_V3");
|
|
23
29
|
class ActionsManagerV3 {
|
|
24
30
|
static {
|
|
25
31
|
__name(this, "ActionsManagerV3");
|
|
@@ -56,6 +62,24 @@ class ActionsManagerV3 {
|
|
|
56
62
|
}
|
|
57
63
|
return this._mapActions.get(fetchListName);
|
|
58
64
|
}
|
|
65
|
+
get callTail() {
|
|
66
|
+
if (!this._mapActions.has(callTailName)) {
|
|
67
|
+
this._mapActions.set(callTailName, new CallTailV3(this._b24, this._logger));
|
|
68
|
+
}
|
|
69
|
+
return this._mapActions.get(callTailName);
|
|
70
|
+
}
|
|
71
|
+
get fetchTail() {
|
|
72
|
+
if (!this._mapActions.has(fetchTailName)) {
|
|
73
|
+
this._mapActions.set(fetchTailName, new FetchTailV3(this._b24, this._logger));
|
|
74
|
+
}
|
|
75
|
+
return this._mapActions.get(fetchTailName);
|
|
76
|
+
}
|
|
77
|
+
get aggregate() {
|
|
78
|
+
if (!this._mapActions.has(aggregateName)) {
|
|
79
|
+
this._mapActions.set(aggregateName, new AggregateV3(this._b24, this._logger));
|
|
80
|
+
}
|
|
81
|
+
return this._mapActions.get(aggregateName);
|
|
82
|
+
}
|
|
59
83
|
get batch() {
|
|
60
84
|
if (!this._mapActions.has(batchName)) {
|
|
61
85
|
this._mapActions.set(batchName, new BatchV3(this._b24, this._logger));
|
|
@@ -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":"
|
|
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 { CallTailV3 } from './call-tail'\nimport { FetchTailV3 } from './fetch-tail'\nimport { AggregateV3 } from './aggregate'\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 callTailName = Symbol('callTail_V3')\nconst fetchTailName = Symbol('fetchTail_V3')\nconst aggregateName = Symbol('aggregate_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 callTail(): CallTailV3 {\n if (!this._mapActions.has(callTailName)) {\n this._mapActions.set(callTailName, new CallTailV3(this._b24, this._logger))\n }\n return this._mapActions.get(callTailName)! as CallTailV3\n }\n\n get fetchTail(): FetchTailV3 {\n if (!this._mapActions.has(fetchTailName)) {\n this._mapActions.set(fetchTailName, new FetchTailV3(this._b24, this._logger))\n }\n return this._mapActions.get(fetchTailName)! as FetchTailV3\n }\n\n get aggregate(): AggregateV3 {\n if (!this._mapActions.has(aggregateName)) {\n this._mapActions.set(aggregateName, new AggregateV3(this._b24, this._logger))\n }\n return this._mapActions.get(aggregateName)! as AggregateV3\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(batchBy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license MIT
|
|
6
6
|
* @see https://github.com/bitrix24/b24jssdk
|
|
@@ -20,6 +20,12 @@ import { LoggerFactory } from '../../logger/logger-factory.mjs';
|
|
|
20
20
|
|
|
21
21
|
var __defProp = Object.defineProperty;
|
|
22
22
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
23
|
+
const LOG_MAX_LENGTH = 300;
|
|
24
|
+
const LOG_SLICE_LENGTH = 100;
|
|
25
|
+
function truncateForLog(value) {
|
|
26
|
+
return value.length > LOG_MAX_LENGTH ? value.slice(0, LOG_SLICE_LENGTH) + "..." : value;
|
|
27
|
+
}
|
|
28
|
+
__name(truncateForLog, "truncateForLog");
|
|
23
29
|
class AbstractHttp {
|
|
24
30
|
static {
|
|
25
31
|
__name(this, "AbstractHttp");
|
|
@@ -28,6 +34,12 @@ class AbstractHttp {
|
|
|
28
34
|
_authActions;
|
|
29
35
|
_requestIdGenerator;
|
|
30
36
|
_restrictionManager;
|
|
37
|
+
/**
|
|
38
|
+
* In-flight token refresh, shared so concurrent 401s coalesce into a single
|
|
39
|
+
* `refreshAuth()` round-trip — avoids OAuth refresh-token reuse errors when a
|
|
40
|
+
* burst of requests expires together. (#182)
|
|
41
|
+
*/
|
|
42
|
+
_pendingRefresh = null;
|
|
31
43
|
_logger;
|
|
32
44
|
_isClientSideWarning = false;
|
|
33
45
|
_clientSideWarningMessage = "";
|
|
@@ -45,18 +57,20 @@ class AbstractHttp {
|
|
|
45
57
|
this._logger = LoggerFactory.createNullLogger();
|
|
46
58
|
const defaultHeaders = {};
|
|
47
59
|
if (this.isServerSide()) {
|
|
48
|
-
defaultHeaders["User-Agent"] = "b24-js-sdk/
|
|
60
|
+
defaultHeaders["User-Agent"] = "b24-js-sdk/2.0.0";
|
|
49
61
|
}
|
|
50
62
|
this._authActions = authActions;
|
|
51
63
|
this._requestIdGenerator = new RequestIdGenerator();
|
|
52
64
|
this._clientAxios = axios.create({
|
|
53
|
-
headers: {
|
|
54
|
-
...defaultHeaders,
|
|
55
|
-
...options ? options.headers : {}
|
|
56
|
-
},
|
|
57
65
|
timeout: 3e4,
|
|
58
66
|
timeoutErrorMessage: "Request timeout exceeded",
|
|
59
|
-
...options
|
|
67
|
+
...options ?? {},
|
|
68
|
+
// headers last so the merged default + caller headers aren't wiped by an
|
|
69
|
+
// `options.headers` (or the previous `headers: undefined`) spread (#144).
|
|
70
|
+
headers: {
|
|
71
|
+
...defaultHeaders,
|
|
72
|
+
...options?.headers ?? {}
|
|
73
|
+
}
|
|
60
74
|
});
|
|
61
75
|
const params = {
|
|
62
76
|
...ParamsFactory.getDefault(),
|
|
@@ -92,7 +106,7 @@ class AbstractHttp {
|
|
|
92
106
|
getStats() {
|
|
93
107
|
return {
|
|
94
108
|
...this._restrictionManager.getStats(),
|
|
95
|
-
totalRequests: this._metrics.
|
|
109
|
+
totalRequests: this._metrics.totalRequests,
|
|
96
110
|
successfulRequests: this._metrics.successfulRequests,
|
|
97
111
|
failedRequests: this._metrics.failedRequests,
|
|
98
112
|
totalDuration: this._metrics.totalDuration,
|
|
@@ -104,7 +118,7 @@ class AbstractHttp {
|
|
|
104
118
|
* @inheritDoc
|
|
105
119
|
*/
|
|
106
120
|
async reset() {
|
|
107
|
-
this._metrics.
|
|
121
|
+
this._metrics.totalRequests = 0;
|
|
108
122
|
this._metrics.successfulRequests = 0;
|
|
109
123
|
this._metrics.failedRequests = 0;
|
|
110
124
|
this._metrics.totalDuration = 0;
|
|
@@ -182,7 +196,7 @@ class AbstractHttp {
|
|
|
182
196
|
this._restrictionManager.incrementError(method);
|
|
183
197
|
this._updateMetrics(method, false, duration, lastError);
|
|
184
198
|
this._logFailedRequest(requestId, method, attempt + 1, maxRetries, lastError);
|
|
185
|
-
if (attempt < maxRetries) {
|
|
199
|
+
if (attempt + 1 < maxRetries) {
|
|
186
200
|
const waitTime = await this._restrictionManager.handleError(requestId, method, params, lastError, attempt);
|
|
187
201
|
if (waitTime > 0) {
|
|
188
202
|
this._restrictionManager.incrementStats("limitHits");
|
|
@@ -296,10 +310,27 @@ class AbstractHttp {
|
|
|
296
310
|
let authData = this._authActions.getAuthData();
|
|
297
311
|
if (authData === false) {
|
|
298
312
|
this._logRefreshingAuthToken(requestId);
|
|
299
|
-
authData = await this.
|
|
313
|
+
authData = await this._refreshAuth();
|
|
300
314
|
}
|
|
301
315
|
return authData;
|
|
302
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Refresh the auth token, coalescing concurrent callers onto a single
|
|
319
|
+
* in-flight `refreshAuth()` so a burst of 401s triggers exactly one refresh
|
|
320
|
+
* round-trip. The slot clears once the refresh settles. (#182)
|
|
321
|
+
*/
|
|
322
|
+
_refreshAuth() {
|
|
323
|
+
if (this._pendingRefresh) {
|
|
324
|
+
return this._pendingRefresh;
|
|
325
|
+
}
|
|
326
|
+
const refresh = this._authActions.refreshAuth();
|
|
327
|
+
this._pendingRefresh = refresh;
|
|
328
|
+
refresh.finally(() => {
|
|
329
|
+
this._pendingRefresh = null;
|
|
330
|
+
}).catch(() => {
|
|
331
|
+
});
|
|
332
|
+
return refresh;
|
|
333
|
+
}
|
|
303
334
|
// Execute the request with 401 error handling
|
|
304
335
|
async _makeRequestWithAuthRetry(requestId, method, params, authData) {
|
|
305
336
|
try {
|
|
@@ -313,33 +344,33 @@ class AbstractHttp {
|
|
|
313
344
|
requestId,
|
|
314
345
|
status: error.status,
|
|
315
346
|
// Redact in case a future portal response embeds credentials in
|
|
316
|
-
// the error body (today it doesn't, but the channel is open)
|
|
317
|
-
|
|
347
|
+
// the error body (today it doesn't, but the channel is open) (#39),
|
|
348
|
+
// and cap the length so a large error body can't flood the sink (#236).
|
|
349
|
+
responseData: truncateForLog(JSON.stringify(redactSensitiveParams(error?.response?.data), null, 0))
|
|
318
350
|
}
|
|
319
351
|
);
|
|
320
352
|
}
|
|
321
|
-
|
|
353
|
+
const ajaxError = this._convertToAjaxError(requestId, error, method, params);
|
|
354
|
+
if (this._isAuthError(ajaxError)) {
|
|
322
355
|
this._logAuthErrorDetected(requestId);
|
|
323
356
|
this._logRefreshingAuthToken(requestId);
|
|
324
|
-
const refreshedAuthData = await this.
|
|
357
|
+
const refreshedAuthData = await this._refreshAuth();
|
|
325
358
|
await this._restrictionManager.checkRateLimit(requestId, method);
|
|
326
359
|
return await this._makeAxiosRequest(requestId, method, params, refreshedAuthData);
|
|
327
360
|
}
|
|
328
|
-
throw
|
|
361
|
+
throw ajaxError;
|
|
329
362
|
}
|
|
330
363
|
}
|
|
331
364
|
async _makeAxiosRequest(requestId, method, params, authData) {
|
|
332
365
|
const methodFormatted = this._prepareMethod(requestId, method, this.getBaseUrl());
|
|
333
366
|
const paramsFormatted = this._prepareParams(authData, params);
|
|
334
367
|
const paramsFormattedForLog = JSON.stringify(redactSensitiveParams(paramsFormatted), null, 0);
|
|
335
|
-
const maxLogLength = 300;
|
|
336
|
-
const sliceLogLength = 100;
|
|
337
368
|
this.getLogger().info(
|
|
338
369
|
`post/send`,
|
|
339
370
|
{
|
|
340
371
|
requestId,
|
|
341
372
|
method,
|
|
342
|
-
params: paramsFormattedForLog
|
|
373
|
+
params: truncateForLog(paramsFormattedForLog)
|
|
343
374
|
}
|
|
344
375
|
);
|
|
345
376
|
const response = await this._clientAxios.post(methodFormatted, paramsFormatted);
|
|
@@ -349,7 +380,7 @@ class AbstractHttp {
|
|
|
349
380
|
{
|
|
350
381
|
requestId,
|
|
351
382
|
// responseFull: JSON.stringify(response.data, null, 2),
|
|
352
|
-
result: resultFormattedForLog
|
|
383
|
+
result: truncateForLog(resultFormattedForLog),
|
|
353
384
|
time: JSON.stringify(response.data.time, null, 0)
|
|
354
385
|
}
|
|
355
386
|
);
|
|
@@ -391,6 +422,50 @@ class AbstractHttp {
|
|
|
391
422
|
status: ajaxError.status
|
|
392
423
|
});
|
|
393
424
|
}
|
|
425
|
+
// endregion ////
|
|
426
|
+
// endregion ////
|
|
427
|
+
// region Prepare ////
|
|
428
|
+
/**
|
|
429
|
+
* Builds the request URL: the method path plus the SDK telemetry query params
|
|
430
|
+
* (`bx24_request_id` / `bx24_sdk_ver` / `bx24_sdk_type` — request tracing and
|
|
431
|
+
* SDK identification, not auth material).
|
|
432
|
+
*
|
|
433
|
+
* Carve-out for the legacy positional `task.*` methods (`task.commentitem.*`,
|
|
434
|
+
* `task.checklistitem.*`, `task.elapseditem.*`, …): these read the request
|
|
435
|
+
* **query string positionally**, so appending the telemetry params shifts
|
|
436
|
+
* `Param #0` and the server rejects the call —
|
|
437
|
+
* `WRONG_ARGUMENTS: Param #0 (taskId) ... expected integer, but given
|
|
438
|
+
* something else`. Verified live against a portal: the same
|
|
439
|
+
* `task.commentitem.getlist` / `task.checklistitem.getlist` call succeeds
|
|
440
|
+
* without the telemetry params and fails with them; modern `tasks.task.*`
|
|
441
|
+
* (named params) is unaffected. So telemetry is omitted for any method whose
|
|
442
|
+
* name contains `task.`.
|
|
443
|
+
*
|
|
444
|
+
* Shared by v2 and v3 (rather than per-transport): once the v3 method
|
|
445
|
+
* allowlist was dropped (#259) a positional `task.*` method can be routed via
|
|
446
|
+
* `actions.v3.*` too, so v3 needs the same suppression — keeping the rule in
|
|
447
|
+
* one place stops the two transports drifting apart again (#207).
|
|
448
|
+
*
|
|
449
|
+
* `includes('task.')` is a deliberate over-approximation: it also drops the
|
|
450
|
+
* (optional, telemetry-safe) params for modern `tasks.task.*` / `bizproc.task.*`.
|
|
451
|
+
* Narrowing to an anchored `^task\.` is possible but unverified across the
|
|
452
|
+
* whole task surface, so the broad, safe match is kept. Bitrix24 method names
|
|
453
|
+
* are lowercase by convention, so the case-sensitive match is sufficient.
|
|
454
|
+
*
|
|
455
|
+
* @see https://apidocs.bitrix24.com/settings/how-to-call-rest-api/data-encoding.html#order-of-parameters
|
|
456
|
+
*/
|
|
457
|
+
_prepareMethod(requestId, method, baseUrl) {
|
|
458
|
+
const methodUrl = `/${encodeURIComponent(method)}`;
|
|
459
|
+
if (method.includes("task.")) {
|
|
460
|
+
return `${baseUrl}${methodUrl}`;
|
|
461
|
+
}
|
|
462
|
+
const queryParams = new URLSearchParams({
|
|
463
|
+
[this._requestIdGenerator.getQueryStringParameterName()]: requestId,
|
|
464
|
+
[this._requestIdGenerator.getQueryStringSdkParameterName()]: "2.0.0",
|
|
465
|
+
[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
|
|
466
|
+
});
|
|
467
|
+
return `${baseUrl}${methodUrl}?${queryParams.toString()}`;
|
|
468
|
+
}
|
|
394
469
|
/**
|
|
395
470
|
* Processes function parameters and adds authorization
|
|
396
471
|
*/
|
|
@@ -555,5 +630,5 @@ class AbstractHttp {
|
|
|
555
630
|
// endregion ////
|
|
556
631
|
}
|
|
557
632
|
|
|
558
|
-
export { AbstractHttp };
|
|
633
|
+
export { AbstractHttp, truncateForLog };
|
|
559
634
|
//# sourceMappingURL=abstract-http.mjs.map
|