@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
package/dist/umd/index.js
CHANGED
|
@@ -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
|
|
@@ -8153,11 +8153,11 @@
|
|
|
8153
8153
|
}
|
|
8154
8154
|
}
|
|
8155
8155
|
|
|
8156
|
-
var __defProp$
|
|
8157
|
-
var __name$
|
|
8156
|
+
var __defProp$1Q = Object.defineProperty;
|
|
8157
|
+
var __name$1Q = (target, value) => __defProp$1Q(target, "name", { value, configurable: true });
|
|
8158
8158
|
class AbstractFormatter {
|
|
8159
8159
|
static {
|
|
8160
|
-
__name$
|
|
8160
|
+
__name$1Q(this, "AbstractFormatter");
|
|
8161
8161
|
}
|
|
8162
8162
|
dateFormat;
|
|
8163
8163
|
constructor(dateFormat = "YYYY-MM-DD HH:mm:ss") {
|
|
@@ -8175,11 +8175,11 @@
|
|
|
8175
8175
|
}
|
|
8176
8176
|
}
|
|
8177
8177
|
|
|
8178
|
-
var __defProp$
|
|
8179
|
-
var __name$
|
|
8178
|
+
var __defProp$1P = Object.defineProperty;
|
|
8179
|
+
var __name$1P = (target, value) => __defProp$1P(target, "name", { value, configurable: true });
|
|
8180
8180
|
class JsonFormatter extends AbstractFormatter {
|
|
8181
8181
|
static {
|
|
8182
|
-
__name$
|
|
8182
|
+
__name$1P(this, "JsonFormatter");
|
|
8183
8183
|
}
|
|
8184
8184
|
constructor(dateFormat = "YYYY-MM-DD HH:mm:ss") {
|
|
8185
8185
|
super(dateFormat);
|
|
@@ -8197,11 +8197,11 @@
|
|
|
8197
8197
|
}
|
|
8198
8198
|
}
|
|
8199
8199
|
|
|
8200
|
-
var __defProp$
|
|
8201
|
-
var __name$
|
|
8200
|
+
var __defProp$1O = Object.defineProperty;
|
|
8201
|
+
var __name$1O = (target, value) => __defProp$1O(target, "name", { value, configurable: true });
|
|
8202
8202
|
class LineFormatter extends AbstractFormatter {
|
|
8203
8203
|
static {
|
|
8204
|
-
__name$
|
|
8204
|
+
__name$1O(this, "LineFormatter");
|
|
8205
8205
|
}
|
|
8206
8206
|
formatString;
|
|
8207
8207
|
constructor(formatString = "[{channel}] {levelName}: {message} {context} {extra} {date}", dateFormat = "YYYY-MM-DD HH:mm:ss") {
|
|
@@ -8226,11 +8226,11 @@
|
|
|
8226
8226
|
}
|
|
8227
8227
|
}
|
|
8228
8228
|
|
|
8229
|
-
var __defProp$
|
|
8230
|
-
var __name$
|
|
8229
|
+
var __defProp$1N = Object.defineProperty;
|
|
8230
|
+
var __name$1N = (target, value) => __defProp$1N(target, "name", { value, configurable: true });
|
|
8231
8231
|
class TelegramFormatter extends AbstractFormatter {
|
|
8232
8232
|
static {
|
|
8233
|
-
__name$
|
|
8233
|
+
__name$1N(this, "TelegramFormatter");
|
|
8234
8234
|
}
|
|
8235
8235
|
useHtml;
|
|
8236
8236
|
maxMessageLength;
|
|
@@ -8317,9 +8317,9 @@ ${extraStr}
|
|
|
8317
8317
|
}
|
|
8318
8318
|
}
|
|
8319
8319
|
|
|
8320
|
-
var __defProp$
|
|
8321
|
-
var __name$
|
|
8322
|
-
const pidProcessor = /* @__PURE__ */ __name$
|
|
8320
|
+
var __defProp$1M = Object.defineProperty;
|
|
8321
|
+
var __name$1M = (target, value) => __defProp$1M(target, "name", { value, configurable: true });
|
|
8322
|
+
const pidProcessor = /* @__PURE__ */ __name$1M((record) => {
|
|
8323
8323
|
record.extra["pid"] = "?";
|
|
8324
8324
|
if (typeof process !== "undefined" && process.pid) {
|
|
8325
8325
|
record.extra["pid"] = process.pid;
|
|
@@ -8327,9 +8327,9 @@ ${extraStr}
|
|
|
8327
8327
|
return record;
|
|
8328
8328
|
}, "pidProcessor");
|
|
8329
8329
|
|
|
8330
|
-
var __defProp$
|
|
8331
|
-
var __name$
|
|
8332
|
-
const memoryUsageProcessor = /* @__PURE__ */ __name$
|
|
8330
|
+
var __defProp$1L = Object.defineProperty;
|
|
8331
|
+
var __name$1L = (target, value) => __defProp$1L(target, "name", { value, configurable: true });
|
|
8332
|
+
const memoryUsageProcessor = /* @__PURE__ */ __name$1L((record) => {
|
|
8333
8333
|
record.extra["memoryUsage"] = "?";
|
|
8334
8334
|
if (typeof process !== "undefined" && process.memoryUsage) {
|
|
8335
8335
|
record.extra["memoryUsage"] = Math.round(process.memoryUsage().heapUsed / 1024 / 1024) + "MB";
|
|
@@ -8337,11 +8337,11 @@ ${extraStr}
|
|
|
8337
8337
|
return record;
|
|
8338
8338
|
}, "memoryUsageProcessor");
|
|
8339
8339
|
|
|
8340
|
-
var __defProp$
|
|
8341
|
-
var __name$
|
|
8340
|
+
var __defProp$1K = Object.defineProperty;
|
|
8341
|
+
var __name$1K = (target, value) => __defProp$1K(target, "name", { value, configurable: true });
|
|
8342
8342
|
class AbstractHandler {
|
|
8343
8343
|
static {
|
|
8344
|
-
__name$
|
|
8344
|
+
__name$1K(this, "AbstractHandler");
|
|
8345
8345
|
}
|
|
8346
8346
|
level;
|
|
8347
8347
|
formatter = null;
|
|
@@ -8364,11 +8364,11 @@ ${extraStr}
|
|
|
8364
8364
|
}
|
|
8365
8365
|
}
|
|
8366
8366
|
|
|
8367
|
-
var __defProp$
|
|
8368
|
-
var __name$
|
|
8367
|
+
var __defProp$1J = Object.defineProperty;
|
|
8368
|
+
var __name$1J = (target, value) => __defProp$1J(target, "name", { value, configurable: true });
|
|
8369
8369
|
class ConsoleHandler extends AbstractHandler {
|
|
8370
8370
|
static {
|
|
8371
|
-
__name$
|
|
8371
|
+
__name$1J(this, "ConsoleHandler");
|
|
8372
8372
|
}
|
|
8373
8373
|
_styles = /* @__PURE__ */ new Map();
|
|
8374
8374
|
_useStyles;
|
|
@@ -8448,11 +8448,11 @@ ${extraStr}
|
|
|
8448
8448
|
}
|
|
8449
8449
|
}
|
|
8450
8450
|
|
|
8451
|
-
var __defProp$
|
|
8452
|
-
var __name$
|
|
8451
|
+
var __defProp$1I = Object.defineProperty;
|
|
8452
|
+
var __name$1I = (target, value) => __defProp$1I(target, "name", { value, configurable: true });
|
|
8453
8453
|
class ConsoleV2Handler extends ConsoleHandler {
|
|
8454
8454
|
static {
|
|
8455
|
-
__name$
|
|
8455
|
+
__name$1I(this, "ConsoleV2Handler");
|
|
8456
8456
|
}
|
|
8457
8457
|
constructor(level = LogLevel.DEBUG, options) {
|
|
8458
8458
|
super(level, options);
|
|
@@ -8485,11 +8485,11 @@ ${extraStr}
|
|
|
8485
8485
|
}
|
|
8486
8486
|
}
|
|
8487
8487
|
|
|
8488
|
-
var __defProp$
|
|
8489
|
-
var __name$
|
|
8488
|
+
var __defProp$1H = Object.defineProperty;
|
|
8489
|
+
var __name$1H = (target, value) => __defProp$1H(target, "name", { value, configurable: true });
|
|
8490
8490
|
class MemoryHandler extends AbstractHandler {
|
|
8491
8491
|
static {
|
|
8492
|
-
__name$
|
|
8492
|
+
__name$1H(this, "MemoryHandler");
|
|
8493
8493
|
}
|
|
8494
8494
|
records = [];
|
|
8495
8495
|
limit;
|
|
@@ -8520,11 +8520,11 @@ ${extraStr}
|
|
|
8520
8520
|
}
|
|
8521
8521
|
}
|
|
8522
8522
|
|
|
8523
|
-
var __defProp$
|
|
8524
|
-
var __name$
|
|
8523
|
+
var __defProp$1G = Object.defineProperty;
|
|
8524
|
+
var __name$1G = (target, value) => __defProp$1G(target, "name", { value, configurable: true });
|
|
8525
8525
|
class StreamHandler extends AbstractHandler {
|
|
8526
8526
|
static {
|
|
8527
|
-
__name$
|
|
8527
|
+
__name$1G(this, "StreamHandler");
|
|
8528
8528
|
}
|
|
8529
8529
|
/**
|
|
8530
8530
|
* Stream for writing logs.
|
|
@@ -8579,11 +8579,11 @@ ${extraStr}
|
|
|
8579
8579
|
}
|
|
8580
8580
|
}
|
|
8581
8581
|
|
|
8582
|
-
var __defProp$
|
|
8583
|
-
var __name$
|
|
8582
|
+
var __defProp$1F = Object.defineProperty;
|
|
8583
|
+
var __name$1F = (target, value) => __defProp$1F(target, "name", { value, configurable: true });
|
|
8584
8584
|
class ConsolaAdapter extends AbstractHandler {
|
|
8585
8585
|
static {
|
|
8586
|
-
__name$
|
|
8586
|
+
__name$1F(this, "ConsolaAdapter");
|
|
8587
8587
|
}
|
|
8588
8588
|
consolaInstance;
|
|
8589
8589
|
constructor(level = LogLevel.DEBUG, options) {
|
|
@@ -8628,11 +8628,11 @@ ${extraStr}
|
|
|
8628
8628
|
}
|
|
8629
8629
|
}
|
|
8630
8630
|
|
|
8631
|
-
var __defProp$
|
|
8632
|
-
var __name$
|
|
8631
|
+
var __defProp$1E = Object.defineProperty;
|
|
8632
|
+
var __name$1E = (target, value) => __defProp$1E(target, "name", { value, configurable: true });
|
|
8633
8633
|
class WinstonAdapter extends AbstractHandler {
|
|
8634
8634
|
static {
|
|
8635
|
-
__name$
|
|
8635
|
+
__name$1E(this, "WinstonAdapter");
|
|
8636
8636
|
}
|
|
8637
8637
|
winstonLogger;
|
|
8638
8638
|
constructor(level = LogLevel.DEBUG, options) {
|
|
@@ -8672,8 +8672,8 @@ ${extraStr}
|
|
|
8672
8672
|
}
|
|
8673
8673
|
}
|
|
8674
8674
|
|
|
8675
|
-
var __defProp$
|
|
8676
|
-
var __name$
|
|
8675
|
+
var __defProp$1D = Object.defineProperty;
|
|
8676
|
+
var __name$1D = (target, value) => __defProp$1D(target, "name", { value, configurable: true });
|
|
8677
8677
|
var Environment = /* @__PURE__ */ ((Environment2) => {
|
|
8678
8678
|
Environment2["UNKNOWN"] = "unknown";
|
|
8679
8679
|
Environment2["BROWSE"] = "browser";
|
|
@@ -8689,13 +8689,13 @@ ${extraStr}
|
|
|
8689
8689
|
}
|
|
8690
8690
|
return "unknown" /* UNKNOWN */;
|
|
8691
8691
|
}
|
|
8692
|
-
__name$
|
|
8692
|
+
__name$1D(getEnvironment, "getEnvironment");
|
|
8693
8693
|
|
|
8694
|
-
var __defProp$
|
|
8695
|
-
var __name$
|
|
8694
|
+
var __defProp$1C = Object.defineProperty;
|
|
8695
|
+
var __name$1C = (target, value) => __defProp$1C(target, "name", { value, configurable: true });
|
|
8696
8696
|
class TelegramHandler extends AbstractHandler {
|
|
8697
8697
|
static {
|
|
8698
|
-
__name$
|
|
8698
|
+
__name$1C(this, "TelegramHandler");
|
|
8699
8699
|
}
|
|
8700
8700
|
botToken;
|
|
8701
8701
|
chatId;
|
|
@@ -8833,11 +8833,11 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
8833
8833
|
}
|
|
8834
8834
|
}
|
|
8835
8835
|
|
|
8836
|
-
var __defProp$
|
|
8837
|
-
var __name$
|
|
8836
|
+
var __defProp$1B = Object.defineProperty;
|
|
8837
|
+
var __name$1B = (target, value) => __defProp$1B(target, "name", { value, configurable: true });
|
|
8838
8838
|
class AbstractLogger {
|
|
8839
8839
|
static {
|
|
8840
|
-
__name$
|
|
8840
|
+
__name$1B(this, "AbstractLogger");
|
|
8841
8841
|
}
|
|
8842
8842
|
/**
|
|
8843
8843
|
* @inheritDoc
|
|
@@ -8890,11 +8890,11 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
8890
8890
|
// endregion ////
|
|
8891
8891
|
}
|
|
8892
8892
|
|
|
8893
|
-
var __defProp$
|
|
8894
|
-
var __name$
|
|
8893
|
+
var __defProp$1A = Object.defineProperty;
|
|
8894
|
+
var __name$1A = (target, value) => __defProp$1A(target, "name", { value, configurable: true });
|
|
8895
8895
|
class NullLogger extends AbstractLogger {
|
|
8896
8896
|
static {
|
|
8897
|
-
__name$
|
|
8897
|
+
__name$1A(this, "NullLogger");
|
|
8898
8898
|
}
|
|
8899
8899
|
// region static methods for creation ////
|
|
8900
8900
|
static create() {
|
|
@@ -8910,11 +8910,11 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
8910
8910
|
// endregion ////
|
|
8911
8911
|
}
|
|
8912
8912
|
|
|
8913
|
-
var __defProp$
|
|
8914
|
-
var __name$
|
|
8913
|
+
var __defProp$1z = Object.defineProperty;
|
|
8914
|
+
var __name$1z = (target, value) => __defProp$1z(target, "name", { value, configurable: true });
|
|
8915
8915
|
class Logger extends AbstractLogger {
|
|
8916
8916
|
static {
|
|
8917
|
-
__name$
|
|
8917
|
+
__name$1z(this, "Logger");
|
|
8918
8918
|
}
|
|
8919
8919
|
channel;
|
|
8920
8920
|
handlers = [];
|
|
@@ -8973,11 +8973,11 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
8973
8973
|
}
|
|
8974
8974
|
}
|
|
8975
8975
|
|
|
8976
|
-
var __defProp$
|
|
8977
|
-
var __name$
|
|
8976
|
+
var __defProp$1y = Object.defineProperty;
|
|
8977
|
+
var __name$1y = (target, value) => __defProp$1y(target, "name", { value, configurable: true });
|
|
8978
8978
|
class LoggerFactory {
|
|
8979
8979
|
static {
|
|
8980
|
-
__name$
|
|
8980
|
+
__name$1y(this, "LoggerFactory");
|
|
8981
8981
|
}
|
|
8982
8982
|
static createNullLogger() {
|
|
8983
8983
|
return NullLogger.create();
|
|
@@ -9025,8 +9025,8 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9025
9025
|
}
|
|
9026
9026
|
}
|
|
9027
9027
|
|
|
9028
|
-
var __defProp$
|
|
9029
|
-
var __name$
|
|
9028
|
+
var __defProp$1x = Object.defineProperty;
|
|
9029
|
+
var __name$1x = (target, value) => __defProp$1x(target, "name", { value, configurable: true });
|
|
9030
9030
|
const deprecateMessage = "@deprecate: use Logger. https://bitrix24.github.io/b24jssdk/docs/working-with-the-rest-api/logger/";
|
|
9031
9031
|
var LoggerType = /* @__PURE__ */ ((LoggerType2) => {
|
|
9032
9032
|
LoggerType2["desktop"] = "desktop";
|
|
@@ -9039,7 +9039,7 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9039
9039
|
})(LoggerType || {});
|
|
9040
9040
|
class LoggerBrowser {
|
|
9041
9041
|
static {
|
|
9042
|
-
__name$
|
|
9042
|
+
__name$1x(this, "LoggerBrowser");
|
|
9043
9043
|
}
|
|
9044
9044
|
#logger;
|
|
9045
9045
|
/**
|
|
@@ -9196,12 +9196,12 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9196
9196
|
return DataType2;
|
|
9197
9197
|
})(DataType || {});
|
|
9198
9198
|
|
|
9199
|
-
var __defProp$
|
|
9200
|
-
var __name$
|
|
9199
|
+
var __defProp$1w = Object.defineProperty;
|
|
9200
|
+
var __name$1w = (target, value) => __defProp$1w(target, "name", { value, configurable: true });
|
|
9201
9201
|
const OBJECT_CONSTRUCTOR_STRING = Function.prototype.toString.call(Object);
|
|
9202
9202
|
class TypeManager {
|
|
9203
9203
|
static {
|
|
9204
|
-
__name$
|
|
9204
|
+
__name$1w(this, "TypeManager");
|
|
9205
9205
|
}
|
|
9206
9206
|
getTag(value) {
|
|
9207
9207
|
return Object.prototype.toString.call(value);
|
|
@@ -9523,8 +9523,8 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9523
9523
|
}
|
|
9524
9524
|
const Type = new TypeManager();
|
|
9525
9525
|
|
|
9526
|
-
var __defProp$
|
|
9527
|
-
var __name$
|
|
9526
|
+
var __defProp$1v = Object.defineProperty;
|
|
9527
|
+
var __name$1v = (target, value) => __defProp$1v(target, "name", { value, configurable: true });
|
|
9528
9528
|
function pick(data, keys) {
|
|
9529
9529
|
const result = {};
|
|
9530
9530
|
for (const key of keys) {
|
|
@@ -9532,7 +9532,7 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9532
9532
|
}
|
|
9533
9533
|
return result;
|
|
9534
9534
|
}
|
|
9535
|
-
__name$
|
|
9535
|
+
__name$1v(pick, "pick");
|
|
9536
9536
|
function omit(data, keys) {
|
|
9537
9537
|
const result = { ...data };
|
|
9538
9538
|
for (const key of keys) {
|
|
@@ -9540,18 +9540,18 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9540
9540
|
}
|
|
9541
9541
|
return result;
|
|
9542
9542
|
}
|
|
9543
|
-
__name$
|
|
9543
|
+
__name$1v(omit, "omit");
|
|
9544
9544
|
function isArrayOfArray(item) {
|
|
9545
9545
|
return Array.isArray(item[0]);
|
|
9546
9546
|
}
|
|
9547
|
-
__name$
|
|
9547
|
+
__name$1v(isArrayOfArray, "isArrayOfArray");
|
|
9548
9548
|
function getEnumValue(enumObj, value) {
|
|
9549
9549
|
return Object.values(enumObj).includes(value) ? value : void 0;
|
|
9550
9550
|
}
|
|
9551
|
-
__name$
|
|
9551
|
+
__name$1v(getEnumValue, "getEnumValue");
|
|
9552
9552
|
|
|
9553
|
-
var __defProp$
|
|
9554
|
-
var __name$
|
|
9553
|
+
var __defProp$1u = Object.defineProperty;
|
|
9554
|
+
var __name$1u = (target, value) => __defProp$1u(target, "name", { value, configurable: true });
|
|
9555
9555
|
const byteToHex = [];
|
|
9556
9556
|
for (let i = 0; i < 256; ++i) {
|
|
9557
9557
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -9570,7 +9570,7 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9570
9570
|
return t >>> 0;
|
|
9571
9571
|
};
|
|
9572
9572
|
}
|
|
9573
|
-
__name$
|
|
9573
|
+
__name$1u(sfc32, "sfc32");
|
|
9574
9574
|
function uuidv7() {
|
|
9575
9575
|
const bytes = new Uint8Array(16);
|
|
9576
9576
|
const timestamp = BigInt(Date.now());
|
|
@@ -9592,10 +9592,10 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9592
9592
|
bytes[8] = 128 | bytes[8] & 63;
|
|
9593
9593
|
return (byteToHex[bytes[0]] + byteToHex[bytes[1]] + byteToHex[bytes[2]] + byteToHex[bytes[3]] + "-" + byteToHex[bytes[4]] + byteToHex[bytes[5]] + "-" + byteToHex[bytes[6]] + byteToHex[bytes[7]] + "-" + byteToHex[bytes[8]] + byteToHex[bytes[9]] + "-" + byteToHex[bytes[10]] + byteToHex[bytes[11]] + byteToHex[bytes[12]] + byteToHex[bytes[13]] + byteToHex[bytes[14]] + byteToHex[bytes[15]]).toLowerCase();
|
|
9594
9594
|
}
|
|
9595
|
-
__name$
|
|
9595
|
+
__name$1u(uuidv7, "uuidv7");
|
|
9596
9596
|
|
|
9597
|
-
var __defProp$
|
|
9598
|
-
var __name$
|
|
9597
|
+
var __defProp$1t = Object.defineProperty;
|
|
9598
|
+
var __name$1t = (target, value) => __defProp$1t(target, "name", { value, configurable: true });
|
|
9599
9599
|
const reEscape = /[&<>'"]/g;
|
|
9600
9600
|
const reUnescape = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34)/g;
|
|
9601
9601
|
const escapeEntities = {
|
|
@@ -9619,7 +9619,7 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9619
9619
|
};
|
|
9620
9620
|
class TextManager {
|
|
9621
9621
|
static {
|
|
9622
|
-
__name$
|
|
9622
|
+
__name$1t(this, "TextManager");
|
|
9623
9623
|
}
|
|
9624
9624
|
getRandom(length = 8) {
|
|
9625
9625
|
return [...Array(length)].map(() => Math.trunc(Math.random() * 36).toString(36)).join("");
|
|
@@ -9719,7 +9719,7 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9719
9719
|
numberFormat(number, decimals = 0, decPoint = ".", thousandsSep = ",") {
|
|
9720
9720
|
const n = !Number.isFinite(number) ? 0 : number;
|
|
9721
9721
|
const fractionDigits = !Number.isFinite(decimals) ? 0 : Math.abs(decimals);
|
|
9722
|
-
const toFixedFix = /* @__PURE__ */ __name$
|
|
9722
|
+
const toFixedFix = /* @__PURE__ */ __name$1t((n2, fractionDigits2) => {
|
|
9723
9723
|
const k = Math.pow(10, fractionDigits2);
|
|
9724
9724
|
return Math.round(n2 * k) / k;
|
|
9725
9725
|
}, "toFixedFix");
|
|
@@ -9788,8 +9788,8 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9788
9788
|
}
|
|
9789
9789
|
const Text = new TextManager();
|
|
9790
9790
|
|
|
9791
|
-
var __defProp$
|
|
9792
|
-
var __name$
|
|
9791
|
+
var __defProp$1s = Object.defineProperty;
|
|
9792
|
+
var __name$1s = (target, value) => __defProp$1s(target, "name", { value, configurable: true });
|
|
9793
9793
|
let UA = "";
|
|
9794
9794
|
try {
|
|
9795
9795
|
UA = navigator?.userAgent.toLowerCase();
|
|
@@ -9798,7 +9798,7 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9798
9798
|
}
|
|
9799
9799
|
class BrowserManager {
|
|
9800
9800
|
static {
|
|
9801
|
-
__name$
|
|
9801
|
+
__name$1s(this, "BrowserManager");
|
|
9802
9802
|
}
|
|
9803
9803
|
isOpera() {
|
|
9804
9804
|
return UA.includes("opera");
|
|
@@ -9936,8 +9936,8 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9936
9936
|
return ApiVersion2;
|
|
9937
9937
|
})(ApiVersion || {});
|
|
9938
9938
|
|
|
9939
|
-
var __defProp$
|
|
9940
|
-
var __name$
|
|
9939
|
+
var __defProp$1r = Object.defineProperty;
|
|
9940
|
+
var __name$1r = (target, value) => __defProp$1r(target, "name", { value, configurable: true });
|
|
9941
9941
|
var EnumCrmEntityType = /* @__PURE__ */ ((EnumCrmEntityType2) => {
|
|
9942
9942
|
EnumCrmEntityType2["undefined"] = "UNDEFINED";
|
|
9943
9943
|
EnumCrmEntityType2["lead"] = "CRM_LEAD";
|
|
@@ -9981,7 +9981,7 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
9981
9981
|
const key = EnumCrmEntityTypeId[id];
|
|
9982
9982
|
return EnumCrmEntityTypeShort[key] || "?" /* undefined */;
|
|
9983
9983
|
}
|
|
9984
|
-
__name$
|
|
9984
|
+
__name$1r(getEnumCrmEntityTypeShort, "getEnumCrmEntityTypeShort");
|
|
9985
9985
|
|
|
9986
9986
|
var ProductRowDiscountTypeId = /* @__PURE__ */ ((ProductRowDiscountTypeId2) => {
|
|
9987
9987
|
ProductRowDiscountTypeId2[ProductRowDiscountTypeId2["undefined"] = 0] = "undefined";
|
|
@@ -10015,8 +10015,8 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
10015
10015
|
return CatalogRoundingRuleType2;
|
|
10016
10016
|
})(CatalogRoundingRuleType || {});
|
|
10017
10017
|
|
|
10018
|
-
var __defProp$
|
|
10019
|
-
var __name$
|
|
10018
|
+
var __defProp$1q = Object.defineProperty;
|
|
10019
|
+
var __name$1q = (target, value) => __defProp$1q(target, "name", { value, configurable: true });
|
|
10020
10020
|
var EnumBitrix24Edition = /* @__PURE__ */ ((EnumBitrix24Edition2) => {
|
|
10021
10021
|
EnumBitrix24Edition2["undefined"] = "undefined";
|
|
10022
10022
|
EnumBitrix24Edition2["b24"] = "b24";
|
|
@@ -10064,7 +10064,7 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
10064
10064
|
}
|
|
10065
10065
|
return EnumCrmEntityTypeId.undefined;
|
|
10066
10066
|
}
|
|
10067
|
-
__name$
|
|
10067
|
+
__name$1q(convertBizprocDocumentTypeToCrmEntityTypeId, "convertBizprocDocumentTypeToCrmEntityTypeId");
|
|
10068
10068
|
function getDocumentType(documentType, entityId) {
|
|
10069
10069
|
let entityIdFormatted = "";
|
|
10070
10070
|
let base = "undefined" /* undefined */;
|
|
@@ -10132,7 +10132,7 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
10132
10132
|
entityIdFormatted
|
|
10133
10133
|
];
|
|
10134
10134
|
}
|
|
10135
|
-
__name$
|
|
10135
|
+
__name$1q(getDocumentType, "getDocumentType");
|
|
10136
10136
|
function getDocumentId(documentType, id, dynamicId) {
|
|
10137
10137
|
let entityIdFormatted = "";
|
|
10138
10138
|
const tmp = getDocumentType(documentType, 1);
|
|
@@ -10180,7 +10180,7 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
10180
10180
|
entityIdFormatted
|
|
10181
10181
|
];
|
|
10182
10182
|
}
|
|
10183
|
-
__name$
|
|
10183
|
+
__name$1q(getDocumentId, "getDocumentId");
|
|
10184
10184
|
function getDocumentTypeForFilter(documentType) {
|
|
10185
10185
|
const result = getDocumentType(documentType, 1);
|
|
10186
10186
|
return [
|
|
@@ -10188,7 +10188,7 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
10188
10188
|
result[1]
|
|
10189
10189
|
];
|
|
10190
10190
|
}
|
|
10191
|
-
__name$
|
|
10191
|
+
__name$1q(getDocumentTypeForFilter, "getDocumentTypeForFilter");
|
|
10192
10192
|
|
|
10193
10193
|
var LoadDataType = /* @__PURE__ */ ((LoadDataType2) => {
|
|
10194
10194
|
LoadDataType2["App"] = "app";
|
|
@@ -10355,11 +10355,11 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
10355
10355
|
["ja" /* ja */]: "ja-JP"
|
|
10356
10356
|
};
|
|
10357
10357
|
|
|
10358
|
-
var __defProp$
|
|
10359
|
-
var __name$
|
|
10358
|
+
var __defProp$1p = Object.defineProperty;
|
|
10359
|
+
var __name$1p = (target, value) => __defProp$1p(target, "name", { value, configurable: true });
|
|
10360
10360
|
class Result {
|
|
10361
10361
|
static {
|
|
10362
|
-
__name$
|
|
10362
|
+
__name$1p(this, "Result");
|
|
10363
10363
|
}
|
|
10364
10364
|
_errors;
|
|
10365
10365
|
_data;
|
|
@@ -10407,6 +10407,40 @@ 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
|
+
* For batch calls the key tells you *which* command failed:
|
|
10417
|
+
* - an **object / named-command batch** keys each error by the command label;
|
|
10418
|
+
* - an **array-mode batch** keys each per-command error by its **numeric
|
|
10419
|
+
* position** (`'0'`, `'1'`, … as a string), matching the command order you
|
|
10420
|
+
* passed in. (#255 — previously these fell back to a random UUID.)
|
|
10421
|
+
*
|
|
10422
|
+
* An envelope-level soft error (not tied to one command) lands under the
|
|
10423
|
+
* internal `'base-error'` key, and {@link Result.addErrors} (no explicit key)
|
|
10424
|
+
* still uses generated UUIDs — for those, prefer {@link Result.getErrors} /
|
|
10425
|
+
* {@link Result.getErrorMessages}. (#230)
|
|
10426
|
+
*
|
|
10427
|
+
* @returns {Record<string, Error>} A map of error key to Error object.
|
|
10428
|
+
*/
|
|
10429
|
+
getErrorsByKey() {
|
|
10430
|
+
return Object.fromEntries(this._errors);
|
|
10431
|
+
}
|
|
10432
|
+
/**
|
|
10433
|
+
* Retrieves all error messages as a plain object (a snapshot copy) keyed by
|
|
10434
|
+
* their identifier. Unlike {@link Result.getErrorMessages}, the keys are
|
|
10435
|
+
* preserved. See {@link Result.getErrorsByKey} for when keys are meaningful.
|
|
10436
|
+
*
|
|
10437
|
+
* @returns {Record<string, string>} A map of error key to error message.
|
|
10438
|
+
*/
|
|
10439
|
+
getErrorMessagesByKey() {
|
|
10440
|
+
return Object.fromEntries(
|
|
10441
|
+
Array.from(this._errors, ([key, error]) => [key, error.message])
|
|
10442
|
+
);
|
|
10443
|
+
}
|
|
10410
10444
|
/**
|
|
10411
10445
|
* Converts the Result object to a string.
|
|
10412
10446
|
*
|
|
@@ -10444,11 +10478,11 @@ Errors: ${this.getErrorMessages().join(", ")}`;
|
|
|
10444
10478
|
}
|
|
10445
10479
|
}
|
|
10446
10480
|
|
|
10447
|
-
var __defProp$
|
|
10448
|
-
var __name$
|
|
10481
|
+
var __defProp$1o = Object.defineProperty;
|
|
10482
|
+
var __name$1o = (target, value) => __defProp$1o(target, "name", { value, configurable: true });
|
|
10449
10483
|
class SdkError extends Error {
|
|
10450
10484
|
static {
|
|
10451
|
-
__name$
|
|
10485
|
+
__name$1o(this, "SdkError");
|
|
10452
10486
|
}
|
|
10453
10487
|
code;
|
|
10454
10488
|
_status;
|
|
@@ -10517,53 +10551,81 @@ ${this.stack}`;
|
|
|
10517
10551
|
}
|
|
10518
10552
|
}
|
|
10519
10553
|
|
|
10520
|
-
var __defProp$
|
|
10521
|
-
var __name$
|
|
10554
|
+
var __defProp$1n = Object.defineProperty;
|
|
10555
|
+
var __name$1n = (target, value) => __defProp$1n(target, "name", { value, configurable: true });
|
|
10522
10556
|
const SENSITIVE_PARAM_KEYS = [
|
|
10523
10557
|
"auth",
|
|
10524
10558
|
"password",
|
|
10525
10559
|
"token",
|
|
10526
10560
|
"secret",
|
|
10527
10561
|
"access_token",
|
|
10528
|
-
"refresh_token"
|
|
10562
|
+
"refresh_token",
|
|
10563
|
+
"client_secret",
|
|
10564
|
+
"application_token",
|
|
10565
|
+
"sessid",
|
|
10566
|
+
"key",
|
|
10567
|
+
"signature"
|
|
10529
10568
|
];
|
|
10530
10569
|
const REDACTED_PLACEHOLDER = "***REDACTED***";
|
|
10570
|
+
const QS_SENSITIVE_RE = new RegExp(
|
|
10571
|
+
`([?&]|^)(${SENSITIVE_PARAM_KEYS.join("|")})=[^&#;]*`,
|
|
10572
|
+
"gi"
|
|
10573
|
+
);
|
|
10531
10574
|
function isPlainObject$1(value) {
|
|
10532
10575
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
10533
10576
|
}
|
|
10534
|
-
__name$
|
|
10577
|
+
__name$1n(isPlainObject$1, "isPlainObject");
|
|
10578
|
+
function redactQueryString(value) {
|
|
10579
|
+
if (!value.includes("=")) return value;
|
|
10580
|
+
return value.replace(
|
|
10581
|
+
QS_SENSITIVE_RE,
|
|
10582
|
+
(_match, sep, key) => `${sep}${key}=${REDACTED_PLACEHOLDER}`
|
|
10583
|
+
);
|
|
10584
|
+
}
|
|
10585
|
+
__name$1n(redactQueryString, "redactQueryString");
|
|
10586
|
+
function redactValue(value, depth) {
|
|
10587
|
+
if (typeof value === "string") return redactQueryString(value);
|
|
10588
|
+
if (depth <= 0) return value;
|
|
10589
|
+
if (isPlainObject$1(value)) return redactObject(value, depth - 1);
|
|
10590
|
+
if (Array.isArray(value)) return value.map((item) => redactValue(item, depth));
|
|
10591
|
+
return value;
|
|
10592
|
+
}
|
|
10593
|
+
__name$1n(redactValue, "redactValue");
|
|
10535
10594
|
function redactObject(source, depth) {
|
|
10536
10595
|
const sanitized = { ...source };
|
|
10537
10596
|
for (const key of Object.keys(sanitized)) {
|
|
10538
|
-
if (SENSITIVE_PARAM_KEYS.includes(key)) {
|
|
10597
|
+
if (SENSITIVE_PARAM_KEYS.includes(key.toLowerCase())) {
|
|
10539
10598
|
sanitized[key] = REDACTED_PLACEHOLDER;
|
|
10540
10599
|
continue;
|
|
10541
10600
|
}
|
|
10542
|
-
|
|
10543
|
-
const child = sanitized[key];
|
|
10544
|
-
if (isPlainObject$1(child)) {
|
|
10545
|
-
sanitized[key] = redactObject(child, depth - 1);
|
|
10546
|
-
} else if (Array.isArray(child)) {
|
|
10547
|
-
sanitized[key] = child.map(
|
|
10548
|
-
(item) => isPlainObject$1(item) ? redactObject(item, depth - 1) : item
|
|
10549
|
-
);
|
|
10550
|
-
}
|
|
10601
|
+
sanitized[key] = redactValue(sanitized[key], depth);
|
|
10551
10602
|
}
|
|
10552
10603
|
return sanitized;
|
|
10553
10604
|
}
|
|
10554
|
-
__name$
|
|
10605
|
+
__name$1n(redactObject, "redactObject");
|
|
10555
10606
|
const DEFAULT_REDACT_DEPTH = 2;
|
|
10556
10607
|
function redactSensitiveParams(params) {
|
|
10557
10608
|
if (!isPlainObject$1(params)) return params;
|
|
10558
10609
|
return redactObject(params, DEFAULT_REDACT_DEPTH);
|
|
10559
10610
|
}
|
|
10560
|
-
__name$
|
|
10611
|
+
__name$1n(redactSensitiveParams, "redactSensitiveParams");
|
|
10612
|
+
function redactSensitiveUrl(url, extraKeys = []) {
|
|
10613
|
+
if (typeof url !== "string" || !url.includes("=")) return url;
|
|
10614
|
+
if (extraKeys.length === 0) return redactQueryString(url);
|
|
10615
|
+
const escaped = extraKeys.map((key) => key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
10616
|
+
const re = new RegExp(
|
|
10617
|
+
`([?&]|^)(${[...SENSITIVE_PARAM_KEYS, ...escaped].join("|")})=[^&#;]*`,
|
|
10618
|
+
"gi"
|
|
10619
|
+
);
|
|
10620
|
+
return url.replace(re, (_match, sep, key) => `${sep}${key}=${REDACTED_PLACEHOLDER}`);
|
|
10621
|
+
}
|
|
10622
|
+
__name$1n(redactSensitiveUrl, "redactSensitiveUrl");
|
|
10561
10623
|
|
|
10562
|
-
var __defProp$
|
|
10563
|
-
var __name$
|
|
10624
|
+
var __defProp$1m = Object.defineProperty;
|
|
10625
|
+
var __name$1m = (target, value) => __defProp$1m(target, "name", { value, configurable: true });
|
|
10564
10626
|
class AjaxError extends SdkError {
|
|
10565
10627
|
static {
|
|
10566
|
-
__name$
|
|
10628
|
+
__name$1m(this, "AjaxError");
|
|
10567
10629
|
}
|
|
10568
10630
|
requestInfo;
|
|
10569
10631
|
constructor(params) {
|
|
@@ -10657,11 +10719,11 @@ ${this.stack}`;
|
|
|
10657
10719
|
}
|
|
10658
10720
|
}
|
|
10659
10721
|
|
|
10660
|
-
var __defProp$
|
|
10661
|
-
var __name$
|
|
10722
|
+
var __defProp$1l = Object.defineProperty;
|
|
10723
|
+
var __name$1l = (target, value) => __defProp$1l(target, "name", { value, configurable: true });
|
|
10662
10724
|
class AjaxResult extends Result {
|
|
10663
10725
|
static {
|
|
10664
|
-
__name$
|
|
10726
|
+
__name$1l(this, "AjaxResult");
|
|
10665
10727
|
}
|
|
10666
10728
|
_status;
|
|
10667
10729
|
_query;
|
|
@@ -10776,10 +10838,10 @@ ${this.stack}`;
|
|
|
10776
10838
|
}
|
|
10777
10839
|
/**
|
|
10778
10840
|
* @deprecated Will be removed in `2.0.0`. Tied to the `restApi:v2` envelope
|
|
10779
|
-
* field `total`, which `restApi:v3` does not return.
|
|
10780
|
-
*
|
|
10781
|
-
* `countDistinct`); for `restApi:v2`
|
|
10782
|
-
* without exposing `total`.
|
|
10841
|
+
* field `total`, which `restApi:v3` does not return. `restApi:v3` has no
|
|
10842
|
+
* element-count replacement yet — an `aggregate` action (`count` /
|
|
10843
|
+
* `countDistinct`) is planned but not exposed in the SDK; for `restApi:v2`
|
|
10844
|
+
* use the list helpers, which iterate without exposing `total`.
|
|
10783
10845
|
*
|
|
10784
10846
|
* @removed 2.0.0
|
|
10785
10847
|
*/
|
|
@@ -10844,11 +10906,12 @@ ${this.stack}`;
|
|
|
10844
10906
|
);
|
|
10845
10907
|
}
|
|
10846
10908
|
#buildNextPageQuery() {
|
|
10847
|
-
const result = { ...this._query };
|
|
10848
10909
|
const payload = this._data;
|
|
10849
10910
|
const nextValue = "next" in payload ? payload.next : void 0;
|
|
10850
|
-
|
|
10851
|
-
|
|
10911
|
+
return {
|
|
10912
|
+
...this._query,
|
|
10913
|
+
params: { ...this._query.params, start: Text.toInteger(nextValue) }
|
|
10914
|
+
};
|
|
10852
10915
|
}
|
|
10853
10916
|
// Immutable API
|
|
10854
10917
|
setData() {
|
|
@@ -10856,11 +10919,11 @@ ${this.stack}`;
|
|
|
10856
10919
|
}
|
|
10857
10920
|
}
|
|
10858
10921
|
|
|
10859
|
-
var __defProp$
|
|
10860
|
-
var __name$
|
|
10922
|
+
var __defProp$1k = Object.defineProperty;
|
|
10923
|
+
var __name$1k = (target, value) => __defProp$1k(target, "name", { value, configurable: true });
|
|
10861
10924
|
class ParamsFactory {
|
|
10862
10925
|
static {
|
|
10863
|
-
__name$
|
|
10926
|
+
__name$1k(this, "ParamsFactory");
|
|
10864
10927
|
}
|
|
10865
10928
|
/**
|
|
10866
10929
|
* Default parameters for regular tariffs
|
|
@@ -10968,11 +11031,11 @@ ${this.stack}`;
|
|
|
10968
11031
|
}
|
|
10969
11032
|
}
|
|
10970
11033
|
|
|
10971
|
-
var __defProp$
|
|
10972
|
-
var __name$
|
|
11034
|
+
var __defProp$1j = Object.defineProperty;
|
|
11035
|
+
var __name$1j = (target, value) => __defProp$1j(target, "name", { value, configurable: true });
|
|
10973
11036
|
class RateLimiter {
|
|
10974
11037
|
static {
|
|
10975
|
-
__name$
|
|
11038
|
+
__name$1j(this, "RateLimiter");
|
|
10976
11039
|
}
|
|
10977
11040
|
#tokens;
|
|
10978
11041
|
#lastRefill;
|
|
@@ -11358,11 +11421,11 @@ ${this.stack}`;
|
|
|
11358
11421
|
// endregion ////
|
|
11359
11422
|
}
|
|
11360
11423
|
|
|
11361
|
-
var __defProp$
|
|
11362
|
-
var __name$
|
|
11424
|
+
var __defProp$1i = Object.defineProperty;
|
|
11425
|
+
var __name$1i = (target, value) => __defProp$1i(target, "name", { value, configurable: true });
|
|
11363
11426
|
class OperatingLimiter {
|
|
11364
11427
|
static {
|
|
11365
|
-
__name$
|
|
11428
|
+
__name$1i(this, "OperatingLimiter");
|
|
11366
11429
|
}
|
|
11367
11430
|
#config;
|
|
11368
11431
|
#methodStats = /* @__PURE__ */ new Map();
|
|
@@ -11517,11 +11580,11 @@ ${this.stack}`;
|
|
|
11517
11580
|
// endregion ////
|
|
11518
11581
|
}
|
|
11519
11582
|
|
|
11520
|
-
var __defProp$
|
|
11521
|
-
var __name$
|
|
11583
|
+
var __defProp$1h = Object.defineProperty;
|
|
11584
|
+
var __name$1h = (target, value) => __defProp$1h(target, "name", { value, configurable: true });
|
|
11522
11585
|
class AdaptiveDelayer {
|
|
11523
11586
|
static {
|
|
11524
|
-
__name$
|
|
11587
|
+
__name$1h(this, "AdaptiveDelayer");
|
|
11525
11588
|
}
|
|
11526
11589
|
#config;
|
|
11527
11590
|
#operatingLimiter;
|
|
@@ -11640,11 +11703,11 @@ ${this.stack}`;
|
|
|
11640
11703
|
// endregion ////
|
|
11641
11704
|
}
|
|
11642
11705
|
|
|
11643
|
-
var __defProp$
|
|
11644
|
-
var __name$
|
|
11706
|
+
var __defProp$1g = Object.defineProperty;
|
|
11707
|
+
var __name$1g = (target, value) => __defProp$1g(target, "name", { value, configurable: true });
|
|
11645
11708
|
class RestrictionManager {
|
|
11646
11709
|
static {
|
|
11647
|
-
__name$
|
|
11710
|
+
__name$1g(this, "RestrictionManager");
|
|
11648
11711
|
}
|
|
11649
11712
|
#rateLimiter;
|
|
11650
11713
|
#operatingLimiter;
|
|
@@ -11817,6 +11880,7 @@ ${this.stack}`;
|
|
|
11817
11880
|
"INVALID_REQUEST",
|
|
11818
11881
|
"OVERLOAD_LIMIT",
|
|
11819
11882
|
"expired_token",
|
|
11883
|
+
"invalid_token",
|
|
11820
11884
|
"ACCESS_DENIED",
|
|
11821
11885
|
"INVALID_CREDENTIALS",
|
|
11822
11886
|
"user_access_error",
|
|
@@ -11995,168 +12059,54 @@ ${this.stack}`;
|
|
|
11995
12059
|
// endregion ////
|
|
11996
12060
|
}
|
|
11997
12061
|
|
|
11998
|
-
var __defProp$
|
|
11999
|
-
var __name$
|
|
12000
|
-
class ParseRow {
|
|
12001
|
-
static {
|
|
12002
|
-
__name$19(this, "ParseRow");
|
|
12003
|
-
}
|
|
12004
|
-
static getBatchCommand(row, options) {
|
|
12005
|
-
if (row) {
|
|
12006
|
-
if (typeof row === "object" && "method" in row && typeof row.method === "string") {
|
|
12007
|
-
return {
|
|
12008
|
-
method: row.method,
|
|
12009
|
-
query: row.params,
|
|
12010
|
-
as: row.as ?? options.asDefaultValue,
|
|
12011
|
-
parallel: row.parallel ?? options.parallelDefaultValue
|
|
12012
|
-
};
|
|
12013
|
-
}
|
|
12014
|
-
if (Array.isArray(row) && row.length > 0 && typeof row[0] === "string") {
|
|
12015
|
-
return {
|
|
12016
|
-
method: row[0],
|
|
12017
|
-
query: row[1],
|
|
12018
|
-
as: options.asDefaultValue,
|
|
12019
|
-
parallel: options.parallelDefaultValue
|
|
12020
|
-
};
|
|
12021
|
-
}
|
|
12022
|
-
}
|
|
12023
|
-
throw new SdkError({
|
|
12024
|
-
code: "JSSDK_INTERACTION_BATCH_ROW_FAIL",
|
|
12025
|
-
description: `There were difficulties parsing the command for batch.
|
|
12026
|
-
${JSON.stringify({
|
|
12027
|
-
row,
|
|
12028
|
-
options
|
|
12029
|
-
})}`,
|
|
12030
|
-
status: 500
|
|
12031
|
-
});
|
|
12032
|
-
}
|
|
12033
|
-
static getMethodsFromCommands(calls) {
|
|
12034
|
-
const result = [];
|
|
12035
|
-
const optsFake = {
|
|
12036
|
-
parallelDefaultValue: false
|
|
12037
|
-
};
|
|
12038
|
-
if (Array.isArray(calls)) {
|
|
12039
|
-
calls.forEach((row) => {
|
|
12040
|
-
const command = ParseRow.getBatchCommand(row, optsFake);
|
|
12041
|
-
result.push(command.method);
|
|
12042
|
-
});
|
|
12043
|
-
} else {
|
|
12044
|
-
Object.entries(calls).forEach(([index, row]) => {
|
|
12045
|
-
const command = ParseRow.getBatchCommand(row, { ...optsFake, asDefaultValue: index });
|
|
12046
|
-
result.push(command.method);
|
|
12047
|
-
});
|
|
12048
|
-
}
|
|
12049
|
-
return result;
|
|
12050
|
-
}
|
|
12051
|
-
}
|
|
12052
|
-
|
|
12053
|
-
var __defProp$18 = Object.defineProperty;
|
|
12054
|
-
var __name$18 = (target, value) => __defProp$18(target, "name", { value, configurable: true });
|
|
12062
|
+
var __defProp$1f = Object.defineProperty;
|
|
12063
|
+
var __name$1f = (target, value) => __defProp$1f(target, "name", { value, configurable: true });
|
|
12055
12064
|
class VersionManager {
|
|
12056
12065
|
static {
|
|
12057
|
-
__name$
|
|
12058
|
-
}
|
|
12059
|
-
#supportMethods;
|
|
12060
|
-
constructor() {
|
|
12061
|
-
this.#supportMethods = [
|
|
12062
|
-
"/batch",
|
|
12063
|
-
// done
|
|
12064
|
-
"/scopes",
|
|
12065
|
-
// done
|
|
12066
|
-
"/rest.scope.list",
|
|
12067
|
-
// done
|
|
12068
|
-
"/rest.documentation.openapi",
|
|
12069
|
-
"/documentation",
|
|
12070
|
-
/** @see /settings/configs/event_log.php */
|
|
12071
|
-
"/main.eventlog.list",
|
|
12072
|
-
// done
|
|
12073
|
-
"/main.eventlog.get",
|
|
12074
|
-
// done
|
|
12075
|
-
"/main.eventlog.tail",
|
|
12076
|
-
// done
|
|
12077
|
-
"/tasks.task.chat.message.send",
|
|
12078
|
-
"/tasks.task.access.get",
|
|
12079
|
-
"/tasks.task.file.attach",
|
|
12080
|
-
"/tasks.task.update",
|
|
12081
|
-
// done
|
|
12082
|
-
"/tasks.task.delete",
|
|
12083
|
-
"/tasks.task.add",
|
|
12084
|
-
"/tasks.task.get"
|
|
12085
|
-
// done
|
|
12086
|
-
// @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
|
|
12092
|
-
];
|
|
12066
|
+
__name$1f(this, "VersionManager");
|
|
12093
12067
|
}
|
|
12094
12068
|
static create() {
|
|
12095
12069
|
return new VersionManager();
|
|
12096
12070
|
}
|
|
12097
12071
|
/**
|
|
12098
|
-
* List of supported API versions
|
|
12099
|
-
* The highest version must be first
|
|
12072
|
+
* List of supported API versions.
|
|
12073
|
+
* The highest version must be first.
|
|
12100
12074
|
*/
|
|
12101
12075
|
getAllApiVersions() {
|
|
12102
12076
|
return [ApiVersion.v3, ApiVersion.v2];
|
|
12103
12077
|
}
|
|
12104
|
-
|
|
12105
|
-
|
|
12106
|
-
|
|
12107
|
-
|
|
12108
|
-
|
|
12109
|
-
|
|
12110
|
-
|
|
12111
|
-
return false;
|
|
12112
|
-
}
|
|
12113
|
-
#v3Support(method) {
|
|
12114
|
-
return this.#supportMethods.includes(`/${method}`);
|
|
12078
|
+
/**
|
|
12079
|
+
* Retained for backward compatibility. The SDK no longer keeps a v3 method
|
|
12080
|
+
* allowlist, so support is not decided client-side any more — always returns
|
|
12081
|
+
* `true`. Method existence is validated by the server.
|
|
12082
|
+
*/
|
|
12083
|
+
isSupport(_version, _method) {
|
|
12084
|
+
return true;
|
|
12115
12085
|
}
|
|
12116
12086
|
/**
|
|
12117
|
-
*
|
|
12087
|
+
* Returns the API version to use when the caller did not specify one. With the
|
|
12088
|
+
* allowlist removed there is no client-side signal that a method is a v3
|
|
12089
|
+
* method, so this defaults to v2 (the universal endpoint). Use the explicit
|
|
12090
|
+
* `actions.v3.*` surface to call a method on v3.
|
|
12118
12091
|
*/
|
|
12119
|
-
automaticallyObtainApiVersion(
|
|
12120
|
-
|
|
12121
|
-
if (!version) {
|
|
12122
|
-
throw new SdkError({
|
|
12123
|
-
code: "JSSDK_VERSION_MANAGER_NOT_DETECT_FOR_METHOD",
|
|
12124
|
-
description: `No API version found that supports method ${method}.`,
|
|
12125
|
-
status: 500
|
|
12126
|
-
});
|
|
12127
|
-
}
|
|
12128
|
-
return version;
|
|
12092
|
+
automaticallyObtainApiVersion(_method) {
|
|
12093
|
+
return ApiVersion.v2;
|
|
12129
12094
|
}
|
|
12130
12095
|
/**
|
|
12131
|
-
*
|
|
12132
|
-
*
|
|
12133
|
-
* @todo test methods
|
|
12134
|
-
* `[['crm.item.get', { entityTypeId: 3, id: 1 }]]`
|
|
12135
|
-
* `[{ method: 'crm.item.get', params: { entityTypeId: 3, id: 1 } }]`
|
|
12136
|
-
* `{ cmd1: { method: 'crm.item.get', params: { entityTypeId: 3, id: 1 } }, cmd2: ['crm.item.get', { entityTypeId: 2, id: 2 }] }`
|
|
12096
|
+
* Batch counterpart of {@link automaticallyObtainApiVersion}. Defaults to v2;
|
|
12097
|
+
* call `actions.v3.batch.make` explicitly to run a batch on v3.
|
|
12137
12098
|
*/
|
|
12138
|
-
automaticallyObtainApiVersionForBatch(
|
|
12139
|
-
const commands = ParseRow.getMethodsFromCommands(calls);
|
|
12140
|
-
let isAllSupportV3 = true;
|
|
12141
|
-
for (const [_, method] of commands.entries()) {
|
|
12142
|
-
if (!this.isSupport(ApiVersion.v3, method)) {
|
|
12143
|
-
isAllSupportV3 = false;
|
|
12144
|
-
break;
|
|
12145
|
-
}
|
|
12146
|
-
}
|
|
12147
|
-
if (isAllSupportV3) {
|
|
12148
|
-
return ApiVersion.v3;
|
|
12149
|
-
}
|
|
12099
|
+
automaticallyObtainApiVersionForBatch(_calls) {
|
|
12150
12100
|
return ApiVersion.v2;
|
|
12151
12101
|
}
|
|
12152
12102
|
}
|
|
12153
12103
|
const versionManager = VersionManager.create();
|
|
12154
12104
|
|
|
12155
|
-
var __defProp$
|
|
12156
|
-
var __name$
|
|
12105
|
+
var __defProp$1e = Object.defineProperty;
|
|
12106
|
+
var __name$1e = (target, value) => __defProp$1e(target, "name", { value, configurable: true });
|
|
12157
12107
|
class AbstractAction {
|
|
12158
12108
|
static {
|
|
12159
|
-
__name$
|
|
12109
|
+
__name$1e(this, "AbstractAction");
|
|
12160
12110
|
}
|
|
12161
12111
|
_b24;
|
|
12162
12112
|
_logger;
|
|
@@ -12166,11 +12116,11 @@ ${JSON.stringify({
|
|
|
12166
12116
|
}
|
|
12167
12117
|
}
|
|
12168
12118
|
|
|
12169
|
-
var __defProp$
|
|
12170
|
-
var __name$
|
|
12119
|
+
var __defProp$1d = Object.defineProperty;
|
|
12120
|
+
var __name$1d = (target, value) => __defProp$1d(target, "name", { value, configurable: true });
|
|
12171
12121
|
class CallV2 extends AbstractAction {
|
|
12172
12122
|
static {
|
|
12173
|
-
__name$
|
|
12123
|
+
__name$1d(this, "CallV2");
|
|
12174
12124
|
}
|
|
12175
12125
|
/**
|
|
12176
12126
|
* Calls the Bitrix24 REST API method.
|
|
@@ -12202,28 +12152,16 @@ ${JSON.stringify({
|
|
|
12202
12152
|
* console.log(response.getData().result.item.name)
|
|
12203
12153
|
*/
|
|
12204
12154
|
async make(options) {
|
|
12205
|
-
if (versionManager.isSupport(ApiVersion.v3, options.method)) {
|
|
12206
|
-
LoggerFactory.forcedLog(
|
|
12207
|
-
this._logger,
|
|
12208
|
-
"warning",
|
|
12209
|
-
`The method ${options.method} is available in restApi:v3. It's worth migrating to the new API.`,
|
|
12210
|
-
{
|
|
12211
|
-
method: options.method,
|
|
12212
|
-
requestId: options.requestId,
|
|
12213
|
-
code: "JSSDK_CORE_METHOD_AVAILABLE_IN_API_V3"
|
|
12214
|
-
}
|
|
12215
|
-
);
|
|
12216
|
-
}
|
|
12217
12155
|
const params = options.params || {};
|
|
12218
12156
|
return this._b24.getHttpClient(ApiVersion.v2).call(options.method, params, options.requestId);
|
|
12219
12157
|
}
|
|
12220
12158
|
}
|
|
12221
12159
|
|
|
12222
|
-
var __defProp$
|
|
12223
|
-
var __name$
|
|
12160
|
+
var __defProp$1c = Object.defineProperty;
|
|
12161
|
+
var __name$1c = (target, value) => __defProp$1c(target, "name", { value, configurable: true });
|
|
12224
12162
|
class CallListV2 extends AbstractAction {
|
|
12225
12163
|
static {
|
|
12226
|
-
__name$
|
|
12164
|
+
__name$1c(this, "CallListV2");
|
|
12227
12165
|
}
|
|
12228
12166
|
/**
|
|
12229
12167
|
* Fast data retrieval without counting the total number of records.
|
|
@@ -12232,12 +12170,16 @@ ${JSON.stringify({
|
|
|
12232
12170
|
*
|
|
12233
12171
|
* @param {ActionCallListV2} options - parameters for executing the request.
|
|
12234
12172
|
* - `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`
|
|
12173
|
+
* - `params?: Omit<TypeCallParams, 'start' | 'order'>` - Request parameters, excluding the `start` and `order` parameters,
|
|
12236
12174
|
* since the method is designed to obtain all data in one call.
|
|
12237
12175
|
* Note: Use `filter`, `order`, and `select` to control the selection.
|
|
12238
|
-
* - `idKey?: string` - The name of the field
|
|
12239
|
-
* Default is 'ID' (uppercase).
|
|
12240
|
-
*
|
|
12176
|
+
* - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
|
|
12177
|
+
* drives the cursor. Default is 'ID' (uppercase). For methods that return a lowercase /
|
|
12178
|
+
* camelCase id (for example `tasks.task.list` returns `id`), set `idKey: 'id'`.
|
|
12179
|
+
* - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the `>` page
|
|
12180
|
+
* filter. Defaults to `idKey`. Set it only when the sortable / filterable field name differs
|
|
12181
|
+
* from the response field name — e.g. `tasks.task.list` sorts and filters by `ID` (uppercase)
|
|
12182
|
+
* but returns `id` (lowercase): pass `idKey: 'id', cursorIdKey: 'ID'`.
|
|
12241
12183
|
* - `customKeyForResult?: string` - A custom key indicating that the response REST API will be
|
|
12242
12184
|
* grouped by this field.
|
|
12243
12185
|
* Example: `items` to group a list of CRM items.
|
|
@@ -12276,16 +12218,17 @@ ${JSON.stringify({
|
|
|
12276
12218
|
const batchSize = 50;
|
|
12277
12219
|
const result = new Result();
|
|
12278
12220
|
const idKey = options?.idKey ?? "ID";
|
|
12221
|
+
const cursorIdKey = options?.cursorIdKey ?? idKey;
|
|
12279
12222
|
const customKeyForResult = options?.customKeyForResult ?? null;
|
|
12280
12223
|
const params = options?.params ?? {};
|
|
12281
12224
|
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
|
|
12225
|
+
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
12226
|
}
|
|
12284
|
-
const moreIdKey = `>${
|
|
12227
|
+
const moreIdKey = `>${cursorIdKey}`;
|
|
12285
12228
|
const { order: _ignoredOrder, ...restParams } = params;
|
|
12286
12229
|
const requestParams = {
|
|
12287
12230
|
...restParams,
|
|
12288
|
-
order: { [
|
|
12231
|
+
order: { [cursorIdKey]: "ASC" },
|
|
12289
12232
|
filter: { ...params["filter"] || {}, [moreIdKey]: 0 },
|
|
12290
12233
|
start: -1
|
|
12291
12234
|
};
|
|
@@ -12330,9 +12273,11 @@ ${JSON.stringify({
|
|
|
12330
12273
|
break;
|
|
12331
12274
|
}
|
|
12332
12275
|
const lastItem = resultData[resultData.length - 1];
|
|
12333
|
-
|
|
12334
|
-
|
|
12276
|
+
const cursorValue = lastItem ? Number.parseInt(lastItem[idKey], 10) : Number.NaN;
|
|
12277
|
+
if (Number.isFinite(cursorValue)) {
|
|
12278
|
+
requestParams.filter[moreIdKey] = cursorValue;
|
|
12335
12279
|
} else {
|
|
12280
|
+
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
12281
|
isContinue = false;
|
|
12337
12282
|
break;
|
|
12338
12283
|
}
|
|
@@ -12341,11 +12286,11 @@ ${JSON.stringify({
|
|
|
12341
12286
|
}
|
|
12342
12287
|
}
|
|
12343
12288
|
|
|
12344
|
-
var __defProp$
|
|
12345
|
-
var __name$
|
|
12289
|
+
var __defProp$1b = Object.defineProperty;
|
|
12290
|
+
var __name$1b = (target, value) => __defProp$1b(target, "name", { value, configurable: true });
|
|
12346
12291
|
class FetchListV2 extends AbstractAction {
|
|
12347
12292
|
static {
|
|
12348
|
-
__name$
|
|
12293
|
+
__name$1b(this, "FetchListV2");
|
|
12349
12294
|
}
|
|
12350
12295
|
/**
|
|
12351
12296
|
* Calls a REST API list method and returns an async generator for efficient large data retrieval.
|
|
@@ -12355,12 +12300,16 @@ ${JSON.stringify({
|
|
|
12355
12300
|
*
|
|
12356
12301
|
* @param {ActionFetchListV2} options - parameters for executing the request.
|
|
12357
12302
|
* - `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`
|
|
12303
|
+
* - `params?: Omit<TypeCallParams, 'start' | 'order'>` - Request parameters, excluding the `start` and `order` parameters,
|
|
12359
12304
|
* since the method is designed to obtain all data in one call.
|
|
12360
12305
|
* Note: Use `filter`, `order`, and `select` to control the selection.
|
|
12361
|
-
* - `idKey?: string` - The name of the field
|
|
12362
|
-
* Default is 'ID' (uppercase).
|
|
12363
|
-
*
|
|
12306
|
+
* - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
|
|
12307
|
+
* drives the cursor. Default is 'ID' (uppercase). For methods that return a lowercase /
|
|
12308
|
+
* camelCase id (for example `tasks.task.list` returns `id`), set `idKey: 'id'`.
|
|
12309
|
+
* - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the `>` page
|
|
12310
|
+
* filter. Defaults to `idKey`. Set it only when the sortable / filterable field name differs
|
|
12311
|
+
* from the response field name — e.g. `tasks.task.list` sorts and filters by `ID` (uppercase)
|
|
12312
|
+
* but returns `id` (lowercase): pass `idKey: 'id', cursorIdKey: 'ID'`.
|
|
12364
12313
|
* - `customKeyForResult?: string` - A custom key indicating that the response REST API will be
|
|
12365
12314
|
* grouped by this field.
|
|
12366
12315
|
* Example: `items` to group a list of CRM items.
|
|
@@ -12401,16 +12350,17 @@ ${JSON.stringify({
|
|
|
12401
12350
|
async *make(options) {
|
|
12402
12351
|
const batchSize = 50;
|
|
12403
12352
|
const idKey = options?.idKey ?? "ID";
|
|
12353
|
+
const cursorIdKey = options?.cursorIdKey ?? idKey;
|
|
12404
12354
|
const customKeyForResult = options?.customKeyForResult ?? null;
|
|
12405
12355
|
const params = options?.params ?? {};
|
|
12406
12356
|
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
|
|
12357
|
+
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
12358
|
}
|
|
12409
|
-
const moreIdKey = `>${
|
|
12359
|
+
const moreIdKey = `>${cursorIdKey}`;
|
|
12410
12360
|
const { order: _ignoredOrder, ...restParams } = params;
|
|
12411
12361
|
const requestParams = {
|
|
12412
12362
|
...restParams,
|
|
12413
|
-
order: { [
|
|
12363
|
+
order: { [cursorIdKey]: "ASC" },
|
|
12414
12364
|
filter: { ...params["filter"] || {}, [moreIdKey]: 0 },
|
|
12415
12365
|
start: -1
|
|
12416
12366
|
};
|
|
@@ -12454,9 +12404,11 @@ ${JSON.stringify({
|
|
|
12454
12404
|
break;
|
|
12455
12405
|
}
|
|
12456
12406
|
const lastItem = resultData[resultData.length - 1];
|
|
12457
|
-
|
|
12458
|
-
|
|
12407
|
+
const cursorValue = lastItem ? Number.parseInt(lastItem[idKey], 10) : Number.NaN;
|
|
12408
|
+
if (Number.isFinite(cursorValue)) {
|
|
12409
|
+
requestParams.filter[moreIdKey] = cursorValue;
|
|
12459
12410
|
} else {
|
|
12411
|
+
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
12412
|
isContinue = false;
|
|
12461
12413
|
break;
|
|
12462
12414
|
}
|
|
@@ -12464,11 +12416,11 @@ ${JSON.stringify({
|
|
|
12464
12416
|
}
|
|
12465
12417
|
}
|
|
12466
12418
|
|
|
12467
|
-
var __defProp$
|
|
12468
|
-
var __name$
|
|
12419
|
+
var __defProp$1a = Object.defineProperty;
|
|
12420
|
+
var __name$1a = (target, value) => __defProp$1a(target, "name", { value, configurable: true });
|
|
12469
12421
|
class AbstractBatch extends AbstractAction {
|
|
12470
12422
|
static {
|
|
12471
|
-
__name$
|
|
12423
|
+
__name$1a(this, "AbstractBatch");
|
|
12472
12424
|
}
|
|
12473
12425
|
_addBatchErrorsIfAny(response, result) {
|
|
12474
12426
|
if (!response.isSuccess) {
|
|
@@ -12546,11 +12498,11 @@ ${JSON.stringify({
|
|
|
12546
12498
|
}
|
|
12547
12499
|
}
|
|
12548
12500
|
|
|
12549
|
-
var __defProp$
|
|
12550
|
-
var __name$
|
|
12501
|
+
var __defProp$19 = Object.defineProperty;
|
|
12502
|
+
var __name$19 = (target, value) => __defProp$19(target, "name", { value, configurable: true });
|
|
12551
12503
|
class BatchV2 extends AbstractBatch {
|
|
12552
12504
|
static {
|
|
12553
|
-
__name$
|
|
12505
|
+
__name$19(this, "BatchV2");
|
|
12554
12506
|
}
|
|
12555
12507
|
/**
|
|
12556
12508
|
* Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50.
|
|
@@ -12659,11 +12611,11 @@ ${JSON.stringify({
|
|
|
12659
12611
|
}
|
|
12660
12612
|
}
|
|
12661
12613
|
|
|
12662
|
-
var __defProp$
|
|
12663
|
-
var __name$
|
|
12614
|
+
var __defProp$18 = Object.defineProperty;
|
|
12615
|
+
var __name$18 = (target, value) => __defProp$18(target, "name", { value, configurable: true });
|
|
12664
12616
|
class BatchByChunkV2 extends AbstractBatch {
|
|
12665
12617
|
static {
|
|
12666
|
-
__name$
|
|
12618
|
+
__name$18(this, "BatchByChunkV2");
|
|
12667
12619
|
}
|
|
12668
12620
|
/**
|
|
12669
12621
|
* Executes a batch request with automatic chunking for any number of commands.
|
|
@@ -12738,16 +12690,16 @@ ${JSON.stringify({
|
|
|
12738
12690
|
}
|
|
12739
12691
|
}
|
|
12740
12692
|
|
|
12741
|
-
var __defProp$
|
|
12742
|
-
var __name$
|
|
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");
|
|
12693
|
+
var __defProp$17 = Object.defineProperty;
|
|
12694
|
+
var __name$17 = (target, value) => __defProp$17(target, "name", { value, configurable: true });
|
|
12695
|
+
const callName$1 = /* @__PURE__ */ Symbol("call_V2");
|
|
12696
|
+
const callListName$1 = /* @__PURE__ */ Symbol("callList_V2");
|
|
12697
|
+
const fetchListName$1 = /* @__PURE__ */ Symbol("fetchList_V2");
|
|
12698
|
+
const batchName$1 = /* @__PURE__ */ Symbol("batch_V2");
|
|
12699
|
+
const batchByChunkName$1 = /* @__PURE__ */ Symbol("batchByChunk_V2");
|
|
12748
12700
|
class ActionsManagerV2 {
|
|
12749
12701
|
static {
|
|
12750
|
-
__name$
|
|
12702
|
+
__name$17(this, "ActionsManagerV2");
|
|
12751
12703
|
}
|
|
12752
12704
|
_b24;
|
|
12753
12705
|
_logger;
|
|
@@ -12795,11 +12747,11 @@ ${JSON.stringify({
|
|
|
12795
12747
|
}
|
|
12796
12748
|
}
|
|
12797
12749
|
|
|
12798
|
-
var __defProp
|
|
12799
|
-
var __name
|
|
12750
|
+
var __defProp$16 = Object.defineProperty;
|
|
12751
|
+
var __name$16 = (target, value) => __defProp$16(target, "name", { value, configurable: true });
|
|
12800
12752
|
class CallV3 extends AbstractAction {
|
|
12801
12753
|
static {
|
|
12802
|
-
__name
|
|
12754
|
+
__name$16(this, "CallV3");
|
|
12803
12755
|
}
|
|
12804
12756
|
/**
|
|
12805
12757
|
* Calls the Bitrix24 REST API method.
|
|
@@ -12826,23 +12778,72 @@ ${JSON.stringify({
|
|
|
12826
12778
|
* console.log(response.getData().result.item.title)
|
|
12827
12779
|
*/
|
|
12828
12780
|
async make(options) {
|
|
12829
|
-
if (!versionManager.isSupport(ApiVersion.v3, options.method)) {
|
|
12830
|
-
throw new SdkError({
|
|
12831
|
-
code: "JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",
|
|
12832
|
-
description: `restApi:v3 not support method ${options.method}`,
|
|
12833
|
-
status: 500
|
|
12834
|
-
});
|
|
12835
|
-
}
|
|
12836
12781
|
const params = options.params || {};
|
|
12837
12782
|
return this._b24.getHttpClient(ApiVersion.v3).call(options.method, params, options.requestId);
|
|
12838
12783
|
}
|
|
12839
12784
|
}
|
|
12840
12785
|
|
|
12841
|
-
var __defProp$
|
|
12842
|
-
var __name$
|
|
12786
|
+
var __defProp$15 = Object.defineProperty;
|
|
12787
|
+
var __name$15 = (target, value) => __defProp$15(target, "name", { value, configurable: true });
|
|
12788
|
+
class KeysetPaginationError extends Error {
|
|
12789
|
+
static {
|
|
12790
|
+
__name$15(this, "KeysetPaginationError");
|
|
12791
|
+
}
|
|
12792
|
+
errors;
|
|
12793
|
+
messages;
|
|
12794
|
+
constructor(errors, messages) {
|
|
12795
|
+
super(messages.join("; "));
|
|
12796
|
+
this.name = "KeysetPaginationError";
|
|
12797
|
+
this.errors = errors;
|
|
12798
|
+
this.messages = messages;
|
|
12799
|
+
}
|
|
12800
|
+
}
|
|
12801
|
+
async function* keysetPaginate(b24, logger, strategy) {
|
|
12802
|
+
let cursor = strategy.initialCursor;
|
|
12803
|
+
let maxPageSize = 0;
|
|
12804
|
+
while (true) {
|
|
12805
|
+
const response = await b24.actions.v3.call.make({
|
|
12806
|
+
method: strategy.method,
|
|
12807
|
+
params: strategy.buildParams(cursor),
|
|
12808
|
+
requestId: strategy.requestId
|
|
12809
|
+
});
|
|
12810
|
+
if (!response.isSuccess) {
|
|
12811
|
+
logger.error(strategy.errorLabel, {
|
|
12812
|
+
method: strategy.method,
|
|
12813
|
+
requestId: strategy.requestId,
|
|
12814
|
+
messages: response.getErrorMessages()
|
|
12815
|
+
});
|
|
12816
|
+
throw new KeysetPaginationError(response.errors, response.getErrorMessages());
|
|
12817
|
+
}
|
|
12818
|
+
const responseData = response.getData();
|
|
12819
|
+
if (!responseData) {
|
|
12820
|
+
break;
|
|
12821
|
+
}
|
|
12822
|
+
const resultData = responseData.result[strategy.customKeyForResult];
|
|
12823
|
+
if (!Array.isArray(resultData) || resultData.length === 0) {
|
|
12824
|
+
break;
|
|
12825
|
+
}
|
|
12826
|
+
yield resultData;
|
|
12827
|
+
maxPageSize = Math.max(maxPageSize, resultData.length);
|
|
12828
|
+
if (resultData.length < maxPageSize) {
|
|
12829
|
+
break;
|
|
12830
|
+
}
|
|
12831
|
+
const lastItem = resultData[resultData.length - 1];
|
|
12832
|
+
const next = lastItem ? strategy.readNextCursor(lastItem) : null;
|
|
12833
|
+
if (next === null || next === void 0) {
|
|
12834
|
+
logger.warning(strategy.noCursorWarning);
|
|
12835
|
+
break;
|
|
12836
|
+
}
|
|
12837
|
+
cursor = next;
|
|
12838
|
+
}
|
|
12839
|
+
}
|
|
12840
|
+
__name$15(keysetPaginate, "keysetPaginate");
|
|
12841
|
+
|
|
12842
|
+
var __defProp$14 = Object.defineProperty;
|
|
12843
|
+
var __name$14 = (target, value) => __defProp$14(target, "name", { value, configurable: true });
|
|
12843
12844
|
class CallListV3 extends AbstractAction {
|
|
12844
12845
|
static {
|
|
12845
|
-
__name$
|
|
12846
|
+
__name$14(this, "CallListV3");
|
|
12846
12847
|
}
|
|
12847
12848
|
/**
|
|
12848
12849
|
* Fast data retrieval without counting the total number of records.
|
|
@@ -12851,11 +12852,15 @@ ${JSON.stringify({
|
|
|
12851
12852
|
*
|
|
12852
12853
|
* @param {ActionCallListV3} options - parameters for executing the request.
|
|
12853
12854
|
* - `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`
|
|
12855
|
+
* - `params?: Omit<TypeCallParams, 'pagination' | 'order'>` - Request parameters, excluding the `pagination` and `order` parameters,
|
|
12855
12856
|
* since the method is designed to obtain all data in one call.
|
|
12856
12857
|
* Note: Use `filter`, `order`, and `select` to control the selection.
|
|
12857
|
-
* - `idKey?: string` - The name of the field
|
|
12858
|
-
* Default is 'id'.
|
|
12858
|
+
* - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
|
|
12859
|
+
* drives the cursor. Default is 'id'. Set it to match the id field the method returns.
|
|
12860
|
+
* - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the
|
|
12861
|
+
* `[field, '>', n]` page filter. Defaults to `idKey`. Set it only when the sortable /
|
|
12862
|
+
* filterable field name differs from the response field name (e.g. an uppercase request
|
|
12863
|
+
* field but a lowercase response id): pass `idKey: 'id', cursorIdKey: 'ID'`.
|
|
12859
12864
|
* - `customKeyForResult: string` - A custom key indicating that the response REST API will be
|
|
12860
12865
|
* grouped by this field.
|
|
12861
12866
|
* Example: `items` to group a list of CRM items.
|
|
@@ -12894,73 +12899,61 @@ ${JSON.stringify({
|
|
|
12894
12899
|
const batchSize = options?.limit ?? 50;
|
|
12895
12900
|
const result = new Result();
|
|
12896
12901
|
const idKey = options?.idKey ?? "id";
|
|
12902
|
+
const cursorIdKey = options?.cursorIdKey ?? idKey;
|
|
12897
12903
|
const customKeyForResult = options?.customKeyForResult ?? null;
|
|
12898
12904
|
const params = options?.params ?? {};
|
|
12899
12905
|
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
|
|
12906
|
+
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
12907
|
}
|
|
12902
12908
|
const { order: _ignoredOrder, ...restParams } = params;
|
|
12903
12909
|
const requestParams = {
|
|
12904
12910
|
...restParams,
|
|
12905
|
-
order: { [
|
|
12911
|
+
order: { [cursorIdKey]: "ASC" },
|
|
12906
12912
|
filter: [...params["filter"] || []],
|
|
12907
12913
|
pagination: { page: 0, limit: batchSize }
|
|
12908
12914
|
};
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
do {
|
|
12913
|
-
const sendParams = { ...requestParams, filter: [...requestParams.filter] };
|
|
12914
|
-
sendParams.filter.push([idKey, ">", nextId]);
|
|
12915
|
-
const response = await this._b24.actions.v3.call.make({
|
|
12915
|
+
const allItems = [];
|
|
12916
|
+
try {
|
|
12917
|
+
for await (const page of keysetPaginate(this._b24, this._logger, {
|
|
12916
12918
|
method: options.method,
|
|
12917
|
-
|
|
12918
|
-
|
|
12919
|
-
|
|
12920
|
-
|
|
12921
|
-
|
|
12922
|
-
|
|
12923
|
-
|
|
12924
|
-
|
|
12925
|
-
|
|
12926
|
-
|
|
12927
|
-
|
|
12919
|
+
requestId: options.requestId,
|
|
12920
|
+
customKeyForResult,
|
|
12921
|
+
initialCursor: 0,
|
|
12922
|
+
// Emulated keyset: append the `[cursorIdKey, '>', cursor]` page filter.
|
|
12923
|
+
buildParams: /* @__PURE__ */ __name$14((cursor) => ({ ...requestParams, filter: [...requestParams.filter, [cursorIdKey, ">", cursor]] }), "buildParams"),
|
|
12924
|
+
// Advance by the numeric id read from the last item via `idKey`. A
|
|
12925
|
+
// non-numeric value (almost always an `idKey` that doesn't match the
|
|
12926
|
+
// response field — e.g. sorting by `ID` while the response carries a
|
|
12927
|
+
// lowercase `id`) stops the walk instead of silently truncating.
|
|
12928
|
+
readNextCursor: /* @__PURE__ */ __name$14((lastItem) => {
|
|
12929
|
+
const value = Number.parseInt(lastItem[idKey], 10);
|
|
12930
|
+
return Number.isFinite(value) ? value : null;
|
|
12931
|
+
}, "readNextCursor"),
|
|
12932
|
+
noCursorWarning: `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').`,
|
|
12933
|
+
errorLabel: "callFastListMethod"
|
|
12934
|
+
})) {
|
|
12935
|
+
for (const item of page) {
|
|
12936
|
+
allItems.push(item);
|
|
12928
12937
|
}
|
|
12929
|
-
isContinue = false;
|
|
12930
|
-
break;
|
|
12931
12938
|
}
|
|
12932
|
-
|
|
12933
|
-
if (
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
|
|
12937
|
-
const resultData = responseData.result[customKeyForResult];
|
|
12938
|
-
if (resultData.length === 0) {
|
|
12939
|
-
isContinue = false;
|
|
12940
|
-
break;
|
|
12941
|
-
}
|
|
12942
|
-
allItems = [...allItems, ...resultData];
|
|
12943
|
-
if (resultData.length < batchSize) {
|
|
12944
|
-
isContinue = false;
|
|
12945
|
-
break;
|
|
12946
|
-
}
|
|
12947
|
-
const lastItem = resultData[resultData.length - 1];
|
|
12948
|
-
if (lastItem && typeof lastItem[idKey] !== "undefined") {
|
|
12949
|
-
nextId = Number.parseInt(lastItem[idKey]);
|
|
12939
|
+
} catch (error) {
|
|
12940
|
+
if (error instanceof KeysetPaginationError) {
|
|
12941
|
+
for (const [index, err] of error.errors) {
|
|
12942
|
+
result.addError(err, index);
|
|
12943
|
+
}
|
|
12950
12944
|
} else {
|
|
12951
|
-
|
|
12952
|
-
break;
|
|
12945
|
+
throw error;
|
|
12953
12946
|
}
|
|
12954
|
-
}
|
|
12947
|
+
}
|
|
12955
12948
|
return result.setData(allItems);
|
|
12956
12949
|
}
|
|
12957
12950
|
}
|
|
12958
12951
|
|
|
12959
|
-
var __defProp$
|
|
12960
|
-
var __name$
|
|
12952
|
+
var __defProp$13 = Object.defineProperty;
|
|
12953
|
+
var __name$13 = (target, value) => __defProp$13(target, "name", { value, configurable: true });
|
|
12961
12954
|
class FetchListV3 extends AbstractAction {
|
|
12962
12955
|
static {
|
|
12963
|
-
__name$
|
|
12956
|
+
__name$13(this, "FetchListV3");
|
|
12964
12957
|
}
|
|
12965
12958
|
/**
|
|
12966
12959
|
* Calls a REST API list method and returns an async generator for efficient large data retrieval.
|
|
@@ -12970,11 +12963,15 @@ ${JSON.stringify({
|
|
|
12970
12963
|
*
|
|
12971
12964
|
* @param {ActionFetchListV3} options - parameters for executing the request.
|
|
12972
12965
|
* - `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`
|
|
12966
|
+
* - `params?: Omit<TypeCallParams, 'pagination' | 'order'>` - Request parameters, excluding the `pagination` and `order` parameters,
|
|
12974
12967
|
* since the method is designed to obtain all data in one call.
|
|
12975
12968
|
* Note: Use `filter`, `order`, and `select` to control the selection.
|
|
12976
|
-
* - `idKey?: string` - The name of the field
|
|
12977
|
-
* Default is 'id'.
|
|
12969
|
+
* - `idKey?: string` - The name of the id field as it appears in each RESPONSE item; its value
|
|
12970
|
+
* drives the cursor. Default is 'id'. Set it to match the id field the method returns.
|
|
12971
|
+
* - `cursorIdKey?: string` - The field name used in the REQUEST for `order` and the
|
|
12972
|
+
* `[field, '>', n]` page filter. Defaults to `idKey`. Set it only when the sortable /
|
|
12973
|
+
* filterable field name differs from the response field name (e.g. an uppercase request
|
|
12974
|
+
* field but a lowercase response id): pass `idKey: 'id', cursorIdKey: 'ID'`.
|
|
12978
12975
|
* - `customKeyForResult: string` - A custom key indicating that the response REST API will be
|
|
12979
12976
|
* grouped by this field.
|
|
12980
12977
|
* Example: `items` to group a list of CRM items.
|
|
@@ -13013,71 +13010,333 @@ ${JSON.stringify({
|
|
|
13013
13010
|
async *make(options) {
|
|
13014
13011
|
const batchSize = options?.limit ?? 50;
|
|
13015
13012
|
const idKey = options?.idKey ?? "id";
|
|
13013
|
+
const cursorIdKey = options?.cursorIdKey ?? idKey;
|
|
13016
13014
|
const customKeyForResult = options?.customKeyForResult ?? null;
|
|
13017
13015
|
const params = options?.params ?? {};
|
|
13018
13016
|
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
|
|
13017
|
+
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
13018
|
}
|
|
13021
13019
|
const { order: _ignoredOrder, ...restParams } = params;
|
|
13022
13020
|
const requestParams = {
|
|
13023
13021
|
...restParams,
|
|
13024
|
-
order: { [
|
|
13022
|
+
order: { [cursorIdKey]: "ASC" },
|
|
13025
13023
|
filter: [...params["filter"] || []],
|
|
13026
13024
|
pagination: { page: 0, limit: batchSize }
|
|
13027
13025
|
};
|
|
13028
|
-
|
|
13029
|
-
|
|
13030
|
-
do {
|
|
13031
|
-
const sendParams = { ...requestParams, filter: [...requestParams.filter] };
|
|
13032
|
-
sendParams.filter.push([idKey, ">", nextId]);
|
|
13033
|
-
const response = await this._b24.actions.v3.call.make({
|
|
13026
|
+
try {
|
|
13027
|
+
yield* keysetPaginate(this._b24, this._logger, {
|
|
13034
13028
|
method: options.method,
|
|
13035
|
-
|
|
13036
|
-
|
|
13029
|
+
requestId: options.requestId,
|
|
13030
|
+
customKeyForResult,
|
|
13031
|
+
initialCursor: 0,
|
|
13032
|
+
// Emulated keyset: append the `[cursorIdKey, '>', cursor]` page filter.
|
|
13033
|
+
buildParams: /* @__PURE__ */ __name$13((cursor) => ({ ...requestParams, filter: [...requestParams.filter, [cursorIdKey, ">", cursor]] }), "buildParams"),
|
|
13034
|
+
// Advance by the numeric id read from the last item via `idKey`. A
|
|
13035
|
+
// non-numeric value (almost always an `idKey` that doesn't match the
|
|
13036
|
+
// response field — e.g. sorting by `ID` while the response carries a
|
|
13037
|
+
// lowercase `id`) stops the walk instead of silently truncating.
|
|
13038
|
+
readNextCursor: /* @__PURE__ */ __name$13((lastItem) => {
|
|
13039
|
+
const value = Number.parseInt(lastItem[idKey], 10);
|
|
13040
|
+
return Number.isFinite(value) ? value : null;
|
|
13041
|
+
}, "readNextCursor"),
|
|
13042
|
+
noCursorWarning: `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').`,
|
|
13043
|
+
errorLabel: "fetchListMethod"
|
|
13044
|
+
});
|
|
13045
|
+
} catch (error) {
|
|
13046
|
+
if (error instanceof KeysetPaginationError) {
|
|
13047
|
+
throw new SdkError({
|
|
13048
|
+
code: "JSSDK_CORE_B24_FETCH_LIST_METHOD_API_V3",
|
|
13049
|
+
description: `API Error: ${error.messages.join("; ")}`,
|
|
13050
|
+
status: 500
|
|
13051
|
+
});
|
|
13052
|
+
}
|
|
13053
|
+
throw error;
|
|
13054
|
+
}
|
|
13055
|
+
}
|
|
13056
|
+
}
|
|
13057
|
+
|
|
13058
|
+
var __defProp$12 = Object.defineProperty;
|
|
13059
|
+
var __name$12 = (target, value) => __defProp$12(target, "name", { value, configurable: true });
|
|
13060
|
+
class CallTailV3 extends AbstractAction {
|
|
13061
|
+
static {
|
|
13062
|
+
__name$12(this, "CallTailV3");
|
|
13063
|
+
}
|
|
13064
|
+
/**
|
|
13065
|
+
* Returns every record of a `tail` method as one array.
|
|
13066
|
+
*
|
|
13067
|
+
* @template T - The type of the elements of the returned array (default is `unknown`).
|
|
13068
|
+
*
|
|
13069
|
+
* @param {ActionCallTailV3} options - parameters for executing the request.
|
|
13070
|
+
* - `method: string` - A REST API `tail` method name (for example: `main.eventlog.tail`).
|
|
13071
|
+
* - `params?: Omit<TypeCallParams, 'pagination' | 'order' | 'cursor'>` - Request parameters
|
|
13072
|
+
* (`filter`, `select`). `pagination`, `order` and `cursor` are managed by this helper.
|
|
13073
|
+
* The cursor field must NOT be used in `filter`.
|
|
13074
|
+
* - `cursorField?: string` - The DTO field that drives the cursor. Default is `id`.
|
|
13075
|
+
* - `order?: 'ASC' | 'DESC'` - Cursor direction. Default is `ASC`. For `DESC` you MUST pass
|
|
13076
|
+
* `initialValue` (the server pages by `field < value`, so the default `0` returns nothing).
|
|
13077
|
+
* - `customKeyForResult?: string` - The key the response groups rows under. Default is `items`.
|
|
13078
|
+
* - `requestId?: string` - Unique request identifier for tracking.
|
|
13079
|
+
* - `limit?: number` - How many records to retrieve at a time. Default is `50`. Maximum is `1000`.
|
|
13080
|
+
* - `initialValue?: number | string` - Cursor start value for the first page. Default is `0`
|
|
13081
|
+
* (valid for ascending numeric fields); required for `DESC` and for non-numeric fields.
|
|
13082
|
+
*
|
|
13083
|
+
* @returns {Promise<Result<T[]>>} A promise that resolves to the result of an REST API call.
|
|
13084
|
+
*
|
|
13085
|
+
* @example
|
|
13086
|
+
* const response = await b24.actions.v3.callTail.make<{ id: string }>({
|
|
13087
|
+
* method: 'main.eventlog.tail',
|
|
13088
|
+
* params: { select: ['id', 'auditType'] },
|
|
13089
|
+
* cursorField: 'id',
|
|
13090
|
+
* customKeyForResult: 'items'
|
|
13091
|
+
* })
|
|
13092
|
+
* if (!response.isSuccess) {
|
|
13093
|
+
* throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)
|
|
13094
|
+
* }
|
|
13095
|
+
* console.log(`Result: ${response.getData()?.length}`)
|
|
13096
|
+
*/
|
|
13097
|
+
async make(options) {
|
|
13098
|
+
const batchSize = options?.limit ?? 50;
|
|
13099
|
+
const result = new Result();
|
|
13100
|
+
const cursorField = options?.cursorField ?? "id";
|
|
13101
|
+
const order = options?.order ?? "ASC";
|
|
13102
|
+
const customKeyForResult = options?.customKeyForResult ?? "items";
|
|
13103
|
+
const params = options?.params ?? {};
|
|
13104
|
+
if (/desc/i.test(order) && options?.initialValue === void 0) {
|
|
13105
|
+
throw new SdkError({
|
|
13106
|
+
code: "JSSDK_CORE_B24_CALL_TAIL_DESC_REQUIRES_INITIAL_VALUE",
|
|
13107
|
+
description: 'callTail.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.',
|
|
13108
|
+
status: 500
|
|
13109
|
+
});
|
|
13110
|
+
}
|
|
13111
|
+
if (Array.isArray(params["filter"]) && params["filter"].some((c) => Array.isArray(c) && c[0] === cursorField)) {
|
|
13112
|
+
this._logger.warning(`callTail.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\`.`);
|
|
13113
|
+
}
|
|
13114
|
+
let select = params["select"];
|
|
13115
|
+
if (Array.isArray(select)) {
|
|
13116
|
+
if (!select.includes(cursorField)) {
|
|
13117
|
+
select = [...select, cursorField];
|
|
13118
|
+
}
|
|
13119
|
+
} else if (cursorField !== "id") {
|
|
13120
|
+
this._logger.warning(`callTail.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.`);
|
|
13121
|
+
}
|
|
13122
|
+
const { select: _ignoredSelect, ...restParams } = params;
|
|
13123
|
+
const allItems = [];
|
|
13124
|
+
try {
|
|
13125
|
+
for await (const page of keysetPaginate(this._b24, this._logger, {
|
|
13126
|
+
method: options.method,
|
|
13127
|
+
requestId: options.requestId,
|
|
13128
|
+
customKeyForResult,
|
|
13129
|
+
initialCursor: options?.initialValue ?? 0,
|
|
13130
|
+
// Native keyset: drive the server's `cursor: { field, value, order, limit }`.
|
|
13131
|
+
buildParams: /* @__PURE__ */ __name$12((cursor) => ({
|
|
13132
|
+
...restParams,
|
|
13133
|
+
...select ? { select } : {},
|
|
13134
|
+
cursor: { field: cursorField, value: cursor, order, limit: batchSize }
|
|
13135
|
+
}), "buildParams"),
|
|
13136
|
+
// Advance by the raw cursor-field value from the last item; a missing
|
|
13137
|
+
// value (cursorField not selected / wrong name) stops the walk.
|
|
13138
|
+
readNextCursor: /* @__PURE__ */ __name$12((lastItem) => lastItem[cursorField] ?? null, "readNextCursor"),
|
|
13139
|
+
noCursorWarning: `callTail.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\`).`,
|
|
13140
|
+
errorLabel: "callTailMethod"
|
|
13141
|
+
})) {
|
|
13142
|
+
for (const item of page) {
|
|
13143
|
+
allItems.push(item);
|
|
13144
|
+
}
|
|
13145
|
+
}
|
|
13146
|
+
} catch (error) {
|
|
13147
|
+
if (error instanceof KeysetPaginationError) {
|
|
13148
|
+
for (const [index, err] of error.errors) {
|
|
13149
|
+
result.addError(err, index);
|
|
13150
|
+
}
|
|
13151
|
+
} else {
|
|
13152
|
+
throw error;
|
|
13153
|
+
}
|
|
13154
|
+
}
|
|
13155
|
+
return result.setData(allItems);
|
|
13156
|
+
}
|
|
13157
|
+
}
|
|
13158
|
+
|
|
13159
|
+
var __defProp$11 = Object.defineProperty;
|
|
13160
|
+
var __name$11 = (target, value) => __defProp$11(target, "name", { value, configurable: true });
|
|
13161
|
+
class FetchTailV3 extends AbstractAction {
|
|
13162
|
+
static {
|
|
13163
|
+
__name$11(this, "FetchTailV3");
|
|
13164
|
+
}
|
|
13165
|
+
/**
|
|
13166
|
+
* Streams every record of a `tail` method as chunks, advancing the keyset
|
|
13167
|
+
* cursor between requests.
|
|
13168
|
+
*
|
|
13169
|
+
* @template T - The type of items in the returned arrays (default is `unknown`).
|
|
13170
|
+
*
|
|
13171
|
+
* @param {ActionFetchTailV3} options - parameters for executing the request.
|
|
13172
|
+
* - `method: string` - A REST API `tail` method name (for example: `main.eventlog.tail`).
|
|
13173
|
+
* - `params?: Omit<TypeCallParams, 'pagination' | 'order' | 'cursor'>` - Request parameters.
|
|
13174
|
+
* Use `filter` and `select` to control the selection. `pagination`, `order` and `cursor`
|
|
13175
|
+
* are managed by this helper and must not be passed. The cursor field must NOT be used in `filter`.
|
|
13176
|
+
* - `cursorField?: string` - The DTO field that drives the cursor. Must be monotonic and
|
|
13177
|
+
* preferably unique, and present in `select`. Default is `id`.
|
|
13178
|
+
* - `order?: 'ASC' | 'DESC'` - Cursor direction. Default is `ASC`. For `DESC` you MUST pass
|
|
13179
|
+
* `initialValue` (the server pages by `field < value`, so the default `0` returns nothing).
|
|
13180
|
+
* - `customKeyForResult?: string` - The key the response groups rows under. Default is `items`.
|
|
13181
|
+
* - `requestId?: string` - Unique request identifier for tracking.
|
|
13182
|
+
* - `limit?: number` - How many records to retrieve at a time. Default is `50`. Maximum is `1000`.
|
|
13183
|
+
* - `initialValue?: number | string` - Cursor start value for the first page. Default is `0`
|
|
13184
|
+
* (valid for ascending numeric fields); required for `DESC` and for non-numeric fields.
|
|
13185
|
+
*
|
|
13186
|
+
* @returns {AsyncGenerator<T[]>} An async generator that yields chunks of data as arrays of type `T`.
|
|
13187
|
+
*
|
|
13188
|
+
* @example
|
|
13189
|
+
* const generator = b24.actions.v3.fetchTail.make<{ id: string }>({
|
|
13190
|
+
* method: 'main.eventlog.tail',
|
|
13191
|
+
* params: { select: ['id', 'auditType'] },
|
|
13192
|
+
* cursorField: 'id',
|
|
13193
|
+
* customKeyForResult: 'items'
|
|
13194
|
+
* })
|
|
13195
|
+
* for await (const chunk of generator) {
|
|
13196
|
+
* console.log(`Processing ${chunk.length} items`)
|
|
13197
|
+
* }
|
|
13198
|
+
*/
|
|
13199
|
+
async *make(options) {
|
|
13200
|
+
const batchSize = options?.limit ?? 50;
|
|
13201
|
+
const cursorField = options?.cursorField ?? "id";
|
|
13202
|
+
const order = options?.order ?? "ASC";
|
|
13203
|
+
const customKeyForResult = options?.customKeyForResult ?? "items";
|
|
13204
|
+
const params = options?.params ?? {};
|
|
13205
|
+
if (/desc/i.test(order) && options?.initialValue === void 0) {
|
|
13206
|
+
throw new SdkError({
|
|
13207
|
+
code: "JSSDK_CORE_B24_FETCH_TAIL_DESC_REQUIRES_INITIAL_VALUE",
|
|
13208
|
+
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.',
|
|
13209
|
+
status: 500
|
|
13210
|
+
});
|
|
13211
|
+
}
|
|
13212
|
+
if (Array.isArray(params["filter"]) && params["filter"].some((c) => Array.isArray(c) && c[0] === cursorField)) {
|
|
13213
|
+
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\`.`);
|
|
13214
|
+
}
|
|
13215
|
+
let select = params["select"];
|
|
13216
|
+
if (Array.isArray(select)) {
|
|
13217
|
+
if (!select.includes(cursorField)) {
|
|
13218
|
+
select = [...select, cursorField];
|
|
13219
|
+
}
|
|
13220
|
+
} else if (cursorField !== "id") {
|
|
13221
|
+
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.`);
|
|
13222
|
+
}
|
|
13223
|
+
const { select: _ignoredSelect, ...restParams } = params;
|
|
13224
|
+
try {
|
|
13225
|
+
yield* keysetPaginate(this._b24, this._logger, {
|
|
13226
|
+
method: options.method,
|
|
13227
|
+
requestId: options.requestId,
|
|
13228
|
+
customKeyForResult,
|
|
13229
|
+
initialCursor: options?.initialValue ?? 0,
|
|
13230
|
+
// Native keyset: drive the server's `cursor: { field, value, order, limit }`.
|
|
13231
|
+
buildParams: /* @__PURE__ */ __name$11((cursor) => ({
|
|
13232
|
+
...restParams,
|
|
13233
|
+
...select ? { select } : {},
|
|
13234
|
+
cursor: { field: cursorField, value: cursor, order, limit: batchSize }
|
|
13235
|
+
}), "buildParams"),
|
|
13236
|
+
// Advance by the raw cursor-field value from the last item; a missing
|
|
13237
|
+
// value (cursorField not selected / wrong name) stops the walk.
|
|
13238
|
+
readNextCursor: /* @__PURE__ */ __name$11((lastItem) => lastItem[cursorField] ?? null, "readNextCursor"),
|
|
13239
|
+
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\`).`,
|
|
13240
|
+
errorLabel: "fetchTailMethod"
|
|
13037
13241
|
});
|
|
13038
|
-
|
|
13039
|
-
|
|
13040
|
-
method: options.method,
|
|
13041
|
-
requestId: options.requestId,
|
|
13042
|
-
messages: response.getErrorMessages()
|
|
13043
|
-
});
|
|
13242
|
+
} catch (error) {
|
|
13243
|
+
if (error instanceof KeysetPaginationError) {
|
|
13044
13244
|
throw new SdkError({
|
|
13045
|
-
code: "
|
|
13046
|
-
description: `API Error: ${
|
|
13245
|
+
code: "JSSDK_CORE_B24_FETCH_TAIL_METHOD_API_V3",
|
|
13246
|
+
description: `API Error: ${error.messages.join("; ")}`,
|
|
13047
13247
|
status: 500
|
|
13048
13248
|
});
|
|
13049
13249
|
}
|
|
13050
|
-
|
|
13051
|
-
|
|
13052
|
-
|
|
13053
|
-
|
|
13054
|
-
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
|
|
13058
|
-
|
|
13250
|
+
throw error;
|
|
13251
|
+
}
|
|
13252
|
+
}
|
|
13253
|
+
}
|
|
13254
|
+
|
|
13255
|
+
var __defProp$10 = Object.defineProperty;
|
|
13256
|
+
var __name$10 = (target, value) => __defProp$10(target, "name", { value, configurable: true });
|
|
13257
|
+
const AGGREGATE_FUNCTIONS = ["sum", "avg", "min", "max", "count", "countDistinct"];
|
|
13258
|
+
class AggregateV3 extends AbstractAction {
|
|
13259
|
+
static {
|
|
13260
|
+
__name$10(this, "AggregateV3");
|
|
13261
|
+
}
|
|
13262
|
+
/**
|
|
13263
|
+
* @param {ActionAggregateV3} options
|
|
13264
|
+
* - `method: string` - an `*.aggregate` method name.
|
|
13265
|
+
* - `select: AggregateSelectV3` - per-function field selection (`sum`/`avg`/`min`/`max`/`count`/`countDistinct`).
|
|
13266
|
+
* - `params?: { filter }` - optional v3 filter (array-of-triples; use `FilterV3` to build it).
|
|
13267
|
+
* - `requestId?: string` - tracking id.
|
|
13268
|
+
*
|
|
13269
|
+
* @returns {Promise<Result<AggregateResultV3>>} buckets keyed by function then field name.
|
|
13270
|
+
*
|
|
13271
|
+
* @example
|
|
13272
|
+
* const response = await b24.actions.v3.aggregate.make({
|
|
13273
|
+
* method: 'some.entity.aggregate',
|
|
13274
|
+
* select: { sum: { amount: 'totalAmount' }, count: ['id'] },
|
|
13275
|
+
* params: { filter: FilterV3.build(FilterV3.eq('status', 'NEW')) }
|
|
13276
|
+
* })
|
|
13277
|
+
* if (response.isSuccess) {
|
|
13278
|
+
* const total = response.getData()?.sum?.amount
|
|
13279
|
+
* }
|
|
13280
|
+
*/
|
|
13281
|
+
async make(options) {
|
|
13282
|
+
const result = new Result();
|
|
13283
|
+
const select = options?.select ?? {};
|
|
13284
|
+
for (const fn of Object.keys(select)) {
|
|
13285
|
+
if (!AGGREGATE_FUNCTIONS.includes(fn)) {
|
|
13286
|
+
throw new SdkError({
|
|
13287
|
+
code: "JSSDK_AGGREGATE_V3_INVALID_FUNCTION",
|
|
13288
|
+
description: `AggregateV3: "${fn}" is not an aggregate function \u2014 use one of ${AGGREGATE_FUNCTIONS.join(" ")}.`,
|
|
13289
|
+
status: 400
|
|
13290
|
+
});
|
|
13059
13291
|
}
|
|
13060
|
-
|
|
13061
|
-
if (
|
|
13062
|
-
|
|
13063
|
-
|
|
13292
|
+
const fields = select[fn];
|
|
13293
|
+
if (!Array.isArray(fields) && (typeof fields !== "object" || fields === null)) {
|
|
13294
|
+
throw new SdkError({
|
|
13295
|
+
code: "JSSDK_AGGREGATE_V3_INVALID_SELECT",
|
|
13296
|
+
description: `AggregateV3: select.${fn} must be a string[] (default alias) or a { field: alias } map.`,
|
|
13297
|
+
status: 400
|
|
13298
|
+
});
|
|
13064
13299
|
}
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
|
|
13300
|
+
}
|
|
13301
|
+
const params = { select };
|
|
13302
|
+
if (options?.params?.filter) {
|
|
13303
|
+
params.filter = options.params.filter;
|
|
13304
|
+
}
|
|
13305
|
+
const response = await this._b24.actions.v3.call.make({
|
|
13306
|
+
method: options.method,
|
|
13307
|
+
params,
|
|
13308
|
+
requestId: options.requestId
|
|
13309
|
+
});
|
|
13310
|
+
if (!response.isSuccess) {
|
|
13311
|
+
this._logger.error("aggregateMethod", {
|
|
13312
|
+
method: options.method,
|
|
13313
|
+
requestId: options.requestId,
|
|
13314
|
+
messages: response.getErrorMessages()
|
|
13315
|
+
});
|
|
13316
|
+
for (const [index, error] of response.errors) {
|
|
13317
|
+
result.addError(error, index);
|
|
13071
13318
|
}
|
|
13072
|
-
|
|
13319
|
+
return result;
|
|
13320
|
+
}
|
|
13321
|
+
const payload = response.getData()?.result;
|
|
13322
|
+
let buckets;
|
|
13323
|
+
if (payload && typeof payload === "object" && "result" in payload) {
|
|
13324
|
+
buckets = payload.result ?? {};
|
|
13325
|
+
} else if (payload && typeof payload === "object") {
|
|
13326
|
+
this._logger.warning(`aggregate.make: response has no nested 'result.result' envelope (the v3 reference \xA77 specifies double nesting); falling back to the top-level 'result'. method=${options.method}`);
|
|
13327
|
+
buckets = payload;
|
|
13328
|
+
} else {
|
|
13329
|
+
buckets = {};
|
|
13330
|
+
}
|
|
13331
|
+
return result.setData(buckets);
|
|
13073
13332
|
}
|
|
13074
13333
|
}
|
|
13075
13334
|
|
|
13076
|
-
var __defProp
|
|
13077
|
-
var __name
|
|
13335
|
+
var __defProp$$ = Object.defineProperty;
|
|
13336
|
+
var __name$$ = (target, value) => __defProp$$(target, "name", { value, configurable: true });
|
|
13078
13337
|
class BatchV3 extends AbstractBatch {
|
|
13079
13338
|
static {
|
|
13080
|
-
__name
|
|
13339
|
+
__name$$(this, "BatchV3");
|
|
13081
13340
|
}
|
|
13082
13341
|
/**
|
|
13083
13342
|
* Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50.
|
|
@@ -13175,23 +13434,16 @@ ${JSON.stringify({
|
|
|
13175
13434
|
...options.options,
|
|
13176
13435
|
apiVersion: ApiVersion.v3
|
|
13177
13436
|
};
|
|
13178
|
-
if (versionManager.automaticallyObtainApiVersionForBatch(options.calls) !== opts.apiVersion) {
|
|
13179
|
-
throw new SdkError({
|
|
13180
|
-
code: "JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",
|
|
13181
|
-
description: `restApi:v3 not support some methods in calls: ${JSON.stringify(options.calls)}`,
|
|
13182
|
-
status: 500
|
|
13183
|
-
});
|
|
13184
|
-
}
|
|
13185
13437
|
const response = await this._b24.getHttpClient(ApiVersion.v3).batch(options.calls, opts);
|
|
13186
13438
|
return this._processBatchResponse(response, options.calls, opts);
|
|
13187
13439
|
}
|
|
13188
13440
|
}
|
|
13189
13441
|
|
|
13190
|
-
var __defProp$
|
|
13191
|
-
var __name$
|
|
13442
|
+
var __defProp$_ = Object.defineProperty;
|
|
13443
|
+
var __name$_ = (target, value) => __defProp$_(target, "name", { value, configurable: true });
|
|
13192
13444
|
class BatchByChunkV3 extends AbstractBatch {
|
|
13193
13445
|
static {
|
|
13194
|
-
__name$
|
|
13446
|
+
__name$_(this, "BatchByChunkV3");
|
|
13195
13447
|
}
|
|
13196
13448
|
/**
|
|
13197
13449
|
* Executes a batch request with automatic chunking for any number of commands.
|
|
@@ -13264,16 +13516,19 @@ ${JSON.stringify({
|
|
|
13264
13516
|
}
|
|
13265
13517
|
}
|
|
13266
13518
|
|
|
13267
|
-
var __defProp$
|
|
13268
|
-
var __name$
|
|
13269
|
-
const callName = Symbol("call_V3");
|
|
13270
|
-
const callListName = Symbol("callList_V3");
|
|
13271
|
-
const fetchListName = Symbol("fetchList_V3");
|
|
13272
|
-
const
|
|
13273
|
-
const
|
|
13519
|
+
var __defProp$Z = Object.defineProperty;
|
|
13520
|
+
var __name$Z = (target, value) => __defProp$Z(target, "name", { value, configurable: true });
|
|
13521
|
+
const callName = /* @__PURE__ */ Symbol("call_V3");
|
|
13522
|
+
const callListName = /* @__PURE__ */ Symbol("callList_V3");
|
|
13523
|
+
const fetchListName = /* @__PURE__ */ Symbol("fetchList_V3");
|
|
13524
|
+
const callTailName = /* @__PURE__ */ Symbol("callTail_V3");
|
|
13525
|
+
const fetchTailName = /* @__PURE__ */ Symbol("fetchTail_V3");
|
|
13526
|
+
const aggregateName = /* @__PURE__ */ Symbol("aggregate_V3");
|
|
13527
|
+
const batchName = /* @__PURE__ */ Symbol("batch_V3");
|
|
13528
|
+
const batchByChunkName = /* @__PURE__ */ Symbol("batchByChunk_V3");
|
|
13274
13529
|
class ActionsManagerV3 {
|
|
13275
13530
|
static {
|
|
13276
|
-
__name$
|
|
13531
|
+
__name$Z(this, "ActionsManagerV3");
|
|
13277
13532
|
}
|
|
13278
13533
|
_b24;
|
|
13279
13534
|
_logger;
|
|
@@ -13307,6 +13562,24 @@ ${JSON.stringify({
|
|
|
13307
13562
|
}
|
|
13308
13563
|
return this._mapActions.get(fetchListName);
|
|
13309
13564
|
}
|
|
13565
|
+
get callTail() {
|
|
13566
|
+
if (!this._mapActions.has(callTailName)) {
|
|
13567
|
+
this._mapActions.set(callTailName, new CallTailV3(this._b24, this._logger));
|
|
13568
|
+
}
|
|
13569
|
+
return this._mapActions.get(callTailName);
|
|
13570
|
+
}
|
|
13571
|
+
get fetchTail() {
|
|
13572
|
+
if (!this._mapActions.has(fetchTailName)) {
|
|
13573
|
+
this._mapActions.set(fetchTailName, new FetchTailV3(this._b24, this._logger));
|
|
13574
|
+
}
|
|
13575
|
+
return this._mapActions.get(fetchTailName);
|
|
13576
|
+
}
|
|
13577
|
+
get aggregate() {
|
|
13578
|
+
if (!this._mapActions.has(aggregateName)) {
|
|
13579
|
+
this._mapActions.set(aggregateName, new AggregateV3(this._b24, this._logger));
|
|
13580
|
+
}
|
|
13581
|
+
return this._mapActions.get(aggregateName);
|
|
13582
|
+
}
|
|
13310
13583
|
get batch() {
|
|
13311
13584
|
if (!this._mapActions.has(batchName)) {
|
|
13312
13585
|
this._mapActions.set(batchName, new BatchV3(this._b24, this._logger));
|
|
@@ -13321,13 +13594,13 @@ ${JSON.stringify({
|
|
|
13321
13594
|
}
|
|
13322
13595
|
}
|
|
13323
13596
|
|
|
13324
|
-
var __defProp$
|
|
13325
|
-
var __name$
|
|
13597
|
+
var __defProp$Y = Object.defineProperty;
|
|
13598
|
+
var __name$Y = (target, value) => __defProp$Y(target, "name", { value, configurable: true });
|
|
13326
13599
|
const apiV2Name = Symbol(ApiVersion.v2);
|
|
13327
13600
|
const apiV3Name = Symbol(ApiVersion.v3);
|
|
13328
13601
|
class ActionsManager {
|
|
13329
13602
|
static {
|
|
13330
|
-
__name$
|
|
13603
|
+
__name$Y(this, "ActionsManager");
|
|
13331
13604
|
}
|
|
13332
13605
|
_b24;
|
|
13333
13606
|
_logger;
|
|
@@ -13359,11 +13632,11 @@ ${JSON.stringify({
|
|
|
13359
13632
|
}
|
|
13360
13633
|
}
|
|
13361
13634
|
|
|
13362
|
-
var __defProp$
|
|
13363
|
-
var __name$
|
|
13635
|
+
var __defProp$X = Object.defineProperty;
|
|
13636
|
+
var __name$X = (target, value) => __defProp$X(target, "name", { value, configurable: true });
|
|
13364
13637
|
class AbstractTool {
|
|
13365
13638
|
static {
|
|
13366
|
-
__name$
|
|
13639
|
+
__name$X(this, "AbstractTool");
|
|
13367
13640
|
}
|
|
13368
13641
|
_b24;
|
|
13369
13642
|
_logger;
|
|
@@ -13373,11 +13646,11 @@ ${JSON.stringify({
|
|
|
13373
13646
|
}
|
|
13374
13647
|
}
|
|
13375
13648
|
|
|
13376
|
-
var __defProp$
|
|
13377
|
-
var __name$
|
|
13649
|
+
var __defProp$W = Object.defineProperty;
|
|
13650
|
+
var __name$W = (target, value) => __defProp$W(target, "name", { value, configurable: true });
|
|
13378
13651
|
class Ping extends AbstractTool {
|
|
13379
13652
|
static {
|
|
13380
|
-
__name$
|
|
13653
|
+
__name$W(this, "Ping");
|
|
13381
13654
|
}
|
|
13382
13655
|
/**
|
|
13383
13656
|
* Measures the response speed of the Bitrix24 REST API.
|
|
@@ -13417,11 +13690,11 @@ ${JSON.stringify({
|
|
|
13417
13690
|
}
|
|
13418
13691
|
}
|
|
13419
13692
|
|
|
13420
|
-
var __defProp$
|
|
13421
|
-
var __name$
|
|
13693
|
+
var __defProp$V = Object.defineProperty;
|
|
13694
|
+
var __name$V = (target, value) => __defProp$V(target, "name", { value, configurable: true });
|
|
13422
13695
|
class HealthCheck extends AbstractTool {
|
|
13423
13696
|
static {
|
|
13424
|
-
__name$
|
|
13697
|
+
__name$V(this, "HealthCheck");
|
|
13425
13698
|
}
|
|
13426
13699
|
/**
|
|
13427
13700
|
* Checks the availability of the Bitrix24 REST API.
|
|
@@ -13453,13 +13726,13 @@ ${JSON.stringify({
|
|
|
13453
13726
|
}
|
|
13454
13727
|
}
|
|
13455
13728
|
|
|
13456
|
-
var __defProp$
|
|
13457
|
-
var __name$
|
|
13458
|
-
const pingName = Symbol("ping");
|
|
13459
|
-
const healthCheckName = Symbol("healthCheck");
|
|
13729
|
+
var __defProp$U = Object.defineProperty;
|
|
13730
|
+
var __name$U = (target, value) => __defProp$U(target, "name", { value, configurable: true });
|
|
13731
|
+
const pingName = /* @__PURE__ */ Symbol("ping");
|
|
13732
|
+
const healthCheckName = /* @__PURE__ */ Symbol("healthCheck");
|
|
13460
13733
|
class ToolsManager {
|
|
13461
13734
|
static {
|
|
13462
|
-
__name$
|
|
13735
|
+
__name$U(this, "ToolsManager");
|
|
13463
13736
|
}
|
|
13464
13737
|
_b24;
|
|
13465
13738
|
_logger;
|
|
@@ -13489,11 +13762,11 @@ ${JSON.stringify({
|
|
|
13489
13762
|
}
|
|
13490
13763
|
}
|
|
13491
13764
|
|
|
13492
|
-
var __defProp$
|
|
13493
|
-
var __name$
|
|
13765
|
+
var __defProp$T = Object.defineProperty;
|
|
13766
|
+
var __name$T = (target, value) => __defProp$T(target, "name", { value, configurable: true });
|
|
13494
13767
|
class AbstractB24 {
|
|
13495
13768
|
static {
|
|
13496
|
-
__name$
|
|
13769
|
+
__name$T(this, "AbstractB24");
|
|
13497
13770
|
}
|
|
13498
13771
|
/**
|
|
13499
13772
|
* Maximum length for batch response.
|
|
@@ -18576,15 +18849,15 @@ ${JSON.stringify({
|
|
|
18576
18849
|
create,
|
|
18577
18850
|
} = axios;
|
|
18578
18851
|
|
|
18579
|
-
var __defProp$
|
|
18580
|
-
var __name$
|
|
18852
|
+
var __defProp$S = Object.defineProperty;
|
|
18853
|
+
var __name$S = (target, value) => __defProp$S(target, "name", { value, configurable: true });
|
|
18581
18854
|
const DEFAULT_REQUEST_ID_HEADER_FIELD_NAME = "X-Request-ID";
|
|
18582
18855
|
const DEFAULT_QUERY_STRING_PARAMETER_NAME = "bx24_request_id";
|
|
18583
18856
|
const DEFAULT_QUERY_STRING_SDK_VER_PARAMETER_NAME = "bx24_sdk_ver";
|
|
18584
18857
|
const DEFAULT_QUERY_STRING_SDK_TYPE_PARAMETER_NAME = "bx24_sdk_type";
|
|
18585
18858
|
class RequestIdGenerator {
|
|
18586
18859
|
static {
|
|
18587
|
-
__name$
|
|
18860
|
+
__name$S(this, "RequestIdGenerator");
|
|
18588
18861
|
}
|
|
18589
18862
|
getQueryStringParameterName() {
|
|
18590
18863
|
return DEFAULT_QUERY_STRING_PARAMETER_NAME;
|
|
@@ -18606,16 +18879,28 @@ ${JSON.stringify({
|
|
|
18606
18879
|
}
|
|
18607
18880
|
}
|
|
18608
18881
|
|
|
18609
|
-
var __defProp$
|
|
18610
|
-
var __name$
|
|
18882
|
+
var __defProp$R = Object.defineProperty;
|
|
18883
|
+
var __name$R = (target, value) => __defProp$R(target, "name", { value, configurable: true });
|
|
18884
|
+
const LOG_MAX_LENGTH = 300;
|
|
18885
|
+
const LOG_SLICE_LENGTH = 100;
|
|
18886
|
+
function truncateForLog(value) {
|
|
18887
|
+
return value.length > LOG_MAX_LENGTH ? value.slice(0, LOG_SLICE_LENGTH) + "..." : value;
|
|
18888
|
+
}
|
|
18889
|
+
__name$R(truncateForLog, "truncateForLog");
|
|
18611
18890
|
class AbstractHttp {
|
|
18612
18891
|
static {
|
|
18613
|
-
__name$
|
|
18892
|
+
__name$R(this, "AbstractHttp");
|
|
18614
18893
|
}
|
|
18615
18894
|
_clientAxios;
|
|
18616
18895
|
_authActions;
|
|
18617
18896
|
_requestIdGenerator;
|
|
18618
18897
|
_restrictionManager;
|
|
18898
|
+
/**
|
|
18899
|
+
* In-flight token refresh, shared so concurrent 401s coalesce into a single
|
|
18900
|
+
* `refreshAuth()` round-trip — avoids OAuth refresh-token reuse errors when a
|
|
18901
|
+
* burst of requests expires together. (#182)
|
|
18902
|
+
*/
|
|
18903
|
+
_pendingRefresh = null;
|
|
18619
18904
|
_logger;
|
|
18620
18905
|
_isClientSideWarning = false;
|
|
18621
18906
|
_clientSideWarningMessage = "";
|
|
@@ -18633,18 +18918,20 @@ ${JSON.stringify({
|
|
|
18633
18918
|
this._logger = LoggerFactory.createNullLogger();
|
|
18634
18919
|
const defaultHeaders = {};
|
|
18635
18920
|
if (this.isServerSide()) {
|
|
18636
|
-
defaultHeaders["User-Agent"] = "b24-js-sdk/
|
|
18921
|
+
defaultHeaders["User-Agent"] = "b24-js-sdk/2.0.0";
|
|
18637
18922
|
}
|
|
18638
18923
|
this._authActions = authActions;
|
|
18639
18924
|
this._requestIdGenerator = new RequestIdGenerator();
|
|
18640
18925
|
this._clientAxios = axios.create({
|
|
18641
|
-
headers: {
|
|
18642
|
-
...defaultHeaders,
|
|
18643
|
-
...options ? options.headers : {}
|
|
18644
|
-
},
|
|
18645
18926
|
timeout: 3e4,
|
|
18646
18927
|
timeoutErrorMessage: "Request timeout exceeded",
|
|
18647
|
-
...options
|
|
18928
|
+
...options ?? {},
|
|
18929
|
+
// headers last so the merged default + caller headers aren't wiped by an
|
|
18930
|
+
// `options.headers` (or the previous `headers: undefined`) spread (#144).
|
|
18931
|
+
headers: {
|
|
18932
|
+
...defaultHeaders,
|
|
18933
|
+
...options?.headers ?? {}
|
|
18934
|
+
}
|
|
18648
18935
|
});
|
|
18649
18936
|
const params = {
|
|
18650
18937
|
...ParamsFactory.getDefault(),
|
|
@@ -18680,7 +18967,7 @@ ${JSON.stringify({
|
|
|
18680
18967
|
getStats() {
|
|
18681
18968
|
return {
|
|
18682
18969
|
...this._restrictionManager.getStats(),
|
|
18683
|
-
totalRequests: this._metrics.
|
|
18970
|
+
totalRequests: this._metrics.totalRequests,
|
|
18684
18971
|
successfulRequests: this._metrics.successfulRequests,
|
|
18685
18972
|
failedRequests: this._metrics.failedRequests,
|
|
18686
18973
|
totalDuration: this._metrics.totalDuration,
|
|
@@ -18692,7 +18979,7 @@ ${JSON.stringify({
|
|
|
18692
18979
|
* @inheritDoc
|
|
18693
18980
|
*/
|
|
18694
18981
|
async reset() {
|
|
18695
|
-
this._metrics.
|
|
18982
|
+
this._metrics.totalRequests = 0;
|
|
18696
18983
|
this._metrics.successfulRequests = 0;
|
|
18697
18984
|
this._metrics.failedRequests = 0;
|
|
18698
18985
|
this._metrics.totalDuration = 0;
|
|
@@ -18770,7 +19057,7 @@ ${JSON.stringify({
|
|
|
18770
19057
|
this._restrictionManager.incrementError(method);
|
|
18771
19058
|
this._updateMetrics(method, false, duration, lastError);
|
|
18772
19059
|
this._logFailedRequest(requestId, method, attempt + 1, maxRetries, lastError);
|
|
18773
|
-
if (attempt < maxRetries) {
|
|
19060
|
+
if (attempt + 1 < maxRetries) {
|
|
18774
19061
|
const waitTime = await this._restrictionManager.handleError(requestId, method, params, lastError, attempt);
|
|
18775
19062
|
if (waitTime > 0) {
|
|
18776
19063
|
this._restrictionManager.incrementStats("limitHits");
|
|
@@ -18884,10 +19171,27 @@ ${JSON.stringify({
|
|
|
18884
19171
|
let authData = this._authActions.getAuthData();
|
|
18885
19172
|
if (authData === false) {
|
|
18886
19173
|
this._logRefreshingAuthToken(requestId);
|
|
18887
|
-
authData = await this.
|
|
19174
|
+
authData = await this._refreshAuth();
|
|
18888
19175
|
}
|
|
18889
19176
|
return authData;
|
|
18890
19177
|
}
|
|
19178
|
+
/**
|
|
19179
|
+
* Refresh the auth token, coalescing concurrent callers onto a single
|
|
19180
|
+
* in-flight `refreshAuth()` so a burst of 401s triggers exactly one refresh
|
|
19181
|
+
* round-trip. The slot clears once the refresh settles. (#182)
|
|
19182
|
+
*/
|
|
19183
|
+
_refreshAuth() {
|
|
19184
|
+
if (this._pendingRefresh) {
|
|
19185
|
+
return this._pendingRefresh;
|
|
19186
|
+
}
|
|
19187
|
+
const refresh = this._authActions.refreshAuth();
|
|
19188
|
+
this._pendingRefresh = refresh;
|
|
19189
|
+
refresh.finally(() => {
|
|
19190
|
+
this._pendingRefresh = null;
|
|
19191
|
+
}).catch(() => {
|
|
19192
|
+
});
|
|
19193
|
+
return refresh;
|
|
19194
|
+
}
|
|
18891
19195
|
// Execute the request with 401 error handling
|
|
18892
19196
|
async _makeRequestWithAuthRetry(requestId, method, params, authData) {
|
|
18893
19197
|
try {
|
|
@@ -18901,33 +19205,33 @@ ${JSON.stringify({
|
|
|
18901
19205
|
requestId,
|
|
18902
19206
|
status: error.status,
|
|
18903
19207
|
// Redact in case a future portal response embeds credentials in
|
|
18904
|
-
// the error body (today it doesn't, but the channel is open)
|
|
18905
|
-
|
|
19208
|
+
// the error body (today it doesn't, but the channel is open) (#39),
|
|
19209
|
+
// and cap the length so a large error body can't flood the sink (#236).
|
|
19210
|
+
responseData: truncateForLog(JSON.stringify(redactSensitiveParams(error?.response?.data), null, 0))
|
|
18906
19211
|
}
|
|
18907
19212
|
);
|
|
18908
19213
|
}
|
|
18909
|
-
|
|
19214
|
+
const ajaxError = this._convertToAjaxError(requestId, error, method, params);
|
|
19215
|
+
if (this._isAuthError(ajaxError)) {
|
|
18910
19216
|
this._logAuthErrorDetected(requestId);
|
|
18911
19217
|
this._logRefreshingAuthToken(requestId);
|
|
18912
|
-
const refreshedAuthData = await this.
|
|
19218
|
+
const refreshedAuthData = await this._refreshAuth();
|
|
18913
19219
|
await this._restrictionManager.checkRateLimit(requestId, method);
|
|
18914
19220
|
return await this._makeAxiosRequest(requestId, method, params, refreshedAuthData);
|
|
18915
19221
|
}
|
|
18916
|
-
throw
|
|
19222
|
+
throw ajaxError;
|
|
18917
19223
|
}
|
|
18918
19224
|
}
|
|
18919
19225
|
async _makeAxiosRequest(requestId, method, params, authData) {
|
|
18920
19226
|
const methodFormatted = this._prepareMethod(requestId, method, this.getBaseUrl());
|
|
18921
19227
|
const paramsFormatted = this._prepareParams(authData, params);
|
|
18922
19228
|
const paramsFormattedForLog = JSON.stringify(redactSensitiveParams(paramsFormatted), null, 0);
|
|
18923
|
-
const maxLogLength = 300;
|
|
18924
|
-
const sliceLogLength = 100;
|
|
18925
19229
|
this.getLogger().info(
|
|
18926
19230
|
`post/send`,
|
|
18927
19231
|
{
|
|
18928
19232
|
requestId,
|
|
18929
19233
|
method,
|
|
18930
|
-
params: paramsFormattedForLog
|
|
19234
|
+
params: truncateForLog(paramsFormattedForLog)
|
|
18931
19235
|
}
|
|
18932
19236
|
);
|
|
18933
19237
|
const response = await this._clientAxios.post(methodFormatted, paramsFormatted);
|
|
@@ -18937,7 +19241,7 @@ ${JSON.stringify({
|
|
|
18937
19241
|
{
|
|
18938
19242
|
requestId,
|
|
18939
19243
|
// responseFull: JSON.stringify(response.data, null, 2),
|
|
18940
|
-
result: resultFormattedForLog
|
|
19244
|
+
result: truncateForLog(resultFormattedForLog),
|
|
18941
19245
|
time: JSON.stringify(response.data.time, null, 0)
|
|
18942
19246
|
}
|
|
18943
19247
|
);
|
|
@@ -18979,6 +19283,50 @@ ${JSON.stringify({
|
|
|
18979
19283
|
status: ajaxError.status
|
|
18980
19284
|
});
|
|
18981
19285
|
}
|
|
19286
|
+
// endregion ////
|
|
19287
|
+
// endregion ////
|
|
19288
|
+
// region Prepare ////
|
|
19289
|
+
/**
|
|
19290
|
+
* Builds the request URL: the method path plus the SDK telemetry query params
|
|
19291
|
+
* (`bx24_request_id` / `bx24_sdk_ver` / `bx24_sdk_type` — request tracing and
|
|
19292
|
+
* SDK identification, not auth material).
|
|
19293
|
+
*
|
|
19294
|
+
* Carve-out for the legacy positional `task.*` methods (`task.commentitem.*`,
|
|
19295
|
+
* `task.checklistitem.*`, `task.elapseditem.*`, …): these read the request
|
|
19296
|
+
* **query string positionally**, so appending the telemetry params shifts
|
|
19297
|
+
* `Param #0` and the server rejects the call —
|
|
19298
|
+
* `WRONG_ARGUMENTS: Param #0 (taskId) ... expected integer, but given
|
|
19299
|
+
* something else`. Verified live against a portal: the same
|
|
19300
|
+
* `task.commentitem.getlist` / `task.checklistitem.getlist` call succeeds
|
|
19301
|
+
* without the telemetry params and fails with them; modern `tasks.task.*`
|
|
19302
|
+
* (named params) is unaffected. So telemetry is omitted for any method whose
|
|
19303
|
+
* name contains `task.`.
|
|
19304
|
+
*
|
|
19305
|
+
* Shared by v2 and v3 (rather than per-transport): once the v3 method
|
|
19306
|
+
* allowlist was dropped (#259) a positional `task.*` method can be routed via
|
|
19307
|
+
* `actions.v3.*` too, so v3 needs the same suppression — keeping the rule in
|
|
19308
|
+
* one place stops the two transports drifting apart again (#207).
|
|
19309
|
+
*
|
|
19310
|
+
* `includes('task.')` is a deliberate over-approximation: it also drops the
|
|
19311
|
+
* (optional, telemetry-safe) params for modern `tasks.task.*` / `bizproc.task.*`.
|
|
19312
|
+
* Narrowing to an anchored `^task\.` is possible but unverified across the
|
|
19313
|
+
* whole task surface, so the broad, safe match is kept. Bitrix24 method names
|
|
19314
|
+
* are lowercase by convention, so the case-sensitive match is sufficient.
|
|
19315
|
+
*
|
|
19316
|
+
* @see https://apidocs.bitrix24.com/settings/how-to-call-rest-api/data-encoding.html#order-of-parameters
|
|
19317
|
+
*/
|
|
19318
|
+
_prepareMethod(requestId, method, baseUrl) {
|
|
19319
|
+
const methodUrl = `/${encodeURIComponent(method)}`;
|
|
19320
|
+
if (method.includes("task.")) {
|
|
19321
|
+
return `${baseUrl}${methodUrl}`;
|
|
19322
|
+
}
|
|
19323
|
+
const queryParams = new URLSearchParams({
|
|
19324
|
+
[this._requestIdGenerator.getQueryStringParameterName()]: requestId,
|
|
19325
|
+
[this._requestIdGenerator.getQueryStringSdkParameterName()]: "2.0.0",
|
|
19326
|
+
[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
|
|
19327
|
+
});
|
|
19328
|
+
return `${baseUrl}${methodUrl}?${queryParams.toString()}`;
|
|
19329
|
+
}
|
|
18982
19330
|
/**
|
|
18983
19331
|
* Processes function parameters and adds authorization
|
|
18984
19332
|
*/
|
|
@@ -19143,11 +19491,11 @@ ${JSON.stringify({
|
|
|
19143
19491
|
// endregion ////
|
|
19144
19492
|
}
|
|
19145
19493
|
|
|
19146
|
-
var __defProp$
|
|
19147
|
-
var __name$
|
|
19494
|
+
var __defProp$Q = Object.defineProperty;
|
|
19495
|
+
var __name$Q = (target, value) => __defProp$Q(target, "name", { value, configurable: true });
|
|
19148
19496
|
class AbstractInteractionBatch {
|
|
19149
19497
|
static {
|
|
19150
|
-
__name$
|
|
19498
|
+
__name$Q(this, "AbstractInteractionBatch");
|
|
19151
19499
|
}
|
|
19152
19500
|
parallelDefaultValue;
|
|
19153
19501
|
requestId;
|
|
@@ -19200,12 +19548,12 @@ ${JSON.stringify({
|
|
|
19200
19548
|
// endregion ////
|
|
19201
19549
|
}
|
|
19202
19550
|
|
|
19203
|
-
var __defProp$
|
|
19204
|
-
var __name$
|
|
19551
|
+
var __defProp$P = Object.defineProperty;
|
|
19552
|
+
var __name$P = (target, value) => __defProp$P(target, "name", { value, configurable: true });
|
|
19205
19553
|
const MAX_BATCH_COMMANDS_V2 = 50;
|
|
19206
19554
|
class InteractionBatchV2 extends AbstractInteractionBatch {
|
|
19207
19555
|
static {
|
|
19208
|
-
__name$
|
|
19556
|
+
__name$P(this, "InteractionBatchV2");
|
|
19209
19557
|
}
|
|
19210
19558
|
get maxSize() {
|
|
19211
19559
|
return MAX_BATCH_COMMANDS_V2;
|
|
@@ -19633,11 +19981,53 @@ ${JSON.stringify({
|
|
|
19633
19981
|
return joined.length > 0 ? prefix + joined : ''
|
|
19634
19982
|
}
|
|
19635
19983
|
|
|
19636
|
-
var __defProp$
|
|
19637
|
-
var __name$
|
|
19984
|
+
var __defProp$O = Object.defineProperty;
|
|
19985
|
+
var __name$O = (target, value) => __defProp$O(target, "name", { value, configurable: true });
|
|
19638
19986
|
class AbstractProcessing {
|
|
19639
19987
|
static {
|
|
19640
|
-
__name$
|
|
19988
|
+
__name$O(this, "AbstractProcessing");
|
|
19989
|
+
}
|
|
19990
|
+
// region prepareItems ////
|
|
19991
|
+
/**
|
|
19992
|
+
* Template method. The soft-error envelope guard lives here ONCE so v2 and v3
|
|
19993
|
+
* can't drift on it (#228 — hoisted from the duplicated #145 fix).
|
|
19994
|
+
*
|
|
19995
|
+
* When the batch CALL itself soft-errors (a top-level code in the restriction
|
|
19996
|
+
* manager's `exceptionCodeForSoft` set, surfaced as a soft `Result` instead of
|
|
19997
|
+
* a throw), the envelope carries `{ error }` and no `result`, so
|
|
19998
|
+
* `response.getData()` is `undefined`. Skip per-row parsing — it would
|
|
19999
|
+
* dereference `getData()!.result` — and let {@link handleResults} surface the
|
|
20000
|
+
* top-level errors. The version-specific success path is {@link _prepareItemsSuccess}.
|
|
20001
|
+
*/
|
|
20002
|
+
async prepareItems(commands, responseHelper) {
|
|
20003
|
+
const results = /* @__PURE__ */ new Map();
|
|
20004
|
+
if (!responseHelper.response.isSuccess) {
|
|
20005
|
+
return results;
|
|
20006
|
+
}
|
|
20007
|
+
return this._prepareItemsSuccess(commands, responseHelper, results);
|
|
20008
|
+
}
|
|
20009
|
+
// endregion ////
|
|
20010
|
+
// region handleResults ////
|
|
20011
|
+
/**
|
|
20012
|
+
* Template method. Same single soft-error guard as {@link prepareItems} (#228):
|
|
20013
|
+
* there is no per-row data and `getData()` is `undefined`, so surface the
|
|
20014
|
+
* envelope's top-level errors and return an empty data map instead of
|
|
20015
|
+
* dereferencing `getData()!.time`. The version-specific success path is
|
|
20016
|
+
* {@link _handleResultsSuccess}.
|
|
20017
|
+
*/
|
|
20018
|
+
async handleResults(commands, results, responseHelper) {
|
|
20019
|
+
const result = new Result();
|
|
20020
|
+
if (!responseHelper.response.isSuccess) {
|
|
20021
|
+
for (const [index, error] of responseHelper.response.errors) {
|
|
20022
|
+
result.addError(error, index);
|
|
20023
|
+
}
|
|
20024
|
+
result.setData({
|
|
20025
|
+
result: /* @__PURE__ */ new Map(),
|
|
20026
|
+
time: void 0
|
|
20027
|
+
});
|
|
20028
|
+
return result;
|
|
20029
|
+
}
|
|
20030
|
+
return this._handleResultsSuccess(commands, results, responseHelper, result);
|
|
19641
20031
|
}
|
|
19642
20032
|
// endregion ////
|
|
19643
20033
|
// region Tools ////
|
|
@@ -19663,11 +20053,11 @@ ${JSON.stringify({
|
|
|
19663
20053
|
// endregion ////
|
|
19664
20054
|
}
|
|
19665
20055
|
|
|
19666
|
-
var __defProp$
|
|
19667
|
-
var __name$
|
|
20056
|
+
var __defProp$N = Object.defineProperty;
|
|
20057
|
+
var __name$N = (target, value) => __defProp$N(target, "name", { value, configurable: true });
|
|
19668
20058
|
class AbstractProcessingV2 extends AbstractProcessing {
|
|
19669
20059
|
static {
|
|
19670
|
-
__name$
|
|
20060
|
+
__name$N(this, "AbstractProcessingV2");
|
|
19671
20061
|
}
|
|
19672
20062
|
_buildRow(command) {
|
|
19673
20063
|
return `${command.method}?${stringify(command.query || {})}`;
|
|
@@ -19696,8 +20086,9 @@ ${JSON.stringify({
|
|
|
19696
20086
|
return result;
|
|
19697
20087
|
}
|
|
19698
20088
|
// region prepareItems ////
|
|
19699
|
-
|
|
19700
|
-
|
|
20089
|
+
// Soft-error guard lives in AbstractProcessing.prepareItems (#228); this is the
|
|
20090
|
+
// success-only path for apiVer2.
|
|
20091
|
+
async _prepareItemsSuccess(commands, responseHelper, results) {
|
|
19701
20092
|
for (const [index, command] of commands.entries()) {
|
|
19702
20093
|
await this._processResponseItem(
|
|
19703
20094
|
command,
|
|
@@ -19745,34 +20136,90 @@ ${JSON.stringify({
|
|
|
19745
20136
|
status: 500
|
|
19746
20137
|
});
|
|
19747
20138
|
}
|
|
19748
|
-
}
|
|
19749
|
-
// endregion ////
|
|
19750
|
-
// region handleResults ////
|
|
19751
|
-
|
|
19752
|
-
|
|
19753
|
-
|
|
19754
|
-
|
|
19755
|
-
|
|
19756
|
-
|
|
19757
|
-
this.
|
|
19758
|
-
|
|
19759
|
-
|
|
19760
|
-
|
|
19761
|
-
|
|
19762
|
-
|
|
19763
|
-
|
|
19764
|
-
|
|
19765
|
-
|
|
20139
|
+
}
|
|
20140
|
+
// endregion ////
|
|
20141
|
+
// region handleResults ////
|
|
20142
|
+
// Soft-error guard lives in AbstractProcessing.handleResults (#228); this is the
|
|
20143
|
+
// success-only path for apiVer2.
|
|
20144
|
+
async _handleResultsSuccess(_commands, results, responseHelper, result) {
|
|
20145
|
+
const dataResult = /* @__PURE__ */ new Map();
|
|
20146
|
+
for (const [index, data] of results) {
|
|
20147
|
+
if (data.getStatus() !== 200 || !data.isSuccess) {
|
|
20148
|
+
const ajaxError = this._createErrorFromAjaxResult(data);
|
|
20149
|
+
this._processResponseError(result, ajaxError, `${index}`);
|
|
20150
|
+
dataResult.set(index, data);
|
|
20151
|
+
}
|
|
20152
|
+
dataResult.set(index, data);
|
|
20153
|
+
}
|
|
20154
|
+
result.setData({
|
|
20155
|
+
result: dataResult,
|
|
20156
|
+
time: responseHelper.response.getData().time
|
|
20157
|
+
});
|
|
20158
|
+
return result;
|
|
20159
|
+
}
|
|
20160
|
+
// endregion ////
|
|
20161
|
+
}
|
|
20162
|
+
|
|
20163
|
+
var __defProp$M = Object.defineProperty;
|
|
20164
|
+
var __name$M = (target, value) => __defProp$M(target, "name", { value, configurable: true });
|
|
20165
|
+
class ParseRow {
|
|
20166
|
+
static {
|
|
20167
|
+
__name$M(this, "ParseRow");
|
|
20168
|
+
}
|
|
20169
|
+
static getBatchCommand(row, options) {
|
|
20170
|
+
if (row) {
|
|
20171
|
+
if (typeof row === "object" && "method" in row && typeof row.method === "string") {
|
|
20172
|
+
return {
|
|
20173
|
+
method: row.method,
|
|
20174
|
+
query: row.params,
|
|
20175
|
+
as: row.as ?? options.asDefaultValue,
|
|
20176
|
+
parallel: row.parallel ?? options.parallelDefaultValue
|
|
20177
|
+
};
|
|
20178
|
+
}
|
|
20179
|
+
if (Array.isArray(row) && row.length > 0 && typeof row[0] === "string") {
|
|
20180
|
+
return {
|
|
20181
|
+
method: row[0],
|
|
20182
|
+
query: row[1],
|
|
20183
|
+
as: options.asDefaultValue,
|
|
20184
|
+
parallel: options.parallelDefaultValue
|
|
20185
|
+
};
|
|
20186
|
+
}
|
|
20187
|
+
}
|
|
20188
|
+
throw new SdkError({
|
|
20189
|
+
code: "JSSDK_INTERACTION_BATCH_ROW_FAIL",
|
|
20190
|
+
description: `There were difficulties parsing the command for batch.
|
|
20191
|
+
${JSON.stringify({
|
|
20192
|
+
row,
|
|
20193
|
+
options
|
|
20194
|
+
})}`,
|
|
20195
|
+
status: 500
|
|
20196
|
+
});
|
|
20197
|
+
}
|
|
20198
|
+
static getMethodsFromCommands(calls) {
|
|
20199
|
+
const result = [];
|
|
20200
|
+
const optsFake = {
|
|
20201
|
+
parallelDefaultValue: false
|
|
20202
|
+
};
|
|
20203
|
+
if (Array.isArray(calls)) {
|
|
20204
|
+
calls.forEach((row) => {
|
|
20205
|
+
const command = ParseRow.getBatchCommand(row, optsFake);
|
|
20206
|
+
result.push(command.method);
|
|
20207
|
+
});
|
|
20208
|
+
} else {
|
|
20209
|
+
Object.entries(calls).forEach(([index, row]) => {
|
|
20210
|
+
const command = ParseRow.getBatchCommand(row, { ...optsFake, asDefaultValue: index });
|
|
20211
|
+
result.push(command.method);
|
|
20212
|
+
});
|
|
20213
|
+
}
|
|
19766
20214
|
return result;
|
|
19767
20215
|
}
|
|
19768
|
-
// endregion ////
|
|
19769
20216
|
}
|
|
19770
20217
|
|
|
19771
|
-
var __defProp$
|
|
19772
|
-
var __name$
|
|
20218
|
+
var __defProp$L = Object.defineProperty;
|
|
20219
|
+
var __name$L = (target, value) => __defProp$L(target, "name", { value, configurable: true });
|
|
19773
20220
|
class ProcessingAsArrayV2 extends AbstractProcessingV2 {
|
|
19774
20221
|
static {
|
|
19775
|
-
__name$
|
|
20222
|
+
__name$L(this, "ProcessingAsArrayV2");
|
|
19776
20223
|
}
|
|
19777
20224
|
prepareCommands(calls, options) {
|
|
19778
20225
|
const result = [];
|
|
@@ -19782,16 +20229,16 @@ ${JSON.stringify({
|
|
|
19782
20229
|
});
|
|
19783
20230
|
return result;
|
|
19784
20231
|
}
|
|
19785
|
-
_processResponseError(result, ajaxError,
|
|
19786
|
-
result.addError(ajaxError);
|
|
20232
|
+
_processResponseError(result, ajaxError, index) {
|
|
20233
|
+
result.addError(ajaxError, index);
|
|
19787
20234
|
}
|
|
19788
20235
|
}
|
|
19789
20236
|
|
|
19790
|
-
var __defProp$
|
|
19791
|
-
var __name$
|
|
20237
|
+
var __defProp$K = Object.defineProperty;
|
|
20238
|
+
var __name$K = (target, value) => __defProp$K(target, "name", { value, configurable: true });
|
|
19792
20239
|
class ProcessingAsObjectV2 extends AbstractProcessingV2 {
|
|
19793
20240
|
static {
|
|
19794
|
-
__name$
|
|
20241
|
+
__name$K(this, "ProcessingAsObjectV2");
|
|
19795
20242
|
}
|
|
19796
20243
|
prepareCommands(calls, options) {
|
|
19797
20244
|
const result = [];
|
|
@@ -19806,11 +20253,11 @@ ${JSON.stringify({
|
|
|
19806
20253
|
}
|
|
19807
20254
|
}
|
|
19808
20255
|
|
|
19809
|
-
var __defProp$
|
|
19810
|
-
var __name$
|
|
20256
|
+
var __defProp$J = Object.defineProperty;
|
|
20257
|
+
var __name$J = (target, value) => __defProp$J(target, "name", { value, configurable: true });
|
|
19811
20258
|
class HttpV2 extends AbstractHttp {
|
|
19812
20259
|
static {
|
|
19813
|
-
__name$
|
|
20260
|
+
__name$J(this, "HttpV2");
|
|
19814
20261
|
}
|
|
19815
20262
|
constructor(authActions, options, restrictionParams) {
|
|
19816
20263
|
super(authActions, options, restrictionParams);
|
|
@@ -19870,31 +20317,14 @@ ${JSON.stringify({
|
|
|
19870
20317
|
return response;
|
|
19871
20318
|
}
|
|
19872
20319
|
// endregion ////
|
|
19873
|
-
// region Prepare ////
|
|
19874
|
-
/**
|
|
19875
|
-
* @inheritDoc
|
|
19876
|
-
*/
|
|
19877
|
-
_prepareMethod(requestId, method, baseUrl) {
|
|
19878
|
-
const methodUrl = `/${encodeURIComponent(method)}`;
|
|
19879
|
-
if (method.includes("task.")) {
|
|
19880
|
-
return `${baseUrl}${methodUrl}`;
|
|
19881
|
-
}
|
|
19882
|
-
const queryParams = new URLSearchParams({
|
|
19883
|
-
[this._requestIdGenerator.getQueryStringParameterName()]: requestId,
|
|
19884
|
-
[this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.2.0",
|
|
19885
|
-
[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
|
|
19886
|
-
});
|
|
19887
|
-
return `${baseUrl}${methodUrl}?${queryParams.toString()}`;
|
|
19888
|
-
}
|
|
19889
|
-
// endregion ////
|
|
19890
20320
|
}
|
|
19891
20321
|
|
|
19892
|
-
var __defProp$
|
|
19893
|
-
var __name$
|
|
20322
|
+
var __defProp$I = Object.defineProperty;
|
|
20323
|
+
var __name$I = (target, value) => __defProp$I(target, "name", { value, configurable: true });
|
|
19894
20324
|
const MAX_BATCH_COMMANDS_V3 = 50;
|
|
19895
20325
|
class InteractionBatchV3 extends AbstractInteractionBatch {
|
|
19896
20326
|
static {
|
|
19897
|
-
__name$
|
|
20327
|
+
__name$I(this, "InteractionBatchV3");
|
|
19898
20328
|
}
|
|
19899
20329
|
get maxSize() {
|
|
19900
20330
|
return MAX_BATCH_COMMANDS_V3;
|
|
@@ -19918,11 +20348,11 @@ ${JSON.stringify({
|
|
|
19918
20348
|
}
|
|
19919
20349
|
}
|
|
19920
20350
|
|
|
19921
|
-
var __defProp$
|
|
19922
|
-
var __name$
|
|
20351
|
+
var __defProp$H = Object.defineProperty;
|
|
20352
|
+
var __name$H = (target, value) => __defProp$H(target, "name", { value, configurable: true });
|
|
19923
20353
|
class AbstractProcessingV3 extends AbstractProcessing {
|
|
19924
20354
|
static {
|
|
19925
|
-
__name$
|
|
20355
|
+
__name$H(this, "AbstractProcessingV3");
|
|
19926
20356
|
}
|
|
19927
20357
|
buildCommands(commands) {
|
|
19928
20358
|
if (commands.length < 1) {
|
|
@@ -19935,11 +20365,9 @@ ${JSON.stringify({
|
|
|
19935
20365
|
return commands;
|
|
19936
20366
|
}
|
|
19937
20367
|
// region prepareItems ////
|
|
19938
|
-
|
|
19939
|
-
|
|
19940
|
-
|
|
19941
|
-
return results;
|
|
19942
|
-
}
|
|
20368
|
+
// Soft-error guard lives in AbstractProcessing.prepareItems (#228); this is the
|
|
20369
|
+
// success-only path for apiVer3 (all-or-nothing — no per-command errors).
|
|
20370
|
+
async _prepareItemsSuccess(commands, responseHelper, results) {
|
|
19943
20371
|
for (const [index, command] of commands.entries()) {
|
|
19944
20372
|
await this._processResponseItem(
|
|
19945
20373
|
command,
|
|
@@ -19988,19 +20416,10 @@ ${JSON.stringify({
|
|
|
19988
20416
|
}
|
|
19989
20417
|
// endregion ////
|
|
19990
20418
|
// region handleResults ////
|
|
19991
|
-
|
|
19992
|
-
|
|
20419
|
+
// Soft-error guard lives in AbstractProcessing.handleResults (#228); this is the
|
|
20420
|
+
// success-only path for apiVer3.
|
|
20421
|
+
async _handleResultsSuccess(commands, results, responseHelper, result) {
|
|
19993
20422
|
const dataResult = /* @__PURE__ */ new Map();
|
|
19994
|
-
if (!responseHelper.response.isSuccess) {
|
|
19995
|
-
for (const [index, error] of responseHelper.response.errors) {
|
|
19996
|
-
result.addError(error, index);
|
|
19997
|
-
}
|
|
19998
|
-
result.setData({
|
|
19999
|
-
result: dataResult,
|
|
20000
|
-
time: void 0
|
|
20001
|
-
});
|
|
20002
|
-
return result;
|
|
20003
|
-
}
|
|
20004
20423
|
for (const [index, data] of results) {
|
|
20005
20424
|
const rowIndex = Number.parseInt(`${index}`);
|
|
20006
20425
|
const command = commands[rowIndex];
|
|
@@ -20028,11 +20447,11 @@ ${JSON.stringify({
|
|
|
20028
20447
|
// endregion ////
|
|
20029
20448
|
}
|
|
20030
20449
|
|
|
20031
|
-
var __defProp$
|
|
20032
|
-
var __name$
|
|
20450
|
+
var __defProp$G = Object.defineProperty;
|
|
20451
|
+
var __name$G = (target, value) => __defProp$G(target, "name", { value, configurable: true });
|
|
20033
20452
|
class ProcessingAsArrayV3 extends AbstractProcessingV3 {
|
|
20034
20453
|
static {
|
|
20035
|
-
__name$
|
|
20454
|
+
__name$G(this, "ProcessingAsArrayV3");
|
|
20036
20455
|
}
|
|
20037
20456
|
prepareCommands(calls, options) {
|
|
20038
20457
|
const result = [];
|
|
@@ -20042,16 +20461,16 @@ ${JSON.stringify({
|
|
|
20042
20461
|
});
|
|
20043
20462
|
return result;
|
|
20044
20463
|
}
|
|
20045
|
-
_processResponseError(result, ajaxError,
|
|
20046
|
-
result.addError(ajaxError);
|
|
20464
|
+
_processResponseError(result, ajaxError, index) {
|
|
20465
|
+
result.addError(ajaxError, index);
|
|
20047
20466
|
}
|
|
20048
20467
|
}
|
|
20049
20468
|
|
|
20050
|
-
var __defProp$
|
|
20051
|
-
var __name$
|
|
20469
|
+
var __defProp$F = Object.defineProperty;
|
|
20470
|
+
var __name$F = (target, value) => __defProp$F(target, "name", { value, configurable: true });
|
|
20052
20471
|
class ProcessingAsObjectV3 extends AbstractProcessingV3 {
|
|
20053
20472
|
static {
|
|
20054
|
-
__name$
|
|
20473
|
+
__name$F(this, "ProcessingAsObjectV3");
|
|
20055
20474
|
}
|
|
20056
20475
|
prepareCommands(calls, options) {
|
|
20057
20476
|
const result = [];
|
|
@@ -20066,11 +20485,11 @@ ${JSON.stringify({
|
|
|
20066
20485
|
}
|
|
20067
20486
|
}
|
|
20068
20487
|
|
|
20069
|
-
var __defProp$
|
|
20070
|
-
var __name$
|
|
20488
|
+
var __defProp$E = Object.defineProperty;
|
|
20489
|
+
var __name$E = (target, value) => __defProp$E(target, "name", { value, configurable: true });
|
|
20071
20490
|
class HttpV3 extends AbstractHttp {
|
|
20072
20491
|
static {
|
|
20073
|
-
__name$
|
|
20492
|
+
__name$E(this, "HttpV3");
|
|
20074
20493
|
}
|
|
20075
20494
|
constructor(authActions, options, restrictionParams) {
|
|
20076
20495
|
super(authActions, options, restrictionParams);
|
|
@@ -20127,25 +20546,11 @@ ${JSON.stringify({
|
|
|
20127
20546
|
return response;
|
|
20128
20547
|
}
|
|
20129
20548
|
// endregion ////
|
|
20130
|
-
// region Prepare ////
|
|
20131
|
-
/**
|
|
20132
|
-
* @inheritDoc
|
|
20133
|
-
*/
|
|
20134
|
-
_prepareMethod(requestId, method, baseUrl) {
|
|
20135
|
-
const methodUrl = `/${encodeURIComponent(method)}`;
|
|
20136
|
-
const queryParams = new URLSearchParams({
|
|
20137
|
-
[this._requestIdGenerator.getQueryStringParameterName()]: requestId,
|
|
20138
|
-
[this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.2.0",
|
|
20139
|
-
[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
|
|
20140
|
-
});
|
|
20141
|
-
return `${baseUrl}${methodUrl}?${queryParams.toString()}`;
|
|
20142
|
-
}
|
|
20143
|
-
// endregion ////
|
|
20144
20549
|
}
|
|
20145
20550
|
|
|
20146
|
-
var __defProp$
|
|
20147
|
-
var __name$
|
|
20148
|
-
const useScrollSize = /* @__PURE__ */ __name$
|
|
20551
|
+
var __defProp$D = Object.defineProperty;
|
|
20552
|
+
var __name$D = (target, value) => __defProp$D(target, "name", { value, configurable: true });
|
|
20553
|
+
const useScrollSize = /* @__PURE__ */ __name$D(() => {
|
|
20149
20554
|
return {
|
|
20150
20555
|
scrollWidth: Math.max(
|
|
20151
20556
|
document.documentElement.scrollWidth,
|
|
@@ -20158,11 +20563,11 @@ ${JSON.stringify({
|
|
|
20158
20563
|
};
|
|
20159
20564
|
}, "useScrollSize");
|
|
20160
20565
|
|
|
20161
|
-
var __defProp$
|
|
20162
|
-
var __name$
|
|
20566
|
+
var __defProp$C = Object.defineProperty;
|
|
20567
|
+
var __name$C = (target, value) => __defProp$C(target, "name", { value, configurable: true });
|
|
20163
20568
|
class FormatterNumbers {
|
|
20164
20569
|
static {
|
|
20165
|
-
__name$
|
|
20570
|
+
__name$C(this, "FormatterNumbers");
|
|
20166
20571
|
}
|
|
20167
20572
|
static isInternalConstructing = false;
|
|
20168
20573
|
static instance = null;
|
|
@@ -20210,11 +20615,11 @@ ${JSON.stringify({
|
|
|
20210
20615
|
}
|
|
20211
20616
|
}
|
|
20212
20617
|
|
|
20213
|
-
var __defProp$
|
|
20214
|
-
var __name$
|
|
20618
|
+
var __defProp$B = Object.defineProperty;
|
|
20619
|
+
var __name$B = (target, value) => __defProp$B(target, "name", { value, configurable: true });
|
|
20215
20620
|
class IbanSpecification {
|
|
20216
20621
|
static {
|
|
20217
|
-
__name$
|
|
20622
|
+
__name$B(this, "IbanSpecification");
|
|
20218
20623
|
}
|
|
20219
20624
|
/**
|
|
20220
20625
|
* the code of the country
|
|
@@ -20380,7 +20785,7 @@ ${JSON.stringify({
|
|
|
20380
20785
|
}
|
|
20381
20786
|
class FormatterIban {
|
|
20382
20787
|
static {
|
|
20383
|
-
__name$
|
|
20788
|
+
__name$B(this, "FormatterIban");
|
|
20384
20789
|
}
|
|
20385
20790
|
static isInternalConstructing = false;
|
|
20386
20791
|
static instance = null;
|
|
@@ -20502,9 +20907,9 @@ ${JSON.stringify({
|
|
|
20502
20907
|
// endregion ////
|
|
20503
20908
|
}
|
|
20504
20909
|
|
|
20505
|
-
var __defProp$
|
|
20506
|
-
var __name$
|
|
20507
|
-
const useFormatter = /* @__PURE__ */ __name$
|
|
20910
|
+
var __defProp$A = Object.defineProperty;
|
|
20911
|
+
var __name$A = (target, value) => __defProp$A(target, "name", { value, configurable: true });
|
|
20912
|
+
const useFormatter = /* @__PURE__ */ __name$A(() => {
|
|
20508
20913
|
const formatterNumber = FormatterNumbers.getInstance();
|
|
20509
20914
|
const formatterIban = FormatterIban.getInstance();
|
|
20510
20915
|
formatterIban.addSpecification(
|
|
@@ -20949,6 +21354,171 @@ ${JSON.stringify({
|
|
|
20949
21354
|
};
|
|
20950
21355
|
}, "useFormatter");
|
|
20951
21356
|
|
|
21357
|
+
var __defProp$z = Object.defineProperty;
|
|
21358
|
+
var __name$z = (target, value) => __defProp$z(target, "name", { value, configurable: true });
|
|
21359
|
+
const FILTER_V3_OPERATORS = ["=", "!=", ">", ">=", "<", "<=", "in", "between"];
|
|
21360
|
+
function condition(field, operator, value) {
|
|
21361
|
+
if (typeof field !== "string" || field.length === 0) {
|
|
21362
|
+
throw new SdkError({
|
|
21363
|
+
code: "JSSDK_FILTER_V3_INVALID_FIELD",
|
|
21364
|
+
description: `FilterV3: field name must be a non-empty string, got ${JSON.stringify(field)}.`,
|
|
21365
|
+
status: 400
|
|
21366
|
+
});
|
|
21367
|
+
}
|
|
21368
|
+
if (!FILTER_V3_OPERATORS.includes(operator)) {
|
|
21369
|
+
throw new SdkError({
|
|
21370
|
+
code: "JSSDK_FILTER_V3_INVALID_OPERATOR",
|
|
21371
|
+
description: `FilterV3: operator "${operator}" is not one of ${FILTER_V3_OPERATORS.join(" ")}.`,
|
|
21372
|
+
status: 400
|
|
21373
|
+
});
|
|
21374
|
+
}
|
|
21375
|
+
return [field, operator, value];
|
|
21376
|
+
}
|
|
21377
|
+
__name$z(condition, "condition");
|
|
21378
|
+
const FilterV3 = Object.freeze({
|
|
21379
|
+
/** `field = value` */
|
|
21380
|
+
eq(field, value) {
|
|
21381
|
+
return condition(field, "=", value);
|
|
21382
|
+
},
|
|
21383
|
+
/** `field != value` */
|
|
21384
|
+
ne(field, value) {
|
|
21385
|
+
return condition(field, "!=", value);
|
|
21386
|
+
},
|
|
21387
|
+
/** `field > value` */
|
|
21388
|
+
gt(field, value) {
|
|
21389
|
+
return condition(field, ">", value);
|
|
21390
|
+
},
|
|
21391
|
+
/** `field >= value` */
|
|
21392
|
+
ge(field, value) {
|
|
21393
|
+
return condition(field, ">=", value);
|
|
21394
|
+
},
|
|
21395
|
+
/** `field < value` */
|
|
21396
|
+
lt(field, value) {
|
|
21397
|
+
return condition(field, "<", value);
|
|
21398
|
+
},
|
|
21399
|
+
/** `field <= value` */
|
|
21400
|
+
le(field, value) {
|
|
21401
|
+
return condition(field, "<=", value);
|
|
21402
|
+
},
|
|
21403
|
+
/** `field in [values]` — `values` must be a non-empty array. */
|
|
21404
|
+
in(field, values) {
|
|
21405
|
+
if (!Array.isArray(values) || values.length === 0) {
|
|
21406
|
+
throw new SdkError({
|
|
21407
|
+
code: "JSSDK_FILTER_V3_INVALID_IN",
|
|
21408
|
+
description: `FilterV3.in("${field}"): value must be a non-empty array.`,
|
|
21409
|
+
status: 400
|
|
21410
|
+
});
|
|
21411
|
+
}
|
|
21412
|
+
return condition(field, "in", values);
|
|
21413
|
+
},
|
|
21414
|
+
/** `field between [from, to]` — inclusive range of exactly two defined operands. */
|
|
21415
|
+
between(field, from, to) {
|
|
21416
|
+
if (from === void 0 || from === null || to === void 0 || to === null) {
|
|
21417
|
+
throw new SdkError({
|
|
21418
|
+
code: "JSSDK_FILTER_V3_INVALID_BETWEEN",
|
|
21419
|
+
description: `FilterV3.between("${field}"): both range operands must be defined (got [${String(from)}, ${String(to)}]).`,
|
|
21420
|
+
status: 400
|
|
21421
|
+
});
|
|
21422
|
+
}
|
|
21423
|
+
return condition(field, "between", [from, to]);
|
|
21424
|
+
},
|
|
21425
|
+
/** Combine nodes with AND (for nesting inside an OR; the top level is already AND). */
|
|
21426
|
+
and(...conditions) {
|
|
21427
|
+
return { logic: "and", conditions };
|
|
21428
|
+
},
|
|
21429
|
+
/** Combine nodes with OR. */
|
|
21430
|
+
or(...conditions) {
|
|
21431
|
+
return { logic: "or", conditions };
|
|
21432
|
+
},
|
|
21433
|
+
/**
|
|
21434
|
+
* Negate a condition or group (wraps it in a NOT). A bare condition is wrapped
|
|
21435
|
+
* in a single-item AND group so the `negative` flag has somewhere to live.
|
|
21436
|
+
* Returns a fresh group (the input's `conditions` array is copied, not shared).
|
|
21437
|
+
*/
|
|
21438
|
+
not(node) {
|
|
21439
|
+
if (isGroup(node)) {
|
|
21440
|
+
return { ...node, conditions: [...node.conditions], negative: true };
|
|
21441
|
+
}
|
|
21442
|
+
return { logic: "and", negative: true, conditions: [node] };
|
|
21443
|
+
},
|
|
21444
|
+
/**
|
|
21445
|
+
* Assemble the top-level filter array (its elements are AND-joined) ready to
|
|
21446
|
+
* pass as `params.filter`. Falsy nodes are skipped, so you can inline
|
|
21447
|
+
* conditionals: `F.build(F.eq('a', 1), flag && F.gt('b', 2))`.
|
|
21448
|
+
*
|
|
21449
|
+
* Always wrap with `build` (or an array) even for a single condition —
|
|
21450
|
+
* `params.filter` must be an array, so pass `build(F.eq('a', 1))`, not the bare
|
|
21451
|
+
* `F.eq('a', 1)`. Each surviving node is shape-checked, so a forgotten spread
|
|
21452
|
+
* (`build([F.eq(...)])`) or a hand-rolled malformed triple fails fast here
|
|
21453
|
+
* instead of as an opaque server error.
|
|
21454
|
+
*/
|
|
21455
|
+
build(...nodes) {
|
|
21456
|
+
const result = nodes.filter(Boolean);
|
|
21457
|
+
for (const node of result) {
|
|
21458
|
+
assertNode(node);
|
|
21459
|
+
}
|
|
21460
|
+
return result;
|
|
21461
|
+
}
|
|
21462
|
+
});
|
|
21463
|
+
function isGroup(node) {
|
|
21464
|
+
return !Array.isArray(node) && typeof node === "object" && node !== null && "conditions" in node;
|
|
21465
|
+
}
|
|
21466
|
+
__name$z(isGroup, "isGroup");
|
|
21467
|
+
function assertNode(node) {
|
|
21468
|
+
if (isGroup(node)) {
|
|
21469
|
+
return;
|
|
21470
|
+
}
|
|
21471
|
+
const ok = Array.isArray(node) && node.length === 3 && typeof node[0] === "string" && FILTER_V3_OPERATORS.includes(node[1]);
|
|
21472
|
+
if (!ok) {
|
|
21473
|
+
throw new SdkError({
|
|
21474
|
+
code: "JSSDK_FILTER_V3_INVALID_NODE",
|
|
21475
|
+
description: `FilterV3.build: each node must be a [field, operator, value] condition or a group \u2014 got ${JSON.stringify(node)}. Did you forget to spread (build(...nodes)) or build a condition with FilterV3 helpers?`,
|
|
21476
|
+
status: 400
|
|
21477
|
+
});
|
|
21478
|
+
}
|
|
21479
|
+
}
|
|
21480
|
+
__name$z(assertNode, "assertNode");
|
|
21481
|
+
|
|
21482
|
+
var __defProp$y = Object.defineProperty;
|
|
21483
|
+
var __name$y = (target, value) => __defProp$y(target, "name", { value, configurable: true });
|
|
21484
|
+
function assertPath(path, who) {
|
|
21485
|
+
if (typeof path !== "string" || path.length === 0) {
|
|
21486
|
+
throw new SdkError({
|
|
21487
|
+
code: "JSSDK_BATCH_REF_V3_INVALID_PATH",
|
|
21488
|
+
description: `${who}: path must be a non-empty dotted string (e.g. "tasks.id").`,
|
|
21489
|
+
status: 400
|
|
21490
|
+
});
|
|
21491
|
+
}
|
|
21492
|
+
}
|
|
21493
|
+
__name$y(assertPath, "assertPath");
|
|
21494
|
+
const BatchRefV3 = Object.freeze({
|
|
21495
|
+
/**
|
|
21496
|
+
* `{ $ref: path }` — substitute a single value from context, e.g.
|
|
21497
|
+
* `ref('newTask.item.id')`. `add` → id / `update` → bool results are NOT in
|
|
21498
|
+
* context (reference §8); only `item` (get) and `items` (list/tail) are.
|
|
21499
|
+
*/
|
|
21500
|
+
ref(path) {
|
|
21501
|
+
assertPath(path, "BatchRefV3.ref");
|
|
21502
|
+
return { $ref: path };
|
|
21503
|
+
},
|
|
21504
|
+
/**
|
|
21505
|
+
* `{ $refArray: path }` — collect one field across the `items[]` of an earlier
|
|
21506
|
+
* list/tail command, e.g. `refArray('tasks.id')`. The path MUST contain a dot
|
|
21507
|
+
* (`alias.field`); the server rejects a dot-less path with INVALIDSELECTEXCEPTION.
|
|
21508
|
+
*/
|
|
21509
|
+
refArray(path) {
|
|
21510
|
+
assertPath(path, "BatchRefV3.refArray");
|
|
21511
|
+
if (!path.includes(".")) {
|
|
21512
|
+
throw new SdkError({
|
|
21513
|
+
code: "JSSDK_BATCH_REF_V3_INVALID_REF_ARRAY",
|
|
21514
|
+
description: `BatchRefV3.refArray: path "${path}" must contain a dot ("alias.field") \u2014 the server collects <field> across the alias's items[].`,
|
|
21515
|
+
status: 400
|
|
21516
|
+
});
|
|
21517
|
+
}
|
|
21518
|
+
return { $refArray: path };
|
|
21519
|
+
}
|
|
21520
|
+
});
|
|
21521
|
+
|
|
20952
21522
|
var __defProp$x = Object.defineProperty;
|
|
20953
21523
|
var __name$x = (target, value) => __defProp$x(target, "name", { value, configurable: true });
|
|
20954
21524
|
class AuthHookManager {
|
|
@@ -21080,7 +21650,7 @@ ${JSON.stringify({
|
|
|
21080
21650
|
try {
|
|
21081
21651
|
parsedUrl = new URL(url.replace("/rest/api", "/rest"));
|
|
21082
21652
|
} catch {
|
|
21083
|
-
throw new Error(
|
|
21653
|
+
throw new Error("Invalid webhook URL format");
|
|
21084
21654
|
}
|
|
21085
21655
|
if (parsedUrl.protocol !== "https:") {
|
|
21086
21656
|
throw new Error("Webhook requires HTTPS protocol");
|
|
@@ -21098,7 +21668,7 @@ ${JSON.stringify({
|
|
|
21098
21668
|
const userIdStr = pathParts[userIdIndex];
|
|
21099
21669
|
const secret = pathParts[secretIndex];
|
|
21100
21670
|
if (!/^\d+$/.test(userIdStr)) {
|
|
21101
|
-
throw new Error(
|
|
21671
|
+
throw new Error("User ID must be numeric in webhook URL");
|
|
21102
21672
|
}
|
|
21103
21673
|
const userId = Number.parseInt(userIdStr, 10);
|
|
21104
21674
|
return new B24Hook(
|
|
@@ -21149,6 +21719,9 @@ ${JSON.stringify({
|
|
|
21149
21719
|
#appFrame;
|
|
21150
21720
|
#callbackPromises;
|
|
21151
21721
|
#callbackSingletone;
|
|
21722
|
+
// origins already warned about (#244) — dedup so a peer spamming postMessage
|
|
21723
|
+
// from a foreign origin can't flood a wired logger sink
|
|
21724
|
+
#rejectedOrigins = /* @__PURE__ */ new Set();
|
|
21152
21725
|
_logger;
|
|
21153
21726
|
runCallbackHandler;
|
|
21154
21727
|
constructor(appFrame) {
|
|
@@ -21228,7 +21801,8 @@ ${JSON.stringify({
|
|
|
21228
21801
|
cmd += ":" + listParams.filter(Boolean).join(":");
|
|
21229
21802
|
}
|
|
21230
21803
|
this.getLogger().debug(`send to ${this.#appFrame.getTargetOrigin()}`, {
|
|
21231
|
-
|
|
21804
|
+
command: command.toString(),
|
|
21805
|
+
callbackKey: keyPromise,
|
|
21232
21806
|
origin: this.#appFrame.getTargetOrigin()
|
|
21233
21807
|
});
|
|
21234
21808
|
parent.postMessage(cmd, this.#appFrame.getTargetOrigin());
|
|
@@ -21258,18 +21832,25 @@ ${JSON.stringify({
|
|
|
21258
21832
|
*/
|
|
21259
21833
|
_runCallback(event) {
|
|
21260
21834
|
if (event.origin !== this.#appFrame.getTargetOrigin()) {
|
|
21835
|
+
if (!this.#rejectedOrigins.has(event.origin)) {
|
|
21836
|
+
this.#rejectedOrigins.add(event.origin);
|
|
21837
|
+
this.getLogger().warning("message rejected: unexpected origin", {
|
|
21838
|
+
origin: event.origin,
|
|
21839
|
+
expected: this.#appFrame.getTargetOrigin()
|
|
21840
|
+
});
|
|
21841
|
+
}
|
|
21261
21842
|
return;
|
|
21262
21843
|
}
|
|
21263
21844
|
if (event.data) {
|
|
21264
|
-
this.getLogger().debug(`get from ${event.origin}`, {
|
|
21265
|
-
data: event.data,
|
|
21266
|
-
origin: event.origin
|
|
21267
|
-
});
|
|
21268
21845
|
const tmp = event.data.split(":");
|
|
21269
21846
|
const cmd = {
|
|
21270
21847
|
id: tmp[0],
|
|
21271
21848
|
args: tmp.slice(1).join(":")
|
|
21272
21849
|
};
|
|
21850
|
+
this.getLogger().debug(`get from ${event.origin}`, {
|
|
21851
|
+
id: cmd.id,
|
|
21852
|
+
origin: event.origin
|
|
21853
|
+
});
|
|
21273
21854
|
if (cmd.args) {
|
|
21274
21855
|
cmd.args = JSON.parse(cmd.args);
|
|
21275
21856
|
}
|
|
@@ -21627,7 +22208,11 @@ ${JSON.stringify({
|
|
|
21627
22208
|
});
|
|
21628
22209
|
}
|
|
21629
22210
|
/**
|
|
21630
|
-
*
|
|
22211
|
+
* Sets the in-layout page title (the `#pagetitle` element the portal renders around the app).
|
|
22212
|
+
*
|
|
22213
|
+
* Does NOT change the browser tab title (`document.title`): the portal applies this command to
|
|
22214
|
+
* `#pagetitle`, never to the tab. To set the browser tab title, open the view as a slider via
|
|
22215
|
+
* `SliderManager.openSliderAppPage` with a `bx24_title` option.
|
|
21631
22216
|
*
|
|
21632
22217
|
* @param {string} title
|
|
21633
22218
|
*
|
|
@@ -21944,6 +22529,10 @@ ${JSON.stringify({
|
|
|
21944
22529
|
/**
|
|
21945
22530
|
* When the method is called, a pop-up window with the application frame will be opened.
|
|
21946
22531
|
*
|
|
22532
|
+
* Settings are passed via `bx24_`-prefixed keys (e.g. `bx24_title`, `bx24_width`).
|
|
22533
|
+
* `bx24_title` sets the slider title; the portal also reflects it to the browser tab title
|
|
22534
|
+
* (`document.title`) — unlike `ParentManager.setTitle`, which only updates the in-layout `#pagetitle`.
|
|
22535
|
+
*
|
|
21947
22536
|
* @link https://apidocs.bitrix24.com/sdk/bx24-js-sdk/additional-functions/bx24-open-application.html
|
|
21948
22537
|
*/
|
|
21949
22538
|
async openSliderAppPage(params = {}) {
|
|
@@ -22278,7 +22867,13 @@ ${JSON.stringify({
|
|
|
22278
22867
|
}
|
|
22279
22868
|
async init() {
|
|
22280
22869
|
const data = await this.#messageManager.send(MessageCommands.getInitData, {});
|
|
22281
|
-
this.getLogger().debug("init data", {
|
|
22870
|
+
this.getLogger().debug("init data", {
|
|
22871
|
+
PLACEMENT: data.PLACEMENT,
|
|
22872
|
+
LANG: data.LANG,
|
|
22873
|
+
INSTALL: data.INSTALL,
|
|
22874
|
+
IS_ADMIN: data.IS_ADMIN,
|
|
22875
|
+
FIRST_RUN: data.FIRST_RUN
|
|
22876
|
+
});
|
|
22282
22877
|
this.#appFrame.initData(data);
|
|
22283
22878
|
this.#authManager.initData(data);
|
|
22284
22879
|
this.#placementManager.initData(data);
|
|
@@ -22375,7 +22970,7 @@ ${JSON.stringify({
|
|
|
22375
22970
|
#b24Target;
|
|
22376
22971
|
#b24TargetRestWithPath;
|
|
22377
22972
|
#oAuthTarget;
|
|
22378
|
-
// 'https://oauth.
|
|
22973
|
+
// from serverEndpoint, e.g. 'https://oauth.bitrix24.tech'
|
|
22379
22974
|
#isAdmin = null;
|
|
22380
22975
|
constructor(b24OAuthParams, oAuthSecret) {
|
|
22381
22976
|
this.#authOptions = Object.assign({}, b24OAuthParams);
|
|
@@ -22387,10 +22982,7 @@ ${JSON.stringify({
|
|
|
22387
22982
|
this.#authExpires = this.#authOptions.expires * 1e3;
|
|
22388
22983
|
this.#authExpiresIn = this.#authOptions.expiresIn;
|
|
22389
22984
|
this.#clientAxios = axios.create({
|
|
22390
|
-
baseURL: this.#oAuthTarget
|
|
22391
|
-
headers: {
|
|
22392
|
-
"Content-Type": "application/json"
|
|
22393
|
-
}
|
|
22985
|
+
baseURL: this.#oAuthTarget
|
|
22394
22986
|
});
|
|
22395
22987
|
this.#b24TargetRestWithPath = /* @__PURE__ */ new Map();
|
|
22396
22988
|
this.#b24TargetRestWithPath.set(ApiVersion.v2, `${this.#b24TargetRest}`);
|
|
@@ -22420,16 +23012,16 @@ ${JSON.stringify({
|
|
|
22420
23012
|
if (this.#customRefreshAuth) {
|
|
22421
23013
|
payload = await this.#customRefreshAuth();
|
|
22422
23014
|
} else {
|
|
22423
|
-
const
|
|
23015
|
+
const body = new URLSearchParams({
|
|
23016
|
+
grant_type: "refresh_token",
|
|
23017
|
+
client_id: this.#oAuthSecret.clientId,
|
|
23018
|
+
client_secret: this.#oAuthSecret.clientSecret,
|
|
23019
|
+
refresh_token: this.#authOptions.refreshToken
|
|
23020
|
+
});
|
|
23021
|
+
const response = await this.#clientAxios.post(
|
|
22424
23022
|
"/oauth/token/",
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
grant_type: "refresh_token",
|
|
22428
|
-
client_id: this.#oAuthSecret.clientId,
|
|
22429
|
-
client_secret: this.#oAuthSecret.clientSecret,
|
|
22430
|
-
refresh_token: this.#authOptions.refreshToken
|
|
22431
|
-
}
|
|
22432
|
-
}
|
|
23023
|
+
body,
|
|
23024
|
+
{ headers: { "Content-Type": "application/x-www-form-urlencoded" } }
|
|
22433
23025
|
);
|
|
22434
23026
|
if (response.data.error) {
|
|
22435
23027
|
throw new Error(`Token update error: ${response.data.error}`);
|
|
@@ -22487,7 +23079,7 @@ ${JSON.stringify({
|
|
|
22487
23079
|
}
|
|
22488
23080
|
throw new Error(
|
|
22489
23081
|
`Strange error: ${error instanceof Error ? error.message : error}`,
|
|
22490
|
-
{ cause: error }
|
|
23082
|
+
{ cause: error instanceof Error ? error : void 0 }
|
|
22491
23083
|
);
|
|
22492
23084
|
}
|
|
22493
23085
|
}
|
|
@@ -23364,7 +23956,7 @@ ${JSON.stringify({
|
|
|
23364
23956
|
}
|
|
23365
23957
|
return;
|
|
23366
23958
|
}
|
|
23367
|
-
this.getLogger().error(`${Text.getDateForLog()}: Pull: Received rpc response with unknown id`, { response });
|
|
23959
|
+
this.getLogger().error(`${Text.getDateForLog()}: Pull: Received rpc response with unknown id`, redactSensitiveParams({ response }));
|
|
23368
23960
|
}
|
|
23369
23961
|
parseJsonRpcMessage(message) {
|
|
23370
23962
|
let decoded;
|
|
@@ -23387,7 +23979,7 @@ ${JSON.stringify({
|
|
|
23387
23979
|
} else {
|
|
23388
23980
|
this.getLogger().error(
|
|
23389
23981
|
`${Text.getDateForLog()}: Pull: unknown rpc packet`,
|
|
23390
|
-
{ decoded }
|
|
23982
|
+
redactSensitiveParams({ decoded })
|
|
23391
23983
|
);
|
|
23392
23984
|
}
|
|
23393
23985
|
return [];
|
|
@@ -23428,7 +24020,7 @@ ${JSON.stringify({
|
|
|
23428
24020
|
} else {
|
|
23429
24021
|
this.getLogger().error(
|
|
23430
24022
|
`${Text.getDateForLog()}: Pull: unknown rpc command in batch`,
|
|
23431
|
-
{ command }
|
|
24023
|
+
redactSensitiveParams({ command })
|
|
23432
24024
|
);
|
|
23433
24025
|
result.push({
|
|
23434
24026
|
jsonrpc: JSON_RPC_VERSION,
|
|
@@ -29765,9 +30357,15 @@ ${JSON.stringify({
|
|
|
29765
30357
|
_pingWaitTimeout = null;
|
|
29766
30358
|
// manual stop workaround ////
|
|
29767
30359
|
_isManualDisconnect = false;
|
|
30360
|
+
// set once destroy() has run; gates reconnect / watch / online so a torn-down
|
|
30361
|
+
// client never schedules new work (#141) ////
|
|
30362
|
+
_disposed = false;
|
|
29768
30363
|
_loggingEnabled = false;
|
|
29769
|
-
// bound event handlers ////
|
|
30364
|
+
// bound event handlers, stored so they can be removed in destroy() (#141) ////
|
|
29770
30365
|
_onPingTimeoutHandler;
|
|
30366
|
+
_onBeforeUnloadHandler;
|
|
30367
|
+
_onOfflineHandler;
|
|
30368
|
+
_onOnlineHandler;
|
|
29771
30369
|
// [userId] => array of callbacks
|
|
29772
30370
|
_userStatusCallbacks = {};
|
|
29773
30371
|
_connectPromise = null;
|
|
@@ -29828,6 +30426,9 @@ ${JSON.stringify({
|
|
|
29828
30426
|
});
|
|
29829
30427
|
this._loggingEnabled = this._sharedConfig.isLoggingEnabled();
|
|
29830
30428
|
this._onPingTimeoutHandler = this.onPingTimeout.bind(this);
|
|
30429
|
+
this._onBeforeUnloadHandler = this.onBeforeUnload.bind(this);
|
|
30430
|
+
this._onOfflineHandler = this.onOffline.bind(this);
|
|
30431
|
+
this._onOnlineHandler = this.onOnline.bind(this);
|
|
29831
30432
|
}
|
|
29832
30433
|
setLogger(logger) {
|
|
29833
30434
|
this._logger = logger;
|
|
@@ -29841,11 +30442,29 @@ ${JSON.stringify({
|
|
|
29841
30442
|
getLogger() {
|
|
29842
30443
|
return this._logger;
|
|
29843
30444
|
}
|
|
30445
|
+
/**
|
|
30446
|
+
* Terminal teardown: removes the window listeners, cancels every pending timer,
|
|
30447
|
+
* persists the session for a quick re-init, and disconnects. Irreversible — a
|
|
30448
|
+
* destroyed client schedules no further work and `start()` rejects with
|
|
30449
|
+
* `PULL_DISPOSED`; create a new instance to reconnect.
|
|
30450
|
+
*/
|
|
29844
30451
|
destroy() {
|
|
30452
|
+
this._disposed = true;
|
|
29845
30453
|
this.stop(CloseReasons.NORMAL_CLOSURE, "manual stop");
|
|
29846
|
-
|
|
30454
|
+
if (typeof window !== "undefined") {
|
|
30455
|
+
window.removeEventListener("beforeunload", this._onBeforeUnloadHandler);
|
|
30456
|
+
window.removeEventListener("offline", this._onOfflineHandler);
|
|
30457
|
+
window.removeEventListener("online", this._onOnlineHandler);
|
|
30458
|
+
}
|
|
30459
|
+
if (this._storage) {
|
|
30460
|
+
this._storage.remove(LsKeys.PullConfig);
|
|
30461
|
+
}
|
|
30462
|
+
this.persistSession();
|
|
29847
30463
|
}
|
|
29848
30464
|
init() {
|
|
30465
|
+
if (this._disposed) {
|
|
30466
|
+
return;
|
|
30467
|
+
}
|
|
29849
30468
|
this._connectors.webSocket = new WebSocketConnector({
|
|
29850
30469
|
parent: this,
|
|
29851
30470
|
onOpen: this.onWebSocketOpen.bind(this),
|
|
@@ -29861,9 +30480,11 @@ ${JSON.stringify({
|
|
|
29861
30480
|
onError: this.onLongPollingError.bind(this)
|
|
29862
30481
|
});
|
|
29863
30482
|
this._connectionType = this.isWebSocketAllowed() ? ConnectionType.WebSocket : ConnectionType.LongPolling;
|
|
29864
|
-
window
|
|
29865
|
-
|
|
29866
|
-
|
|
30483
|
+
if (typeof window !== "undefined") {
|
|
30484
|
+
window.addEventListener("beforeunload", this._onBeforeUnloadHandler);
|
|
30485
|
+
window.addEventListener("offline", this._onOfflineHandler);
|
|
30486
|
+
window.addEventListener("online", this._onOnlineHandler);
|
|
30487
|
+
}
|
|
29867
30488
|
this._jsonRpcAdapter = new JsonRpc({
|
|
29868
30489
|
connector: this._connectors.webSocket,
|
|
29869
30490
|
handlers: {
|
|
@@ -30015,7 +30636,8 @@ ${JSON.stringify({
|
|
|
30015
30636
|
if (this._debug && this._context !== "master") {
|
|
30016
30637
|
this.getLogger().warning(
|
|
30017
30638
|
`${Text.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string`,
|
|
30018
|
-
|
|
30639
|
+
// data.params / data.extra are app-defined and may carry a credential key (#43)
|
|
30640
|
+
redactSensitiveParams({ data })
|
|
30019
30641
|
);
|
|
30020
30642
|
}
|
|
30021
30643
|
method(data.params, data.extra, data.command);
|
|
@@ -30024,9 +30646,21 @@ ${JSON.stringify({
|
|
|
30024
30646
|
});
|
|
30025
30647
|
}
|
|
30026
30648
|
/**
|
|
30649
|
+
* Connects the client and begins receiving events.
|
|
30650
|
+
*
|
|
30027
30651
|
* @param config
|
|
30652
|
+
* @throws Rejects with `{ ex: { error: 'PULL_DISPOSED' } }` when called after
|
|
30653
|
+
* `destroy()` — a destroyed client cannot be restarted; create a new instance.
|
|
30028
30654
|
*/
|
|
30029
30655
|
async start(config = null) {
|
|
30656
|
+
if (this._disposed) {
|
|
30657
|
+
return Promise.reject({
|
|
30658
|
+
ex: {
|
|
30659
|
+
error: "PULL_DISPOSED",
|
|
30660
|
+
error_description: "PullClient has been destroyed; create a new instance"
|
|
30661
|
+
}
|
|
30662
|
+
});
|
|
30663
|
+
}
|
|
30030
30664
|
let allowConfigCaching = true;
|
|
30031
30665
|
if (this.isConnected()) {
|
|
30032
30666
|
return Promise.resolve(true);
|
|
@@ -30093,6 +30727,9 @@ ${JSON.stringify({
|
|
|
30093
30727
|
* @param disconnectReason
|
|
30094
30728
|
*/
|
|
30095
30729
|
restart(disconnectCode = CloseReasons.NORMAL_CLOSURE, disconnectReason = "manual restart") {
|
|
30730
|
+
if (this._disposed) {
|
|
30731
|
+
return;
|
|
30732
|
+
}
|
|
30096
30733
|
if (this._restartTimeout) {
|
|
30097
30734
|
clearTimeout(this._restartTimeout);
|
|
30098
30735
|
this._restartTimeout = null;
|
|
@@ -30135,6 +30772,34 @@ ${JSON.stringify({
|
|
|
30135
30772
|
stop(disconnectCode = CloseReasons.NORMAL_CLOSURE, disconnectReason = "manual stop") {
|
|
30136
30773
|
this.disconnect(disconnectCode, disconnectReason);
|
|
30137
30774
|
this.stopCheckConfig();
|
|
30775
|
+
this.clearAllTimers();
|
|
30776
|
+
}
|
|
30777
|
+
// Cancel every pending timer so a stopped/destroyed client leaves nothing
|
|
30778
|
+
// running. Previously only _checkInterval was cleared, so the other six timers
|
|
30779
|
+
// (including the self-rescheduling watch-extend) survived teardown (#141).
|
|
30780
|
+
clearAllTimers() {
|
|
30781
|
+
for (const timer of [
|
|
30782
|
+
this._reconnectTimeout,
|
|
30783
|
+
this._restartTimeout,
|
|
30784
|
+
this._restoreWebSocketTimeout,
|
|
30785
|
+
this._offlineTimeout,
|
|
30786
|
+
this._watchUpdateTimeout,
|
|
30787
|
+
this._pingWaitTimeout
|
|
30788
|
+
]) {
|
|
30789
|
+
if (timer) {
|
|
30790
|
+
clearTimeout(timer);
|
|
30791
|
+
}
|
|
30792
|
+
}
|
|
30793
|
+
if (this._checkInterval) {
|
|
30794
|
+
clearInterval(this._checkInterval);
|
|
30795
|
+
}
|
|
30796
|
+
this._reconnectTimeout = null;
|
|
30797
|
+
this._restartTimeout = null;
|
|
30798
|
+
this._restoreWebSocketTimeout = null;
|
|
30799
|
+
this._offlineTimeout = null;
|
|
30800
|
+
this._watchUpdateTimeout = null;
|
|
30801
|
+
this._pingWaitTimeout = null;
|
|
30802
|
+
this._checkInterval = null;
|
|
30138
30803
|
}
|
|
30139
30804
|
reconnect(disconnectCode, disconnectReason, delay = 1) {
|
|
30140
30805
|
this.disconnect(disconnectCode, disconnectReason);
|
|
@@ -30353,7 +31018,10 @@ ${JSON.stringify({
|
|
|
30353
31018
|
let configDump;
|
|
30354
31019
|
if (this._config && this._config.channels) {
|
|
30355
31020
|
configDump = {
|
|
30356
|
-
|
|
31021
|
+
// The private channel id is a subscription secret — mask it here too, not
|
|
31022
|
+
// just in `Path` below, so the debug dump never surfaces it (#148). Expiry
|
|
31023
|
+
// timestamps are non-sensitive and kept for diagnostics.
|
|
31024
|
+
ChannelID: this._config.channels.private?.id ? REDACTED_PLACEHOLDER : "n/a",
|
|
30357
31025
|
ChannelDie: this._config.channels.private?.end || "n/a",
|
|
30358
31026
|
ChannelDieShared: this._config.channels.shared?.end || "n/a"
|
|
30359
31027
|
};
|
|
@@ -30370,6 +31038,7 @@ ${JSON.stringify({
|
|
|
30370
31038
|
websocketMode = this._connectors.webSocket?.socket?.url.search("binaryMode=true") != -1 ? "protobuf" : "text";
|
|
30371
31039
|
}
|
|
30372
31040
|
}
|
|
31041
|
+
const connectionPath = this.connector?.connectionPath;
|
|
30373
31042
|
return {
|
|
30374
31043
|
"UserId": this._userId + (this._userId > 0 ? "" : "(guest)"),
|
|
30375
31044
|
"Guest userId": this._guestMode && this._guestUserId !== 0 ? this._guestUserId : "-",
|
|
@@ -30381,7 +31050,9 @@ ${JSON.stringify({
|
|
|
30381
31050
|
"WebSocket mode": websocketMode,
|
|
30382
31051
|
"Try connect": this._reconnectTimeout ? "Y" : "N",
|
|
30383
31052
|
"Try number": this._connectionAttempt,
|
|
30384
|
-
|
|
31053
|
+
// Mask the push JWT (`token`) and private `CHANNEL_ID`s before exposing
|
|
31054
|
+
// the connection path through this developer-facing debug dump (#148).
|
|
31055
|
+
"Path": connectionPath ? redactSensitiveUrl(connectionPath, ["CHANNEL_ID"]) : "-",
|
|
30385
31056
|
...configDump,
|
|
30386
31057
|
"Last message": this._session.mid || "-",
|
|
30387
31058
|
"Session history": this._session.history,
|
|
@@ -30412,13 +31083,10 @@ ${JSON.stringify({
|
|
|
30412
31083
|
params["token"] = this._config?.jwt;
|
|
30413
31084
|
} else {
|
|
30414
31085
|
const channels = [];
|
|
30415
|
-
if (this._config?.channels?.private) {
|
|
30416
|
-
channels.push(this._config.channels.private?.id || "");
|
|
30417
|
-
}
|
|
30418
|
-
if (this._config?.channels.private?.id) {
|
|
31086
|
+
if (this._config?.channels?.private?.id) {
|
|
30419
31087
|
channels.push(this._config.channels.private.id);
|
|
30420
31088
|
}
|
|
30421
|
-
if (this._config?.channels
|
|
31089
|
+
if (this._config?.channels?.shared?.id) {
|
|
30422
31090
|
channels.push(this._config.channels.shared.id);
|
|
30423
31091
|
}
|
|
30424
31092
|
if (channels.length === 0) {
|
|
@@ -30667,7 +31335,8 @@ ${JSON.stringify({
|
|
|
30667
31335
|
this.getLogger().warning("PULL ERROR", {
|
|
30668
31336
|
errorType: "broadcastMessages execute error",
|
|
30669
31337
|
errorEvent: error,
|
|
30670
|
-
message
|
|
31338
|
+
// app-defined message.params / extra may carry a credential key (#43)
|
|
31339
|
+
message: redactSensitiveParams(message)
|
|
30671
31340
|
});
|
|
30672
31341
|
}
|
|
30673
31342
|
if (message.extra && message.extra.revision_web) {
|
|
@@ -30897,6 +31566,9 @@ ${JSON.stringify({
|
|
|
30897
31566
|
return true;
|
|
30898
31567
|
}
|
|
30899
31568
|
startCheckConfig() {
|
|
31569
|
+
if (this._disposed) {
|
|
31570
|
+
return;
|
|
31571
|
+
}
|
|
30900
31572
|
if (this._checkInterval) {
|
|
30901
31573
|
clearInterval(this._checkInterval);
|
|
30902
31574
|
this._checkInterval = null;
|
|
@@ -30937,7 +31609,7 @@ ${JSON.stringify({
|
|
|
30937
31609
|
this.setPublicIds(Object.values(config.publicChannels));
|
|
30938
31610
|
}
|
|
30939
31611
|
this._configTimestamp = Number(config.server.config_timestamp);
|
|
30940
|
-
if (this._storage && allowCaching) {
|
|
31612
|
+
if (this._storage && allowCaching && !this._disposed) {
|
|
30941
31613
|
try {
|
|
30942
31614
|
this._storage.set(LsKeys.PullConfig, config);
|
|
30943
31615
|
} catch (error) {
|
|
@@ -30998,7 +31670,7 @@ ${JSON.stringify({
|
|
|
30998
31670
|
* @param connectionDelay
|
|
30999
31671
|
*/
|
|
31000
31672
|
scheduleReconnect(connectionDelay = 0) {
|
|
31001
|
-
if (!this._enabled) {
|
|
31673
|
+
if (this._disposed || !this._enabled) {
|
|
31002
31674
|
return;
|
|
31003
31675
|
}
|
|
31004
31676
|
if (!connectionDelay) {
|
|
@@ -31022,6 +31694,9 @@ ${JSON.stringify({
|
|
|
31022
31694
|
}, connectionDelay * 1e3);
|
|
31023
31695
|
}
|
|
31024
31696
|
scheduleRestoreWebSocketConnection() {
|
|
31697
|
+
if (this._disposed) {
|
|
31698
|
+
return;
|
|
31699
|
+
}
|
|
31025
31700
|
this.logToConsole(
|
|
31026
31701
|
`Pull: scheduling restoration of websocket connection in ${RESTORE_WEBSOCKET_TIMEOUT} seconds`
|
|
31027
31702
|
);
|
|
@@ -31037,7 +31712,7 @@ ${JSON.stringify({
|
|
|
31037
31712
|
* @returns {Promise}
|
|
31038
31713
|
*/
|
|
31039
31714
|
async connect() {
|
|
31040
|
-
if (!this._enabled) {
|
|
31715
|
+
if (this._disposed || !this._enabled) {
|
|
31041
31716
|
return Promise.reject();
|
|
31042
31717
|
}
|
|
31043
31718
|
if (this.connector?.connected) {
|
|
@@ -31063,6 +31738,9 @@ ${JSON.stringify({
|
|
|
31063
31738
|
* @param restartDelay
|
|
31064
31739
|
*/
|
|
31065
31740
|
scheduleRestart(disconnectCode, disconnectReason, restartDelay = 0) {
|
|
31741
|
+
if (this._disposed) {
|
|
31742
|
+
return;
|
|
31743
|
+
}
|
|
31066
31744
|
if (this._restartTimeout) {
|
|
31067
31745
|
clearTimeout(this._restartTimeout);
|
|
31068
31746
|
this._restartTimeout = null;
|
|
@@ -31145,13 +31823,13 @@ ${JSON.stringify({
|
|
|
31145
31823
|
if (typeChanel === "private" && this._config?.channels?.private) {
|
|
31146
31824
|
this._config.channels.private = message.params.new_channel;
|
|
31147
31825
|
this.logToConsole(
|
|
31148
|
-
`Pull: new config for ${message.params.channel.type} channel set:
|
|
31826
|
+
`Pull: new config for ${message.params.channel.type} channel set: [updated]`
|
|
31149
31827
|
);
|
|
31150
31828
|
}
|
|
31151
31829
|
if (typeChanel === "shared" && this._config?.channels?.shared) {
|
|
31152
31830
|
this._config.channels.shared = message.params.new_channel;
|
|
31153
31831
|
this.logToConsole(
|
|
31154
|
-
`Pull: new config for ${message.params.channel.type} channel set:
|
|
31832
|
+
`Pull: new config for ${message.params.channel.type} channel set: [updated]`
|
|
31155
31833
|
);
|
|
31156
31834
|
}
|
|
31157
31835
|
this.reconnect(CloseReasons.CONFIG_REPLACED, "config was replaced");
|
|
@@ -31408,7 +32086,10 @@ ${JSON.stringify({
|
|
|
31408
32086
|
if (dataArray === null) {
|
|
31409
32087
|
this.getLogger().warning("PULL ERROR", {
|
|
31410
32088
|
errorType: "parseResponse error parsing message",
|
|
31411
|
-
|
|
32089
|
+
// The frame failed the NGINX-delimiter match, so its content is
|
|
32090
|
+
// unparseable anyway and could carry a credential (e.g. a channel
|
|
32091
|
+
// `signature`); log only its size, never the bytes (#43).
|
|
32092
|
+
byteLength: pullEvent.length
|
|
31412
32093
|
});
|
|
31413
32094
|
return [];
|
|
31414
32095
|
}
|
|
@@ -31461,15 +32142,28 @@ ${JSON.stringify({
|
|
|
31461
32142
|
// endregion ////
|
|
31462
32143
|
// region Events.Status /////
|
|
31463
32144
|
onOffline() {
|
|
32145
|
+
if (this._disposed) {
|
|
32146
|
+
return;
|
|
32147
|
+
}
|
|
31464
32148
|
this.disconnect(CloseReasons.NORMAL_CLOSURE, "offline");
|
|
31465
32149
|
}
|
|
31466
32150
|
onOnline() {
|
|
32151
|
+
if (this._disposed) {
|
|
32152
|
+
return;
|
|
32153
|
+
}
|
|
31467
32154
|
this.connect().catch((error) => {
|
|
31468
32155
|
this.getLogger().error("onOnline", { error });
|
|
31469
32156
|
});
|
|
31470
32157
|
}
|
|
31471
32158
|
onBeforeUnload() {
|
|
31472
32159
|
this._unloading = true;
|
|
32160
|
+
this.persistSession();
|
|
32161
|
+
this.scheduleReconnect(15);
|
|
32162
|
+
}
|
|
32163
|
+
// Persist the current session (with a short TTL) so a quick reload / re-init can
|
|
32164
|
+
// resume it. Shared by onBeforeUnload and destroy() — destroy() saves WITHOUT
|
|
32165
|
+
// scheduling a reconnect (#141).
|
|
32166
|
+
persistSession() {
|
|
31473
32167
|
const session = Type.clone(this.session);
|
|
31474
32168
|
session.ttl = Date.now() + LS_SESSION_CACHE_TIME * 1e3;
|
|
31475
32169
|
if (this._storage) {
|
|
@@ -31486,7 +32180,6 @@ ${JSON.stringify({
|
|
|
31486
32180
|
);
|
|
31487
32181
|
}
|
|
31488
32182
|
}
|
|
31489
|
-
this.scheduleReconnect(15);
|
|
31490
32183
|
}
|
|
31491
32184
|
// endregion ////
|
|
31492
32185
|
// region PullStatus ////
|
|
@@ -31495,6 +32188,9 @@ ${JSON.stringify({
|
|
|
31495
32188
|
* @param delay
|
|
31496
32189
|
*/
|
|
31497
32190
|
sendPullStatusDelayed(status, delay) {
|
|
32191
|
+
if (this._disposed) {
|
|
32192
|
+
return;
|
|
32193
|
+
}
|
|
31498
32194
|
if (this._offlineTimeout) {
|
|
31499
32195
|
clearTimeout(this._offlineTimeout);
|
|
31500
32196
|
this._offlineTimeout = null;
|
|
@@ -31540,6 +32236,9 @@ ${JSON.stringify({
|
|
|
31540
32236
|
* @param force
|
|
31541
32237
|
*/
|
|
31542
32238
|
updateWatch(force = false) {
|
|
32239
|
+
if (this._disposed) {
|
|
32240
|
+
return;
|
|
32241
|
+
}
|
|
31543
32242
|
if (this._watchUpdateTimeout) {
|
|
31544
32243
|
clearTimeout(this._watchUpdateTimeout);
|
|
31545
32244
|
this._watchUpdateTimeout = null;
|
|
@@ -31580,6 +32279,9 @@ ${JSON.stringify({
|
|
|
31580
32279
|
this.connector?.send(JSON_RPC_PONG);
|
|
31581
32280
|
}
|
|
31582
32281
|
updatePingWaitTimeout() {
|
|
32282
|
+
if (this._disposed) {
|
|
32283
|
+
return;
|
|
32284
|
+
}
|
|
31583
32285
|
if (this._pingWaitTimeout) {
|
|
31584
32286
|
clearTimeout(this._pingWaitTimeout);
|
|
31585
32287
|
this._pingWaitTimeout = null;
|
|
@@ -31597,7 +32299,7 @@ ${JSON.stringify({
|
|
|
31597
32299
|
}
|
|
31598
32300
|
onPingTimeout() {
|
|
31599
32301
|
this._pingWaitTimeout = null;
|
|
31600
|
-
if (!this._enabled || !this.isConnected()) {
|
|
32302
|
+
if (this._disposed || !this._enabled || !this.isConnected()) {
|
|
31601
32303
|
return;
|
|
31602
32304
|
}
|
|
31603
32305
|
this.getLogger().warning(`No pings are received in ${PING_TIMEOUT * 2} seconds. Reconnecting`);
|
|
@@ -31658,30 +32360,30 @@ ${JSON.stringify({
|
|
|
31658
32360
|
if (message.extra?.sender && message.extra.sender.type === SenderType.Client) {
|
|
31659
32361
|
this.getLogger().info(
|
|
31660
32362
|
`onPullClientEvent-${message.module_id}`,
|
|
31661
|
-
{
|
|
32363
|
+
redactSensitiveParams({
|
|
31662
32364
|
command: message.command,
|
|
31663
32365
|
params: message.params,
|
|
31664
32366
|
extra: message.extra
|
|
31665
|
-
}
|
|
32367
|
+
})
|
|
31666
32368
|
);
|
|
31667
32369
|
} else if (message.module_id == "online") {
|
|
31668
32370
|
this.getLogger().info(
|
|
31669
32371
|
`onPullOnlineEvent`,
|
|
31670
|
-
{
|
|
32372
|
+
redactSensitiveParams({
|
|
31671
32373
|
command: message.command,
|
|
31672
32374
|
params: message.params,
|
|
31673
32375
|
extra: message.extra
|
|
31674
|
-
}
|
|
32376
|
+
})
|
|
31675
32377
|
);
|
|
31676
32378
|
} else {
|
|
31677
32379
|
this.getLogger().info(
|
|
31678
32380
|
`onPullEvent`,
|
|
31679
|
-
{
|
|
32381
|
+
redactSensitiveParams({
|
|
31680
32382
|
moduleId: message.module_id,
|
|
31681
32383
|
command: message.command,
|
|
31682
32384
|
params: message.params,
|
|
31683
32385
|
extra: message.extra
|
|
31684
|
-
}
|
|
32386
|
+
})
|
|
31685
32387
|
);
|
|
31686
32388
|
}
|
|
31687
32389
|
}
|
|
@@ -32272,6 +32974,7 @@ ${JSON.stringify({
|
|
|
32272
32974
|
exports.B24LocaleMap = B24LocaleMap;
|
|
32273
32975
|
exports.B24OAuth = B24OAuth;
|
|
32274
32976
|
exports.B24PullClientManager = PullClient;
|
|
32977
|
+
exports.BatchRefV3 = BatchRefV3;
|
|
32275
32978
|
exports.Browser = Browser;
|
|
32276
32979
|
exports.CatalogProductImageType = CatalogProductImageType;
|
|
32277
32980
|
exports.CatalogProductType = CatalogProductType;
|
|
@@ -32291,6 +32994,7 @@ ${JSON.stringify({
|
|
|
32291
32994
|
exports.EnumCrmEntityTypeId = EnumCrmEntityTypeId;
|
|
32292
32995
|
exports.EnumCrmEntityTypeShort = EnumCrmEntityTypeShort;
|
|
32293
32996
|
exports.Environment = Environment;
|
|
32997
|
+
exports.FilterV3 = FilterV3;
|
|
32294
32998
|
exports.HttpV2 = HttpV2;
|
|
32295
32999
|
exports.HttpV3 = HttpV3;
|
|
32296
33000
|
exports.JsonFormatter = JsonFormatter;
|