@bitrix24/b24jssdk 1.3.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 +3 -2
- 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 +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 +1 -1
- package/dist/esm/core/actions/v2/manager-v2.mjs +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 +30 -44
- 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 +24 -41
- 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 +25 -1
- package/dist/esm/core/actions/v3/manager-v3.mjs.map +1 -1
- package/dist/esm/core/http/abstract-http.mjs +68 -17
- 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 +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 +11 -4
- 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 +1 -1
- package/dist/esm/core/tools/ping.mjs +1 -1
- package/dist/esm/core/version-manager.mjs +19 -157
- 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 +1 -1
- package/dist/esm/frame/placement.mjs +1 -1
- package/dist/esm/frame/slider.mjs +1 -1
- package/dist/esm/helper/abstract-helper.mjs +1 -1
- package/dist/esm/helper/app-manager.mjs +1 -1
- package/dist/esm/helper/currency-manager.mjs +1 -1
- package/dist/esm/helper/helper-manager.mjs +1 -1
- package/dist/esm/helper/license-manager.mjs +1 -1
- package/dist/esm/helper/options-manager.mjs +1 -1
- package/dist/esm/helper/payment-manager.mjs +1 -1
- package/dist/esm/helper/profile-manager.mjs +1 -1
- package/dist/esm/helper/use-b24-helper.mjs +1 -1
- package/dist/esm/hook/auth.mjs +1 -1
- package/dist/esm/hook/b24.mjs +3 -3
- package/dist/esm/hook/b24.mjs.map +1 -1
- package/dist/esm/index.d.mts +412 -39
- package/dist/esm/index.d.ts +412 -39
- 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 +1258 -719
- 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;
|
|
@@ -10413,9 +10413,16 @@ If you need to send logs from browser, use a proxy server.`;
|
|
|
10413
10413
|
* {@link Result.getErrors}, the keys are not discarded — useful for batch
|
|
10414
10414
|
* calls with `isHaltOnError: false`.
|
|
10415
10415
|
*
|
|
10416
|
-
*
|
|
10417
|
-
*
|
|
10418
|
-
*
|
|
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)
|
|
10419
10426
|
*
|
|
10420
10427
|
* @returns {Record<string, Error>} A map of error key to Error object.
|
|
10421
10428
|
*/
|
|
@@ -10471,11 +10478,11 @@ Errors: ${this.getErrorMessages().join(", ")}`;
|
|
|
10471
10478
|
}
|
|
10472
10479
|
}
|
|
10473
10480
|
|
|
10474
|
-
var __defProp$
|
|
10475
|
-
var __name$
|
|
10481
|
+
var __defProp$1o = Object.defineProperty;
|
|
10482
|
+
var __name$1o = (target, value) => __defProp$1o(target, "name", { value, configurable: true });
|
|
10476
10483
|
class SdkError extends Error {
|
|
10477
10484
|
static {
|
|
10478
|
-
__name$
|
|
10485
|
+
__name$1o(this, "SdkError");
|
|
10479
10486
|
}
|
|
10480
10487
|
code;
|
|
10481
10488
|
_status;
|
|
@@ -10544,53 +10551,81 @@ ${this.stack}`;
|
|
|
10544
10551
|
}
|
|
10545
10552
|
}
|
|
10546
10553
|
|
|
10547
|
-
var __defProp$
|
|
10548
|
-
var __name$
|
|
10554
|
+
var __defProp$1n = Object.defineProperty;
|
|
10555
|
+
var __name$1n = (target, value) => __defProp$1n(target, "name", { value, configurable: true });
|
|
10549
10556
|
const SENSITIVE_PARAM_KEYS = [
|
|
10550
10557
|
"auth",
|
|
10551
10558
|
"password",
|
|
10552
10559
|
"token",
|
|
10553
10560
|
"secret",
|
|
10554
10561
|
"access_token",
|
|
10555
|
-
"refresh_token"
|
|
10562
|
+
"refresh_token",
|
|
10563
|
+
"client_secret",
|
|
10564
|
+
"application_token",
|
|
10565
|
+
"sessid",
|
|
10566
|
+
"key",
|
|
10567
|
+
"signature"
|
|
10556
10568
|
];
|
|
10557
10569
|
const REDACTED_PLACEHOLDER = "***REDACTED***";
|
|
10570
|
+
const QS_SENSITIVE_RE = new RegExp(
|
|
10571
|
+
`([?&]|^)(${SENSITIVE_PARAM_KEYS.join("|")})=[^&#;]*`,
|
|
10572
|
+
"gi"
|
|
10573
|
+
);
|
|
10558
10574
|
function isPlainObject$1(value) {
|
|
10559
10575
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
10560
10576
|
}
|
|
10561
|
-
__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");
|
|
10562
10594
|
function redactObject(source, depth) {
|
|
10563
10595
|
const sanitized = { ...source };
|
|
10564
10596
|
for (const key of Object.keys(sanitized)) {
|
|
10565
|
-
if (SENSITIVE_PARAM_KEYS.includes(key)) {
|
|
10597
|
+
if (SENSITIVE_PARAM_KEYS.includes(key.toLowerCase())) {
|
|
10566
10598
|
sanitized[key] = REDACTED_PLACEHOLDER;
|
|
10567
10599
|
continue;
|
|
10568
10600
|
}
|
|
10569
|
-
|
|
10570
|
-
const child = sanitized[key];
|
|
10571
|
-
if (isPlainObject$1(child)) {
|
|
10572
|
-
sanitized[key] = redactObject(child, depth - 1);
|
|
10573
|
-
} else if (Array.isArray(child)) {
|
|
10574
|
-
sanitized[key] = child.map(
|
|
10575
|
-
(item) => isPlainObject$1(item) ? redactObject(item, depth - 1) : item
|
|
10576
|
-
);
|
|
10577
|
-
}
|
|
10601
|
+
sanitized[key] = redactValue(sanitized[key], depth);
|
|
10578
10602
|
}
|
|
10579
10603
|
return sanitized;
|
|
10580
10604
|
}
|
|
10581
|
-
__name$
|
|
10605
|
+
__name$1n(redactObject, "redactObject");
|
|
10582
10606
|
const DEFAULT_REDACT_DEPTH = 2;
|
|
10583
10607
|
function redactSensitiveParams(params) {
|
|
10584
10608
|
if (!isPlainObject$1(params)) return params;
|
|
10585
10609
|
return redactObject(params, DEFAULT_REDACT_DEPTH);
|
|
10586
10610
|
}
|
|
10587
|
-
__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");
|
|
10588
10623
|
|
|
10589
|
-
var __defProp$
|
|
10590
|
-
var __name$
|
|
10624
|
+
var __defProp$1m = Object.defineProperty;
|
|
10625
|
+
var __name$1m = (target, value) => __defProp$1m(target, "name", { value, configurable: true });
|
|
10591
10626
|
class AjaxError extends SdkError {
|
|
10592
10627
|
static {
|
|
10593
|
-
__name$
|
|
10628
|
+
__name$1m(this, "AjaxError");
|
|
10594
10629
|
}
|
|
10595
10630
|
requestInfo;
|
|
10596
10631
|
constructor(params) {
|
|
@@ -10684,11 +10719,11 @@ ${this.stack}`;
|
|
|
10684
10719
|
}
|
|
10685
10720
|
}
|
|
10686
10721
|
|
|
10687
|
-
var __defProp$
|
|
10688
|
-
var __name$
|
|
10722
|
+
var __defProp$1l = Object.defineProperty;
|
|
10723
|
+
var __name$1l = (target, value) => __defProp$1l(target, "name", { value, configurable: true });
|
|
10689
10724
|
class AjaxResult extends Result {
|
|
10690
10725
|
static {
|
|
10691
|
-
__name$
|
|
10726
|
+
__name$1l(this, "AjaxResult");
|
|
10692
10727
|
}
|
|
10693
10728
|
_status;
|
|
10694
10729
|
_query;
|
|
@@ -10803,10 +10838,10 @@ ${this.stack}`;
|
|
|
10803
10838
|
}
|
|
10804
10839
|
/**
|
|
10805
10840
|
* @deprecated Will be removed in `2.0.0`. Tied to the `restApi:v2` envelope
|
|
10806
|
-
* field `total`, which `restApi:v3` does not return.
|
|
10807
|
-
*
|
|
10808
|
-
* `countDistinct`); for `restApi:v2`
|
|
10809
|
-
* 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`.
|
|
10810
10845
|
*
|
|
10811
10846
|
* @removed 2.0.0
|
|
10812
10847
|
*/
|
|
@@ -10871,11 +10906,12 @@ ${this.stack}`;
|
|
|
10871
10906
|
);
|
|
10872
10907
|
}
|
|
10873
10908
|
#buildNextPageQuery() {
|
|
10874
|
-
const result = { ...this._query };
|
|
10875
10909
|
const payload = this._data;
|
|
10876
10910
|
const nextValue = "next" in payload ? payload.next : void 0;
|
|
10877
|
-
|
|
10878
|
-
|
|
10911
|
+
return {
|
|
10912
|
+
...this._query,
|
|
10913
|
+
params: { ...this._query.params, start: Text.toInteger(nextValue) }
|
|
10914
|
+
};
|
|
10879
10915
|
}
|
|
10880
10916
|
// Immutable API
|
|
10881
10917
|
setData() {
|
|
@@ -10883,11 +10919,11 @@ ${this.stack}`;
|
|
|
10883
10919
|
}
|
|
10884
10920
|
}
|
|
10885
10921
|
|
|
10886
|
-
var __defProp$
|
|
10887
|
-
var __name$
|
|
10922
|
+
var __defProp$1k = Object.defineProperty;
|
|
10923
|
+
var __name$1k = (target, value) => __defProp$1k(target, "name", { value, configurable: true });
|
|
10888
10924
|
class ParamsFactory {
|
|
10889
10925
|
static {
|
|
10890
|
-
__name$
|
|
10926
|
+
__name$1k(this, "ParamsFactory");
|
|
10891
10927
|
}
|
|
10892
10928
|
/**
|
|
10893
10929
|
* Default parameters for regular tariffs
|
|
@@ -10995,11 +11031,11 @@ ${this.stack}`;
|
|
|
10995
11031
|
}
|
|
10996
11032
|
}
|
|
10997
11033
|
|
|
10998
|
-
var __defProp$
|
|
10999
|
-
var __name$
|
|
11034
|
+
var __defProp$1j = Object.defineProperty;
|
|
11035
|
+
var __name$1j = (target, value) => __defProp$1j(target, "name", { value, configurable: true });
|
|
11000
11036
|
class RateLimiter {
|
|
11001
11037
|
static {
|
|
11002
|
-
__name$
|
|
11038
|
+
__name$1j(this, "RateLimiter");
|
|
11003
11039
|
}
|
|
11004
11040
|
#tokens;
|
|
11005
11041
|
#lastRefill;
|
|
@@ -11385,11 +11421,11 @@ ${this.stack}`;
|
|
|
11385
11421
|
// endregion ////
|
|
11386
11422
|
}
|
|
11387
11423
|
|
|
11388
|
-
var __defProp$
|
|
11389
|
-
var __name$
|
|
11424
|
+
var __defProp$1i = Object.defineProperty;
|
|
11425
|
+
var __name$1i = (target, value) => __defProp$1i(target, "name", { value, configurable: true });
|
|
11390
11426
|
class OperatingLimiter {
|
|
11391
11427
|
static {
|
|
11392
|
-
__name$
|
|
11428
|
+
__name$1i(this, "OperatingLimiter");
|
|
11393
11429
|
}
|
|
11394
11430
|
#config;
|
|
11395
11431
|
#methodStats = /* @__PURE__ */ new Map();
|
|
@@ -11544,11 +11580,11 @@ ${this.stack}`;
|
|
|
11544
11580
|
// endregion ////
|
|
11545
11581
|
}
|
|
11546
11582
|
|
|
11547
|
-
var __defProp$
|
|
11548
|
-
var __name$
|
|
11583
|
+
var __defProp$1h = Object.defineProperty;
|
|
11584
|
+
var __name$1h = (target, value) => __defProp$1h(target, "name", { value, configurable: true });
|
|
11549
11585
|
class AdaptiveDelayer {
|
|
11550
11586
|
static {
|
|
11551
|
-
__name$
|
|
11587
|
+
__name$1h(this, "AdaptiveDelayer");
|
|
11552
11588
|
}
|
|
11553
11589
|
#config;
|
|
11554
11590
|
#operatingLimiter;
|
|
@@ -11667,11 +11703,11 @@ ${this.stack}`;
|
|
|
11667
11703
|
// endregion ////
|
|
11668
11704
|
}
|
|
11669
11705
|
|
|
11670
|
-
var __defProp$
|
|
11671
|
-
var __name$
|
|
11706
|
+
var __defProp$1g = Object.defineProperty;
|
|
11707
|
+
var __name$1g = (target, value) => __defProp$1g(target, "name", { value, configurable: true });
|
|
11672
11708
|
class RestrictionManager {
|
|
11673
11709
|
static {
|
|
11674
|
-
__name$
|
|
11710
|
+
__name$1g(this, "RestrictionManager");
|
|
11675
11711
|
}
|
|
11676
11712
|
#rateLimiter;
|
|
11677
11713
|
#operatingLimiter;
|
|
@@ -12023,245 +12059,54 @@ ${this.stack}`;
|
|
|
12023
12059
|
// endregion ////
|
|
12024
12060
|
}
|
|
12025
12061
|
|
|
12026
|
-
var __defProp$
|
|
12027
|
-
var __name$
|
|
12028
|
-
class ParseRow {
|
|
12029
|
-
static {
|
|
12030
|
-
__name$19(this, "ParseRow");
|
|
12031
|
-
}
|
|
12032
|
-
static getBatchCommand(row, options) {
|
|
12033
|
-
if (row) {
|
|
12034
|
-
if (typeof row === "object" && "method" in row && typeof row.method === "string") {
|
|
12035
|
-
return {
|
|
12036
|
-
method: row.method,
|
|
12037
|
-
query: row.params,
|
|
12038
|
-
as: row.as ?? options.asDefaultValue,
|
|
12039
|
-
parallel: row.parallel ?? options.parallelDefaultValue
|
|
12040
|
-
};
|
|
12041
|
-
}
|
|
12042
|
-
if (Array.isArray(row) && row.length > 0 && typeof row[0] === "string") {
|
|
12043
|
-
return {
|
|
12044
|
-
method: row[0],
|
|
12045
|
-
query: row[1],
|
|
12046
|
-
as: options.asDefaultValue,
|
|
12047
|
-
parallel: options.parallelDefaultValue
|
|
12048
|
-
};
|
|
12049
|
-
}
|
|
12050
|
-
}
|
|
12051
|
-
throw new SdkError({
|
|
12052
|
-
code: "JSSDK_INTERACTION_BATCH_ROW_FAIL",
|
|
12053
|
-
description: `There were difficulties parsing the command for batch.
|
|
12054
|
-
${JSON.stringify({
|
|
12055
|
-
row,
|
|
12056
|
-
options
|
|
12057
|
-
})}`,
|
|
12058
|
-
status: 500
|
|
12059
|
-
});
|
|
12060
|
-
}
|
|
12061
|
-
static getMethodsFromCommands(calls) {
|
|
12062
|
-
const result = [];
|
|
12063
|
-
const optsFake = {
|
|
12064
|
-
parallelDefaultValue: false
|
|
12065
|
-
};
|
|
12066
|
-
if (Array.isArray(calls)) {
|
|
12067
|
-
calls.forEach((row) => {
|
|
12068
|
-
const command = ParseRow.getBatchCommand(row, optsFake);
|
|
12069
|
-
result.push(command.method);
|
|
12070
|
-
});
|
|
12071
|
-
} else {
|
|
12072
|
-
Object.entries(calls).forEach(([index, row]) => {
|
|
12073
|
-
const command = ParseRow.getBatchCommand(row, { ...optsFake, asDefaultValue: index });
|
|
12074
|
-
result.push(command.method);
|
|
12075
|
-
});
|
|
12076
|
-
}
|
|
12077
|
-
return result;
|
|
12078
|
-
}
|
|
12079
|
-
}
|
|
12080
|
-
|
|
12081
|
-
var __defProp$18 = Object.defineProperty;
|
|
12082
|
-
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 });
|
|
12083
12064
|
class VersionManager {
|
|
12084
12065
|
static {
|
|
12085
|
-
__name$
|
|
12086
|
-
}
|
|
12087
|
-
#supportMethods;
|
|
12088
|
-
constructor() {
|
|
12089
|
-
this.#supportMethods = [
|
|
12090
|
-
// --- infrastructure ---
|
|
12091
|
-
"/batch",
|
|
12092
|
-
// done
|
|
12093
|
-
"/scopes",
|
|
12094
|
-
// done
|
|
12095
|
-
"/rest.scope.list",
|
|
12096
|
-
// done
|
|
12097
|
-
"/rest.documentation.openapi",
|
|
12098
|
-
"/documentation",
|
|
12099
|
-
// --- main ---
|
|
12100
|
-
/** @see /settings/configs/event_log.php */
|
|
12101
|
-
"/main.eventlog.list",
|
|
12102
|
-
// done
|
|
12103
|
-
"/main.eventlog.get",
|
|
12104
|
-
// done
|
|
12105
|
-
"/main.eventlog.tail",
|
|
12106
|
-
// done
|
|
12107
|
-
"/main.eventlog.field.list",
|
|
12108
|
-
"/main.eventlog.field.get",
|
|
12109
|
-
// --- mail (rest-v3) ---
|
|
12110
|
-
"/mail.mailbox.list",
|
|
12111
|
-
"/mail.mailbox.get",
|
|
12112
|
-
"/mail.mailbox.senders",
|
|
12113
|
-
"/mail.mailbox.field.list",
|
|
12114
|
-
"/mail.mailbox.field.get",
|
|
12115
|
-
"/mail.message.list",
|
|
12116
|
-
"/mail.message.get",
|
|
12117
|
-
"/mail.message.thread",
|
|
12118
|
-
"/mail.message.send",
|
|
12119
|
-
"/mail.message.reply",
|
|
12120
|
-
"/mail.message.forward",
|
|
12121
|
-
"/mail.message.movetofolder",
|
|
12122
|
-
"/mail.message.createcrmactivity",
|
|
12123
|
-
"/mail.message.removecrmactivity",
|
|
12124
|
-
"/mail.message.createtask",
|
|
12125
|
-
"/mail.message.createcalendarevent",
|
|
12126
|
-
"/mail.message.createchat",
|
|
12127
|
-
"/mail.message.createfeedpost",
|
|
12128
|
-
"/mail.message.field.list",
|
|
12129
|
-
"/mail.message.field.get",
|
|
12130
|
-
"/mail.recipient.listcontacts",
|
|
12131
|
-
"/mail.recipient.listemployees",
|
|
12132
|
-
"/mail.recipient.field.list",
|
|
12133
|
-
"/mail.recipient.field.get",
|
|
12134
|
-
// --- humanresources (rest-v3) ---
|
|
12135
|
-
"/humanresources.node.add",
|
|
12136
|
-
"/humanresources.node.edit",
|
|
12137
|
-
"/humanresources.node.get",
|
|
12138
|
-
"/humanresources.node.list",
|
|
12139
|
-
"/humanresources.node.search",
|
|
12140
|
-
"/humanresources.node.children",
|
|
12141
|
-
"/humanresources.node.count",
|
|
12142
|
-
"/humanresources.node.move",
|
|
12143
|
-
"/humanresources.node.field.list",
|
|
12144
|
-
"/humanresources.node.field.get",
|
|
12145
|
-
"/humanresources.node.member.add",
|
|
12146
|
-
"/humanresources.node.member.set",
|
|
12147
|
-
"/humanresources.node.member.move",
|
|
12148
|
-
"/humanresources.node.member.remove",
|
|
12149
|
-
"/humanresources.node.communication.edit",
|
|
12150
|
-
"/humanresources.node.communication.list",
|
|
12151
|
-
"/humanresources.employee.search",
|
|
12152
|
-
"/humanresources.employee.subordinates",
|
|
12153
|
-
"/humanresources.employee.count",
|
|
12154
|
-
"/humanresources.employee.multidepartment",
|
|
12155
|
-
"/humanresources.employee.field.list",
|
|
12156
|
-
"/humanresources.employee.field.get",
|
|
12157
|
-
// --- tasks (rest-v3) ---
|
|
12158
|
-
"/tasks.task.add",
|
|
12159
|
-
"/tasks.task.get",
|
|
12160
|
-
// done
|
|
12161
|
-
"/tasks.task.update",
|
|
12162
|
-
// done
|
|
12163
|
-
"/tasks.task.delete",
|
|
12164
|
-
"/tasks.task.access.get",
|
|
12165
|
-
"/tasks.task.file.attach",
|
|
12166
|
-
"/tasks.task.chat.message.send",
|
|
12167
|
-
"/tasks.task.result.add",
|
|
12168
|
-
"/tasks.task.result.addfromchatmessage",
|
|
12169
|
-
"/tasks.task.result.update",
|
|
12170
|
-
"/tasks.task.result.list",
|
|
12171
|
-
"/tasks.task.result.delete",
|
|
12172
|
-
"/tasks.task.field.list",
|
|
12173
|
-
"/tasks.task.field.get",
|
|
12174
|
-
"/tasks.task.access.field.list",
|
|
12175
|
-
"/tasks.task.access.field.get",
|
|
12176
|
-
"/tasks.task.file.field.list",
|
|
12177
|
-
"/tasks.task.file.field.get",
|
|
12178
|
-
"/tasks.task.chat.message.field.list",
|
|
12179
|
-
"/tasks.task.chat.message.field.get",
|
|
12180
|
-
// --- timeman (rest-v3) — read-only in v3 (no record.get / add / update / delete) ---
|
|
12181
|
-
"/timeman.record.list",
|
|
12182
|
-
"/timeman.record.field.list",
|
|
12183
|
-
"/timeman.record.field.get"
|
|
12184
|
-
// Cross-module methods are cross-referenced from the rest-v3 pages above but
|
|
12185
|
-
// belong to modules not actualized here — add them when those modules land:
|
|
12186
|
-
// user.get — user module (seen on humanresources + timeman)
|
|
12187
|
-
// im.message.update / im.message.delete / im.dialog.messages.get — im module (seen on tasks)
|
|
12188
|
-
// disk.storage.uploadfile / disk.folder.uploadfile /
|
|
12189
|
-
// disk.storage.getchildren / disk.folder.getchildren — disk module (seen on tasks)
|
|
12190
|
-
//
|
|
12191
|
-
// @todo When API.v3 arrives - change in AuthOAuthManager.initIsAdmin()
|
|
12192
|
-
// '/profile' // wait
|
|
12193
|
-
// '/main.message.get' // wait
|
|
12194
|
-
// '/main.chat.update' // wait
|
|
12195
|
-
// '/main.chat.list' // wait
|
|
12196
|
-
// '/main.user.list' // wait
|
|
12197
|
-
];
|
|
12066
|
+
__name$1f(this, "VersionManager");
|
|
12198
12067
|
}
|
|
12199
12068
|
static create() {
|
|
12200
12069
|
return new VersionManager();
|
|
12201
12070
|
}
|
|
12202
12071
|
/**
|
|
12203
|
-
* List of supported API versions
|
|
12204
|
-
* The highest version must be first
|
|
12072
|
+
* List of supported API versions.
|
|
12073
|
+
* The highest version must be first.
|
|
12205
12074
|
*/
|
|
12206
12075
|
getAllApiVersions() {
|
|
12207
12076
|
return [ApiVersion.v3, ApiVersion.v2];
|
|
12208
12077
|
}
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
|
|
12212
|
-
|
|
12213
|
-
|
|
12214
|
-
|
|
12215
|
-
|
|
12216
|
-
return false;
|
|
12217
|
-
}
|
|
12218
|
-
#v3Support(method) {
|
|
12219
|
-
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;
|
|
12220
12085
|
}
|
|
12221
12086
|
/**
|
|
12222
|
-
*
|
|
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.
|
|
12223
12091
|
*/
|
|
12224
|
-
automaticallyObtainApiVersion(
|
|
12225
|
-
|
|
12226
|
-
if (!version) {
|
|
12227
|
-
throw new SdkError({
|
|
12228
|
-
code: "JSSDK_VERSION_MANAGER_NOT_DETECT_FOR_METHOD",
|
|
12229
|
-
description: `No API version found that supports method ${method}.`,
|
|
12230
|
-
status: 500
|
|
12231
|
-
});
|
|
12232
|
-
}
|
|
12233
|
-
return version;
|
|
12092
|
+
automaticallyObtainApiVersion(_method) {
|
|
12093
|
+
return ApiVersion.v2;
|
|
12234
12094
|
}
|
|
12235
12095
|
/**
|
|
12236
|
-
*
|
|
12237
|
-
*
|
|
12238
|
-
* @todo test methods
|
|
12239
|
-
* `[['crm.item.get', { entityTypeId: 3, id: 1 }]]`
|
|
12240
|
-
* `[{ method: 'crm.item.get', params: { entityTypeId: 3, id: 1 } }]`
|
|
12241
|
-
* `{ 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.
|
|
12242
12098
|
*/
|
|
12243
|
-
automaticallyObtainApiVersionForBatch(
|
|
12244
|
-
const commands = ParseRow.getMethodsFromCommands(calls);
|
|
12245
|
-
let isAllSupportV3 = true;
|
|
12246
|
-
for (const [_, method] of commands.entries()) {
|
|
12247
|
-
if (!this.isSupport(ApiVersion.v3, method)) {
|
|
12248
|
-
isAllSupportV3 = false;
|
|
12249
|
-
break;
|
|
12250
|
-
}
|
|
12251
|
-
}
|
|
12252
|
-
if (isAllSupportV3) {
|
|
12253
|
-
return ApiVersion.v3;
|
|
12254
|
-
}
|
|
12099
|
+
automaticallyObtainApiVersionForBatch(_calls) {
|
|
12255
12100
|
return ApiVersion.v2;
|
|
12256
12101
|
}
|
|
12257
12102
|
}
|
|
12258
12103
|
const versionManager = VersionManager.create();
|
|
12259
12104
|
|
|
12260
|
-
var __defProp$
|
|
12261
|
-
var __name$
|
|
12105
|
+
var __defProp$1e = Object.defineProperty;
|
|
12106
|
+
var __name$1e = (target, value) => __defProp$1e(target, "name", { value, configurable: true });
|
|
12262
12107
|
class AbstractAction {
|
|
12263
12108
|
static {
|
|
12264
|
-
__name$
|
|
12109
|
+
__name$1e(this, "AbstractAction");
|
|
12265
12110
|
}
|
|
12266
12111
|
_b24;
|
|
12267
12112
|
_logger;
|
|
@@ -12271,11 +12116,11 @@ ${JSON.stringify({
|
|
|
12271
12116
|
}
|
|
12272
12117
|
}
|
|
12273
12118
|
|
|
12274
|
-
var __defProp$
|
|
12275
|
-
var __name$
|
|
12119
|
+
var __defProp$1d = Object.defineProperty;
|
|
12120
|
+
var __name$1d = (target, value) => __defProp$1d(target, "name", { value, configurable: true });
|
|
12276
12121
|
class CallV2 extends AbstractAction {
|
|
12277
12122
|
static {
|
|
12278
|
-
__name$
|
|
12123
|
+
__name$1d(this, "CallV2");
|
|
12279
12124
|
}
|
|
12280
12125
|
/**
|
|
12281
12126
|
* Calls the Bitrix24 REST API method.
|
|
@@ -12307,28 +12152,16 @@ ${JSON.stringify({
|
|
|
12307
12152
|
* console.log(response.getData().result.item.name)
|
|
12308
12153
|
*/
|
|
12309
12154
|
async make(options) {
|
|
12310
|
-
if (versionManager.isSupport(ApiVersion.v3, options.method)) {
|
|
12311
|
-
LoggerFactory.forcedLog(
|
|
12312
|
-
this._logger,
|
|
12313
|
-
"warning",
|
|
12314
|
-
`The method ${options.method} is available in restApi:v3. It's worth migrating to the new API.`,
|
|
12315
|
-
{
|
|
12316
|
-
method: options.method,
|
|
12317
|
-
requestId: options.requestId,
|
|
12318
|
-
code: "JSSDK_CORE_METHOD_AVAILABLE_IN_API_V3"
|
|
12319
|
-
}
|
|
12320
|
-
);
|
|
12321
|
-
}
|
|
12322
12155
|
const params = options.params || {};
|
|
12323
12156
|
return this._b24.getHttpClient(ApiVersion.v2).call(options.method, params, options.requestId);
|
|
12324
12157
|
}
|
|
12325
12158
|
}
|
|
12326
12159
|
|
|
12327
|
-
var __defProp$
|
|
12328
|
-
var __name$
|
|
12160
|
+
var __defProp$1c = Object.defineProperty;
|
|
12161
|
+
var __name$1c = (target, value) => __defProp$1c(target, "name", { value, configurable: true });
|
|
12329
12162
|
class CallListV2 extends AbstractAction {
|
|
12330
12163
|
static {
|
|
12331
|
-
__name$
|
|
12164
|
+
__name$1c(this, "CallListV2");
|
|
12332
12165
|
}
|
|
12333
12166
|
/**
|
|
12334
12167
|
* Fast data retrieval without counting the total number of records.
|
|
@@ -12453,11 +12286,11 @@ ${JSON.stringify({
|
|
|
12453
12286
|
}
|
|
12454
12287
|
}
|
|
12455
12288
|
|
|
12456
|
-
var __defProp$
|
|
12457
|
-
var __name$
|
|
12289
|
+
var __defProp$1b = Object.defineProperty;
|
|
12290
|
+
var __name$1b = (target, value) => __defProp$1b(target, "name", { value, configurable: true });
|
|
12458
12291
|
class FetchListV2 extends AbstractAction {
|
|
12459
12292
|
static {
|
|
12460
|
-
__name$
|
|
12293
|
+
__name$1b(this, "FetchListV2");
|
|
12461
12294
|
}
|
|
12462
12295
|
/**
|
|
12463
12296
|
* Calls a REST API list method and returns an async generator for efficient large data retrieval.
|
|
@@ -12583,11 +12416,11 @@ ${JSON.stringify({
|
|
|
12583
12416
|
}
|
|
12584
12417
|
}
|
|
12585
12418
|
|
|
12586
|
-
var __defProp$
|
|
12587
|
-
var __name$
|
|
12419
|
+
var __defProp$1a = Object.defineProperty;
|
|
12420
|
+
var __name$1a = (target, value) => __defProp$1a(target, "name", { value, configurable: true });
|
|
12588
12421
|
class AbstractBatch extends AbstractAction {
|
|
12589
12422
|
static {
|
|
12590
|
-
__name$
|
|
12423
|
+
__name$1a(this, "AbstractBatch");
|
|
12591
12424
|
}
|
|
12592
12425
|
_addBatchErrorsIfAny(response, result) {
|
|
12593
12426
|
if (!response.isSuccess) {
|
|
@@ -12665,11 +12498,11 @@ ${JSON.stringify({
|
|
|
12665
12498
|
}
|
|
12666
12499
|
}
|
|
12667
12500
|
|
|
12668
|
-
var __defProp$
|
|
12669
|
-
var __name$
|
|
12501
|
+
var __defProp$19 = Object.defineProperty;
|
|
12502
|
+
var __name$19 = (target, value) => __defProp$19(target, "name", { value, configurable: true });
|
|
12670
12503
|
class BatchV2 extends AbstractBatch {
|
|
12671
12504
|
static {
|
|
12672
|
-
__name$
|
|
12505
|
+
__name$19(this, "BatchV2");
|
|
12673
12506
|
}
|
|
12674
12507
|
/**
|
|
12675
12508
|
* Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50.
|
|
@@ -12778,11 +12611,11 @@ ${JSON.stringify({
|
|
|
12778
12611
|
}
|
|
12779
12612
|
}
|
|
12780
12613
|
|
|
12781
|
-
var __defProp$
|
|
12782
|
-
var __name$
|
|
12614
|
+
var __defProp$18 = Object.defineProperty;
|
|
12615
|
+
var __name$18 = (target, value) => __defProp$18(target, "name", { value, configurable: true });
|
|
12783
12616
|
class BatchByChunkV2 extends AbstractBatch {
|
|
12784
12617
|
static {
|
|
12785
|
-
__name$
|
|
12618
|
+
__name$18(this, "BatchByChunkV2");
|
|
12786
12619
|
}
|
|
12787
12620
|
/**
|
|
12788
12621
|
* Executes a batch request with automatic chunking for any number of commands.
|
|
@@ -12857,8 +12690,8 @@ ${JSON.stringify({
|
|
|
12857
12690
|
}
|
|
12858
12691
|
}
|
|
12859
12692
|
|
|
12860
|
-
var __defProp$
|
|
12861
|
-
var __name$
|
|
12693
|
+
var __defProp$17 = Object.defineProperty;
|
|
12694
|
+
var __name$17 = (target, value) => __defProp$17(target, "name", { value, configurable: true });
|
|
12862
12695
|
const callName$1 = /* @__PURE__ */ Symbol("call_V2");
|
|
12863
12696
|
const callListName$1 = /* @__PURE__ */ Symbol("callList_V2");
|
|
12864
12697
|
const fetchListName$1 = /* @__PURE__ */ Symbol("fetchList_V2");
|
|
@@ -12866,7 +12699,7 @@ ${JSON.stringify({
|
|
|
12866
12699
|
const batchByChunkName$1 = /* @__PURE__ */ Symbol("batchByChunk_V2");
|
|
12867
12700
|
class ActionsManagerV2 {
|
|
12868
12701
|
static {
|
|
12869
|
-
__name$
|
|
12702
|
+
__name$17(this, "ActionsManagerV2");
|
|
12870
12703
|
}
|
|
12871
12704
|
_b24;
|
|
12872
12705
|
_logger;
|
|
@@ -12914,11 +12747,11 @@ ${JSON.stringify({
|
|
|
12914
12747
|
}
|
|
12915
12748
|
}
|
|
12916
12749
|
|
|
12917
|
-
var __defProp
|
|
12918
|
-
var __name
|
|
12750
|
+
var __defProp$16 = Object.defineProperty;
|
|
12751
|
+
var __name$16 = (target, value) => __defProp$16(target, "name", { value, configurable: true });
|
|
12919
12752
|
class CallV3 extends AbstractAction {
|
|
12920
12753
|
static {
|
|
12921
|
-
__name
|
|
12754
|
+
__name$16(this, "CallV3");
|
|
12922
12755
|
}
|
|
12923
12756
|
/**
|
|
12924
12757
|
* Calls the Bitrix24 REST API method.
|
|
@@ -12945,23 +12778,72 @@ ${JSON.stringify({
|
|
|
12945
12778
|
* console.log(response.getData().result.item.title)
|
|
12946
12779
|
*/
|
|
12947
12780
|
async make(options) {
|
|
12948
|
-
if (!versionManager.isSupport(ApiVersion.v3, options.method)) {
|
|
12949
|
-
throw new SdkError({
|
|
12950
|
-
code: "JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",
|
|
12951
|
-
description: `restApi:v3 not support method ${options.method}`,
|
|
12952
|
-
status: 500
|
|
12953
|
-
});
|
|
12954
|
-
}
|
|
12955
12781
|
const params = options.params || {};
|
|
12956
12782
|
return this._b24.getHttpClient(ApiVersion.v3).call(options.method, params, options.requestId);
|
|
12957
12783
|
}
|
|
12958
12784
|
}
|
|
12959
12785
|
|
|
12960
|
-
var __defProp$
|
|
12961
|
-
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 });
|
|
12962
12844
|
class CallListV3 extends AbstractAction {
|
|
12963
12845
|
static {
|
|
12964
|
-
__name$
|
|
12846
|
+
__name$14(this, "CallListV3");
|
|
12965
12847
|
}
|
|
12966
12848
|
/**
|
|
12967
12849
|
* Fast data retrieval without counting the total number of records.
|
|
@@ -13030,63 +12912,48 @@ ${JSON.stringify({
|
|
|
13030
12912
|
filter: [...params["filter"] || []],
|
|
13031
12913
|
pagination: { page: 0, limit: batchSize }
|
|
13032
12914
|
};
|
|
13033
|
-
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
do {
|
|
13037
|
-
const sendParams = { ...requestParams, filter: [...requestParams.filter] };
|
|
13038
|
-
sendParams.filter.push([cursorIdKey, ">", nextId]);
|
|
13039
|
-
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, {
|
|
13040
12918
|
method: options.method,
|
|
13041
|
-
|
|
13042
|
-
|
|
13043
|
-
|
|
13044
|
-
|
|
13045
|
-
|
|
13046
|
-
|
|
13047
|
-
|
|
13048
|
-
|
|
13049
|
-
|
|
13050
|
-
|
|
13051
|
-
|
|
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);
|
|
13052
12937
|
}
|
|
13053
|
-
isContinue = false;
|
|
13054
|
-
break;
|
|
13055
12938
|
}
|
|
13056
|
-
|
|
13057
|
-
if (
|
|
13058
|
-
|
|
13059
|
-
|
|
13060
|
-
|
|
13061
|
-
const resultData = responseData.result[customKeyForResult];
|
|
13062
|
-
if (resultData.length === 0) {
|
|
13063
|
-
isContinue = false;
|
|
13064
|
-
break;
|
|
13065
|
-
}
|
|
13066
|
-
allItems = [...allItems, ...resultData];
|
|
13067
|
-
if (resultData.length < batchSize) {
|
|
13068
|
-
isContinue = false;
|
|
13069
|
-
break;
|
|
13070
|
-
}
|
|
13071
|
-
const lastItem = resultData[resultData.length - 1];
|
|
13072
|
-
const cursorValue = lastItem ? Number.parseInt(lastItem[idKey], 10) : Number.NaN;
|
|
13073
|
-
if (Number.isFinite(cursorValue)) {
|
|
13074
|
-
nextId = cursorValue;
|
|
12939
|
+
} catch (error) {
|
|
12940
|
+
if (error instanceof KeysetPaginationError) {
|
|
12941
|
+
for (const [index, err] of error.errors) {
|
|
12942
|
+
result.addError(err, index);
|
|
12943
|
+
}
|
|
13075
12944
|
} else {
|
|
13076
|
-
|
|
13077
|
-
isContinue = false;
|
|
13078
|
-
break;
|
|
12945
|
+
throw error;
|
|
13079
12946
|
}
|
|
13080
|
-
}
|
|
12947
|
+
}
|
|
13081
12948
|
return result.setData(allItems);
|
|
13082
12949
|
}
|
|
13083
12950
|
}
|
|
13084
12951
|
|
|
13085
|
-
var __defProp$
|
|
13086
|
-
var __name$
|
|
12952
|
+
var __defProp$13 = Object.defineProperty;
|
|
12953
|
+
var __name$13 = (target, value) => __defProp$13(target, "name", { value, configurable: true });
|
|
13087
12954
|
class FetchListV3 extends AbstractAction {
|
|
13088
12955
|
static {
|
|
13089
|
-
__name$
|
|
12956
|
+
__name$13(this, "FetchListV3");
|
|
13090
12957
|
}
|
|
13091
12958
|
/**
|
|
13092
12959
|
* Calls a REST API list method and returns an async generator for efficient large data retrieval.
|
|
@@ -13156,61 +13023,320 @@ ${JSON.stringify({
|
|
|
13156
13023
|
filter: [...params["filter"] || []],
|
|
13157
13024
|
pagination: { page: 0, limit: batchSize }
|
|
13158
13025
|
};
|
|
13159
|
-
|
|
13160
|
-
|
|
13161
|
-
|
|
13162
|
-
|
|
13163
|
-
|
|
13164
|
-
|
|
13026
|
+
try {
|
|
13027
|
+
yield* keysetPaginate(this._b24, this._logger, {
|
|
13028
|
+
method: options.method,
|
|
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, {
|
|
13165
13226
|
method: options.method,
|
|
13166
|
-
|
|
13167
|
-
|
|
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"
|
|
13168
13241
|
});
|
|
13169
|
-
|
|
13170
|
-
|
|
13171
|
-
method: options.method,
|
|
13172
|
-
requestId: options.requestId,
|
|
13173
|
-
messages: response.getErrorMessages()
|
|
13174
|
-
});
|
|
13242
|
+
} catch (error) {
|
|
13243
|
+
if (error instanceof KeysetPaginationError) {
|
|
13175
13244
|
throw new SdkError({
|
|
13176
|
-
code: "
|
|
13177
|
-
description: `API Error: ${
|
|
13245
|
+
code: "JSSDK_CORE_B24_FETCH_TAIL_METHOD_API_V3",
|
|
13246
|
+
description: `API Error: ${error.messages.join("; ")}`,
|
|
13178
13247
|
status: 500
|
|
13179
13248
|
});
|
|
13180
13249
|
}
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
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
|
+
});
|
|
13190
13291
|
}
|
|
13191
|
-
|
|
13192
|
-
if (
|
|
13193
|
-
|
|
13194
|
-
|
|
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
|
+
});
|
|
13195
13299
|
}
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
|
|
13200
|
-
|
|
13201
|
-
|
|
13202
|
-
|
|
13203
|
-
|
|
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);
|
|
13204
13318
|
}
|
|
13205
|
-
|
|
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);
|
|
13206
13332
|
}
|
|
13207
13333
|
}
|
|
13208
13334
|
|
|
13209
|
-
var __defProp
|
|
13210
|
-
var __name
|
|
13335
|
+
var __defProp$$ = Object.defineProperty;
|
|
13336
|
+
var __name$$ = (target, value) => __defProp$$(target, "name", { value, configurable: true });
|
|
13211
13337
|
class BatchV3 extends AbstractBatch {
|
|
13212
13338
|
static {
|
|
13213
|
-
__name
|
|
13339
|
+
__name$$(this, "BatchV3");
|
|
13214
13340
|
}
|
|
13215
13341
|
/**
|
|
13216
13342
|
* Executes a batch request to the Bitrix24 REST API with a maximum number of commands of no more than 50.
|
|
@@ -13308,23 +13434,16 @@ ${JSON.stringify({
|
|
|
13308
13434
|
...options.options,
|
|
13309
13435
|
apiVersion: ApiVersion.v3
|
|
13310
13436
|
};
|
|
13311
|
-
if (versionManager.automaticallyObtainApiVersionForBatch(options.calls) !== opts.apiVersion) {
|
|
13312
|
-
throw new SdkError({
|
|
13313
|
-
code: "JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3",
|
|
13314
|
-
description: `restApi:v3 not support some methods in calls: ${JSON.stringify(options.calls)}`,
|
|
13315
|
-
status: 500
|
|
13316
|
-
});
|
|
13317
|
-
}
|
|
13318
13437
|
const response = await this._b24.getHttpClient(ApiVersion.v3).batch(options.calls, opts);
|
|
13319
13438
|
return this._processBatchResponse(response, options.calls, opts);
|
|
13320
13439
|
}
|
|
13321
13440
|
}
|
|
13322
13441
|
|
|
13323
|
-
var __defProp$
|
|
13324
|
-
var __name$
|
|
13442
|
+
var __defProp$_ = Object.defineProperty;
|
|
13443
|
+
var __name$_ = (target, value) => __defProp$_(target, "name", { value, configurable: true });
|
|
13325
13444
|
class BatchByChunkV3 extends AbstractBatch {
|
|
13326
13445
|
static {
|
|
13327
|
-
__name$
|
|
13446
|
+
__name$_(this, "BatchByChunkV3");
|
|
13328
13447
|
}
|
|
13329
13448
|
/**
|
|
13330
13449
|
* Executes a batch request with automatic chunking for any number of commands.
|
|
@@ -13397,16 +13516,19 @@ ${JSON.stringify({
|
|
|
13397
13516
|
}
|
|
13398
13517
|
}
|
|
13399
13518
|
|
|
13400
|
-
var __defProp$
|
|
13401
|
-
var __name$
|
|
13519
|
+
var __defProp$Z = Object.defineProperty;
|
|
13520
|
+
var __name$Z = (target, value) => __defProp$Z(target, "name", { value, configurable: true });
|
|
13402
13521
|
const callName = /* @__PURE__ */ Symbol("call_V3");
|
|
13403
13522
|
const callListName = /* @__PURE__ */ Symbol("callList_V3");
|
|
13404
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");
|
|
13405
13527
|
const batchName = /* @__PURE__ */ Symbol("batch_V3");
|
|
13406
13528
|
const batchByChunkName = /* @__PURE__ */ Symbol("batchByChunk_V3");
|
|
13407
13529
|
class ActionsManagerV3 {
|
|
13408
13530
|
static {
|
|
13409
|
-
__name$
|
|
13531
|
+
__name$Z(this, "ActionsManagerV3");
|
|
13410
13532
|
}
|
|
13411
13533
|
_b24;
|
|
13412
13534
|
_logger;
|
|
@@ -13440,6 +13562,24 @@ ${JSON.stringify({
|
|
|
13440
13562
|
}
|
|
13441
13563
|
return this._mapActions.get(fetchListName);
|
|
13442
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
|
+
}
|
|
13443
13583
|
get batch() {
|
|
13444
13584
|
if (!this._mapActions.has(batchName)) {
|
|
13445
13585
|
this._mapActions.set(batchName, new BatchV3(this._b24, this._logger));
|
|
@@ -13454,13 +13594,13 @@ ${JSON.stringify({
|
|
|
13454
13594
|
}
|
|
13455
13595
|
}
|
|
13456
13596
|
|
|
13457
|
-
var __defProp$
|
|
13458
|
-
var __name$
|
|
13597
|
+
var __defProp$Y = Object.defineProperty;
|
|
13598
|
+
var __name$Y = (target, value) => __defProp$Y(target, "name", { value, configurable: true });
|
|
13459
13599
|
const apiV2Name = Symbol(ApiVersion.v2);
|
|
13460
13600
|
const apiV3Name = Symbol(ApiVersion.v3);
|
|
13461
13601
|
class ActionsManager {
|
|
13462
13602
|
static {
|
|
13463
|
-
__name$
|
|
13603
|
+
__name$Y(this, "ActionsManager");
|
|
13464
13604
|
}
|
|
13465
13605
|
_b24;
|
|
13466
13606
|
_logger;
|
|
@@ -13492,11 +13632,11 @@ ${JSON.stringify({
|
|
|
13492
13632
|
}
|
|
13493
13633
|
}
|
|
13494
13634
|
|
|
13495
|
-
var __defProp$
|
|
13496
|
-
var __name$
|
|
13635
|
+
var __defProp$X = Object.defineProperty;
|
|
13636
|
+
var __name$X = (target, value) => __defProp$X(target, "name", { value, configurable: true });
|
|
13497
13637
|
class AbstractTool {
|
|
13498
13638
|
static {
|
|
13499
|
-
__name$
|
|
13639
|
+
__name$X(this, "AbstractTool");
|
|
13500
13640
|
}
|
|
13501
13641
|
_b24;
|
|
13502
13642
|
_logger;
|
|
@@ -13506,11 +13646,11 @@ ${JSON.stringify({
|
|
|
13506
13646
|
}
|
|
13507
13647
|
}
|
|
13508
13648
|
|
|
13509
|
-
var __defProp$
|
|
13510
|
-
var __name$
|
|
13649
|
+
var __defProp$W = Object.defineProperty;
|
|
13650
|
+
var __name$W = (target, value) => __defProp$W(target, "name", { value, configurable: true });
|
|
13511
13651
|
class Ping extends AbstractTool {
|
|
13512
13652
|
static {
|
|
13513
|
-
__name$
|
|
13653
|
+
__name$W(this, "Ping");
|
|
13514
13654
|
}
|
|
13515
13655
|
/**
|
|
13516
13656
|
* Measures the response speed of the Bitrix24 REST API.
|
|
@@ -13550,11 +13690,11 @@ ${JSON.stringify({
|
|
|
13550
13690
|
}
|
|
13551
13691
|
}
|
|
13552
13692
|
|
|
13553
|
-
var __defProp$
|
|
13554
|
-
var __name$
|
|
13693
|
+
var __defProp$V = Object.defineProperty;
|
|
13694
|
+
var __name$V = (target, value) => __defProp$V(target, "name", { value, configurable: true });
|
|
13555
13695
|
class HealthCheck extends AbstractTool {
|
|
13556
13696
|
static {
|
|
13557
|
-
__name$
|
|
13697
|
+
__name$V(this, "HealthCheck");
|
|
13558
13698
|
}
|
|
13559
13699
|
/**
|
|
13560
13700
|
* Checks the availability of the Bitrix24 REST API.
|
|
@@ -13586,13 +13726,13 @@ ${JSON.stringify({
|
|
|
13586
13726
|
}
|
|
13587
13727
|
}
|
|
13588
13728
|
|
|
13589
|
-
var __defProp$
|
|
13590
|
-
var __name$
|
|
13729
|
+
var __defProp$U = Object.defineProperty;
|
|
13730
|
+
var __name$U = (target, value) => __defProp$U(target, "name", { value, configurable: true });
|
|
13591
13731
|
const pingName = /* @__PURE__ */ Symbol("ping");
|
|
13592
13732
|
const healthCheckName = /* @__PURE__ */ Symbol("healthCheck");
|
|
13593
13733
|
class ToolsManager {
|
|
13594
13734
|
static {
|
|
13595
|
-
__name$
|
|
13735
|
+
__name$U(this, "ToolsManager");
|
|
13596
13736
|
}
|
|
13597
13737
|
_b24;
|
|
13598
13738
|
_logger;
|
|
@@ -13622,11 +13762,11 @@ ${JSON.stringify({
|
|
|
13622
13762
|
}
|
|
13623
13763
|
}
|
|
13624
13764
|
|
|
13625
|
-
var __defProp$
|
|
13626
|
-
var __name$
|
|
13765
|
+
var __defProp$T = Object.defineProperty;
|
|
13766
|
+
var __name$T = (target, value) => __defProp$T(target, "name", { value, configurable: true });
|
|
13627
13767
|
class AbstractB24 {
|
|
13628
13768
|
static {
|
|
13629
|
-
__name$
|
|
13769
|
+
__name$T(this, "AbstractB24");
|
|
13630
13770
|
}
|
|
13631
13771
|
/**
|
|
13632
13772
|
* Maximum length for batch response.
|
|
@@ -18709,15 +18849,15 @@ ${JSON.stringify({
|
|
|
18709
18849
|
create,
|
|
18710
18850
|
} = axios;
|
|
18711
18851
|
|
|
18712
|
-
var __defProp$
|
|
18713
|
-
var __name$
|
|
18852
|
+
var __defProp$S = Object.defineProperty;
|
|
18853
|
+
var __name$S = (target, value) => __defProp$S(target, "name", { value, configurable: true });
|
|
18714
18854
|
const DEFAULT_REQUEST_ID_HEADER_FIELD_NAME = "X-Request-ID";
|
|
18715
18855
|
const DEFAULT_QUERY_STRING_PARAMETER_NAME = "bx24_request_id";
|
|
18716
18856
|
const DEFAULT_QUERY_STRING_SDK_VER_PARAMETER_NAME = "bx24_sdk_ver";
|
|
18717
18857
|
const DEFAULT_QUERY_STRING_SDK_TYPE_PARAMETER_NAME = "bx24_sdk_type";
|
|
18718
18858
|
class RequestIdGenerator {
|
|
18719
18859
|
static {
|
|
18720
|
-
__name$
|
|
18860
|
+
__name$S(this, "RequestIdGenerator");
|
|
18721
18861
|
}
|
|
18722
18862
|
getQueryStringParameterName() {
|
|
18723
18863
|
return DEFAULT_QUERY_STRING_PARAMETER_NAME;
|
|
@@ -18739,11 +18879,17 @@ ${JSON.stringify({
|
|
|
18739
18879
|
}
|
|
18740
18880
|
}
|
|
18741
18881
|
|
|
18742
|
-
var __defProp$
|
|
18743
|
-
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");
|
|
18744
18890
|
class AbstractHttp {
|
|
18745
18891
|
static {
|
|
18746
|
-
__name$
|
|
18892
|
+
__name$R(this, "AbstractHttp");
|
|
18747
18893
|
}
|
|
18748
18894
|
_clientAxios;
|
|
18749
18895
|
_authActions;
|
|
@@ -18772,18 +18918,20 @@ ${JSON.stringify({
|
|
|
18772
18918
|
this._logger = LoggerFactory.createNullLogger();
|
|
18773
18919
|
const defaultHeaders = {};
|
|
18774
18920
|
if (this.isServerSide()) {
|
|
18775
|
-
defaultHeaders["User-Agent"] = "b24-js-sdk/
|
|
18921
|
+
defaultHeaders["User-Agent"] = "b24-js-sdk/2.0.0";
|
|
18776
18922
|
}
|
|
18777
18923
|
this._authActions = authActions;
|
|
18778
18924
|
this._requestIdGenerator = new RequestIdGenerator();
|
|
18779
18925
|
this._clientAxios = axios.create({
|
|
18780
|
-
headers: {
|
|
18781
|
-
...defaultHeaders,
|
|
18782
|
-
...options ? options.headers : {}
|
|
18783
|
-
},
|
|
18784
18926
|
timeout: 3e4,
|
|
18785
18927
|
timeoutErrorMessage: "Request timeout exceeded",
|
|
18786
|
-
...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
|
+
}
|
|
18787
18935
|
});
|
|
18788
18936
|
const params = {
|
|
18789
18937
|
...ParamsFactory.getDefault(),
|
|
@@ -18819,7 +18967,7 @@ ${JSON.stringify({
|
|
|
18819
18967
|
getStats() {
|
|
18820
18968
|
return {
|
|
18821
18969
|
...this._restrictionManager.getStats(),
|
|
18822
|
-
totalRequests: this._metrics.
|
|
18970
|
+
totalRequests: this._metrics.totalRequests,
|
|
18823
18971
|
successfulRequests: this._metrics.successfulRequests,
|
|
18824
18972
|
failedRequests: this._metrics.failedRequests,
|
|
18825
18973
|
totalDuration: this._metrics.totalDuration,
|
|
@@ -18831,7 +18979,7 @@ ${JSON.stringify({
|
|
|
18831
18979
|
* @inheritDoc
|
|
18832
18980
|
*/
|
|
18833
18981
|
async reset() {
|
|
18834
|
-
this._metrics.
|
|
18982
|
+
this._metrics.totalRequests = 0;
|
|
18835
18983
|
this._metrics.successfulRequests = 0;
|
|
18836
18984
|
this._metrics.failedRequests = 0;
|
|
18837
18985
|
this._metrics.totalDuration = 0;
|
|
@@ -18909,7 +19057,7 @@ ${JSON.stringify({
|
|
|
18909
19057
|
this._restrictionManager.incrementError(method);
|
|
18910
19058
|
this._updateMetrics(method, false, duration, lastError);
|
|
18911
19059
|
this._logFailedRequest(requestId, method, attempt + 1, maxRetries, lastError);
|
|
18912
|
-
if (attempt < maxRetries) {
|
|
19060
|
+
if (attempt + 1 < maxRetries) {
|
|
18913
19061
|
const waitTime = await this._restrictionManager.handleError(requestId, method, params, lastError, attempt);
|
|
18914
19062
|
if (waitTime > 0) {
|
|
18915
19063
|
this._restrictionManager.incrementStats("limitHits");
|
|
@@ -19057,8 +19205,9 @@ ${JSON.stringify({
|
|
|
19057
19205
|
requestId,
|
|
19058
19206
|
status: error.status,
|
|
19059
19207
|
// Redact in case a future portal response embeds credentials in
|
|
19060
|
-
// the error body (today it doesn't, but the channel is open)
|
|
19061
|
-
|
|
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))
|
|
19062
19211
|
}
|
|
19063
19212
|
);
|
|
19064
19213
|
}
|
|
@@ -19077,14 +19226,12 @@ ${JSON.stringify({
|
|
|
19077
19226
|
const methodFormatted = this._prepareMethod(requestId, method, this.getBaseUrl());
|
|
19078
19227
|
const paramsFormatted = this._prepareParams(authData, params);
|
|
19079
19228
|
const paramsFormattedForLog = JSON.stringify(redactSensitiveParams(paramsFormatted), null, 0);
|
|
19080
|
-
const maxLogLength = 300;
|
|
19081
|
-
const sliceLogLength = 100;
|
|
19082
19229
|
this.getLogger().info(
|
|
19083
19230
|
`post/send`,
|
|
19084
19231
|
{
|
|
19085
19232
|
requestId,
|
|
19086
19233
|
method,
|
|
19087
|
-
params: paramsFormattedForLog
|
|
19234
|
+
params: truncateForLog(paramsFormattedForLog)
|
|
19088
19235
|
}
|
|
19089
19236
|
);
|
|
19090
19237
|
const response = await this._clientAxios.post(methodFormatted, paramsFormatted);
|
|
@@ -19094,7 +19241,7 @@ ${JSON.stringify({
|
|
|
19094
19241
|
{
|
|
19095
19242
|
requestId,
|
|
19096
19243
|
// responseFull: JSON.stringify(response.data, null, 2),
|
|
19097
|
-
result: resultFormattedForLog
|
|
19244
|
+
result: truncateForLog(resultFormattedForLog),
|
|
19098
19245
|
time: JSON.stringify(response.data.time, null, 0)
|
|
19099
19246
|
}
|
|
19100
19247
|
);
|
|
@@ -19136,6 +19283,50 @@ ${JSON.stringify({
|
|
|
19136
19283
|
status: ajaxError.status
|
|
19137
19284
|
});
|
|
19138
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
|
+
}
|
|
19139
19330
|
/**
|
|
19140
19331
|
* Processes function parameters and adds authorization
|
|
19141
19332
|
*/
|
|
@@ -19300,11 +19491,11 @@ ${JSON.stringify({
|
|
|
19300
19491
|
// endregion ////
|
|
19301
19492
|
}
|
|
19302
19493
|
|
|
19303
|
-
var __defProp$
|
|
19304
|
-
var __name$
|
|
19494
|
+
var __defProp$Q = Object.defineProperty;
|
|
19495
|
+
var __name$Q = (target, value) => __defProp$Q(target, "name", { value, configurable: true });
|
|
19305
19496
|
class AbstractInteractionBatch {
|
|
19306
19497
|
static {
|
|
19307
|
-
__name$
|
|
19498
|
+
__name$Q(this, "AbstractInteractionBatch");
|
|
19308
19499
|
}
|
|
19309
19500
|
parallelDefaultValue;
|
|
19310
19501
|
requestId;
|
|
@@ -19357,12 +19548,12 @@ ${JSON.stringify({
|
|
|
19357
19548
|
// endregion ////
|
|
19358
19549
|
}
|
|
19359
19550
|
|
|
19360
|
-
var __defProp$
|
|
19361
|
-
var __name$
|
|
19551
|
+
var __defProp$P = Object.defineProperty;
|
|
19552
|
+
var __name$P = (target, value) => __defProp$P(target, "name", { value, configurable: true });
|
|
19362
19553
|
const MAX_BATCH_COMMANDS_V2 = 50;
|
|
19363
19554
|
class InteractionBatchV2 extends AbstractInteractionBatch {
|
|
19364
19555
|
static {
|
|
19365
|
-
__name$
|
|
19556
|
+
__name$P(this, "InteractionBatchV2");
|
|
19366
19557
|
}
|
|
19367
19558
|
get maxSize() {
|
|
19368
19559
|
return MAX_BATCH_COMMANDS_V2;
|
|
@@ -19790,11 +19981,53 @@ ${JSON.stringify({
|
|
|
19790
19981
|
return joined.length > 0 ? prefix + joined : ''
|
|
19791
19982
|
}
|
|
19792
19983
|
|
|
19793
|
-
var __defProp$
|
|
19794
|
-
var __name$
|
|
19984
|
+
var __defProp$O = Object.defineProperty;
|
|
19985
|
+
var __name$O = (target, value) => __defProp$O(target, "name", { value, configurable: true });
|
|
19795
19986
|
class AbstractProcessing {
|
|
19796
19987
|
static {
|
|
19797
|
-
__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);
|
|
19798
20031
|
}
|
|
19799
20032
|
// endregion ////
|
|
19800
20033
|
// region Tools ////
|
|
@@ -19820,11 +20053,11 @@ ${JSON.stringify({
|
|
|
19820
20053
|
// endregion ////
|
|
19821
20054
|
}
|
|
19822
20055
|
|
|
19823
|
-
var __defProp$
|
|
19824
|
-
var __name$
|
|
20056
|
+
var __defProp$N = Object.defineProperty;
|
|
20057
|
+
var __name$N = (target, value) => __defProp$N(target, "name", { value, configurable: true });
|
|
19825
20058
|
class AbstractProcessingV2 extends AbstractProcessing {
|
|
19826
20059
|
static {
|
|
19827
|
-
__name$
|
|
20060
|
+
__name$N(this, "AbstractProcessingV2");
|
|
19828
20061
|
}
|
|
19829
20062
|
_buildRow(command) {
|
|
19830
20063
|
return `${command.method}?${stringify(command.query || {})}`;
|
|
@@ -19853,8 +20086,9 @@ ${JSON.stringify({
|
|
|
19853
20086
|
return result;
|
|
19854
20087
|
}
|
|
19855
20088
|
// region prepareItems ////
|
|
19856
|
-
|
|
19857
|
-
|
|
20089
|
+
// Soft-error guard lives in AbstractProcessing.prepareItems (#228); this is the
|
|
20090
|
+
// success-only path for apiVer2.
|
|
20091
|
+
async _prepareItemsSuccess(commands, responseHelper, results) {
|
|
19858
20092
|
for (const [index, command] of commands.entries()) {
|
|
19859
20093
|
await this._processResponseItem(
|
|
19860
20094
|
command,
|
|
@@ -19902,34 +20136,90 @@ ${JSON.stringify({
|
|
|
19902
20136
|
status: 500
|
|
19903
20137
|
});
|
|
19904
20138
|
}
|
|
19905
|
-
}
|
|
19906
|
-
// endregion ////
|
|
19907
|
-
// region handleResults ////
|
|
19908
|
-
|
|
19909
|
-
|
|
19910
|
-
|
|
19911
|
-
|
|
19912
|
-
|
|
19913
|
-
|
|
19914
|
-
this.
|
|
19915
|
-
|
|
19916
|
-
|
|
19917
|
-
|
|
19918
|
-
|
|
19919
|
-
|
|
19920
|
-
|
|
19921
|
-
|
|
19922
|
-
|
|
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
|
+
}
|
|
19923
20214
|
return result;
|
|
19924
20215
|
}
|
|
19925
|
-
// endregion ////
|
|
19926
20216
|
}
|
|
19927
20217
|
|
|
19928
|
-
var __defProp$
|
|
19929
|
-
var __name$
|
|
20218
|
+
var __defProp$L = Object.defineProperty;
|
|
20219
|
+
var __name$L = (target, value) => __defProp$L(target, "name", { value, configurable: true });
|
|
19930
20220
|
class ProcessingAsArrayV2 extends AbstractProcessingV2 {
|
|
19931
20221
|
static {
|
|
19932
|
-
__name$
|
|
20222
|
+
__name$L(this, "ProcessingAsArrayV2");
|
|
19933
20223
|
}
|
|
19934
20224
|
prepareCommands(calls, options) {
|
|
19935
20225
|
const result = [];
|
|
@@ -19939,16 +20229,16 @@ ${JSON.stringify({
|
|
|
19939
20229
|
});
|
|
19940
20230
|
return result;
|
|
19941
20231
|
}
|
|
19942
|
-
_processResponseError(result, ajaxError,
|
|
19943
|
-
result.addError(ajaxError);
|
|
20232
|
+
_processResponseError(result, ajaxError, index) {
|
|
20233
|
+
result.addError(ajaxError, index);
|
|
19944
20234
|
}
|
|
19945
20235
|
}
|
|
19946
20236
|
|
|
19947
|
-
var __defProp$
|
|
19948
|
-
var __name$
|
|
20237
|
+
var __defProp$K = Object.defineProperty;
|
|
20238
|
+
var __name$K = (target, value) => __defProp$K(target, "name", { value, configurable: true });
|
|
19949
20239
|
class ProcessingAsObjectV2 extends AbstractProcessingV2 {
|
|
19950
20240
|
static {
|
|
19951
|
-
__name$
|
|
20241
|
+
__name$K(this, "ProcessingAsObjectV2");
|
|
19952
20242
|
}
|
|
19953
20243
|
prepareCommands(calls, options) {
|
|
19954
20244
|
const result = [];
|
|
@@ -19963,11 +20253,11 @@ ${JSON.stringify({
|
|
|
19963
20253
|
}
|
|
19964
20254
|
}
|
|
19965
20255
|
|
|
19966
|
-
var __defProp$
|
|
19967
|
-
var __name$
|
|
20256
|
+
var __defProp$J = Object.defineProperty;
|
|
20257
|
+
var __name$J = (target, value) => __defProp$J(target, "name", { value, configurable: true });
|
|
19968
20258
|
class HttpV2 extends AbstractHttp {
|
|
19969
20259
|
static {
|
|
19970
|
-
__name$
|
|
20260
|
+
__name$J(this, "HttpV2");
|
|
19971
20261
|
}
|
|
19972
20262
|
constructor(authActions, options, restrictionParams) {
|
|
19973
20263
|
super(authActions, options, restrictionParams);
|
|
@@ -20027,31 +20317,14 @@ ${JSON.stringify({
|
|
|
20027
20317
|
return response;
|
|
20028
20318
|
}
|
|
20029
20319
|
// endregion ////
|
|
20030
|
-
// region Prepare ////
|
|
20031
|
-
/**
|
|
20032
|
-
* @inheritDoc
|
|
20033
|
-
*/
|
|
20034
|
-
_prepareMethod(requestId, method, baseUrl) {
|
|
20035
|
-
const methodUrl = `/${encodeURIComponent(method)}`;
|
|
20036
|
-
if (method.includes("task.")) {
|
|
20037
|
-
return `${baseUrl}${methodUrl}`;
|
|
20038
|
-
}
|
|
20039
|
-
const queryParams = new URLSearchParams({
|
|
20040
|
-
[this._requestIdGenerator.getQueryStringParameterName()]: requestId,
|
|
20041
|
-
[this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.3.0",
|
|
20042
|
-
[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
|
|
20043
|
-
});
|
|
20044
|
-
return `${baseUrl}${methodUrl}?${queryParams.toString()}`;
|
|
20045
|
-
}
|
|
20046
|
-
// endregion ////
|
|
20047
20320
|
}
|
|
20048
20321
|
|
|
20049
|
-
var __defProp$
|
|
20050
|
-
var __name$
|
|
20322
|
+
var __defProp$I = Object.defineProperty;
|
|
20323
|
+
var __name$I = (target, value) => __defProp$I(target, "name", { value, configurable: true });
|
|
20051
20324
|
const MAX_BATCH_COMMANDS_V3 = 50;
|
|
20052
20325
|
class InteractionBatchV3 extends AbstractInteractionBatch {
|
|
20053
20326
|
static {
|
|
20054
|
-
__name$
|
|
20327
|
+
__name$I(this, "InteractionBatchV3");
|
|
20055
20328
|
}
|
|
20056
20329
|
get maxSize() {
|
|
20057
20330
|
return MAX_BATCH_COMMANDS_V3;
|
|
@@ -20075,11 +20348,11 @@ ${JSON.stringify({
|
|
|
20075
20348
|
}
|
|
20076
20349
|
}
|
|
20077
20350
|
|
|
20078
|
-
var __defProp$
|
|
20079
|
-
var __name$
|
|
20351
|
+
var __defProp$H = Object.defineProperty;
|
|
20352
|
+
var __name$H = (target, value) => __defProp$H(target, "name", { value, configurable: true });
|
|
20080
20353
|
class AbstractProcessingV3 extends AbstractProcessing {
|
|
20081
20354
|
static {
|
|
20082
|
-
__name$
|
|
20355
|
+
__name$H(this, "AbstractProcessingV3");
|
|
20083
20356
|
}
|
|
20084
20357
|
buildCommands(commands) {
|
|
20085
20358
|
if (commands.length < 1) {
|
|
@@ -20092,11 +20365,9 @@ ${JSON.stringify({
|
|
|
20092
20365
|
return commands;
|
|
20093
20366
|
}
|
|
20094
20367
|
// region prepareItems ////
|
|
20095
|
-
|
|
20096
|
-
|
|
20097
|
-
|
|
20098
|
-
return results;
|
|
20099
|
-
}
|
|
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) {
|
|
20100
20371
|
for (const [index, command] of commands.entries()) {
|
|
20101
20372
|
await this._processResponseItem(
|
|
20102
20373
|
command,
|
|
@@ -20145,19 +20416,10 @@ ${JSON.stringify({
|
|
|
20145
20416
|
}
|
|
20146
20417
|
// endregion ////
|
|
20147
20418
|
// region handleResults ////
|
|
20148
|
-
|
|
20149
|
-
|
|
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) {
|
|
20150
20422
|
const dataResult = /* @__PURE__ */ new Map();
|
|
20151
|
-
if (!responseHelper.response.isSuccess) {
|
|
20152
|
-
for (const [index, error] of responseHelper.response.errors) {
|
|
20153
|
-
result.addError(error, index);
|
|
20154
|
-
}
|
|
20155
|
-
result.setData({
|
|
20156
|
-
result: dataResult,
|
|
20157
|
-
time: void 0
|
|
20158
|
-
});
|
|
20159
|
-
return result;
|
|
20160
|
-
}
|
|
20161
20423
|
for (const [index, data] of results) {
|
|
20162
20424
|
const rowIndex = Number.parseInt(`${index}`);
|
|
20163
20425
|
const command = commands[rowIndex];
|
|
@@ -20185,11 +20447,11 @@ ${JSON.stringify({
|
|
|
20185
20447
|
// endregion ////
|
|
20186
20448
|
}
|
|
20187
20449
|
|
|
20188
|
-
var __defProp$
|
|
20189
|
-
var __name$
|
|
20450
|
+
var __defProp$G = Object.defineProperty;
|
|
20451
|
+
var __name$G = (target, value) => __defProp$G(target, "name", { value, configurable: true });
|
|
20190
20452
|
class ProcessingAsArrayV3 extends AbstractProcessingV3 {
|
|
20191
20453
|
static {
|
|
20192
|
-
__name$
|
|
20454
|
+
__name$G(this, "ProcessingAsArrayV3");
|
|
20193
20455
|
}
|
|
20194
20456
|
prepareCommands(calls, options) {
|
|
20195
20457
|
const result = [];
|
|
@@ -20199,16 +20461,16 @@ ${JSON.stringify({
|
|
|
20199
20461
|
});
|
|
20200
20462
|
return result;
|
|
20201
20463
|
}
|
|
20202
|
-
_processResponseError(result, ajaxError,
|
|
20203
|
-
result.addError(ajaxError);
|
|
20464
|
+
_processResponseError(result, ajaxError, index) {
|
|
20465
|
+
result.addError(ajaxError, index);
|
|
20204
20466
|
}
|
|
20205
20467
|
}
|
|
20206
20468
|
|
|
20207
|
-
var __defProp$
|
|
20208
|
-
var __name$
|
|
20469
|
+
var __defProp$F = Object.defineProperty;
|
|
20470
|
+
var __name$F = (target, value) => __defProp$F(target, "name", { value, configurable: true });
|
|
20209
20471
|
class ProcessingAsObjectV3 extends AbstractProcessingV3 {
|
|
20210
20472
|
static {
|
|
20211
|
-
__name$
|
|
20473
|
+
__name$F(this, "ProcessingAsObjectV3");
|
|
20212
20474
|
}
|
|
20213
20475
|
prepareCommands(calls, options) {
|
|
20214
20476
|
const result = [];
|
|
@@ -20223,11 +20485,11 @@ ${JSON.stringify({
|
|
|
20223
20485
|
}
|
|
20224
20486
|
}
|
|
20225
20487
|
|
|
20226
|
-
var __defProp$
|
|
20227
|
-
var __name$
|
|
20488
|
+
var __defProp$E = Object.defineProperty;
|
|
20489
|
+
var __name$E = (target, value) => __defProp$E(target, "name", { value, configurable: true });
|
|
20228
20490
|
class HttpV3 extends AbstractHttp {
|
|
20229
20491
|
static {
|
|
20230
|
-
__name$
|
|
20492
|
+
__name$E(this, "HttpV3");
|
|
20231
20493
|
}
|
|
20232
20494
|
constructor(authActions, options, restrictionParams) {
|
|
20233
20495
|
super(authActions, options, restrictionParams);
|
|
@@ -20284,25 +20546,11 @@ ${JSON.stringify({
|
|
|
20284
20546
|
return response;
|
|
20285
20547
|
}
|
|
20286
20548
|
// endregion ////
|
|
20287
|
-
// region Prepare ////
|
|
20288
|
-
/**
|
|
20289
|
-
* @inheritDoc
|
|
20290
|
-
*/
|
|
20291
|
-
_prepareMethod(requestId, method, baseUrl) {
|
|
20292
|
-
const methodUrl = `/${encodeURIComponent(method)}`;
|
|
20293
|
-
const queryParams = new URLSearchParams({
|
|
20294
|
-
[this._requestIdGenerator.getQueryStringParameterName()]: requestId,
|
|
20295
|
-
[this._requestIdGenerator.getQueryStringSdkParameterName()]: "1.3.0",
|
|
20296
|
-
[this._requestIdGenerator.getQueryStringSdkTypeParameterName()]: "b24-js-sdk"
|
|
20297
|
-
});
|
|
20298
|
-
return `${baseUrl}${methodUrl}?${queryParams.toString()}`;
|
|
20299
|
-
}
|
|
20300
|
-
// endregion ////
|
|
20301
20549
|
}
|
|
20302
20550
|
|
|
20303
|
-
var __defProp$
|
|
20304
|
-
var __name$
|
|
20305
|
-
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(() => {
|
|
20306
20554
|
return {
|
|
20307
20555
|
scrollWidth: Math.max(
|
|
20308
20556
|
document.documentElement.scrollWidth,
|
|
@@ -20315,11 +20563,11 @@ ${JSON.stringify({
|
|
|
20315
20563
|
};
|
|
20316
20564
|
}, "useScrollSize");
|
|
20317
20565
|
|
|
20318
|
-
var __defProp$
|
|
20319
|
-
var __name$
|
|
20566
|
+
var __defProp$C = Object.defineProperty;
|
|
20567
|
+
var __name$C = (target, value) => __defProp$C(target, "name", { value, configurable: true });
|
|
20320
20568
|
class FormatterNumbers {
|
|
20321
20569
|
static {
|
|
20322
|
-
__name$
|
|
20570
|
+
__name$C(this, "FormatterNumbers");
|
|
20323
20571
|
}
|
|
20324
20572
|
static isInternalConstructing = false;
|
|
20325
20573
|
static instance = null;
|
|
@@ -20367,11 +20615,11 @@ ${JSON.stringify({
|
|
|
20367
20615
|
}
|
|
20368
20616
|
}
|
|
20369
20617
|
|
|
20370
|
-
var __defProp$
|
|
20371
|
-
var __name$
|
|
20618
|
+
var __defProp$B = Object.defineProperty;
|
|
20619
|
+
var __name$B = (target, value) => __defProp$B(target, "name", { value, configurable: true });
|
|
20372
20620
|
class IbanSpecification {
|
|
20373
20621
|
static {
|
|
20374
|
-
__name$
|
|
20622
|
+
__name$B(this, "IbanSpecification");
|
|
20375
20623
|
}
|
|
20376
20624
|
/**
|
|
20377
20625
|
* the code of the country
|
|
@@ -20537,7 +20785,7 @@ ${JSON.stringify({
|
|
|
20537
20785
|
}
|
|
20538
20786
|
class FormatterIban {
|
|
20539
20787
|
static {
|
|
20540
|
-
__name$
|
|
20788
|
+
__name$B(this, "FormatterIban");
|
|
20541
20789
|
}
|
|
20542
20790
|
static isInternalConstructing = false;
|
|
20543
20791
|
static instance = null;
|
|
@@ -20659,9 +20907,9 @@ ${JSON.stringify({
|
|
|
20659
20907
|
// endregion ////
|
|
20660
20908
|
}
|
|
20661
20909
|
|
|
20662
|
-
var __defProp$
|
|
20663
|
-
var __name$
|
|
20664
|
-
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(() => {
|
|
20665
20913
|
const formatterNumber = FormatterNumbers.getInstance();
|
|
20666
20914
|
const formatterIban = FormatterIban.getInstance();
|
|
20667
20915
|
formatterIban.addSpecification(
|
|
@@ -21106,6 +21354,171 @@ ${JSON.stringify({
|
|
|
21106
21354
|
};
|
|
21107
21355
|
}, "useFormatter");
|
|
21108
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
|
+
|
|
21109
21522
|
var __defProp$x = Object.defineProperty;
|
|
21110
21523
|
var __name$x = (target, value) => __defProp$x(target, "name", { value, configurable: true });
|
|
21111
21524
|
class AuthHookManager {
|
|
@@ -21237,7 +21650,7 @@ ${JSON.stringify({
|
|
|
21237
21650
|
try {
|
|
21238
21651
|
parsedUrl = new URL(url.replace("/rest/api", "/rest"));
|
|
21239
21652
|
} catch {
|
|
21240
|
-
throw new Error(
|
|
21653
|
+
throw new Error("Invalid webhook URL format");
|
|
21241
21654
|
}
|
|
21242
21655
|
if (parsedUrl.protocol !== "https:") {
|
|
21243
21656
|
throw new Error("Webhook requires HTTPS protocol");
|
|
@@ -21255,7 +21668,7 @@ ${JSON.stringify({
|
|
|
21255
21668
|
const userIdStr = pathParts[userIdIndex];
|
|
21256
21669
|
const secret = pathParts[secretIndex];
|
|
21257
21670
|
if (!/^\d+$/.test(userIdStr)) {
|
|
21258
|
-
throw new Error(
|
|
21671
|
+
throw new Error("User ID must be numeric in webhook URL");
|
|
21259
21672
|
}
|
|
21260
21673
|
const userId = Number.parseInt(userIdStr, 10);
|
|
21261
21674
|
return new B24Hook(
|
|
@@ -21306,6 +21719,9 @@ ${JSON.stringify({
|
|
|
21306
21719
|
#appFrame;
|
|
21307
21720
|
#callbackPromises;
|
|
21308
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();
|
|
21309
21725
|
_logger;
|
|
21310
21726
|
runCallbackHandler;
|
|
21311
21727
|
constructor(appFrame) {
|
|
@@ -21385,7 +21801,8 @@ ${JSON.stringify({
|
|
|
21385
21801
|
cmd += ":" + listParams.filter(Boolean).join(":");
|
|
21386
21802
|
}
|
|
21387
21803
|
this.getLogger().debug(`send to ${this.#appFrame.getTargetOrigin()}`, {
|
|
21388
|
-
|
|
21804
|
+
command: command.toString(),
|
|
21805
|
+
callbackKey: keyPromise,
|
|
21389
21806
|
origin: this.#appFrame.getTargetOrigin()
|
|
21390
21807
|
});
|
|
21391
21808
|
parent.postMessage(cmd, this.#appFrame.getTargetOrigin());
|
|
@@ -21415,18 +21832,25 @@ ${JSON.stringify({
|
|
|
21415
21832
|
*/
|
|
21416
21833
|
_runCallback(event) {
|
|
21417
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
|
+
}
|
|
21418
21842
|
return;
|
|
21419
21843
|
}
|
|
21420
21844
|
if (event.data) {
|
|
21421
|
-
this.getLogger().debug(`get from ${event.origin}`, {
|
|
21422
|
-
data: event.data,
|
|
21423
|
-
origin: event.origin
|
|
21424
|
-
});
|
|
21425
21845
|
const tmp = event.data.split(":");
|
|
21426
21846
|
const cmd = {
|
|
21427
21847
|
id: tmp[0],
|
|
21428
21848
|
args: tmp.slice(1).join(":")
|
|
21429
21849
|
};
|
|
21850
|
+
this.getLogger().debug(`get from ${event.origin}`, {
|
|
21851
|
+
id: cmd.id,
|
|
21852
|
+
origin: event.origin
|
|
21853
|
+
});
|
|
21430
21854
|
if (cmd.args) {
|
|
21431
21855
|
cmd.args = JSON.parse(cmd.args);
|
|
21432
21856
|
}
|
|
@@ -22443,7 +22867,13 @@ ${JSON.stringify({
|
|
|
22443
22867
|
}
|
|
22444
22868
|
async init() {
|
|
22445
22869
|
const data = await this.#messageManager.send(MessageCommands.getInitData, {});
|
|
22446
|
-
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
|
+
});
|
|
22447
22877
|
this.#appFrame.initData(data);
|
|
22448
22878
|
this.#authManager.initData(data);
|
|
22449
22879
|
this.#placementManager.initData(data);
|
|
@@ -22540,7 +22970,7 @@ ${JSON.stringify({
|
|
|
22540
22970
|
#b24Target;
|
|
22541
22971
|
#b24TargetRestWithPath;
|
|
22542
22972
|
#oAuthTarget;
|
|
22543
|
-
// 'https://oauth.
|
|
22973
|
+
// from serverEndpoint, e.g. 'https://oauth.bitrix24.tech'
|
|
22544
22974
|
#isAdmin = null;
|
|
22545
22975
|
constructor(b24OAuthParams, oAuthSecret) {
|
|
22546
22976
|
this.#authOptions = Object.assign({}, b24OAuthParams);
|
|
@@ -22552,10 +22982,7 @@ ${JSON.stringify({
|
|
|
22552
22982
|
this.#authExpires = this.#authOptions.expires * 1e3;
|
|
22553
22983
|
this.#authExpiresIn = this.#authOptions.expiresIn;
|
|
22554
22984
|
this.#clientAxios = axios.create({
|
|
22555
|
-
baseURL: this.#oAuthTarget
|
|
22556
|
-
headers: {
|
|
22557
|
-
"Content-Type": "application/json"
|
|
22558
|
-
}
|
|
22985
|
+
baseURL: this.#oAuthTarget
|
|
22559
22986
|
});
|
|
22560
22987
|
this.#b24TargetRestWithPath = /* @__PURE__ */ new Map();
|
|
22561
22988
|
this.#b24TargetRestWithPath.set(ApiVersion.v2, `${this.#b24TargetRest}`);
|
|
@@ -22585,16 +23012,16 @@ ${JSON.stringify({
|
|
|
22585
23012
|
if (this.#customRefreshAuth) {
|
|
22586
23013
|
payload = await this.#customRefreshAuth();
|
|
22587
23014
|
} else {
|
|
22588
|
-
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(
|
|
22589
23022
|
"/oauth/token/",
|
|
22590
|
-
|
|
22591
|
-
|
|
22592
|
-
grant_type: "refresh_token",
|
|
22593
|
-
client_id: this.#oAuthSecret.clientId,
|
|
22594
|
-
client_secret: this.#oAuthSecret.clientSecret,
|
|
22595
|
-
refresh_token: this.#authOptions.refreshToken
|
|
22596
|
-
}
|
|
22597
|
-
}
|
|
23023
|
+
body,
|
|
23024
|
+
{ headers: { "Content-Type": "application/x-www-form-urlencoded" } }
|
|
22598
23025
|
);
|
|
22599
23026
|
if (response.data.error) {
|
|
22600
23027
|
throw new Error(`Token update error: ${response.data.error}`);
|
|
@@ -22652,7 +23079,7 @@ ${JSON.stringify({
|
|
|
22652
23079
|
}
|
|
22653
23080
|
throw new Error(
|
|
22654
23081
|
`Strange error: ${error instanceof Error ? error.message : error}`,
|
|
22655
|
-
{ cause: error }
|
|
23082
|
+
{ cause: error instanceof Error ? error : void 0 }
|
|
22656
23083
|
);
|
|
22657
23084
|
}
|
|
22658
23085
|
}
|
|
@@ -23529,7 +23956,7 @@ ${JSON.stringify({
|
|
|
23529
23956
|
}
|
|
23530
23957
|
return;
|
|
23531
23958
|
}
|
|
23532
|
-
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 }));
|
|
23533
23960
|
}
|
|
23534
23961
|
parseJsonRpcMessage(message) {
|
|
23535
23962
|
let decoded;
|
|
@@ -23552,7 +23979,7 @@ ${JSON.stringify({
|
|
|
23552
23979
|
} else {
|
|
23553
23980
|
this.getLogger().error(
|
|
23554
23981
|
`${Text.getDateForLog()}: Pull: unknown rpc packet`,
|
|
23555
|
-
{ decoded }
|
|
23982
|
+
redactSensitiveParams({ decoded })
|
|
23556
23983
|
);
|
|
23557
23984
|
}
|
|
23558
23985
|
return [];
|
|
@@ -23593,7 +24020,7 @@ ${JSON.stringify({
|
|
|
23593
24020
|
} else {
|
|
23594
24021
|
this.getLogger().error(
|
|
23595
24022
|
`${Text.getDateForLog()}: Pull: unknown rpc command in batch`,
|
|
23596
|
-
{ command }
|
|
24023
|
+
redactSensitiveParams({ command })
|
|
23597
24024
|
);
|
|
23598
24025
|
result.push({
|
|
23599
24026
|
jsonrpc: JSON_RPC_VERSION,
|
|
@@ -29930,9 +30357,15 @@ ${JSON.stringify({
|
|
|
29930
30357
|
_pingWaitTimeout = null;
|
|
29931
30358
|
// manual stop workaround ////
|
|
29932
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;
|
|
29933
30363
|
_loggingEnabled = false;
|
|
29934
|
-
// bound event handlers ////
|
|
30364
|
+
// bound event handlers, stored so they can be removed in destroy() (#141) ////
|
|
29935
30365
|
_onPingTimeoutHandler;
|
|
30366
|
+
_onBeforeUnloadHandler;
|
|
30367
|
+
_onOfflineHandler;
|
|
30368
|
+
_onOnlineHandler;
|
|
29936
30369
|
// [userId] => array of callbacks
|
|
29937
30370
|
_userStatusCallbacks = {};
|
|
29938
30371
|
_connectPromise = null;
|
|
@@ -29993,6 +30426,9 @@ ${JSON.stringify({
|
|
|
29993
30426
|
});
|
|
29994
30427
|
this._loggingEnabled = this._sharedConfig.isLoggingEnabled();
|
|
29995
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);
|
|
29996
30432
|
}
|
|
29997
30433
|
setLogger(logger) {
|
|
29998
30434
|
this._logger = logger;
|
|
@@ -30006,11 +30442,29 @@ ${JSON.stringify({
|
|
|
30006
30442
|
getLogger() {
|
|
30007
30443
|
return this._logger;
|
|
30008
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
|
+
*/
|
|
30009
30451
|
destroy() {
|
|
30452
|
+
this._disposed = true;
|
|
30010
30453
|
this.stop(CloseReasons.NORMAL_CLOSURE, "manual stop");
|
|
30011
|
-
|
|
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();
|
|
30012
30463
|
}
|
|
30013
30464
|
init() {
|
|
30465
|
+
if (this._disposed) {
|
|
30466
|
+
return;
|
|
30467
|
+
}
|
|
30014
30468
|
this._connectors.webSocket = new WebSocketConnector({
|
|
30015
30469
|
parent: this,
|
|
30016
30470
|
onOpen: this.onWebSocketOpen.bind(this),
|
|
@@ -30026,9 +30480,11 @@ ${JSON.stringify({
|
|
|
30026
30480
|
onError: this.onLongPollingError.bind(this)
|
|
30027
30481
|
});
|
|
30028
30482
|
this._connectionType = this.isWebSocketAllowed() ? ConnectionType.WebSocket : ConnectionType.LongPolling;
|
|
30029
|
-
window
|
|
30030
|
-
|
|
30031
|
-
|
|
30483
|
+
if (typeof window !== "undefined") {
|
|
30484
|
+
window.addEventListener("beforeunload", this._onBeforeUnloadHandler);
|
|
30485
|
+
window.addEventListener("offline", this._onOfflineHandler);
|
|
30486
|
+
window.addEventListener("online", this._onOnlineHandler);
|
|
30487
|
+
}
|
|
30032
30488
|
this._jsonRpcAdapter = new JsonRpc({
|
|
30033
30489
|
connector: this._connectors.webSocket,
|
|
30034
30490
|
handlers: {
|
|
@@ -30180,7 +30636,8 @@ ${JSON.stringify({
|
|
|
30180
30636
|
if (this._debug && this._context !== "master") {
|
|
30181
30637
|
this.getLogger().warning(
|
|
30182
30638
|
`${Text.getDateForLog()}: Pull.attachCommandHandler: result of handler.getModuleId() is not a string`,
|
|
30183
|
-
|
|
30639
|
+
// data.params / data.extra are app-defined and may carry a credential key (#43)
|
|
30640
|
+
redactSensitiveParams({ data })
|
|
30184
30641
|
);
|
|
30185
30642
|
}
|
|
30186
30643
|
method(data.params, data.extra, data.command);
|
|
@@ -30189,9 +30646,21 @@ ${JSON.stringify({
|
|
|
30189
30646
|
});
|
|
30190
30647
|
}
|
|
30191
30648
|
/**
|
|
30649
|
+
* Connects the client and begins receiving events.
|
|
30650
|
+
*
|
|
30192
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.
|
|
30193
30654
|
*/
|
|
30194
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
|
+
}
|
|
30195
30664
|
let allowConfigCaching = true;
|
|
30196
30665
|
if (this.isConnected()) {
|
|
30197
30666
|
return Promise.resolve(true);
|
|
@@ -30258,6 +30727,9 @@ ${JSON.stringify({
|
|
|
30258
30727
|
* @param disconnectReason
|
|
30259
30728
|
*/
|
|
30260
30729
|
restart(disconnectCode = CloseReasons.NORMAL_CLOSURE, disconnectReason = "manual restart") {
|
|
30730
|
+
if (this._disposed) {
|
|
30731
|
+
return;
|
|
30732
|
+
}
|
|
30261
30733
|
if (this._restartTimeout) {
|
|
30262
30734
|
clearTimeout(this._restartTimeout);
|
|
30263
30735
|
this._restartTimeout = null;
|
|
@@ -30300,6 +30772,34 @@ ${JSON.stringify({
|
|
|
30300
30772
|
stop(disconnectCode = CloseReasons.NORMAL_CLOSURE, disconnectReason = "manual stop") {
|
|
30301
30773
|
this.disconnect(disconnectCode, disconnectReason);
|
|
30302
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;
|
|
30303
30803
|
}
|
|
30304
30804
|
reconnect(disconnectCode, disconnectReason, delay = 1) {
|
|
30305
30805
|
this.disconnect(disconnectCode, disconnectReason);
|
|
@@ -30518,7 +31018,10 @@ ${JSON.stringify({
|
|
|
30518
31018
|
let configDump;
|
|
30519
31019
|
if (this._config && this._config.channels) {
|
|
30520
31020
|
configDump = {
|
|
30521
|
-
|
|
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",
|
|
30522
31025
|
ChannelDie: this._config.channels.private?.end || "n/a",
|
|
30523
31026
|
ChannelDieShared: this._config.channels.shared?.end || "n/a"
|
|
30524
31027
|
};
|
|
@@ -30535,6 +31038,7 @@ ${JSON.stringify({
|
|
|
30535
31038
|
websocketMode = this._connectors.webSocket?.socket?.url.search("binaryMode=true") != -1 ? "protobuf" : "text";
|
|
30536
31039
|
}
|
|
30537
31040
|
}
|
|
31041
|
+
const connectionPath = this.connector?.connectionPath;
|
|
30538
31042
|
return {
|
|
30539
31043
|
"UserId": this._userId + (this._userId > 0 ? "" : "(guest)"),
|
|
30540
31044
|
"Guest userId": this._guestMode && this._guestUserId !== 0 ? this._guestUserId : "-",
|
|
@@ -30546,7 +31050,9 @@ ${JSON.stringify({
|
|
|
30546
31050
|
"WebSocket mode": websocketMode,
|
|
30547
31051
|
"Try connect": this._reconnectTimeout ? "Y" : "N",
|
|
30548
31052
|
"Try number": this._connectionAttempt,
|
|
30549
|
-
|
|
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"]) : "-",
|
|
30550
31056
|
...configDump,
|
|
30551
31057
|
"Last message": this._session.mid || "-",
|
|
30552
31058
|
"Session history": this._session.history,
|
|
@@ -30577,13 +31083,10 @@ ${JSON.stringify({
|
|
|
30577
31083
|
params["token"] = this._config?.jwt;
|
|
30578
31084
|
} else {
|
|
30579
31085
|
const channels = [];
|
|
30580
|
-
if (this._config?.channels?.private) {
|
|
30581
|
-
channels.push(this._config.channels.private?.id || "");
|
|
30582
|
-
}
|
|
30583
|
-
if (this._config?.channels.private?.id) {
|
|
31086
|
+
if (this._config?.channels?.private?.id) {
|
|
30584
31087
|
channels.push(this._config.channels.private.id);
|
|
30585
31088
|
}
|
|
30586
|
-
if (this._config?.channels
|
|
31089
|
+
if (this._config?.channels?.shared?.id) {
|
|
30587
31090
|
channels.push(this._config.channels.shared.id);
|
|
30588
31091
|
}
|
|
30589
31092
|
if (channels.length === 0) {
|
|
@@ -30832,7 +31335,8 @@ ${JSON.stringify({
|
|
|
30832
31335
|
this.getLogger().warning("PULL ERROR", {
|
|
30833
31336
|
errorType: "broadcastMessages execute error",
|
|
30834
31337
|
errorEvent: error,
|
|
30835
|
-
message
|
|
31338
|
+
// app-defined message.params / extra may carry a credential key (#43)
|
|
31339
|
+
message: redactSensitiveParams(message)
|
|
30836
31340
|
});
|
|
30837
31341
|
}
|
|
30838
31342
|
if (message.extra && message.extra.revision_web) {
|
|
@@ -31062,6 +31566,9 @@ ${JSON.stringify({
|
|
|
31062
31566
|
return true;
|
|
31063
31567
|
}
|
|
31064
31568
|
startCheckConfig() {
|
|
31569
|
+
if (this._disposed) {
|
|
31570
|
+
return;
|
|
31571
|
+
}
|
|
31065
31572
|
if (this._checkInterval) {
|
|
31066
31573
|
clearInterval(this._checkInterval);
|
|
31067
31574
|
this._checkInterval = null;
|
|
@@ -31102,7 +31609,7 @@ ${JSON.stringify({
|
|
|
31102
31609
|
this.setPublicIds(Object.values(config.publicChannels));
|
|
31103
31610
|
}
|
|
31104
31611
|
this._configTimestamp = Number(config.server.config_timestamp);
|
|
31105
|
-
if (this._storage && allowCaching) {
|
|
31612
|
+
if (this._storage && allowCaching && !this._disposed) {
|
|
31106
31613
|
try {
|
|
31107
31614
|
this._storage.set(LsKeys.PullConfig, config);
|
|
31108
31615
|
} catch (error) {
|
|
@@ -31163,7 +31670,7 @@ ${JSON.stringify({
|
|
|
31163
31670
|
* @param connectionDelay
|
|
31164
31671
|
*/
|
|
31165
31672
|
scheduleReconnect(connectionDelay = 0) {
|
|
31166
|
-
if (!this._enabled) {
|
|
31673
|
+
if (this._disposed || !this._enabled) {
|
|
31167
31674
|
return;
|
|
31168
31675
|
}
|
|
31169
31676
|
if (!connectionDelay) {
|
|
@@ -31187,6 +31694,9 @@ ${JSON.stringify({
|
|
|
31187
31694
|
}, connectionDelay * 1e3);
|
|
31188
31695
|
}
|
|
31189
31696
|
scheduleRestoreWebSocketConnection() {
|
|
31697
|
+
if (this._disposed) {
|
|
31698
|
+
return;
|
|
31699
|
+
}
|
|
31190
31700
|
this.logToConsole(
|
|
31191
31701
|
`Pull: scheduling restoration of websocket connection in ${RESTORE_WEBSOCKET_TIMEOUT} seconds`
|
|
31192
31702
|
);
|
|
@@ -31202,7 +31712,7 @@ ${JSON.stringify({
|
|
|
31202
31712
|
* @returns {Promise}
|
|
31203
31713
|
*/
|
|
31204
31714
|
async connect() {
|
|
31205
|
-
if (!this._enabled) {
|
|
31715
|
+
if (this._disposed || !this._enabled) {
|
|
31206
31716
|
return Promise.reject();
|
|
31207
31717
|
}
|
|
31208
31718
|
if (this.connector?.connected) {
|
|
@@ -31228,6 +31738,9 @@ ${JSON.stringify({
|
|
|
31228
31738
|
* @param restartDelay
|
|
31229
31739
|
*/
|
|
31230
31740
|
scheduleRestart(disconnectCode, disconnectReason, restartDelay = 0) {
|
|
31741
|
+
if (this._disposed) {
|
|
31742
|
+
return;
|
|
31743
|
+
}
|
|
31231
31744
|
if (this._restartTimeout) {
|
|
31232
31745
|
clearTimeout(this._restartTimeout);
|
|
31233
31746
|
this._restartTimeout = null;
|
|
@@ -31310,13 +31823,13 @@ ${JSON.stringify({
|
|
|
31310
31823
|
if (typeChanel === "private" && this._config?.channels?.private) {
|
|
31311
31824
|
this._config.channels.private = message.params.new_channel;
|
|
31312
31825
|
this.logToConsole(
|
|
31313
|
-
`Pull: new config for ${message.params.channel.type} channel set:
|
|
31826
|
+
`Pull: new config for ${message.params.channel.type} channel set: [updated]`
|
|
31314
31827
|
);
|
|
31315
31828
|
}
|
|
31316
31829
|
if (typeChanel === "shared" && this._config?.channels?.shared) {
|
|
31317
31830
|
this._config.channels.shared = message.params.new_channel;
|
|
31318
31831
|
this.logToConsole(
|
|
31319
|
-
`Pull: new config for ${message.params.channel.type} channel set:
|
|
31832
|
+
`Pull: new config for ${message.params.channel.type} channel set: [updated]`
|
|
31320
31833
|
);
|
|
31321
31834
|
}
|
|
31322
31835
|
this.reconnect(CloseReasons.CONFIG_REPLACED, "config was replaced");
|
|
@@ -31573,7 +32086,10 @@ ${JSON.stringify({
|
|
|
31573
32086
|
if (dataArray === null) {
|
|
31574
32087
|
this.getLogger().warning("PULL ERROR", {
|
|
31575
32088
|
errorType: "parseResponse error parsing message",
|
|
31576
|
-
|
|
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
|
|
31577
32093
|
});
|
|
31578
32094
|
return [];
|
|
31579
32095
|
}
|
|
@@ -31626,15 +32142,28 @@ ${JSON.stringify({
|
|
|
31626
32142
|
// endregion ////
|
|
31627
32143
|
// region Events.Status /////
|
|
31628
32144
|
onOffline() {
|
|
32145
|
+
if (this._disposed) {
|
|
32146
|
+
return;
|
|
32147
|
+
}
|
|
31629
32148
|
this.disconnect(CloseReasons.NORMAL_CLOSURE, "offline");
|
|
31630
32149
|
}
|
|
31631
32150
|
onOnline() {
|
|
32151
|
+
if (this._disposed) {
|
|
32152
|
+
return;
|
|
32153
|
+
}
|
|
31632
32154
|
this.connect().catch((error) => {
|
|
31633
32155
|
this.getLogger().error("onOnline", { error });
|
|
31634
32156
|
});
|
|
31635
32157
|
}
|
|
31636
32158
|
onBeforeUnload() {
|
|
31637
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() {
|
|
31638
32167
|
const session = Type.clone(this.session);
|
|
31639
32168
|
session.ttl = Date.now() + LS_SESSION_CACHE_TIME * 1e3;
|
|
31640
32169
|
if (this._storage) {
|
|
@@ -31651,7 +32180,6 @@ ${JSON.stringify({
|
|
|
31651
32180
|
);
|
|
31652
32181
|
}
|
|
31653
32182
|
}
|
|
31654
|
-
this.scheduleReconnect(15);
|
|
31655
32183
|
}
|
|
31656
32184
|
// endregion ////
|
|
31657
32185
|
// region PullStatus ////
|
|
@@ -31660,6 +32188,9 @@ ${JSON.stringify({
|
|
|
31660
32188
|
* @param delay
|
|
31661
32189
|
*/
|
|
31662
32190
|
sendPullStatusDelayed(status, delay) {
|
|
32191
|
+
if (this._disposed) {
|
|
32192
|
+
return;
|
|
32193
|
+
}
|
|
31663
32194
|
if (this._offlineTimeout) {
|
|
31664
32195
|
clearTimeout(this._offlineTimeout);
|
|
31665
32196
|
this._offlineTimeout = null;
|
|
@@ -31705,6 +32236,9 @@ ${JSON.stringify({
|
|
|
31705
32236
|
* @param force
|
|
31706
32237
|
*/
|
|
31707
32238
|
updateWatch(force = false) {
|
|
32239
|
+
if (this._disposed) {
|
|
32240
|
+
return;
|
|
32241
|
+
}
|
|
31708
32242
|
if (this._watchUpdateTimeout) {
|
|
31709
32243
|
clearTimeout(this._watchUpdateTimeout);
|
|
31710
32244
|
this._watchUpdateTimeout = null;
|
|
@@ -31745,6 +32279,9 @@ ${JSON.stringify({
|
|
|
31745
32279
|
this.connector?.send(JSON_RPC_PONG);
|
|
31746
32280
|
}
|
|
31747
32281
|
updatePingWaitTimeout() {
|
|
32282
|
+
if (this._disposed) {
|
|
32283
|
+
return;
|
|
32284
|
+
}
|
|
31748
32285
|
if (this._pingWaitTimeout) {
|
|
31749
32286
|
clearTimeout(this._pingWaitTimeout);
|
|
31750
32287
|
this._pingWaitTimeout = null;
|
|
@@ -31762,7 +32299,7 @@ ${JSON.stringify({
|
|
|
31762
32299
|
}
|
|
31763
32300
|
onPingTimeout() {
|
|
31764
32301
|
this._pingWaitTimeout = null;
|
|
31765
|
-
if (!this._enabled || !this.isConnected()) {
|
|
32302
|
+
if (this._disposed || !this._enabled || !this.isConnected()) {
|
|
31766
32303
|
return;
|
|
31767
32304
|
}
|
|
31768
32305
|
this.getLogger().warning(`No pings are received in ${PING_TIMEOUT * 2} seconds. Reconnecting`);
|
|
@@ -31823,30 +32360,30 @@ ${JSON.stringify({
|
|
|
31823
32360
|
if (message.extra?.sender && message.extra.sender.type === SenderType.Client) {
|
|
31824
32361
|
this.getLogger().info(
|
|
31825
32362
|
`onPullClientEvent-${message.module_id}`,
|
|
31826
|
-
{
|
|
32363
|
+
redactSensitiveParams({
|
|
31827
32364
|
command: message.command,
|
|
31828
32365
|
params: message.params,
|
|
31829
32366
|
extra: message.extra
|
|
31830
|
-
}
|
|
32367
|
+
})
|
|
31831
32368
|
);
|
|
31832
32369
|
} else if (message.module_id == "online") {
|
|
31833
32370
|
this.getLogger().info(
|
|
31834
32371
|
`onPullOnlineEvent`,
|
|
31835
|
-
{
|
|
32372
|
+
redactSensitiveParams({
|
|
31836
32373
|
command: message.command,
|
|
31837
32374
|
params: message.params,
|
|
31838
32375
|
extra: message.extra
|
|
31839
|
-
}
|
|
32376
|
+
})
|
|
31840
32377
|
);
|
|
31841
32378
|
} else {
|
|
31842
32379
|
this.getLogger().info(
|
|
31843
32380
|
`onPullEvent`,
|
|
31844
|
-
{
|
|
32381
|
+
redactSensitiveParams({
|
|
31845
32382
|
moduleId: message.module_id,
|
|
31846
32383
|
command: message.command,
|
|
31847
32384
|
params: message.params,
|
|
31848
32385
|
extra: message.extra
|
|
31849
|
-
}
|
|
32386
|
+
})
|
|
31850
32387
|
);
|
|
31851
32388
|
}
|
|
31852
32389
|
}
|
|
@@ -32437,6 +32974,7 @@ ${JSON.stringify({
|
|
|
32437
32974
|
exports.B24LocaleMap = B24LocaleMap;
|
|
32438
32975
|
exports.B24OAuth = B24OAuth;
|
|
32439
32976
|
exports.B24PullClientManager = PullClient;
|
|
32977
|
+
exports.BatchRefV3 = BatchRefV3;
|
|
32440
32978
|
exports.Browser = Browser;
|
|
32441
32979
|
exports.CatalogProductImageType = CatalogProductImageType;
|
|
32442
32980
|
exports.CatalogProductType = CatalogProductType;
|
|
@@ -32456,6 +32994,7 @@ ${JSON.stringify({
|
|
|
32456
32994
|
exports.EnumCrmEntityTypeId = EnumCrmEntityTypeId;
|
|
32457
32995
|
exports.EnumCrmEntityTypeShort = EnumCrmEntityTypeShort;
|
|
32458
32996
|
exports.Environment = Environment;
|
|
32997
|
+
exports.FilterV3 = FilterV3;
|
|
32459
32998
|
exports.HttpV2 = HttpV2;
|
|
32460
32999
|
exports.HttpV3 = HttpV3;
|
|
32461
33000
|
exports.JsonFormatter = JsonFormatter;
|