@azure/service-bus 7.10.0-beta.1 → 7.10.0-beta.2
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.md +114 -57
- package/dist/browser/connectionContext.d.ts +109 -0
- package/dist/browser/connectionContext.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/connectionContext.js +11 -10
- package/dist/browser/connectionContext.js.map +1 -0
- package/dist/browser/constructorHelpers.d.ts +79 -0
- package/dist/browser/constructorHelpers.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/constructorHelpers.js +9 -8
- package/dist/browser/constructorHelpers.js.map +1 -0
- package/dist/browser/core/autoLockRenewer.d.ts +58 -0
- package/dist/browser/core/autoLockRenewer.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/core/autoLockRenewer.js +3 -3
- package/dist/browser/core/autoLockRenewer.js.map +1 -0
- package/dist/browser/core/batchingReceiver.d.ts +120 -0
- package/dist/browser/core/batchingReceiver.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/core/batchingReceiver.js +27 -25
- package/dist/browser/core/batchingReceiver.js.map +1 -0
- package/dist/browser/core/linkEntity.d.ts +192 -0
- package/dist/browser/core/linkEntity.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/core/linkEntity.js +7 -5
- package/dist/browser/core/linkEntity.js.map +1 -0
- package/dist/browser/core/managementClient.d.ts +312 -0
- package/dist/browser/core/managementClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/core/managementClient.js +58 -54
- package/dist/browser/core/managementClient.js.map +1 -0
- package/dist/browser/core/messageReceiver.d.ts +147 -0
- package/dist/browser/core/messageReceiver.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/core/messageReceiver.js +16 -21
- package/dist/browser/core/messageReceiver.js.map +1 -0
- package/dist/browser/core/messageSender.d.ts +93 -0
- package/dist/browser/core/messageSender.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/core/messageSender.js +22 -21
- package/dist/browser/core/messageSender.js.map +1 -0
- package/dist/browser/core/receiverHelper.d.ts +45 -0
- package/dist/browser/core/receiverHelper.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/core/receiverHelper.js +5 -5
- package/dist/browser/core/receiverHelper.js.map +1 -0
- package/dist/browser/core/shared.d.ts +34 -0
- package/dist/browser/core/shared.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/core/shared.js +7 -14
- package/dist/browser/core/shared.js.map +1 -0
- package/dist/browser/core/streamingReceiver.d.ts +142 -0
- package/dist/browser/core/streamingReceiver.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/core/streamingReceiver.js +29 -23
- package/dist/browser/core/streamingReceiver.js.map +1 -0
- package/dist/browser/dataTransformer.d.ts +77 -0
- package/dist/browser/dataTransformer.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/dataTransformer.js +2 -2
- package/dist/browser/dataTransformer.js.map +1 -0
- package/dist/browser/diagnostics/instrumentServiceBusMessage.d.ts +50 -0
- package/dist/browser/diagnostics/instrumentServiceBusMessage.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/diagnostics/instrumentServiceBusMessage.js +10 -18
- package/dist/browser/diagnostics/instrumentServiceBusMessage.js.map +1 -0
- package/dist/browser/diagnostics/tracing.d.ts +21 -0
- package/dist/browser/diagnostics/tracing.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/diagnostics/tracing.js +2 -2
- package/dist/browser/diagnostics/tracing.js.map +1 -0
- package/dist/browser/experimental/index.d.ts +10 -0
- package/dist/browser/experimental/index.d.ts.map +1 -0
- package/dist/browser/experimental/index.js +4 -0
- package/dist/browser/experimental/index.js.map +1 -0
- package/dist/browser/index.d.ts +26 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/index.js +5 -5
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/log.d.ts +70 -0
- package/dist/browser/log.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/log.js +1 -1
- package/dist/browser/log.js.map +1 -0
- package/dist/browser/models.d.ts +328 -0
- package/dist/browser/models.d.ts.map +1 -0
- package/dist/browser/models.js +4 -0
- package/dist/browser/models.js.map +1 -0
- package/dist/browser/modelsToBeSharedWithEventHubs.d.ts +18 -0
- package/dist/browser/modelsToBeSharedWithEventHubs.d.ts.map +1 -0
- package/dist/browser/modelsToBeSharedWithEventHubs.js +4 -0
- package/dist/browser/modelsToBeSharedWithEventHubs.js.map +1 -0
- package/dist/browser/package.json +3 -0
- package/dist/browser/receivers/receiver.d.ts +299 -0
- package/dist/browser/receivers/receiver.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/receivers/receiver.js +39 -66
- package/dist/browser/receivers/receiver.js.map +1 -0
- package/dist/browser/receivers/receiverCommon.d.ts +81 -0
- package/dist/browser/receivers/receiverCommon.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/receivers/receiverCommon.js +28 -44
- package/dist/browser/receivers/receiverCommon.js.map +1 -0
- package/dist/browser/receivers/sessionReceiver.d.ts +189 -0
- package/dist/browser/receivers/sessionReceiver.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/receivers/sessionReceiver.js +44 -76
- package/dist/browser/receivers/sessionReceiver.js.map +1 -0
- package/dist/browser/sender.d.ts +125 -0
- package/dist/browser/sender.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/sender.js +16 -32
- package/dist/browser/sender.js.map +1 -0
- package/dist/browser/serializers/namespaceResourceSerializer.d.ts +46 -0
- package/dist/browser/serializers/namespaceResourceSerializer.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/serializers/namespaceResourceSerializer.js +3 -3
- package/dist/browser/serializers/namespaceResourceSerializer.js.map +1 -0
- package/dist/browser/serializers/queueResourceSerializer.d.ts +461 -0
- package/dist/browser/serializers/queueResourceSerializer.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/serializers/queueResourceSerializer.js +5 -13
- package/dist/browser/serializers/queueResourceSerializer.js.map +1 -0
- package/dist/browser/serializers/ruleResourceSerializer.d.ts +135 -0
- package/dist/browser/serializers/ruleResourceSerializer.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/serializers/ruleResourceSerializer.js +6 -5
- package/dist/browser/serializers/ruleResourceSerializer.js.map +1 -0
- package/dist/browser/serializers/subscriptionResourceSerializer.d.ts +396 -0
- package/dist/browser/serializers/subscriptionResourceSerializer.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/serializers/subscriptionResourceSerializer.js +5 -5
- package/dist/browser/serializers/subscriptionResourceSerializer.js.map +1 -0
- package/dist/browser/serializers/topicResourceSerializer.d.ts +335 -0
- package/dist/browser/serializers/topicResourceSerializer.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/serializers/topicResourceSerializer.js +4 -4
- package/dist/browser/serializers/topicResourceSerializer.js.map +1 -0
- package/dist/browser/serviceBusAtomManagementClient.d.ts +652 -0
- package/dist/browser/serviceBusAtomManagementClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/serviceBusAtomManagementClient.js +283 -267
- package/dist/browser/serviceBusAtomManagementClient.js.map +1 -0
- package/dist/browser/serviceBusClient.d.ts +231 -0
- package/dist/browser/serviceBusClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/serviceBusClient.js +34 -30
- package/dist/browser/serviceBusClient.js.map +1 -0
- package/dist/browser/serviceBusError.d.ts +119 -0
- package/dist/browser/serviceBusError.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/serviceBusError.js +2 -2
- package/dist/browser/serviceBusError.js.map +1 -0
- package/dist/browser/serviceBusMessage.d.ts +529 -0
- package/dist/browser/serviceBusMessage.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/serviceBusMessage.js +18 -25
- package/dist/browser/serviceBusMessage.js.map +1 -0
- package/dist/browser/serviceBusMessageBatch.d.ts +153 -0
- package/dist/browser/serviceBusMessageBatch.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/serviceBusMessageBatch.js +5 -5
- package/dist/browser/serviceBusMessageBatch.js.map +1 -0
- package/dist/browser/serviceBusRuleManager.d.ts +103 -0
- package/dist/browser/serviceBusRuleManager.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/serviceBusRuleManager.js +18 -39
- package/dist/browser/serviceBusRuleManager.js.map +1 -0
- package/dist/browser/session/messageSession.d.ts +236 -0
- package/dist/browser/session/messageSession.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/session/messageSession.js +42 -32
- package/dist/browser/session/messageSession.js.map +1 -0
- package/dist/browser/util/atomXmlHelper.d.ts +56 -0
- package/dist/browser/util/atomXmlHelper.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/atomXmlHelper.js +12 -11
- package/dist/browser/util/atomXmlHelper.js.map +1 -0
- package/dist/browser/util/compat/compatibility.d.ts +109 -0
- package/dist/browser/util/compat/compatibility.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/compat/compatibility.js +2 -2
- package/dist/browser/util/compat/compatibility.js.map +1 -0
- package/dist/browser/util/compat/httpHeaders.d.ts +136 -0
- package/dist/browser/util/compat/httpHeaders.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/compat/httpHeaders.js +1 -1
- package/{dist-esm/src → dist/browser}/util/compat/httpHeaders.js.map +1 -1
- package/dist/browser/util/compat/index.d.ts +3 -0
- package/dist/browser/util/compat/index.d.ts.map +1 -0
- package/dist/browser/util/compat/index.js +5 -0
- package/dist/browser/util/compat/index.js.map +1 -0
- package/dist/browser/util/connectionStringUtils.d.ts +53 -0
- package/dist/browser/util/connectionStringUtils.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/connectionStringUtils.js +8 -2
- package/dist/browser/util/connectionStringUtils.js.map +1 -0
- package/dist/browser/util/constants.d.ts +322 -0
- package/dist/browser/util/constants.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/constants.js +3 -3
- package/{dist-esm/src → dist/browser}/util/constants.js.map +1 -1
- package/dist/browser/util/crypto-browser.d.mts.map +1 -0
- package/dist/browser/util/crypto-browser.mjs.map +1 -0
- package/dist/browser/util/crypto.d.ts +5 -0
- package/{dist-esm/src/util/crypto.browser.js → dist/browser/util/crypto.js} +2 -4
- package/dist/browser/util/errors.d.ts +130 -0
- package/dist/browser/util/errors.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/errors.js +4 -4
- package/dist/browser/util/errors.js.map +1 -0
- package/dist/browser/util/parseUrl-browser.d.mts.map +1 -0
- package/dist/browser/util/parseUrl-browser.mjs.map +1 -0
- package/dist/browser/util/parseUrl.d.ts +5 -0
- package/{dist-esm/src/util/parseUrl.browser.js → dist/browser/util/parseUrl.js} +1 -3
- package/dist/browser/util/runtimeInfo-browser.d.mts.map +1 -0
- package/dist/browser/util/runtimeInfo-browser.mjs.map +1 -0
- package/dist/browser/util/runtimeInfo.d.ts +7 -0
- package/{dist-esm/src/util/runtimeInfo.browser.js → dist/browser/util/runtimeInfo.js} +2 -2
- package/dist/browser/util/sasServiceClientCredentials.d.ts +31 -0
- package/dist/browser/util/sasServiceClientCredentials.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/sasServiceClientCredentials.js +1 -3
- package/dist/browser/util/sasServiceClientCredentials.js.map +1 -0
- package/dist/browser/util/semaphore.d.ts +38 -0
- package/dist/browser/util/semaphore.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/semaphore.js +1 -1
- package/{dist-esm/src → dist/browser}/util/semaphore.js.map +1 -1
- package/dist/browser/util/typeGuards.d.ts +8 -0
- package/dist/browser/util/typeGuards.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/typeGuards.js +2 -2
- package/dist/browser/util/typeGuards.js.map +1 -0
- package/dist/browser/util/utils.d.ts +247 -0
- package/dist/browser/util/utils.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/util/utils.js +12 -12
- package/dist/browser/util/utils.js.map +1 -0
- package/dist/commonjs/connectionContext.d.ts +109 -0
- package/dist/commonjs/connectionContext.d.ts.map +1 -0
- package/dist/commonjs/connectionContext.js +359 -0
- package/dist/commonjs/connectionContext.js.map +1 -0
- package/dist/commonjs/constructorHelpers.d.ts +79 -0
- package/dist/commonjs/constructorHelpers.d.ts.map +1 -0
- package/dist/commonjs/constructorHelpers.js +104 -0
- package/dist/commonjs/constructorHelpers.js.map +1 -0
- package/dist/commonjs/core/autoLockRenewer.d.ts +58 -0
- package/dist/commonjs/core/autoLockRenewer.d.ts.map +1 -0
- package/dist/commonjs/core/autoLockRenewer.js +174 -0
- package/dist/commonjs/core/autoLockRenewer.js.map +1 -0
- package/dist/commonjs/core/batchingReceiver.d.ts +120 -0
- package/dist/commonjs/core/batchingReceiver.d.ts.map +1 -0
- package/dist/commonjs/core/batchingReceiver.js +397 -0
- package/dist/commonjs/core/batchingReceiver.js.map +1 -0
- package/dist/commonjs/core/linkEntity.d.ts +192 -0
- package/dist/commonjs/core/linkEntity.d.ts.map +1 -0
- package/dist/commonjs/core/linkEntity.js +283 -0
- package/dist/commonjs/core/linkEntity.js.map +1 -0
- package/dist/commonjs/core/managementClient.d.ts +312 -0
- package/dist/commonjs/core/managementClient.d.ts.map +1 -0
- package/dist/commonjs/core/managementClient.js +1078 -0
- package/dist/commonjs/core/managementClient.js.map +1 -0
- package/dist/commonjs/core/messageReceiver.d.ts +147 -0
- package/dist/commonjs/core/messageReceiver.d.ts.map +1 -0
- package/dist/commonjs/core/messageReceiver.js +142 -0
- package/dist/commonjs/core/messageReceiver.js.map +1 -0
- package/dist/commonjs/core/messageSender.d.ts +93 -0
- package/dist/commonjs/core/messageSender.d.ts.map +1 -0
- package/dist/commonjs/core/messageSender.js +284 -0
- package/dist/commonjs/core/messageSender.js.map +1 -0
- package/dist/commonjs/core/receiverHelper.d.ts +45 -0
- package/dist/commonjs/core/receiverHelper.d.ts.map +1 -0
- package/dist/commonjs/core/receiverHelper.js +122 -0
- package/dist/commonjs/core/receiverHelper.js.map +1 -0
- package/dist/commonjs/core/shared.d.ts +34 -0
- package/dist/commonjs/core/shared.d.ts.map +1 -0
- package/dist/commonjs/core/shared.js +63 -0
- package/dist/commonjs/core/shared.js.map +1 -0
- package/dist/commonjs/core/streamingReceiver.d.ts +142 -0
- package/dist/commonjs/core/streamingReceiver.d.ts.map +1 -0
- package/dist/commonjs/core/streamingReceiver.js +495 -0
- package/dist/commonjs/core/streamingReceiver.js.map +1 -0
- package/dist/commonjs/dataTransformer.d.ts +77 -0
- package/dist/commonjs/dataTransformer.d.ts.map +1 -0
- package/dist/commonjs/dataTransformer.js +169 -0
- package/dist/commonjs/dataTransformer.js.map +1 -0
- package/dist/commonjs/diagnostics/instrumentServiceBusMessage.d.ts +50 -0
- package/dist/commonjs/diagnostics/instrumentServiceBusMessage.d.ts.map +1 -0
- package/dist/commonjs/diagnostics/instrumentServiceBusMessage.js +99 -0
- package/dist/commonjs/diagnostics/instrumentServiceBusMessage.js.map +1 -0
- package/dist/commonjs/diagnostics/tracing.d.ts +21 -0
- package/dist/commonjs/diagnostics/tracing.d.ts.map +1 -0
- package/dist/commonjs/diagnostics/tracing.js +41 -0
- package/dist/commonjs/diagnostics/tracing.js.map +1 -0
- package/dist/commonjs/experimental/index.d.ts +10 -0
- package/dist/commonjs/experimental/index.d.ts.map +1 -0
- package/dist/commonjs/experimental/index.js +5 -0
- package/dist/commonjs/experimental/index.js.map +1 -0
- package/dist/commonjs/index.d.ts +26 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +22 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/log.d.ts +70 -0
- package/dist/commonjs/log.d.ts.map +1 -0
- package/dist/commonjs/log.js +94 -0
- package/dist/commonjs/log.js.map +1 -0
- package/dist/commonjs/models.d.ts +328 -0
- package/dist/commonjs/models.d.ts.map +1 -0
- package/dist/commonjs/models.js +5 -0
- package/dist/commonjs/models.js.map +1 -0
- package/dist/commonjs/modelsToBeSharedWithEventHubs.d.ts +18 -0
- package/dist/commonjs/modelsToBeSharedWithEventHubs.d.ts.map +1 -0
- package/dist/commonjs/modelsToBeSharedWithEventHubs.js +5 -0
- package/dist/commonjs/modelsToBeSharedWithEventHubs.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/receivers/receiver.d.ts +299 -0
- package/dist/commonjs/receivers/receiver.d.ts.map +1 -0
- package/dist/commonjs/receivers/receiver.js +338 -0
- package/dist/commonjs/receivers/receiver.js.map +1 -0
- package/dist/commonjs/receivers/receiverCommon.d.ts +81 -0
- package/dist/commonjs/receivers/receiverCommon.d.ts.map +1 -0
- package/dist/commonjs/receivers/receiverCommon.js +254 -0
- package/dist/commonjs/receivers/receiverCommon.js.map +1 -0
- package/dist/commonjs/receivers/sessionReceiver.d.ts +189 -0
- package/dist/commonjs/receivers/sessionReceiver.d.ts.map +1 -0
- package/dist/commonjs/receivers/sessionReceiver.js +392 -0
- package/dist/commonjs/receivers/sessionReceiver.js.map +1 -0
- package/dist/commonjs/sender.d.ts +125 -0
- package/dist/commonjs/sender.d.ts.map +1 -0
- package/dist/commonjs/sender.js +169 -0
- package/dist/commonjs/sender.js.map +1 -0
- package/dist/commonjs/serializers/namespaceResourceSerializer.d.ts +46 -0
- package/dist/commonjs/serializers/namespaceResourceSerializer.d.ts.map +1 -0
- package/dist/commonjs/serializers/namespaceResourceSerializer.js +39 -0
- package/dist/commonjs/serializers/namespaceResourceSerializer.js.map +1 -0
- package/dist/commonjs/serializers/queueResourceSerializer.d.ts +461 -0
- package/dist/commonjs/serializers/queueResourceSerializer.d.ts.map +1 -0
- package/dist/commonjs/serializers/queueResourceSerializer.js +99 -0
- package/dist/commonjs/serializers/queueResourceSerializer.js.map +1 -0
- package/dist/commonjs/serializers/ruleResourceSerializer.d.ts +135 -0
- package/dist/commonjs/serializers/ruleResourceSerializer.d.ts.map +1 -0
- package/dist/commonjs/serializers/ruleResourceSerializer.js +288 -0
- package/dist/commonjs/serializers/ruleResourceSerializer.js.map +1 -0
- package/dist/commonjs/serializers/subscriptionResourceSerializer.d.ts +396 -0
- package/dist/commonjs/serializers/subscriptionResourceSerializer.d.ts.map +1 -0
- package/dist/commonjs/serializers/subscriptionResourceSerializer.js +103 -0
- package/dist/commonjs/serializers/subscriptionResourceSerializer.js.map +1 -0
- package/dist/commonjs/serializers/topicResourceSerializer.d.ts +335 -0
- package/dist/commonjs/serializers/topicResourceSerializer.d.ts.map +1 -0
- package/dist/commonjs/serializers/topicResourceSerializer.js +97 -0
- package/dist/commonjs/serializers/topicResourceSerializer.js.map +1 -0
- package/dist/commonjs/serviceBusAtomManagementClient.d.ts +652 -0
- package/dist/commonjs/serviceBusAtomManagementClient.d.ts.map +1 -0
- package/dist/commonjs/serviceBusAtomManagementClient.js +1694 -0
- package/dist/commonjs/serviceBusAtomManagementClient.js.map +1 -0
- package/dist/commonjs/serviceBusClient.d.ts +231 -0
- package/dist/commonjs/serviceBusClient.d.ts.map +1 -0
- package/dist/commonjs/serviceBusClient.js +212 -0
- package/dist/commonjs/serviceBusClient.js.map +1 -0
- package/dist/commonjs/serviceBusError.d.ts +119 -0
- package/dist/commonjs/serviceBusError.d.ts.map +1 -0
- package/dist/commonjs/serviceBusError.js +89 -0
- package/dist/commonjs/serviceBusError.js.map +1 -0
- package/dist/commonjs/serviceBusMessage.d.ts +529 -0
- package/dist/commonjs/serviceBusMessage.d.ts.map +1 -0
- package/dist/commonjs/serviceBusMessage.js +415 -0
- package/dist/commonjs/serviceBusMessage.js.map +1 -0
- package/dist/commonjs/serviceBusMessageBatch.d.ts +153 -0
- package/dist/commonjs/serviceBusMessageBatch.d.ts.map +1 -0
- package/dist/commonjs/serviceBusMessageBatch.js +172 -0
- package/dist/commonjs/serviceBusMessageBatch.js.map +1 -0
- package/dist/commonjs/serviceBusRuleManager.d.ts +103 -0
- package/dist/commonjs/serviceBusRuleManager.d.ts.map +1 -0
- package/dist/commonjs/serviceBusRuleManager.js +129 -0
- package/dist/commonjs/serviceBusRuleManager.js.map +1 -0
- package/dist/commonjs/session/messageSession.d.ts +236 -0
- package/dist/commonjs/session/messageSession.d.ts.map +1 -0
- package/dist/commonjs/session/messageSession.js +654 -0
- package/dist/commonjs/session/messageSession.js.map +1 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/commonjs/util/atomXmlHelper.d.ts +56 -0
- package/dist/commonjs/util/atomXmlHelper.d.ts.map +1 -0
- package/dist/commonjs/util/atomXmlHelper.js +387 -0
- package/dist/commonjs/util/atomXmlHelper.js.map +1 -0
- package/dist/commonjs/util/compat/compatibility.d.ts +109 -0
- package/dist/commonjs/util/compat/compatibility.d.ts.map +1 -0
- package/dist/commonjs/util/compat/compatibility.js +30 -0
- package/dist/commonjs/util/compat/compatibility.js.map +1 -0
- package/dist/commonjs/util/compat/httpHeaders.d.ts +136 -0
- package/dist/commonjs/util/compat/httpHeaders.d.ts.map +1 -0
- package/dist/commonjs/util/compat/httpHeaders.js +156 -0
- package/dist/commonjs/util/compat/httpHeaders.js.map +1 -0
- package/dist/commonjs/util/compat/index.d.ts +3 -0
- package/dist/commonjs/util/compat/index.d.ts.map +1 -0
- package/dist/commonjs/util/compat/index.js +8 -0
- package/dist/commonjs/util/compat/index.js.map +1 -0
- package/dist/commonjs/util/connectionStringUtils.d.ts +53 -0
- package/dist/commonjs/util/connectionStringUtils.d.ts.map +1 -0
- package/dist/commonjs/util/connectionStringUtils.js +51 -0
- package/dist/commonjs/util/connectionStringUtils.js.map +1 -0
- package/dist/commonjs/util/constants.d.ts +322 -0
- package/dist/commonjs/util/constants.d.ts.map +1 -0
- package/dist/commonjs/util/constants.js +327 -0
- package/dist/commonjs/util/constants.js.map +1 -0
- package/dist/commonjs/util/crypto.d.ts +5 -0
- package/dist/commonjs/util/crypto.d.ts.map +1 -0
- package/dist/commonjs/util/crypto.js +15 -0
- package/dist/commonjs/util/crypto.js.map +1 -0
- package/dist/commonjs/util/errors.d.ts +130 -0
- package/dist/commonjs/util/errors.d.ts.map +1 -0
- package/dist/commonjs/util/errors.js +236 -0
- package/dist/commonjs/util/errors.js.map +1 -0
- package/dist/commonjs/util/parseUrl.d.ts +5 -0
- package/dist/commonjs/util/parseUrl.d.ts.map +1 -0
- package/dist/commonjs/util/parseUrl.js +13 -0
- package/dist/commonjs/util/parseUrl.js.map +1 -0
- package/dist/commonjs/util/runtimeInfo.d.ts +7 -0
- package/dist/commonjs/util/runtimeInfo.d.ts.map +1 -0
- package/dist/commonjs/util/runtimeInfo.js +24 -0
- package/dist/commonjs/util/runtimeInfo.js.map +1 -0
- package/dist/commonjs/util/sasServiceClientCredentials.d.ts +31 -0
- package/dist/commonjs/util/sasServiceClientCredentials.d.ts.map +1 -0
- package/dist/commonjs/util/sasServiceClientCredentials.js +48 -0
- package/dist/commonjs/util/sasServiceClientCredentials.js.map +1 -0
- package/dist/commonjs/util/semaphore.d.ts +38 -0
- package/dist/commonjs/util/semaphore.d.ts.map +1 -0
- package/dist/commonjs/util/semaphore.js +81 -0
- package/dist/commonjs/util/semaphore.js.map +1 -0
- package/dist/commonjs/util/typeGuards.d.ts +8 -0
- package/dist/commonjs/util/typeGuards.d.ts.map +1 -0
- package/dist/commonjs/util/typeGuards.js +15 -0
- package/dist/commonjs/util/typeGuards.js.map +1 -0
- package/dist/commonjs/util/utils.d.ts +247 -0
- package/dist/commonjs/util/utils.d.ts.map +1 -0
- package/dist/commonjs/util/utils.js +526 -0
- package/dist/commonjs/util/utils.js.map +1 -0
- package/dist/esm/connectionContext.d.ts +109 -0
- package/dist/esm/connectionContext.d.ts.map +1 -0
- package/dist/esm/connectionContext.js +356 -0
- package/dist/esm/connectionContext.js.map +1 -0
- package/dist/esm/constructorHelpers.d.ts +79 -0
- package/dist/esm/constructorHelpers.d.ts.map +1 -0
- package/dist/esm/constructorHelpers.js +97 -0
- package/dist/esm/constructorHelpers.js.map +1 -0
- package/dist/esm/core/autoLockRenewer.d.ts +58 -0
- package/dist/esm/core/autoLockRenewer.d.ts.map +1 -0
- package/dist/esm/core/autoLockRenewer.js +170 -0
- package/dist/esm/core/autoLockRenewer.js.map +1 -0
- package/dist/esm/core/batchingReceiver.d.ts +120 -0
- package/dist/esm/core/batchingReceiver.d.ts.map +1 -0
- package/dist/esm/core/batchingReceiver.js +391 -0
- package/dist/esm/core/batchingReceiver.js.map +1 -0
- package/dist/esm/core/linkEntity.d.ts +192 -0
- package/dist/esm/core/linkEntity.d.ts.map +1 -0
- package/dist/esm/core/linkEntity.js +279 -0
- package/dist/esm/core/linkEntity.js.map +1 -0
- package/dist/esm/core/managementClient.d.ts +312 -0
- package/dist/esm/core/managementClient.d.ts.map +1 -0
- package/dist/esm/core/managementClient.js +1072 -0
- package/dist/esm/core/managementClient.js.map +1 -0
- package/dist/esm/core/messageReceiver.d.ts +147 -0
- package/dist/esm/core/messageReceiver.d.ts.map +1 -0
- package/dist/esm/core/messageReceiver.js +138 -0
- package/dist/esm/core/messageReceiver.js.map +1 -0
- package/dist/esm/core/messageSender.d.ts +93 -0
- package/dist/esm/core/messageSender.d.ts.map +1 -0
- package/dist/esm/core/messageSender.js +280 -0
- package/dist/esm/core/messageSender.js.map +1 -0
- package/dist/esm/core/receiverHelper.d.ts +45 -0
- package/dist/esm/core/receiverHelper.d.ts.map +1 -0
- package/dist/esm/core/receiverHelper.js +118 -0
- package/dist/esm/core/receiverHelper.js.map +1 -0
- package/dist/esm/core/shared.d.ts +34 -0
- package/dist/esm/core/shared.d.ts.map +1 -0
- package/dist/esm/core/shared.js +59 -0
- package/dist/esm/core/shared.js.map +1 -0
- package/dist/esm/core/streamingReceiver.d.ts +142 -0
- package/dist/esm/core/streamingReceiver.d.ts.map +1 -0
- package/dist/esm/core/streamingReceiver.js +491 -0
- package/dist/esm/core/streamingReceiver.js.map +1 -0
- package/dist/esm/dataTransformer.d.ts +77 -0
- package/dist/esm/dataTransformer.d.ts.map +1 -0
- package/dist/esm/dataTransformer.js +163 -0
- package/dist/esm/dataTransformer.js.map +1 -0
- package/dist/esm/diagnostics/instrumentServiceBusMessage.d.ts +50 -0
- package/dist/esm/diagnostics/instrumentServiceBusMessage.d.ts.map +1 -0
- package/dist/esm/diagnostics/instrumentServiceBusMessage.js +93 -0
- package/dist/esm/diagnostics/instrumentServiceBusMessage.js.map +1 -0
- package/dist/esm/diagnostics/tracing.d.ts +21 -0
- package/dist/esm/diagnostics/tracing.d.ts.map +1 -0
- package/dist/esm/diagnostics/tracing.js +37 -0
- package/dist/esm/diagnostics/tracing.js.map +1 -0
- package/dist/esm/experimental/index.d.ts +10 -0
- package/dist/esm/experimental/index.d.ts.map +1 -0
- package/dist/esm/experimental/index.js +4 -0
- package/dist/esm/experimental/index.js.map +1 -0
- package/dist/esm/index.d.ts +26 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/log.d.ts +70 -0
- package/dist/esm/log.d.ts.map +1 -0
- package/dist/esm/log.js +89 -0
- package/dist/esm/log.js.map +1 -0
- package/dist/esm/models.d.ts +328 -0
- package/dist/esm/models.d.ts.map +1 -0
- package/dist/esm/models.js +4 -0
- package/dist/esm/models.js.map +1 -0
- package/dist/esm/modelsToBeSharedWithEventHubs.d.ts +18 -0
- package/dist/esm/modelsToBeSharedWithEventHubs.d.ts.map +1 -0
- package/dist/esm/modelsToBeSharedWithEventHubs.js +4 -0
- package/dist/esm/modelsToBeSharedWithEventHubs.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/receivers/receiver.d.ts +299 -0
- package/dist/esm/receivers/receiver.d.ts.map +1 -0
- package/dist/esm/receivers/receiver.js +334 -0
- package/dist/esm/receivers/receiver.js.map +1 -0
- package/dist/esm/receivers/receiverCommon.d.ts +81 -0
- package/dist/esm/receivers/receiverCommon.d.ts.map +1 -0
- package/dist/esm/receivers/receiverCommon.js +242 -0
- package/dist/esm/receivers/receiverCommon.js.map +1 -0
- package/dist/esm/receivers/sessionReceiver.d.ts +189 -0
- package/dist/esm/receivers/sessionReceiver.d.ts.map +1 -0
- package/dist/esm/receivers/sessionReceiver.js +388 -0
- package/dist/esm/receivers/sessionReceiver.js.map +1 -0
- package/dist/esm/sender.d.ts +125 -0
- package/dist/esm/sender.d.ts.map +1 -0
- package/dist/esm/sender.js +164 -0
- package/dist/esm/sender.js.map +1 -0
- package/dist/esm/serializers/namespaceResourceSerializer.d.ts +46 -0
- package/dist/esm/serializers/namespaceResourceSerializer.d.ts.map +1 -0
- package/dist/esm/serializers/namespaceResourceSerializer.js +34 -0
- package/dist/esm/serializers/namespaceResourceSerializer.js.map +1 -0
- package/dist/esm/serializers/queueResourceSerializer.d.ts +461 -0
- package/dist/esm/serializers/queueResourceSerializer.d.ts.map +1 -0
- package/dist/esm/serializers/queueResourceSerializer.js +91 -0
- package/dist/esm/serializers/queueResourceSerializer.js.map +1 -0
- package/dist/esm/serializers/ruleResourceSerializer.d.ts +135 -0
- package/dist/esm/serializers/ruleResourceSerializer.d.ts.map +1 -0
- package/dist/esm/serializers/ruleResourceSerializer.js +279 -0
- package/dist/esm/serializers/ruleResourceSerializer.js.map +1 -0
- package/dist/esm/serializers/subscriptionResourceSerializer.d.ts +396 -0
- package/dist/esm/serializers/subscriptionResourceSerializer.d.ts.map +1 -0
- package/dist/esm/serializers/subscriptionResourceSerializer.js +95 -0
- package/dist/esm/serializers/subscriptionResourceSerializer.js.map +1 -0
- package/dist/esm/serializers/topicResourceSerializer.d.ts +335 -0
- package/dist/esm/serializers/topicResourceSerializer.d.ts.map +1 -0
- package/dist/esm/serializers/topicResourceSerializer.js +89 -0
- package/dist/esm/serializers/topicResourceSerializer.js.map +1 -0
- package/dist/esm/serviceBusAtomManagementClient.d.ts +652 -0
- package/dist/esm/serviceBusAtomManagementClient.d.ts.map +1 -0
- package/dist/esm/serviceBusAtomManagementClient.js +1690 -0
- package/dist/esm/serviceBusAtomManagementClient.js.map +1 -0
- package/dist/esm/serviceBusClient.d.ts +231 -0
- package/dist/esm/serviceBusClient.d.ts.map +1 -0
- package/dist/esm/serviceBusClient.js +207 -0
- package/dist/esm/serviceBusClient.js.map +1 -0
- package/dist/esm/serviceBusError.d.ts +119 -0
- package/dist/esm/serviceBusError.d.ts.map +1 -0
- package/dist/esm/serviceBusError.js +83 -0
- package/dist/esm/serviceBusError.js.map +1 -0
- package/dist/esm/serviceBusMessage.d.ts +529 -0
- package/dist/esm/serviceBusMessage.d.ts.map +1 -0
- package/dist/esm/serviceBusMessage.js +403 -0
- package/dist/esm/serviceBusMessage.js.map +1 -0
- package/dist/esm/serviceBusMessageBatch.d.ts +153 -0
- package/dist/esm/serviceBusMessageBatch.d.ts.map +1 -0
- package/dist/esm/serviceBusMessageBatch.js +168 -0
- package/dist/esm/serviceBusMessageBatch.js.map +1 -0
- package/dist/esm/serviceBusRuleManager.d.ts +103 -0
- package/dist/esm/serviceBusRuleManager.d.ts.map +1 -0
- package/dist/esm/serviceBusRuleManager.js +125 -0
- package/dist/esm/serviceBusRuleManager.js.map +1 -0
- package/dist/esm/session/messageSession.d.ts +236 -0
- package/dist/esm/session/messageSession.d.ts.map +1 -0
- package/dist/esm/session/messageSession.js +650 -0
- package/dist/esm/session/messageSession.js.map +1 -0
- package/dist/esm/util/atomXmlHelper.d.ts +56 -0
- package/dist/esm/util/atomXmlHelper.d.ts.map +1 -0
- package/dist/esm/util/atomXmlHelper.js +379 -0
- package/dist/esm/util/atomXmlHelper.js.map +1 -0
- package/dist/esm/util/compat/compatibility.d.ts +109 -0
- package/dist/esm/util/compat/compatibility.d.ts.map +1 -0
- package/dist/esm/util/compat/compatibility.js +27 -0
- package/dist/esm/util/compat/compatibility.js.map +1 -0
- package/dist/esm/util/compat/httpHeaders.d.ts +136 -0
- package/dist/esm/util/compat/httpHeaders.d.ts.map +1 -0
- package/dist/esm/util/compat/httpHeaders.js +151 -0
- package/dist/esm/util/compat/httpHeaders.js.map +1 -0
- package/dist/esm/util/compat/index.d.ts +3 -0
- package/dist/esm/util/compat/index.d.ts.map +1 -0
- package/dist/esm/util/compat/index.js +5 -0
- package/dist/esm/util/compat/index.js.map +1 -0
- package/dist/esm/util/connectionStringUtils.d.ts +53 -0
- package/dist/esm/util/connectionStringUtils.d.ts.map +1 -0
- package/dist/esm/util/connectionStringUtils.js +48 -0
- package/dist/esm/util/connectionStringUtils.js.map +1 -0
- package/dist/esm/util/constants.d.ts +322 -0
- package/dist/esm/util/constants.d.ts.map +1 -0
- package/dist/esm/util/constants.js +324 -0
- package/dist/esm/util/constants.js.map +1 -0
- package/dist/esm/util/crypto.d.ts +5 -0
- package/dist/esm/util/crypto.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/util/crypto.js +1 -3
- package/dist/esm/util/crypto.js.map +1 -0
- package/dist/esm/util/errors.d.ts +130 -0
- package/dist/esm/util/errors.d.ts.map +1 -0
- package/dist/esm/util/errors.js +220 -0
- package/dist/esm/util/errors.js.map +1 -0
- package/dist/esm/util/parseUrl.d.ts +5 -0
- package/dist/esm/util/parseUrl.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/util/parseUrl.js +0 -6
- package/dist/esm/util/parseUrl.js.map +1 -0
- package/dist/esm/util/runtimeInfo.d.ts +7 -0
- package/dist/esm/util/runtimeInfo.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/util/runtimeInfo.js +2 -2
- package/{dist-esm/src → dist/esm}/util/runtimeInfo.js.map +1 -1
- package/dist/esm/util/sasServiceClientCredentials.d.ts +31 -0
- package/dist/esm/util/sasServiceClientCredentials.d.ts.map +1 -0
- package/dist/esm/util/sasServiceClientCredentials.js +44 -0
- package/dist/esm/util/sasServiceClientCredentials.js.map +1 -0
- package/dist/esm/util/semaphore.d.ts +38 -0
- package/dist/esm/util/semaphore.d.ts.map +1 -0
- package/dist/esm/util/semaphore.js +77 -0
- package/dist/esm/util/semaphore.js.map +1 -0
- package/dist/esm/util/typeGuards.d.ts +8 -0
- package/dist/esm/util/typeGuards.d.ts.map +1 -0
- package/dist/esm/util/typeGuards.js +12 -0
- package/dist/esm/util/typeGuards.js.map +1 -0
- package/dist/esm/util/utils.d.ts +247 -0
- package/dist/esm/util/utils.d.ts.map +1 -0
- package/dist/esm/util/utils.js +498 -0
- package/dist/esm/util/utils.js.map +1 -0
- package/dist/react-native/connectionContext.d.ts +109 -0
- package/dist/react-native/connectionContext.d.ts.map +1 -0
- package/dist/react-native/connectionContext.js +356 -0
- package/dist/react-native/connectionContext.js.map +1 -0
- package/dist/react-native/constructorHelpers.d.ts +79 -0
- package/dist/react-native/constructorHelpers.d.ts.map +1 -0
- package/dist/react-native/constructorHelpers.js +97 -0
- package/dist/react-native/constructorHelpers.js.map +1 -0
- package/dist/react-native/core/autoLockRenewer.d.ts +58 -0
- package/dist/react-native/core/autoLockRenewer.d.ts.map +1 -0
- package/dist/react-native/core/autoLockRenewer.js +170 -0
- package/dist/react-native/core/autoLockRenewer.js.map +1 -0
- package/dist/react-native/core/batchingReceiver.d.ts +120 -0
- package/dist/react-native/core/batchingReceiver.d.ts.map +1 -0
- package/dist/react-native/core/batchingReceiver.js +391 -0
- package/dist/react-native/core/batchingReceiver.js.map +1 -0
- package/dist/react-native/core/linkEntity.d.ts +192 -0
- package/dist/react-native/core/linkEntity.d.ts.map +1 -0
- package/dist/react-native/core/linkEntity.js +279 -0
- package/dist/react-native/core/linkEntity.js.map +1 -0
- package/dist/react-native/core/managementClient.d.ts +312 -0
- package/dist/react-native/core/managementClient.d.ts.map +1 -0
- package/dist/react-native/core/managementClient.js +1072 -0
- package/dist/react-native/core/managementClient.js.map +1 -0
- package/dist/react-native/core/messageReceiver.d.ts +147 -0
- package/dist/react-native/core/messageReceiver.d.ts.map +1 -0
- package/dist/react-native/core/messageReceiver.js +138 -0
- package/dist/react-native/core/messageReceiver.js.map +1 -0
- package/dist/react-native/core/messageSender.d.ts +93 -0
- package/dist/react-native/core/messageSender.d.ts.map +1 -0
- package/dist/react-native/core/messageSender.js +280 -0
- package/dist/react-native/core/messageSender.js.map +1 -0
- package/dist/react-native/core/receiverHelper.d.ts +45 -0
- package/dist/react-native/core/receiverHelper.d.ts.map +1 -0
- package/dist/react-native/core/receiverHelper.js +118 -0
- package/dist/react-native/core/receiverHelper.js.map +1 -0
- package/dist/react-native/core/shared.d.ts +34 -0
- package/dist/react-native/core/shared.d.ts.map +1 -0
- package/dist/react-native/core/shared.js +59 -0
- package/dist/react-native/core/shared.js.map +1 -0
- package/dist/react-native/core/streamingReceiver.d.ts +142 -0
- package/dist/react-native/core/streamingReceiver.d.ts.map +1 -0
- package/dist/react-native/core/streamingReceiver.js +491 -0
- package/dist/react-native/core/streamingReceiver.js.map +1 -0
- package/dist/react-native/dataTransformer.d.ts +77 -0
- package/dist/react-native/dataTransformer.d.ts.map +1 -0
- package/dist/react-native/dataTransformer.js +163 -0
- package/dist/react-native/dataTransformer.js.map +1 -0
- package/dist/react-native/diagnostics/instrumentServiceBusMessage.d.ts +50 -0
- package/dist/react-native/diagnostics/instrumentServiceBusMessage.d.ts.map +1 -0
- package/dist/react-native/diagnostics/instrumentServiceBusMessage.js +93 -0
- package/dist/react-native/diagnostics/instrumentServiceBusMessage.js.map +1 -0
- package/dist/react-native/diagnostics/tracing.d.ts +21 -0
- package/dist/react-native/diagnostics/tracing.d.ts.map +1 -0
- package/dist/react-native/diagnostics/tracing.js +37 -0
- package/dist/react-native/diagnostics/tracing.js.map +1 -0
- package/dist/react-native/experimental/index.d.ts +10 -0
- package/dist/react-native/experimental/index.d.ts.map +1 -0
- package/dist/react-native/experimental/index.js +4 -0
- package/dist/react-native/experimental/index.js.map +1 -0
- package/dist/react-native/index.d.ts +26 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +10 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/log.d.ts +70 -0
- package/dist/react-native/log.d.ts.map +1 -0
- package/dist/react-native/log.js +89 -0
- package/dist/react-native/log.js.map +1 -0
- package/dist/react-native/models.d.ts +328 -0
- package/dist/react-native/models.d.ts.map +1 -0
- package/dist/react-native/models.js +4 -0
- package/dist/react-native/models.js.map +1 -0
- package/dist/react-native/modelsToBeSharedWithEventHubs.d.ts +18 -0
- package/dist/react-native/modelsToBeSharedWithEventHubs.d.ts.map +1 -0
- package/dist/react-native/modelsToBeSharedWithEventHubs.js +4 -0
- package/dist/react-native/modelsToBeSharedWithEventHubs.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/receivers/receiver.d.ts +299 -0
- package/dist/react-native/receivers/receiver.d.ts.map +1 -0
- package/dist/react-native/receivers/receiver.js +334 -0
- package/dist/react-native/receivers/receiver.js.map +1 -0
- package/dist/react-native/receivers/receiverCommon.d.ts +81 -0
- package/dist/react-native/receivers/receiverCommon.d.ts.map +1 -0
- package/dist/react-native/receivers/receiverCommon.js +242 -0
- package/dist/react-native/receivers/receiverCommon.js.map +1 -0
- package/dist/react-native/receivers/sessionReceiver.d.ts +189 -0
- package/dist/react-native/receivers/sessionReceiver.d.ts.map +1 -0
- package/dist/react-native/receivers/sessionReceiver.js +388 -0
- package/dist/react-native/receivers/sessionReceiver.js.map +1 -0
- package/dist/react-native/sender.d.ts +125 -0
- package/dist/react-native/sender.d.ts.map +1 -0
- package/dist/react-native/sender.js +164 -0
- package/dist/react-native/sender.js.map +1 -0
- package/dist/react-native/serializers/namespaceResourceSerializer.d.ts +46 -0
- package/dist/react-native/serializers/namespaceResourceSerializer.d.ts.map +1 -0
- package/dist/react-native/serializers/namespaceResourceSerializer.js +34 -0
- package/dist/react-native/serializers/namespaceResourceSerializer.js.map +1 -0
- package/dist/react-native/serializers/queueResourceSerializer.d.ts +461 -0
- package/dist/react-native/serializers/queueResourceSerializer.d.ts.map +1 -0
- package/dist/react-native/serializers/queueResourceSerializer.js +91 -0
- package/dist/react-native/serializers/queueResourceSerializer.js.map +1 -0
- package/dist/react-native/serializers/ruleResourceSerializer.d.ts +135 -0
- package/dist/react-native/serializers/ruleResourceSerializer.d.ts.map +1 -0
- package/dist/react-native/serializers/ruleResourceSerializer.js +279 -0
- package/dist/react-native/serializers/ruleResourceSerializer.js.map +1 -0
- package/dist/react-native/serializers/subscriptionResourceSerializer.d.ts +396 -0
- package/dist/react-native/serializers/subscriptionResourceSerializer.d.ts.map +1 -0
- package/dist/react-native/serializers/subscriptionResourceSerializer.js +95 -0
- package/dist/react-native/serializers/subscriptionResourceSerializer.js.map +1 -0
- package/dist/react-native/serializers/topicResourceSerializer.d.ts +335 -0
- package/dist/react-native/serializers/topicResourceSerializer.d.ts.map +1 -0
- package/dist/react-native/serializers/topicResourceSerializer.js +89 -0
- package/dist/react-native/serializers/topicResourceSerializer.js.map +1 -0
- package/dist/react-native/serviceBusAtomManagementClient.d.ts +652 -0
- package/dist/react-native/serviceBusAtomManagementClient.d.ts.map +1 -0
- package/dist/react-native/serviceBusAtomManagementClient.js +1690 -0
- package/dist/react-native/serviceBusAtomManagementClient.js.map +1 -0
- package/dist/react-native/serviceBusClient.d.ts +231 -0
- package/dist/react-native/serviceBusClient.d.ts.map +1 -0
- package/dist/react-native/serviceBusClient.js +207 -0
- package/dist/react-native/serviceBusClient.js.map +1 -0
- package/dist/react-native/serviceBusError.d.ts +119 -0
- package/dist/react-native/serviceBusError.d.ts.map +1 -0
- package/dist/react-native/serviceBusError.js +83 -0
- package/dist/react-native/serviceBusError.js.map +1 -0
- package/dist/react-native/serviceBusMessage.d.ts +529 -0
- package/dist/react-native/serviceBusMessage.d.ts.map +1 -0
- package/dist/react-native/serviceBusMessage.js +403 -0
- package/dist/react-native/serviceBusMessage.js.map +1 -0
- package/dist/react-native/serviceBusMessageBatch.d.ts +153 -0
- package/dist/react-native/serviceBusMessageBatch.d.ts.map +1 -0
- package/dist/react-native/serviceBusMessageBatch.js +168 -0
- package/dist/react-native/serviceBusMessageBatch.js.map +1 -0
- package/dist/react-native/serviceBusRuleManager.d.ts +103 -0
- package/dist/react-native/serviceBusRuleManager.d.ts.map +1 -0
- package/dist/react-native/serviceBusRuleManager.js +125 -0
- package/dist/react-native/serviceBusRuleManager.js.map +1 -0
- package/dist/react-native/session/messageSession.d.ts +236 -0
- package/dist/react-native/session/messageSession.d.ts.map +1 -0
- package/dist/react-native/session/messageSession.js +650 -0
- package/dist/react-native/session/messageSession.js.map +1 -0
- package/dist/react-native/util/atomXmlHelper.d.ts +56 -0
- package/dist/react-native/util/atomXmlHelper.d.ts.map +1 -0
- package/dist/react-native/util/atomXmlHelper.js +379 -0
- package/dist/react-native/util/atomXmlHelper.js.map +1 -0
- package/dist/react-native/util/compat/compatibility.d.ts +109 -0
- package/dist/react-native/util/compat/compatibility.d.ts.map +1 -0
- package/dist/react-native/util/compat/compatibility.js +27 -0
- package/dist/react-native/util/compat/compatibility.js.map +1 -0
- package/dist/react-native/util/compat/httpHeaders.d.ts +136 -0
- package/dist/react-native/util/compat/httpHeaders.d.ts.map +1 -0
- package/dist/react-native/util/compat/httpHeaders.js +151 -0
- package/dist/react-native/util/compat/httpHeaders.js.map +1 -0
- package/dist/react-native/util/compat/index.d.ts +3 -0
- package/dist/react-native/util/compat/index.d.ts.map +1 -0
- package/dist/react-native/util/compat/index.js +5 -0
- package/dist/react-native/util/compat/index.js.map +1 -0
- package/dist/react-native/util/connectionStringUtils.d.ts +53 -0
- package/dist/react-native/util/connectionStringUtils.d.ts.map +1 -0
- package/dist/react-native/util/connectionStringUtils.js +48 -0
- package/dist/react-native/util/connectionStringUtils.js.map +1 -0
- package/dist/react-native/util/constants.d.ts +322 -0
- package/dist/react-native/util/constants.d.ts.map +1 -0
- package/dist/react-native/util/constants.js +324 -0
- package/dist/react-native/util/constants.js.map +1 -0
- package/dist/react-native/util/crypto.d.ts +5 -0
- package/dist/react-native/util/crypto.d.ts.map +1 -0
- package/dist/react-native/util/crypto.js +11 -0
- package/dist/react-native/util/crypto.js.map +1 -0
- package/dist/react-native/util/errors.d.ts +130 -0
- package/dist/react-native/util/errors.d.ts.map +1 -0
- package/dist/react-native/util/errors.js +220 -0
- package/dist/react-native/util/errors.js.map +1 -0
- package/dist/react-native/util/parseUrl.d.ts +5 -0
- package/dist/react-native/util/parseUrl.d.ts.map +1 -0
- package/dist/react-native/util/parseUrl.js +9 -0
- package/dist/react-native/util/parseUrl.js.map +1 -0
- package/dist/react-native/util/runtimeInfo-react-native.d.mts.map +1 -0
- package/dist/react-native/util/runtimeInfo-react-native.mjs.map +1 -0
- package/dist/react-native/util/runtimeInfo.d.ts +7 -0
- package/{dist-esm/src/util/runtimeInfo.native.js → dist/react-native/util/runtimeInfo.js} +3 -3
- package/dist/react-native/util/sasServiceClientCredentials.d.ts +31 -0
- package/dist/react-native/util/sasServiceClientCredentials.d.ts.map +1 -0
- package/dist/react-native/util/sasServiceClientCredentials.js +44 -0
- package/dist/react-native/util/sasServiceClientCredentials.js.map +1 -0
- package/dist/react-native/util/semaphore.d.ts +38 -0
- package/dist/react-native/util/semaphore.d.ts.map +1 -0
- package/dist/react-native/util/semaphore.js +77 -0
- package/dist/react-native/util/semaphore.js.map +1 -0
- package/dist/react-native/util/typeGuards.d.ts +8 -0
- package/dist/react-native/util/typeGuards.d.ts.map +1 -0
- package/dist/react-native/util/typeGuards.js +12 -0
- package/dist/react-native/util/typeGuards.js.map +1 -0
- package/dist/react-native/util/utils.d.ts +247 -0
- package/dist/react-native/util/utils.d.ts.map +1 -0
- package/dist/react-native/util/utils.js +498 -0
- package/dist/react-native/util/utils.js.map +1 -0
- package/package.json +115 -96
- package/dist/index.js +0 -10438
- package/dist/index.js.map +0 -1
- package/dist-esm/src/connectionContext.js.map +0 -1
- package/dist-esm/src/constructorHelpers.js.map +0 -1
- package/dist-esm/src/core/autoLockRenewer.js.map +0 -1
- package/dist-esm/src/core/batchingReceiver.js.map +0 -1
- package/dist-esm/src/core/linkEntity.js.map +0 -1
- package/dist-esm/src/core/managementClient.js.map +0 -1
- package/dist-esm/src/core/messageReceiver.js.map +0 -1
- package/dist-esm/src/core/messageSender.js.map +0 -1
- package/dist-esm/src/core/receiverHelper.js.map +0 -1
- package/dist-esm/src/core/shared.js.map +0 -1
- package/dist-esm/src/core/streamingReceiver.js.map +0 -1
- package/dist-esm/src/dataTransformer.js.map +0 -1
- package/dist-esm/src/diagnostics/instrumentServiceBusMessage.js.map +0 -1
- package/dist-esm/src/diagnostics/tracing.js.map +0 -1
- package/dist-esm/src/index.js.map +0 -1
- package/dist-esm/src/log.js.map +0 -1
- package/dist-esm/src/models.js +0 -4
- package/dist-esm/src/models.js.map +0 -1
- package/dist-esm/src/modelsToBeSharedWithEventHubs.js +0 -4
- package/dist-esm/src/modelsToBeSharedWithEventHubs.js.map +0 -1
- package/dist-esm/src/receivers/receiver.js.map +0 -1
- package/dist-esm/src/receivers/receiverCommon.js.map +0 -1
- package/dist-esm/src/receivers/sessionReceiver.js.map +0 -1
- package/dist-esm/src/sender.js.map +0 -1
- package/dist-esm/src/serializers/namespaceResourceSerializer.js.map +0 -1
- package/dist-esm/src/serializers/queueResourceSerializer.js.map +0 -1
- package/dist-esm/src/serializers/ruleResourceSerializer.js.map +0 -1
- package/dist-esm/src/serializers/subscriptionResourceSerializer.js.map +0 -1
- package/dist-esm/src/serializers/topicResourceSerializer.js.map +0 -1
- package/dist-esm/src/serviceBusAtomManagementClient.js.map +0 -1
- package/dist-esm/src/serviceBusClient.js.map +0 -1
- package/dist-esm/src/serviceBusError.js.map +0 -1
- package/dist-esm/src/serviceBusMessage.js.map +0 -1
- package/dist-esm/src/serviceBusMessageBatch.js.map +0 -1
- package/dist-esm/src/serviceBusRuleManager.js.map +0 -1
- package/dist-esm/src/session/messageSession.js.map +0 -1
- package/dist-esm/src/util/atomXmlHelper.js.map +0 -1
- package/dist-esm/src/util/compat/compatibility.js.map +0 -1
- package/dist-esm/src/util/compat/index.js +0 -5
- package/dist-esm/src/util/compat/index.js.map +0 -1
- package/dist-esm/src/util/connectionStringUtils.js.map +0 -1
- package/dist-esm/src/util/crypto.browser.js.map +0 -1
- package/dist-esm/src/util/crypto.js.map +0 -1
- package/dist-esm/src/util/errors.js.map +0 -1
- package/dist-esm/src/util/parseUrl.browser.js.map +0 -1
- package/dist-esm/src/util/parseUrl.js.map +0 -1
- package/dist-esm/src/util/runtimeInfo.browser.js.map +0 -1
- package/dist-esm/src/util/runtimeInfo.native.js.map +0 -1
- package/dist-esm/src/util/sasServiceClientCredentials.js.map +0 -1
- package/dist-esm/src/util/typeGuards.js.map +0 -1
- package/dist-esm/src/util/utils.js.map +0 -1
- package/types/latest/service-bus-beta.d.ts +0 -3197
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/log.ts","../src/util/constants.ts","../src/util/parseUrl.ts","../src/util/compat/httpHeaders.ts","../src/util/compat/compatibility.ts","../src/serviceBusError.ts","../src/util/utils.ts","../src/util/atomXmlHelper.ts","../src/serializers/namespaceResourceSerializer.ts","../src/serializers/queueResourceSerializer.ts","../src/serializers/ruleResourceSerializer.ts","../src/serializers/subscriptionResourceSerializer.ts","../src/serializers/topicResourceSerializer.ts","../src/util/crypto.ts","../src/util/sasServiceClientCredentials.ts","../src/diagnostics/tracing.ts","../src/serviceBusAtomManagementClient.ts","../src/dataTransformer.ts","../src/serviceBusMessage.ts","../src/core/linkEntity.ts","../src/util/errors.ts","../src/core/managementClient.ts","../src/util/runtimeInfo.ts","../src/connectionContext.ts","../src/util/connectionStringUtils.ts","../src/constructorHelpers.ts","../src/core/shared.ts","../src/core/messageReceiver.ts","../src/core/receiverHelper.ts","../src/diagnostics/instrumentServiceBusMessage.ts","../src/receivers/receiverCommon.ts","../src/core/streamingReceiver.ts","../src/core/batchingReceiver.ts","../src/core/autoLockRenewer.ts","../src/receivers/receiver.ts","../src/receivers/sessionReceiver.ts","../src/serviceBusRuleManager.ts","../src/serviceBusMessageBatch.ts","../src/core/messageSender.ts","../src/sender.ts","../src/session/messageSession.ts","../src/util/typeGuards.ts","../src/serviceBusClient.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzureLogger, createClientLogger } from \"@azure/logger\";\nimport { AmqpError } from \"rhea-promise\";\nimport { isObjectWithProperties } from \"@azure/core-util\";\n\n/**\n * The `@azure/logger` configuration for this package.\n * This will output logs using the `azure:service-bus` namespace prefix.\n * @internal\n */\nexport const logger = createServiceBusLogger(\"service-bus\");\n\n/**\n * Logging for ServiceBusReceivers of any type (session, non-session)\n * @internal\n */\nexport const receiverLogger = createServiceBusLogger(\"service-bus:receiver\");\n\n/**\n * Logging for ServiceBusSenders\n * @internal\n */\nexport const senderLogger = createServiceBusLogger(\"service-bus:sender\");\n\n/**\n * Logging for ServiceBusRuleManagers\n * @internal\n */\nexport const ruleManagerLogger = createServiceBusLogger(\"service-bus:rulemanager\");\n\n/**\n * Logging for connection management\n * @internal\n */\nexport const connectionLogger = createServiceBusLogger(\"service-bus:connection\");\n\n/**\n * Logging for the ServiceBusAdministrationClient\n * @internal\n */\nexport const administrationLogger = createServiceBusLogger(\"service-bus:administration\");\n\n/**\n * Logging related to message encoding/decoding.\n * @internal\n */\nexport const messageLogger = createServiceBusLogger(\"service-bus:messages\");\n\n/**\n * Logging related to message encoding/decoding.\n * @internal\n */\nexport const managementClientLogger = createServiceBusLogger(\"service-bus:management\");\n\n/**\n * Logs the error's stack trace to \"verbose\" if a stack trace is available.\n * @param error - Error containing a stack trace.\n * @internal\n */\nexport function logErrorStackTrace(_logger: AzureLogger, error: unknown): void {\n if (isObjectWithProperties(error, [\"stack\"]) && error.stack) {\n _logger.verbose(error.stack);\n }\n}\n\n/**\n * @internal\n */\nexport interface ServiceBusLogger extends AzureLogger {\n /**\n * Logs an error with an associated message, formatted. If there is a stack\n * trace in the error that will be logged to the verbose stream.\n *\n * Example:\n * receiverLogger.logError(new Error(\"hello, this is the error\"), \"this is my message\");\n * will output:\n * azure:service-bus:receiver:warning this is my message : Error: hello, this is the error\n */\n logError(err: Error | AmqpError | undefined, ...args: any[]): void;\n}\n\n/**\n * Creates an AzureLogger with any additional methods for standardized logging (for example, with errors)\n * @internal\n */\nexport function createServiceBusLogger(namespace: string): ServiceBusLogger {\n const _logger = createClientLogger(namespace) as ServiceBusLogger;\n\n _logger[\"logError\"] = (err: Error | AmqpError | undefined, ...args: any[]): void => {\n let l: typeof logger.info;\n\n // abort errors are user initiated so we don't have to treat them as warnings, like we\n // would with other errors.\n if (isError(err) && err.name === \"AbortError\") {\n l = _logger.info;\n } else {\n l = _logger.warning;\n }\n\n // tack on the error object so it also gets logged.\n args.push(\":\", err);\n\n // let the normal formatting work and include the error at the end.\n l(...args);\n\n // optionally log the stack trace if it's available but this always goes to verbose\n if (err && (err as any).stack) {\n _logger.verbose((err as any).stack);\n }\n };\n\n return _logger;\n}\n\n/**\n * @internal\n */\nfunction isError(err: Error | AmqpError | undefined): err is Error {\n return err != null && (err as any).name != null;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * @internal\n */\nexport const packageJsonInfo = {\n name: \"@azure/service-bus\",\n version: \"7.10.0-beta.1\",\n};\n\n/**\n * @internal\n */\nexport const messageDispositionTimeout = 20000;\n\n/**\n * The amount of time in milliseconds that a receiver\n * will wait while draining credits before returning.\n * @internal\n */\nexport const receiveDrainTimeoutInMs = 200;\n\n/**\n * @internal\n */\nexport const max32BitNumber = Math.pow(2, 31) - 1;\n\n/**\n * Queue name identifier\n * @internal\n */\nexport const QUEUE_NAME = \"QueueName\";\n\n/**\n * Topic name identifier\n * @internal\n */\nexport const TOPIC_NAME = \"TopicName\";\n\n/**\n * Subscription name identifier\n * @internal\n */\nexport const SUBSCRIPTION_NAME = \"SubscriptionName\";\n\n/**\n * Rule name identifier\n * @internal\n */\nexport const RULE_NAME = \"RuleName\";\n\n/**\n * Accessed at field\n * @internal\n */\nexport const ACCESSED_AT = \"AccessedAt\";\n\n/**\n * Updated at field\n * @internal\n */\nexport const UPDATED_AT = \"UpdatedAt\";\n\n/**\n * Created at field\n * @internal\n */\nexport const CREATED_AT = \"CreatedAt\";\n\n/**\n * Authorization rules on the entity\n * @internal\n */\nexport const AUTHORIZATION_RULES = \"AuthorizationRules\";\n\n/**\n * Is Anonymous Accessible field\n * @internal\n */\nexport const IS_ANONYMOUS_ACCESSIBLE = \"IsAnonymousAccessible\";\n\n/**\n * Entity Availability Status field\n * @internal\n */\nexport const ENTITY_AVAILABILITY_STATUS = \"EntityAvailabilityStatus\";\n\n/**\n * Enable express option\n * @internal\n */\nexport const ENABLE_EXPRESS = \"EnableExpress\";\n\n/**\n * Is express option\n * @internal\n */\nexport const IS_EXPRESS = \"IsExpress\";\n\n/**\n * Enable Subscription Partitioning option\n * @internal\n */\nexport const ENABLE_SUBSCRIPTION_PARTITIONING = \"EnableSubscriptionPartitioning\";\n\n/**\n * Filtering Messages Before Publishing option\n * @internal\n */\nexport const FILTER_MESSAGES_BEFORE_PUBLISHING = \"FilteringMessagesBeforePublishing\";\n\n/**\n * The entity's size in bytes.\n *\n * @internal\n */\nexport const SIZE_IN_BYTES = \"SizeInBytes\";\n\n/**\n * The entity's message count.\n *\n * @internal\n */\nexport const MESSAGE_COUNT = \"MessageCount\";\n\n/**\n * The topic's subscription count.\n *\n * @internal\n */\nexport const SUBSCRIPTION_COUNT = \"SubscriptionCount\";\n\n/**\n * The topic / subscription's count details.\n *\n * @internal\n */\nexport const COUNT_DETAILS = \"CountDetails\";\n\n/**\n * The default rule name.\n *\n * @internal\n */\nexport const DEFAULT_RULE_NAME = \"$Default\";\n\n/**\n * Max idle time before entity is deleted.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const AUTO_DELETE_ON_IDLE = \"AutoDeleteOnIdle\";\n\n/**\n * The status information on response\n *\n * @internal\n */\nexport const STATUS = \"Status\";\n\n/**\n * The URL of Service Bus entity to forward messages to.\n *\n * @internal\n */\nexport const FORWARD_TO = \"ForwardTo\";\n\n/**\n * The user meta data information\n *\n * @internal\n */\nexport const USER_METADATA = \"UserMetadata\";\n\n/**\n * The maximum size in megabytes.\n *\n * @internal\n */\nexport const MAX_SIZE_IN_MEGABYTES = \"MaxSizeInMegabytes\";\n/**\n * The maximum size in kilobytes.\n *\n * @internal\n */\nexport const MAX_MESSAGE_SIZE_IN_KILOBYTES = \"MaxMessageSizeInKilobytes\";\n/**\n * The default message time to live.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const DEFAULT_MESSAGE_TIME_TO_LIVE = \"DefaultMessageTimeToLive\";\n\n/**\n * The lock duration.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const LOCK_DURATION = \"LockDuration\";\n\n/**\n * The indication if session is required or not.\n *\n * @internal\n */\nexport const REQUIRES_SESSION = \"RequiresSession\";\n\n/**\n * The indication if duplicate detection is required or not.\n *\n * @internal\n */\nexport const REQUIRES_DUPLICATE_DETECTION = \"RequiresDuplicateDetection\";\n\n/**\n * The indication if dead lettering on message expiration. If it is enabled and a message expires,\n * the Service Bus moves the message from the queue into the entity dead-letter sub-queue.\n * If disabled, message will be permanently deleted from the main entity.\n * Settable only at entity creation time.\n *\n * @internal\n */\nexport const DEAD_LETTERING_ON_MESSAGE_EXPIRATION = \"DeadLetteringOnMessageExpiration\";\n\n/**\n * The indication if dead lettering on filter evaluation exceptions.\n *\n * @internal\n */\nexport const DEAD_LETTERING_ON_FILTER_EVALUATION_EXCEPTIONS =\n \"DeadLetteringOnFilterEvaluationExceptions\";\n\n/**\n * The history time window for duplicate detection.\n * This is specified in ISO-8601 duration format such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n * @internal\n */\nexport const DUPLICATE_DETECTION_HISTORY_TIME_WINDOW = \"DuplicateDetectionHistoryTimeWindow\";\n\n/**\n * The maximum delivery count of messages after which if it is still not settled, gets moved to the dead-letter sub-queue.\n *\n * @internal\n */\nexport const MAX_DELIVERY_COUNT = \"MaxDeliveryCount\";\n\n/**\n * Indicates if the queue has enabled batch operations.\n *\n * @internal\n */\nexport const ENABLE_BATCHED_OPERATIONS = \"EnableBatchedOperations\";\n\n/**\n * Indicates whether the topic can be ordered\n *\n * @internal\n */\nexport const SUPPORT_ORDERING = \"SupportOrdering\";\n\n/**\n * Indicates whether the topic/queue should be split across multiple partitions\n *\n * @internal\n */\nexport const ENABLE_PARTITIONING = \"EnablePartitioning\";\n\n/**\n * The URL of Service Bus entity to forward deadlettered messages to.\n *\n * @internal\n */\nexport const FORWARD_DEADLETTERED_MESSAGES_TO = \"ForwardDeadLetteredMessagesTo\";\n\n/**\n * Query string parameter to set Service Bus API version\n *\n * @internal\n */\nexport const API_VERSION_QUERY_KEY = \"api-version\";\n\n/**\n * Current API version being sent to service bus\n *\n * @internal\n */\nexport const CURRENT_API_VERSION = \"2021-05\";\n\n/**\n * Constant representing the Odata Error 'message' property\n *\n * @internal\n */\nexport const ODATA_ERROR_MESSAGE = \"message\";\n/**\n * Constant representing the 'value' property of Odata Error 'message' property\n *\n * @internal\n */\nexport const ODATA_ERROR_MESSAGE_VALUE = \"value\";\n\n/**\n * Marker for atom metadata.\n *\n * @internal\n */\nexport const XML_METADATA_MARKER = \"$\";\n\n/**\n * Marker for atom value.\n *\n * @internal\n */\nexport const XML_VALUE_MARKER = \"_\";\n\n/**\n * Constant representing the property where the atom default elements are stored.\n *\n * @internal\n */\nexport const ATOM_METADATA_MARKER = \"_\";\n\n/**\n * Known HTTP status codes as documented and referenced in ATOM based management API feature\n * https://docs.microsoft.com/dotnet/api/system.net.httpstatuscode?view=netframework-4.8\n * @internal\n */\nexport const HttpResponseCodes = {\n 100: \"Continue\",\n 101: \"SwitchingProtocols\",\n 200: \"Ok\",\n 201: \"Created\",\n 202: \"Accepted\",\n 203: \"NonAuthoritativeInformation\",\n 204: \"NoContent\",\n 205: \"ResetContent\",\n 206: \"PartialContent\",\n 300: \"MultipleChoices\",\n 301: \"Moved\",\n 302: \"Redirect\",\n 303: \"RedirectMethod\",\n 304: \"NotModified\",\n 305: \"UseProxy\",\n 306: \"Unused\",\n 400: \"BadRequest\",\n 401: \"Unauthorized\",\n 402: \"PaymentRequired\",\n 403: \"Forbidden\",\n 404: \"NotFound\",\n 405: \"MethodNotAllowed\",\n 406: \"NotAcceptable\",\n 407: \"ProxyAuthenticationRequired\",\n 409: \"Conflict\",\n 410: \"Gone\",\n 411: \"LengthRequired\",\n 412: \"PreconditionFailed\",\n 413: \"RequestEntityTooLarge\",\n 414: \"RequestUriTooLong\",\n 415: \"UnsupportedMediaType\",\n 416: \"RequestRangeNotSatisfiable\",\n 417: \"ExpectationFailed\",\n 426: \"UpgradeRequired\",\n 500: \"InternalServerError\",\n 501: \"NotImplemented\",\n 502: \"BadGateway\",\n 503: \"ServiceUnavailable\",\n 504: \"GatewayTimeout\",\n 505: \"HttpVersionNotSupported\",\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @internal\n */\nimport { URL } from \"url\";\n\n/**\n * @internal\n */\nexport const parseURL = (rawUrl: string): URL => {\n return new URL(rawUrl);\n};\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * A collection of HttpHeaders that can be sent with a HTTP request.\n */\nfunction getHeaderKey(headerName: string): string {\n return headerName.toLowerCase();\n}\n\n/**\n * An individual header within a HttpHeaders collection.\n */\nexport interface HttpHeader {\n /**\n * The name of the header.\n */\n name: string;\n\n /**\n * The value of the header.\n */\n value: string;\n}\n\n/**\n * A HttpHeaders collection represented as a simple JSON object.\n */\nexport type RawHttpHeaders = { [headerName: string]: string };\n\n/**\n * A collection of HTTP header key/value pairs.\n */\nexport interface HttpHeadersLike {\n /**\n * Set a header in this collection with the provided name and value. The name is\n * case-insensitive.\n * @param headerName - The name of the header to set. This value is case-insensitive.\n * @param headerValue - The value of the header to set.\n */\n set(headerName: string, headerValue: string | number): void;\n /**\n * Get the header value for the provided header name, or undefined if no header exists in this\n * collection with the provided name.\n * @param headerName - The name of the header.\n */\n get(headerName: string): string | undefined;\n /**\n * Get whether or not this header collection contains a header entry for the provided header name.\n */\n contains(headerName: string): boolean;\n /**\n * Remove the header with the provided headerName. Return whether or not the header existed and\n * was removed.\n * @param headerName - The name of the header to remove.\n */\n remove(headerName: string): boolean;\n /**\n * Get the headers that are contained this collection as an object.\n */\n rawHeaders(): RawHttpHeaders;\n /**\n * Get the headers that are contained in this collection as an array.\n */\n headersArray(): HttpHeader[];\n /**\n * Get the header names that are contained in this collection.\n */\n headerNames(): string[];\n /**\n * Get the header values that are contained in this collection.\n */\n headerValues(): string[];\n /**\n * Create a deep clone/copy of this HttpHeaders collection.\n */\n clone(): HttpHeadersLike;\n /**\n * Get the JSON object representation of this HTTP header collection.\n * The result is the same as `rawHeaders()`.\n */\n toJson(options?: { preserveCase?: boolean }): RawHttpHeaders;\n}\n\nexport function isHttpHeadersLike(object?: unknown): object is HttpHeadersLike {\n if (object && typeof object === \"object\") {\n const castObject = object as {\n rawHeaders: unknown;\n clone: unknown;\n get: unknown;\n set: unknown;\n contains: unknown;\n remove: unknown;\n headersArray: unknown;\n headerValues: unknown;\n headerNames: unknown;\n toJson: unknown;\n };\n if (\n typeof castObject.rawHeaders === \"function\" &&\n typeof castObject.clone === \"function\" &&\n typeof castObject.get === \"function\" &&\n typeof castObject.set === \"function\" &&\n typeof castObject.contains === \"function\" &&\n typeof castObject.remove === \"function\" &&\n typeof castObject.headersArray === \"function\" &&\n typeof castObject.headerValues === \"function\" &&\n typeof castObject.headerNames === \"function\" &&\n typeof castObject.toJson === \"function\"\n ) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * A collection of HTTP header key/value pairs.\n */\nexport class HttpHeaders implements HttpHeadersLike {\n private readonly _headersMap: { [headerKey: string]: HttpHeader };\n\n constructor(rawHeaders?: RawHttpHeaders) {\n this._headersMap = {};\n if (rawHeaders) {\n for (const headerName in rawHeaders) {\n this.set(headerName, rawHeaders[headerName]);\n }\n }\n }\n\n /**\n * Set a header in this collection with the provided name and value. The name is\n * case-insensitive.\n * @param headerName - The name of the header to set. This value is case-insensitive.\n * @param headerValue - The value of the header to set.\n */\n public set(headerName: string, headerValue: string | number): void {\n this._headersMap[getHeaderKey(headerName)] = {\n name: headerName,\n value: headerValue.toString(),\n };\n }\n\n /**\n * Get the header value for the provided header name, or undefined if no header exists in this\n * collection with the provided name.\n * @param headerName - The name of the header.\n */\n public get(headerName: string): string | undefined {\n const header: HttpHeader = this._headersMap[getHeaderKey(headerName)];\n return !header ? undefined : header.value;\n }\n\n /**\n * Get whether or not this header collection contains a header entry for the provided header name.\n */\n public contains(headerName: string): boolean {\n return !!this._headersMap[getHeaderKey(headerName)];\n }\n\n /**\n * Remove the header with the provided headerName. Return whether or not the header existed and\n * was removed.\n * @param headerName - The name of the header to remove.\n */\n public remove(headerName: string): boolean {\n const result: boolean = this.contains(headerName);\n delete this._headersMap[getHeaderKey(headerName)];\n return result;\n }\n\n /**\n * Get the headers that are contained this collection as an object.\n */\n public rawHeaders(): RawHttpHeaders {\n return this.toJson({ preserveCase: true });\n }\n\n /**\n * Get the headers that are contained in this collection as an array.\n */\n public headersArray(): HttpHeader[] {\n const headers: HttpHeader[] = [];\n for (const headerKey in this._headersMap) {\n headers.push(this._headersMap[headerKey]);\n }\n return headers;\n }\n\n /**\n * Get the header names that are contained in this collection.\n */\n public headerNames(): string[] {\n const headerNames: string[] = [];\n const headers: HttpHeader[] = this.headersArray();\n for (let i = 0; i < headers.length; ++i) {\n headerNames.push(headers[i].name);\n }\n return headerNames;\n }\n\n /**\n * Get the header values that are contained in this collection.\n */\n public headerValues(): string[] {\n const headerValues: string[] = [];\n const headers: HttpHeader[] = this.headersArray();\n for (let i = 0; i < headers.length; ++i) {\n headerValues.push(headers[i].value);\n }\n return headerValues;\n }\n\n /**\n * Get the JSON object representation of this HTTP header collection.\n */\n public toJson(options: { preserveCase?: boolean } = {}): RawHttpHeaders {\n const result: RawHttpHeaders = {};\n if (options.preserveCase) {\n for (const headerKey in this._headersMap) {\n const header: HttpHeader = this._headersMap[headerKey];\n result[header.name] = header.value;\n }\n } else {\n for (const headerKey in this._headersMap) {\n const header: HttpHeader = this._headersMap[headerKey];\n result[getHeaderKey(header.name)] = header.value;\n }\n }\n return result;\n }\n\n /**\n * Get the string representation of this HTTP header collection.\n */\n public toString(): string {\n return JSON.stringify(this.toJson({ preserveCase: true }));\n }\n\n /**\n * Create a deep clone/copy of this HttpHeaders collection.\n */\n public clone(): HttpHeaders {\n const resultPreservingCasing: RawHttpHeaders = {};\n for (const headerKey in this._headersMap) {\n const header: HttpHeader = this._headersMap[headerKey];\n resultPreservingCasing[header.name] = header.value;\n }\n return new HttpHeaders(resultPreservingCasing);\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport {\n HttpHeaders,\n HttpMethods,\n PipelineRequest,\n PipelineResponse,\n ProxySettings,\n} from \"@azure/core-rest-pipeline\";\nimport { HttpHeadersLike, HttpHeaders as HttpHeadersV1 } from \"./httpHeaders\";\n\n/**\n * Fired in response to upload or download progress.\n */\nexport type TransferProgressEvent = {\n /**\n * The number of bytes loaded so far.\n */\n loadedBytes: number;\n};\n\n/**\n * A description of a HTTP request to be made to a remote server.\n */\nexport interface WebResourceLike {\n /**\n * The URL being accessed by the request.\n */\n url: string;\n /**\n * The HTTP method to use when making the request.\n */\n method: HttpMethods;\n /**\n * The HTTP body contents of the request.\n */\n body?: any;\n /**\n * The HTTP headers to use when making the request.\n */\n headers: HttpHeadersLike;\n /**\n * Whether or not the body of the HttpOperationResponse should be treated as a stream.\n * @deprecated Use streamResponseStatusCodes property instead.\n */\n streamResponseBody?: boolean;\n /**\n * A list of response status codes whose corresponding HttpOperationResponse body should be treated as a stream.\n */\n streamResponseStatusCodes?: Set<number>;\n /**\n * Form data, used to build the request body.\n */\n formData?: any;\n /**\n * A query string represented as an object.\n */\n query?: { [key: string]: any };\n /**\n * If credentials (cookies) should be sent along during an XHR.\n */\n withCredentials: boolean;\n /**\n * The number of milliseconds a request can take before automatically being terminated.\n * If the request is terminated, an `AbortError` is thrown.\n */\n timeout: number;\n /**\n * Proxy configuration.\n */\n proxySettings?: ProxySettings;\n /**\n * If the connection should be reused.\n */\n keepAlive?: boolean;\n /**\n * Whether or not to decompress response according to Accept-Encoding header (node-fetch only)\n */\n decompressResponse?: boolean;\n /**\n * A unique identifier for the request. Used for logging and tracing.\n */\n requestId: string;\n\n /**\n * Signal of an abort controller. Can be used to abort both sending a network request and waiting for a response.\n */\n abortSignal?: AbortSignalLike;\n\n /**\n * Callback which fires upon upload progress.\n */\n onUploadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Callback which fires upon download progress. */\n onDownloadProgress?: (progress: TransferProgressEvent) => void;\n}\n\n/**\n * The properties on an HTTP response which will always be present.\n */\nexport interface HttpResponse {\n /**\n * The raw request\n */\n request: WebResourceLike;\n\n /**\n * The HTTP response status (e.g. 200)\n */\n status: number;\n\n /**\n * The HTTP response headers.\n */\n headers: HttpHeadersLike;\n}\n\nfunction toHttpHeaderLike(headers: HttpHeaders): HttpHeadersLike {\n return new HttpHeadersV1(headers.toJSON({ preserveCase: true }));\n}\n\nfunction toWebResourceLike(request: PipelineRequest): WebResourceLike {\n return {\n url: request.url,\n method: request.method,\n headers: toHttpHeaderLike(request.headers),\n withCredentials: request.withCredentials,\n timeout: request.timeout,\n requestId: request.headers.get(\"x-ms-client-request-id\") || \"\",\n };\n}\n\n/**\n * Helper to transform PipelineResponse to slimmed-down HttpResponse used in Service Bus.\n */\nexport function toHttpResponse(response: PipelineResponse): HttpResponse {\n return {\n request: toWebResourceLike(response.request),\n status: response.status,\n headers: toHttpHeaderLike(response.headers),\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isMessagingError, MessagingError, translate } from \"@azure/core-amqp\";\nimport { AmqpError } from \"rhea-promise\";\nimport { isObjectWithProperties } from \"@azure/core-util\";\n\n/**\n * Service Bus failure codes.\n */\nexport type ServiceBusErrorCode =\n // note: This list is intended to loosely follow https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/servicebus/Azure.Messaging.ServiceBus/src/Primitives/ServiceBusFailureReason.cs\n /**\n * The exception was the result of a general error within the client library.\n */\n | \"GeneralError\"\n /**\n * A Service Bus resource cannot be found by the Service Bus service.\n */\n | \"MessagingEntityNotFound\"\n /**\n * The lock on the message is lost. Callers should attempt to receive and process the message again.\n */\n | \"MessageLockLost\"\n /**\n * The requested message was not found.\n */\n | \"MessageNotFound\"\n /**\n * A message is larger than the maximum size allowed for its transport.\n */\n | \"MessageSizeExceeded\"\n /**\n * An entity with the same name exists under the same namespace.\n */\n | \"MessagingEntityAlreadyExists\"\n /**\n * The Messaging Entity is disabled. Enable the entity again using Portal.\n */\n | \"MessagingEntityDisabled\"\n /**\n * The quota applied to an Service Bus resource has been exceeded while interacting with the Azure Service Bus service.\n */\n | \"QuotaExceeded\"\n /**\n * The Azure Service Bus service reports that it is busy in response to a client request to perform an operation.\n */\n | \"ServiceBusy\"\n /**\n * An operation or other request timed out while interacting with the Azure Service Bus service.\n */\n | \"ServiceTimeout\"\n /**\n * There was a general communications error encountered when interacting with the Azure Service Bus service.\n */\n | \"ServiceCommunicationProblem\"\n /**\n * The requested session cannot be locked.\n */\n | \"SessionCannotBeLocked\"\n /**\n * The lock on the session has expired. Callers should request the session again.\n */\n | \"SessionLockLost\"\n /**\n * The user doesn't have access to the entity.\n */\n | \"UnauthorizedAccess\";\n\n/**\n * Translation between the MessagingErrorCodes into a ServiceBusCode\n *\n * @internal\n */\nexport const wellKnownMessageCodesToServiceBusCodes: Map<string, ServiceBusErrorCode> = new Map([\n [\"MessagingEntityNotFoundError\", \"MessagingEntityNotFound\"],\n [\"MessageLockLostError\", \"MessageLockLost\"],\n [\"MessageNotFoundError\", \"MessageNotFound\"],\n [\"MessageTooLargeError\", \"MessageSizeExceeded\"],\n [\"MessagingEntityAlreadyExistsError\", \"MessagingEntityAlreadyExists\"],\n [\"MessagingEntityDisabledError\", \"MessagingEntityDisabled\"],\n [\"QuotaExceededError\", \"QuotaExceeded\"],\n [\"ServerBusyError\", \"ServiceBusy\"],\n\n [\"OperationTimeoutError\", \"ServiceTimeout\"],\n [\"ServiceUnavailableError\", \"ServiceTimeout\"],\n [\"ServiceCommunicationError\", \"ServiceCommunicationProblem\"],\n [\"SessionCannotBeLockedError\", \"SessionCannotBeLocked\"],\n [\"SessionLockLostError\", \"SessionLockLost\"],\n [\"UnauthorizedError\", \"UnauthorizedAccess\"],\n]);\n\n/**\n * Errors that occur within Service Bus.\n */\nexport class ServiceBusError extends MessagingError {\n /**\n * The reason for the failure.\n *\n * - **GeneralError**: The exception was the result of a general error within the client library.\n * - **MessagingEntityNotFound**: A Service Bus resource cannot be found by the Service Bus service.\n * - **MessageLockLost**: The lock on the message is lost. Callers should attempt to receive and process the message again.\n * - **MessageNotFound**: The requested message was not found.\n * - **MessageSizeExceeded**: A message is larger than the maximum size allowed for its transport.\n * - **MessagingEntityAlreadyExists**: An entity with the same name exists under the same namespace.\n * - **MessagingEntityDisabled**: The Messaging Entity is disabled. Enable the entity again using Portal.\n * - **QuotaExceeded**: The quota applied to an Service Bus resource has been exceeded while interacting with the Azure Service Bus service.\n * - **ServiceBusy**: The Azure Service Bus service reports that it is busy in response to a client request to perform an operation.\n * - **ServiceTimeout**: An operation or other request timed out while interacting with the Azure Service Bus service.\n * - **ServiceCommunicationProblem**: There was a general communications error encountered when interacting with the Azure Service Bus service.\n * - **SessionCannotBeLocked**: The requested session cannot be locked.\n * - **SessionLockLost**: The lock on the session has expired. Callers should request the session again.\n * - **UnauthorizedAccess\"**: The user doesn't have access to the entity.\n */\n // NOTE: make sure this list and the list above are properly kept in sync.\n code: ServiceBusErrorCode;\n\n /**\n * @param message - The error message that provides more information about the error.\n * @param code - The reason for the failure.\n */\n constructor(message: string, code: ServiceBusErrorCode);\n /**\n * @param messagingError - An error whose properties will be copied to the ServiceBusError.\n */\n constructor(messagingError: MessagingError);\n constructor(messageOrError: string | MessagingError, code?: ServiceBusErrorCode) {\n const message = typeof messageOrError === \"string\" ? messageOrError : messageOrError.message;\n super(message);\n\n if (typeof messageOrError === \"string\") {\n this.code = code ?? \"GeneralError\";\n } else {\n for (const prop in messageOrError) {\n (this as any)[prop] = (messageOrError as any)[prop];\n }\n\n this.code = ServiceBusError.normalizeMessagingCode(messageOrError.code);\n // For GeneralErrors, prefix the error message with the MessagingError code to provide\n // more context to the user.\n if (this.code === \"GeneralError\" && messageOrError.code) {\n this.message = `${messageOrError.code}: ${this.message}`;\n }\n }\n\n this.name = \"ServiceBusError\";\n }\n\n private static normalizeMessagingCode(oldCode?: string): ServiceBusErrorCode {\n if (oldCode == null || !wellKnownMessageCodesToServiceBusCodes.has(oldCode)) {\n return \"GeneralError\";\n }\n\n return wellKnownMessageCodesToServiceBusCodes.get(oldCode)!;\n }\n}\n\n/**\n * Translates an error into either an Error or a ServiceBusError which provides a `reason` code that\n * can be used by clients to programmatically react to errors.\n *\n * If you are calling `@azure/core-amqp/translate` you should swap to using this function instead since it provides\n * Service Bus specific handling of the error (falling back to default translate behavior otherwise).\n *\n * @internal\n */\nexport function translateServiceBusError(err: AmqpError | Error): ServiceBusError | Error {\n if (isServiceBusError(err)) {\n return err;\n }\n\n const translatedError = translate(err);\n\n if (isMessagingError(translatedError)) {\n return new ServiceBusError(translatedError);\n }\n\n return translatedError;\n}\n\n/**\n * Determines if an error is of type `ServiceBusError`\n *\n * @param err - An error to check to see if it's of type ServiceBusError\n */\nexport function isServiceBusError(err: unknown): err is ServiceBusError {\n return isObjectWithProperties(err, [\"name\"]) && err.name === \"ServiceBusError\";\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport Long from \"long\";\nimport { logger, receiverLogger, messageLogger, ServiceBusLogger } from \"../log\";\nimport { AmqpError, OperationTimeoutError, generate_uuid } from \"rhea-promise\";\nimport isBuffer from \"is-buffer\";\nimport { Buffer } from \"buffer\";\nimport * as Constants from \"../util/constants\";\nimport { AbortError, AbortSignalLike } from \"@azure/abort-controller\";\nimport { PipelineResponse } from \"@azure/core-rest-pipeline\";\nimport { isDefined } from \"@azure/core-util\";\nimport { HttpResponse, toHttpResponse } from \"./compat\";\nimport { ErrorNameConditionMapper, StandardAbortMessage, delay } from \"@azure/core-amqp\";\nimport { translateServiceBusError } from \"../serviceBusError\";\n\n// This is the only dependency we have on DOM types, so rather than require\n// the DOM lib we can just shim this in.\n/**\n * @hidden\n * @internal\n */\ninterface Navigator {\n hardwareConcurrency: number;\n}\n/**\n * @hidden\n * @internal\n */\ndeclare const navigator: Navigator;\n\n/**\n * @internal\n * Provides a uniue name by appending a string guid to the given string in the following format:\n * `{name}-{uuid}`.\n * @param name - The nme of the entity\n */\nexport function getUniqueName(name: string): string {\n return `${name}-${generate_uuid()}`;\n}\n\n/**\n * @internal\n * Returns the passed identifier if it is not undefined or empty;\n * otherwise generate and returns a unique one in the following format;\n * `{prefix}-{uuid}`.\n * @param prefix - The prefix used to generate identifier\n * @param identifier - an identifier name\n */\nexport function ensureValidIdentifier(prefix: string, identifier?: string): string {\n return identifier ? identifier : getUniqueName(prefix);\n}\n\n/**\n * @internal\n * If you try to turn a Guid into a Buffer in .NET, the bytes of the first three groups get\n * flipped within the group, but the last two groups don't get flipped, so we end up with a\n * different byte order. This is the order of bytes needed to make Service Bus recognize the token.\n *\n * @param lockToken - The lock token whose bytes need to be reorded.\n * @returns Buffer representing reordered bytes.\n */\nexport function reorderLockToken(lockTokenBytes: Buffer): Buffer {\n if (!lockTokenBytes || !Buffer.isBuffer(lockTokenBytes)) {\n return lockTokenBytes;\n }\n\n return Buffer.from([\n lockTokenBytes[3],\n lockTokenBytes[2],\n lockTokenBytes[1],\n lockTokenBytes[0],\n\n lockTokenBytes[5],\n lockTokenBytes[4],\n\n lockTokenBytes[7],\n lockTokenBytes[6],\n\n lockTokenBytes[8],\n lockTokenBytes[9],\n\n lockTokenBytes[10],\n lockTokenBytes[11],\n lockTokenBytes[12],\n lockTokenBytes[13],\n lockTokenBytes[14],\n lockTokenBytes[15],\n ]);\n}\n\n/**\n * @internal\n * Provides the time in milliseconds after which the lock renewal should occur.\n * @param lockedUntilUtc - The time until which the message is locked.\n */\nexport function calculateRenewAfterDuration(lockedUntilUtc: Date): number {\n const now = Date.now();\n const lockedUntil = lockedUntilUtc.getTime();\n const remainingTime = lockedUntil - now;\n receiverLogger.verbose(\"Locked until utc : %d\", lockedUntil);\n receiverLogger.verbose(\"Current time is : %d\", now);\n receiverLogger.verbose(\"Remaining time is : %d\", remainingTime);\n if (remainingTime < 1000) {\n return 0;\n }\n const buffer = Math.min(remainingTime / 2, 10000); // 10 seconds\n const renewAfter = remainingTime - buffer;\n receiverLogger.verbose(\"Renew after : %d\", renewAfter);\n return renewAfter;\n}\n\n/**\n * @internal\n * Converts the .net ticks to a JS Date object.\n *\n * - The epoch for the DateTimeOffset type is `0000-01-01`, while the epoch for JS Dates is\n * `1970-01-01`.\n * - The DateTimeOffset ticks value for the date `1970-01-01` is `621355968000000000`.\n * - Hence, to convert it to the JS epoch; we `subtract` the delta from the given value.\n * - Ticks in DateTimeOffset is `1/10000000` second, while ticks in JS Date is `1/1000` second.\n * - Thus, we `divide` the value by `10000` to convert it to JS Date ticks.\n *\n * @param buf - Input as a Buffer\n * @returns The JS Date object.\n */\nexport function convertTicksToDate(buf: number[]): Date {\n const epochMicroDiff: number = 621355968000000000;\n const longValue: Long = Long.fromBytesBE(buf);\n const timeInMS = longValue.sub(epochMicroDiff).div(10000).toNumber();\n const result = new Date(timeInMS);\n logger.verbose(\"The converted date is: %s\", result.toString());\n return result;\n}\n\n/**\n * @internal\n * Converts any given input to a Buffer.\n * @param input - The input that needs to be converted to a Buffer.\n */\nexport function toBuffer(input: unknown): Buffer {\n let result: any;\n messageLogger.verbose(\n \"[utils.toBuffer] The given message body that needs to be converted to buffer is: \",\n input,\n );\n if (isBuffer(input)) {\n result = input;\n } else {\n // string, undefined, null, boolean, array, object, number should end up here\n // coercing undefined to null as that will ensure that null value will be given to the\n // customer on receive.\n if (input === undefined) input = null;\n try {\n const inputStr = JSON.stringify(input);\n result = Buffer.from(inputStr, \"utf8\");\n } catch (err: any) {\n const msg =\n `An error occurred while executing JSON.stringify() on the given input ` +\n input +\n `${err instanceof Error ? err.stack : JSON.stringify(err)}`;\n messageLogger.warning(\"[utils.toBuffer] \" + msg);\n throw err instanceof Error ? err : new Error(msg);\n }\n }\n messageLogger.verbose(\"[utils.toBuffer] The converted buffer is: %O.\", result);\n return result;\n}\n\n/**\n * @internal\n * Helper utility to retrieve `string` value from given string,\n * or throws error if undefined.\n */\nexport function getString(value: unknown, nameOfProperty: string): string {\n const result = getStringOrUndefined(value);\n if (result === undefined) {\n throw new Error(\n `\"${nameOfProperty}\" received from service expected to be a string value and not undefined.`,\n );\n }\n return result;\n}\n\n/**\n * @internal\n * Helper utility to retrieve `string` value from given input,\n * or undefined if not passed in.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getStringOrUndefined(value: any): string | undefined {\n if (!isDefined(value)) {\n return undefined;\n }\n return value.toString();\n}\n\n/**\n * @internal\n * Helper utility to retrieve `integer` value from given string,\n * or throws error if undefined.\n */\nexport function getInteger(value: unknown, nameOfProperty: string): number {\n const result = getIntegerOrUndefined(value);\n if (result === undefined) {\n throw new Error(\n `\"${nameOfProperty}\" received from service expected to be a number value and not undefined.`,\n );\n }\n return result;\n}\n\n/**\n * @internal\n * Helper utility to retrieve `integer` value from given string,\n * or undefined if not passed in.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getIntegerOrUndefined(value: any): number | undefined {\n if (!isDefined(value)) {\n return undefined;\n }\n const result = parseInt(value.toString());\n return isNaN(result) ? undefined : result;\n}\n\n/**\n * @internal\n * Helper utility to convert ISO-8601 time into Date type.\n */\nexport function getDate(value: string, nameOfProperty: string): Date {\n return new Date(getString(value, nameOfProperty));\n}\n\n/**\n * @internal\n * Helper utility to retrieve `boolean` value from given string,\n * or throws error if undefined.\n */\nexport function getBoolean(value: unknown, nameOfProperty: string): boolean {\n const result = getBooleanOrUndefined(value);\n if (result === undefined) {\n throw new Error(\n `\"${nameOfProperty}\" received from service expected to be a boolean value and not undefined.`,\n );\n }\n return result;\n}\n\n/**\n * @internal\n * Helper utility to retrieve `boolean` value from given string,\n * or undefined if not passed in.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getBooleanOrUndefined(value: any): boolean | undefined {\n if (!isDefined(value)) {\n return undefined;\n }\n return value.toString().trim().toLowerCase() === \"true\";\n}\n\n/**\n * @internal\n * Helps in differentiating JSON like objects from other kinds of objects.\n */\nconst EMPTY_JSON_OBJECT_CONSTRUCTOR = {}.constructor;\n\n/**\n * @internal\n * Returns `true` if given input is a JSON like object.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function isJSONLikeObject(value: any): boolean {\n // `value.constructor === {}.constructor` differentiates among the \"object\"s,\n // would filter the JSON objects and won't match any array or other kinds of objects\n\n // -------------------------------------------------------------------------------\n // Few examples | typeof obj ===\"object\" | obj.constructor==={}.constructor\n // -------------------------------------------------------------------------------\n // {abc:1} | true | true\n // [\"a\",\"b\"] | true | false\n // [{\"a\":1},{\"b\":2}] | true | false\n // new Date() | true | false\n // 123 | false | false\n // -------------------------------------------------------------------------------\n return typeof value === \"object\" && value.constructor === EMPTY_JSON_OBJECT_CONSTRUCTOR;\n}\n\n/**\n * @internal\n * Helper utility to retrieve message count details from given input,\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getMessageCountDetails(value: any): MessageCountDetails {\n const xmlnsPrefix = getXMLNSPrefix(value);\n if (!isDefined(value)) {\n value = {};\n }\n return {\n activeMessageCount: parseInt(value[`${xmlnsPrefix}:ActiveMessageCount`]) || 0,\n deadLetterMessageCount: parseInt(value[`${xmlnsPrefix}:DeadLetterMessageCount`]) || 0,\n scheduledMessageCount: parseInt(value[`${xmlnsPrefix}:ScheduledMessageCount`]) || 0,\n transferMessageCount: parseInt(value[`${xmlnsPrefix}:TransferMessageCount`]) || 0,\n transferDeadLetterMessageCount:\n parseInt(value[`${xmlnsPrefix}:TransferDeadLetterMessageCount`]) || 0,\n };\n}\n\n/**\n * @internal\n * Gets the xmlns prefix from the root of the objects that are part of the parsed response body.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getXMLNSPrefix(value: any): string {\n if (!value[Constants.XML_METADATA_MARKER]) {\n throw new Error(\n `Error occurred while parsing the response body - cannot find the XML_METADATA_MARKER \"$\" on the object ${JSON.stringify(\n value,\n )}`,\n );\n }\n const keys = Object.keys(value[Constants.XML_METADATA_MARKER]);\n if (keys.length !== 1) {\n throw new Error(\n `Error occurred while parsing the response body - unexpected number of \"xmlns:\\${prefix}\" keys at ${JSON.stringify(\n value[Constants.XML_METADATA_MARKER],\n )}`,\n );\n }\n if (!keys[0].startsWith(\"xmlns:\")) {\n throw new Error(\n `Error occurred while parsing the response body - unexpected key at ${JSON.stringify(\n value[Constants.XML_METADATA_MARKER],\n )}`,\n );\n }\n // Pick the substring that's after \"xmlns:\"\n const xmlnsPrefix = keys[0].substring(6);\n if (!xmlnsPrefix) {\n throw new Error(\n `Error occurred while parsing the response body - unexpected xmlns prefix at ${JSON.stringify(\n value[Constants.XML_METADATA_MARKER],\n )}`,\n );\n }\n return xmlnsPrefix;\n}\n\n/**\n * Represents type of message count details in ATOM based management operations.\n * @internal\n */\nexport type MessageCountDetails = {\n activeMessageCount: number;\n deadLetterMessageCount: number;\n scheduledMessageCount: number;\n transferMessageCount: number;\n transferDeadLetterMessageCount: number;\n};\n\n/**\n * Represents type of `AuthorizationRule` in ATOM based management operations.\n */\nexport interface AuthorizationRule {\n /**\n * The claim type.\n */\n claimType: string;\n /**\n * The list of rights(\"Manage\" | \"Send\" | \"Listen\").\n */\n accessRights?: (\"Manage\" | \"Send\" | \"Listen\")[];\n /**\n * The authorization rule key name.\n */\n keyName: string;\n /**\n * The primary key for the authorization rule.\n */\n primaryKey?: string;\n /**\n * The secondary key for the authorization rule.\n */\n secondaryKey?: string;\n}\n\n/**\n * @internal\n * Helper utility to retrieve array of `AuthorizationRule` from given input,\n * or undefined if not passed in.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function getAuthorizationRulesOrUndefined(value: any): AuthorizationRule[] | undefined {\n const authorizationRules: AuthorizationRule[] = [];\n\n // Ignore special case as Service Bus treats \"\" as a valid value for authorization rules\n if (typeof value === \"string\" && value.trim() === \"\") {\n return undefined;\n }\n\n if (!isDefined(value)) {\n return undefined;\n }\n\n const rawAuthorizationRules = value.AuthorizationRule;\n if (Array.isArray(rawAuthorizationRules)) {\n for (let i = 0; i < rawAuthorizationRules.length; i++) {\n authorizationRules.push(buildAuthorizationRule(rawAuthorizationRules[i]));\n }\n } else {\n authorizationRules.push(buildAuthorizationRule(rawAuthorizationRules));\n }\n return authorizationRules;\n}\n\n/**\n * @internal\n * Helper utility to build an instance of parsed authorization rule as `AuthorizationRule` from given input.\n */\nfunction buildAuthorizationRule(value: any): AuthorizationRule {\n let accessRights;\n if (isDefined(value[\"Rights\"])) {\n accessRights = value[\"Rights\"][\"AccessRights\"];\n }\n\n const authorizationRule: AuthorizationRule = {\n claimType: value[\"ClaimType\"],\n accessRights,\n keyName: value[\"KeyName\"],\n primaryKey: value[\"PrimaryKey\"],\n secondaryKey: value[\"SecondaryKey\"],\n };\n\n if (authorizationRule.accessRights && !Array.isArray(authorizationRule.accessRights)) {\n authorizationRule.accessRights = [authorizationRule.accessRights];\n }\n return authorizationRule;\n}\n\n/**\n * @internal\n * Helper utility to extract output containing array of `RawAuthorizationRule` instances from given input,\n * or undefined if not passed in.\n */\nexport function getRawAuthorizationRules(authorizationRules: AuthorizationRule[] | undefined): any {\n if (!isDefined(authorizationRules)) {\n return undefined;\n }\n\n if (!Array.isArray(authorizationRules)) {\n throw new TypeError(\n `authorizationRules must be an array of AuthorizationRule objects or undefined, but received ${JSON.stringify(\n authorizationRules,\n undefined,\n 2,\n )}`,\n );\n }\n\n const rawAuthorizationRules: any[] = [];\n for (let i = 0; i < authorizationRules.length; i++) {\n rawAuthorizationRules.push(buildRawAuthorizationRule(authorizationRules[i]));\n }\n return { AuthorizationRule: rawAuthorizationRules };\n}\n\n/**\n * @internal\n * Helper utility to build an instance of raw authorization rule as RawAuthorizationRule from given `AuthorizationRule` input.\n * @param authorizationRule - parsed Authorization Rule instance\n */\nfunction buildRawAuthorizationRule(authorizationRule: AuthorizationRule): any {\n if (!isJSONLikeObject(authorizationRule) || authorizationRule === null) {\n throw new TypeError(\n `Expected authorizationRule input to be a JS object value, but received ${JSON.stringify(\n authorizationRule,\n undefined,\n 2,\n )}`,\n );\n }\n\n const rawAuthorizationRule: any = {\n ClaimType: authorizationRule.claimType,\n // ClaimValue is not settable by the users, but service expects the value for PUT requests\n ClaimValue: \"None\",\n Rights: {\n AccessRights: authorizationRule.accessRights,\n },\n KeyName: authorizationRule.keyName,\n PrimaryKey: authorizationRule.primaryKey,\n SecondaryKey: authorizationRule.secondaryKey,\n };\n rawAuthorizationRule[Constants.XML_METADATA_MARKER] = {\n \"p5:type\": \"SharedAccessAuthorizationRule\",\n \"xmlns:p5\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n return rawAuthorizationRule;\n}\n\n/**\n * @internal\n * Helper utility to check if given string is an absolute URL\n */\nexport function isAbsoluteUrl(url: string): boolean {\n const _url = url.toLowerCase();\n return _url.startsWith(\"sb://\") || _url.startsWith(\"http://\") || _url.startsWith(\"https://\");\n}\n\n/**\n * Possible values for `status` of the Service Bus messaging entities.\n */\nexport type EntityStatus =\n | \"Active\"\n | \"Creating\"\n | \"Deleting\"\n | \"ReceiveDisabled\"\n | \"SendDisabled\"\n | \"Disabled\"\n | \"Renaming\"\n | \"Restoring\"\n | \"Unknown\";\n\n/**\n * Possible values for `availabilityStatus` of the Service Bus messaging entities.\n */\nexport type EntityAvailabilityStatus =\n | \"Available\"\n | \"Limited\"\n | \"Renaming\"\n | \"Restoring\"\n | \"Unknown\";\n\n/**\n * @internal\n */\ntype setTimeoutArgs = (callback: (...args: any[]) => void, ms: number, ...args: any[]) => any;\n\n/**\n * An executor for a function that returns a Promise that obeys both a timeout and an\n * optional AbortSignal.\n * @param timeoutMs - The number of milliseconds to allow before throwing an OperationTimeoutError.\n * @param timeoutMessage - The message to place in the .description field for the thrown exception for Timeout.\n * @param abortSignal - The abortSignal associated with containing operation.\n * @param abortErrorMsg - The abort error message associated with containing operation.\n * @param value - The value to be resolved with after a timeout of t milliseconds.\n *\n * @internal\n */\nexport async function waitForTimeoutOrAbortOrResolve<T>(args: {\n actionFn: () => Promise<T>;\n timeoutMs: number;\n timeoutMessage: string;\n abortSignal?: AbortSignalLike;\n // these are optional and only here for testing.\n timeoutFunctions?: {\n setTimeoutFn: setTimeoutArgs;\n clearTimeoutFn: (timeoutId: any) => void;\n };\n}): Promise<T> {\n if (args.abortSignal && args.abortSignal.aborted) {\n throw new AbortError(StandardAbortMessage);\n }\n\n let timer: any | undefined = undefined;\n let clearAbortSignal: (() => void) | undefined = undefined;\n\n const clearAbortSignalAndTimer = (): void => {\n (args.timeoutFunctions?.clearTimeoutFn ?? clearTimeout)(timer);\n\n if (clearAbortSignal) {\n clearAbortSignal();\n }\n };\n\n // eslint-disable-next-line promise/param-names\n const abortOrTimeoutPromise = new Promise<T>((_resolve, reject) => {\n clearAbortSignal = checkAndRegisterWithAbortSignal(reject, args.abortSignal);\n\n timer = (args.timeoutFunctions?.setTimeoutFn ?? setTimeout)(() => {\n reject(new OperationTimeoutError(args.timeoutMessage));\n }, args.timeoutMs);\n });\n\n try {\n return await Promise.race([abortOrTimeoutPromise, args.actionFn()]);\n } finally {\n clearAbortSignalAndTimer();\n }\n}\n\n/**\n * Registers listener to the abort event on the abortSignal to call your abortFn and\n * returns a function that will clear the same listener.\n *\n * If abort signal is already aborted, then throws an AbortError and returns a function that does nothing\n *\n * @returns A function that removes any of our attached event listeners on the abort signal or an empty function if\n * the abortSignal was not defined.\n *\n * @internal\n */\nexport function checkAndRegisterWithAbortSignal(\n onAbortFn: (abortError: AbortError) => void,\n abortSignal?: AbortSignalLike,\n): () => void {\n if (abortSignal == null) {\n return () => {\n /** Nothing to do here, no abort signal */\n };\n }\n\n if (abortSignal.aborted) {\n throw new AbortError(StandardAbortMessage);\n }\n\n const onAbort = (): void => {\n abortSignal.removeEventListener(\"abort\", onAbort);\n onAbortFn(new AbortError(StandardAbortMessage));\n };\n\n abortSignal.addEventListener(\"abort\", onAbort);\n\n return () => abortSignal.removeEventListener(\"abort\", onAbort);\n}\n\n/**\n * @internal\n * The user agent prefix string for the ServiceBus client.\n * See guideline at https://azure.github.io/azure-sdk/general_azurecore.html#telemetry-policy\n */\nexport const libInfo: string = `azsdk-js-azureservicebus/${Constants.packageJsonInfo.version}`;\n\n/**\n * @internal\n * Returns the formatted prefix by removing the spaces, by appending the libInfo.\n */\nexport function formatUserAgentPrefix(prefix?: string): string {\n let userAgentPrefix = `${(prefix || \"\").replace(\" \", \"\")}`;\n userAgentPrefix = userAgentPrefix.length > 0 ? userAgentPrefix + \" \" : \"\";\n return `${userAgentPrefix}${libInfo}`;\n}\n\n/**\n * @internal\n * Helper method which returns `HttpResponse` from an object of shape `PipelineResponse`.\n * TODO: remove this and use toHttpResponse() directly\n */\nexport const getHttpResponseOnly = (pipelineResponse: PipelineResponse): HttpResponse =>\n toHttpResponse(pipelineResponse);\n\n/**\n * @internal\n * Type with the service versions for the ATOM API.\n */\nexport type ServiceBusAtomAPIVersion = \"2021-05\" | \"2017-04\";\n\n/**\n * @internal\n * Waits for one second if a sender is not sendable then check again. Throws\n * SenderBusyError if it is still not sendable.\n * Only waits when operation timeout is greater than one second.\n * @returns the actual waiting time.\n */\nexport async function waitForSendable(\n sendLogger: ServiceBusLogger,\n logPrefix: string,\n name: string,\n timeout: number,\n sender:\n | {\n sendable: () => boolean;\n credit: number;\n }\n | undefined,\n outgoingAvaiable: number,\n): Promise<number> {\n let waitTimeForSendable = 1000;\n if (!sender?.sendable() && timeout > waitTimeForSendable) {\n sendLogger.verbose(\n \"%s Sender '%s', waiting for 1 second for sender to become sendable\",\n logPrefix,\n name,\n );\n\n await delay(waitTimeForSendable);\n\n sendLogger.verbose(\n \"%s Sender '%s' after waiting for a second, credit: %d available: %d\",\n logPrefix,\n name,\n sender?.credit,\n outgoingAvaiable,\n );\n } else {\n waitTimeForSendable = 0;\n }\n\n if (!sender?.sendable()) {\n // let us retry to send the message after some time.\n const msg =\n `[${logPrefix}] Sender \"${name}\", ` + `cannot send the message right now. Please try later.`;\n sendLogger.warning(msg);\n const amqpError: AmqpError = {\n condition: ErrorNameConditionMapper.SenderBusyError,\n description: msg,\n };\n throw translateServiceBusError(amqpError);\n }\n return waitTimeForSendable;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n PipelineResponse,\n RestError,\n PipelineRequest,\n TransferProgressEvent,\n} from \"@azure/core-rest-pipeline\";\nimport { ServiceClient, OperationOptions, FullOperationResponse } from \"@azure/core-client\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\n\nimport * as Constants from \"./constants\";\nimport { administrationLogger as logger } from \"../log\";\nimport { Buffer } from \"buffer\";\n\nimport { parseURL } from \"./parseUrl\";\nimport { isJSONLikeObject } from \"./utils\";\nimport { isDefined } from \"@azure/core-util\";\nimport { OperationTracingOptions } from \"@azure/core-tracing\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { InternalQueueOptions } from \"../serializers/queueResourceSerializer\";\nimport { InternalTopicOptions } from \"../serializers/topicResourceSerializer\";\nimport { InternalSubscriptionOptions } from \"../serializers/subscriptionResourceSerializer\";\nimport { CreateRuleOptions } from \"../serializers/ruleResourceSerializer\";\n\n/**\n * @internal\n * Represents the internal ATOM XML serializer interface\n */\nexport interface AtomXmlSerializer {\n // eslint-disable-next-line @typescript-eslint/ban-types\n serialize(requestBodyInJson: object): Record<string, unknown>;\n\n deserialize(response: FullOperationResponse): Promise<FullOperationResponse>;\n}\n\n/**\n applies options to the pipeline request.\n */\nfunction applyRequestOptions(\n request: PipelineRequest,\n options: {\n headers?: Record<string, string>;\n onUploadProgress?: (progress: TransferProgressEvent) => void;\n onDownloadProgress?: (progress: TransferProgressEvent) => void;\n abortSignal?: AbortSignalLike;\n tracingOptions?: OperationTracingOptions;\n timeout: number;\n },\n): void {\n if (options.headers) {\n const headers = options.headers;\n for (const headerName of Object.keys(headers)) {\n request.headers.set(headerName, headers[headerName]);\n }\n }\n request.onDownloadProgress = options.onDownloadProgress;\n request.onUploadProgress = options.onUploadProgress;\n request.abortSignal = options.abortSignal;\n request.timeout = options.timeout;\n if (options.tracingOptions) {\n request.tracingOptions = options.tracingOptions;\n }\n}\n\n/**\n * @internal\n * Utility to execute Atom XML operations as HTTP requests\n */\nexport async function executeAtomXmlOperation(\n serviceBusAtomManagementClient: ServiceClient,\n request: PipelineRequest,\n serializer: AtomXmlSerializer,\n operationOptions: OperationOptions,\n requestObject?:\n | InternalQueueOptions\n | InternalTopicOptions\n | InternalSubscriptionOptions\n | CreateRuleOptions,\n): Promise<FullOperationResponse> {\n if (requestObject) {\n request.body = stringifyXML(serializer.serialize(requestObject), { rootName: \"entry\" });\n if (request.method === \"PUT\") {\n request.headers.set(\"content-length\", Buffer.byteLength(request.body));\n }\n }\n\n logger.verbose(`Executing ATOM based HTTP request: ${request.body}`);\n\n const reqPrepareOptions = {\n headers: operationOptions.requestOptions?.customHeaders,\n onUploadProgress: operationOptions.requestOptions?.onUploadProgress,\n onDownloadProgress: operationOptions.requestOptions?.onDownloadProgress,\n abortSignal: operationOptions.abortSignal,\n tracingOptions: operationOptions.tracingOptions,\n disableJsonStringifyOnBody: true,\n timeout: operationOptions.requestOptions?.timeout || 0,\n };\n applyRequestOptions(request, reqPrepareOptions);\n const response: PipelineResponse = await serviceBusAtomManagementClient.sendRequest(request);\n\n logger.verbose(`Received ATOM based HTTP response: ${response.bodyAsText}`);\n\n try {\n if (response.bodyAsText) {\n (response as FullOperationResponse).parsedBody = await parseXML(response.bodyAsText, {\n includeRoot: true,\n });\n }\n } catch (err: any) {\n const error = new RestError(\n `Error occurred while parsing the response body - expected the service to return valid xml content.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n logger.logError(err, \"Error parsing response body from Service\");\n throw error;\n }\n\n return serializer.deserialize(response);\n}\n\n/**\n * @internal\n * The key-value pairs having undefined/null as the values would lead to the empty tags in the serialized XML request.\n * Empty tags in the request body is problematic because of the following reasons.\n * - ATOM based management operations throw a \"Bad Request\" error if empty tags are included in the XML request body at top level.\n * - At the inner levels, Service assigns the empty strings as values to the empty tags instead of throwing an error.\n *\n * This method recursively removes the key-value pairs with undefined/null as the values from the request object that is to be serialized.\n *\n */\nexport function sanitizeSerializableObject(resource: { [key: string]: any }): void {\n Object.keys(resource).forEach(function (property) {\n if (!isDefined(resource[property])) {\n delete resource[property];\n } else if (isJSONLikeObject(resource[property])) {\n sanitizeSerializableObject(resource[property]);\n }\n });\n}\n\n/**\n * @internal\n * Serializes input information to construct the Atom XML request\n * @param resourceName - Name of the resource to be serialized like `QueueDescription`\n * @param resource - The entity details\n * @param allowedProperties - The set of properties that are allowed by the service for the\n * associated operation(s);\n */\nexport function serializeToAtomXmlRequest(\n resourceName: string,\n resource: unknown,\n): Record<string, unknown> {\n const content: any = {};\n\n content[resourceName] = Object.assign({}, resource);\n sanitizeSerializableObject(content[resourceName]);\n\n content[resourceName][Constants.XML_METADATA_MARKER] = {\n xmlns: \"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\",\n \"xmlns:i\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n\n content[Constants.XML_METADATA_MARKER] = { type: \"application/xml\" };\n const requestDetails: Record<string, unknown> = {\n updated: new Date().toISOString(),\n content: content,\n };\n requestDetails[Constants.XML_METADATA_MARKER] = {\n xmlns: \"http://www.w3.org/2005/Atom\",\n };\n return requestDetails;\n}\n\n/**\n * @internal\n * Transforms response to contain the parsed data.\n * @param nameProperties - The set of 'name' properties to be constructed on the\n * resultant object e.g., QueueName, TopicName, etc.\n */\nexport async function deserializeAtomXmlResponse(\n nameProperties: string[],\n response: FullOperationResponse,\n): Promise<FullOperationResponse> {\n // If received data is a non-valid HTTP response, the body is expected to contain error information\n if (response.status < 200 || response.status >= 300) {\n throw buildError(response);\n }\n\n parseAtomResult(response, nameProperties);\n\n return response;\n}\n\n/**\n * @internal\n * Utility to deserialize the given JSON content in response body based on\n * if it's a single `entry` or `feed` and updates the `response.parsedBody` to hold the evaluated output.\n * @param response - Response containing the JSON value in `response.parsedBody`\n * @param nameProperties - The set of 'name' properties to be constructed on the\n * resultant object e.g., QueueName, TopicName, etc.\n * */\nfunction parseAtomResult(response: FullOperationResponse, nameProperties: string[]): void {\n const atomResponseInJson = response.parsedBody;\n\n let result: any;\n if (!atomResponseInJson) {\n response.parsedBody = undefined;\n return;\n }\n\n if (atomResponseInJson.feed) {\n result = parseFeedResult(atomResponseInJson.feed);\n } else if (atomResponseInJson.entry) {\n result = parseEntryResult(atomResponseInJson.entry);\n }\n\n if (result) {\n if (Array.isArray(result)) {\n result.forEach((entry) => {\n setName(entry, nameProperties);\n });\n } else {\n setName(result, nameProperties);\n }\n response.parsedBody = result;\n return;\n }\n\n logger.warning(\n \"Failure in parsing response body from service. Expected response to be in Atom XML format and have either feed or entry components, but received - %0\",\n atomResponseInJson,\n );\n throw new RestError(\n \"Error occurred while parsing the response body - expected the service to return atom xml content with either feed or entry elements.\",\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n}\n\n/**\n * @internal\n * Utility to help parse given `entry` result\n */\nfunction parseEntryResult(entry: any): Record<string, unknown> | undefined {\n let result: any;\n\n if (\n typeof entry !== \"object\" ||\n entry == null ||\n typeof entry.content !== \"object\" ||\n entry.content == null\n ) {\n return undefined;\n }\n\n const contentElementNames = Object.keys(entry.content).filter(function (key) {\n return key !== Constants.XML_METADATA_MARKER;\n });\n\n if (contentElementNames && contentElementNames[0]) {\n const contentRootElementName = contentElementNames[0];\n delete entry.content[contentRootElementName][Constants.XML_METADATA_MARKER];\n result = entry.content[contentRootElementName];\n\n if (result) {\n if (entry[Constants.XML_METADATA_MARKER]) {\n result[Constants.ATOM_METADATA_MARKER] = entry[Constants.XML_METADATA_MARKER];\n } else {\n result[Constants.ATOM_METADATA_MARKER] = {};\n }\n\n result[Constants.ATOM_METADATA_MARKER][\"ContentRootElement\"] = contentRootElementName;\n\n Object.keys(entry).forEach((property: string) => {\n if (property !== \"content\" && property !== Constants.XML_METADATA_MARKER) {\n result[Constants.ATOM_METADATA_MARKER][property] = entry[property];\n }\n });\n\n return result;\n }\n }\n\n return undefined;\n}\n\n/**\n * @internal\n * Utility to help parse link info from the given `feed` result\n */\nfunction parseLinkInfo(\n feedLink: { [Constants.XML_METADATA_MARKER]: { rel: string; href: string } }[],\n relationship: \"self\" | \"next\",\n): string | undefined {\n if (!feedLink || !Array.isArray(feedLink)) {\n return undefined;\n }\n for (const linkInfo of feedLink) {\n if (linkInfo[Constants.XML_METADATA_MARKER].rel === relationship) {\n return linkInfo[Constants.XML_METADATA_MARKER].href;\n }\n }\n return undefined;\n}\n\n/**\n * @internal\n * Utility to help parse given `feed` result\n */\nfunction parseFeedResult(feed: any): Record<string, unknown>[] & { nextLink?: string } {\n const result: Record<string, unknown>[] & { nextLink?: string } = [];\n if (typeof feed === \"object\" && feed != null && feed.entry) {\n if (Array.isArray(feed.entry)) {\n feed.entry.forEach((entry: any) => {\n const parsedEntryResult = parseEntryResult(entry);\n if (parsedEntryResult) {\n result.push(parsedEntryResult);\n }\n });\n } else {\n const parsedEntryResult = parseEntryResult(feed.entry);\n if (parsedEntryResult) {\n result.push(parsedEntryResult);\n }\n }\n result.nextLink = parseLinkInfo(feed.link, \"next\");\n }\n return result;\n}\n\n/**\n * @internal\n */\nfunction isKnownResponseCode(\n statusCode: number,\n): statusCode is keyof typeof Constants.HttpResponseCodes {\n return !!(Constants.HttpResponseCodes as { [statusCode: number]: string })[statusCode];\n}\n\n/**\n * @internal\n * Extracts the applicable entity name(s) from the URL based on the known structure\n * and instantiates the corresponding name properties to the deserialized response\n *\n * The pattern matching checks to extract entity names are based on following\n * constraints dictated by the service\n * - '/' is allowed in Queue and Topic names\n * - '/' is not allowed in Namespace, Subscription and Rule names\n * - Valid pathname URL structures used in the ATOM based management API are\n * - `<namespace-component>/<topic-name>/Subscriptions/<subscription-name>/Rules/<rule-name>`\n * - `<namespace-component>/<topic-name>/Subscriptions/<subscription-name>`\n * - `<namespace-component>/<any-entity-name>`\n *\n */\nfunction setName(entry: any, nameProperties: any): any {\n if (entry[Constants.ATOM_METADATA_MARKER]) {\n let rawUrl = entry[Constants.ATOM_METADATA_MARKER].id;\n\n // The parsedUrl gets constructed differently for browser vs Node.\n // It is specifically behaves different for some of the Atom based management API where\n // the received URL in \"id\" element is of type \"sb:// ... \" and not a standard HTTP one\n // Hence, normalizing the URL for parsing to work as expected in browser\n if (rawUrl.startsWith(\"sb://\")) {\n rawUrl = \"https://\" + rawUrl.substring(5);\n }\n\n const parsedUrl = parseURL(rawUrl);\n const pathname: string = parsedUrl.pathname;\n\n const firstIndexOfDelimiter = pathname.indexOf(\"/\");\n\n if (pathname.match(\"(.*)/(.*)/Subscriptions/(.*)/Rules/(.*)\")) {\n const lastIndexOfSubscriptionsDelimiter = pathname.lastIndexOf(\"/Subscriptions/\");\n const firstIndexOfRulesDelimiter = pathname.indexOf(\"/Rules/\");\n entry[nameProperties[0]] = pathname.substring(\n firstIndexOfDelimiter + 1,\n lastIndexOfSubscriptionsDelimiter,\n );\n entry[nameProperties[1]] = pathname.substring(\n lastIndexOfSubscriptionsDelimiter + 15,\n firstIndexOfRulesDelimiter,\n );\n entry[nameProperties[2]] = pathname.substring(firstIndexOfRulesDelimiter + 7);\n } else if (pathname.match(\"(.*)/(.*)/Subscriptions/(.*)\")) {\n const lastIndexOfSubscriptionsDelimiter = pathname.lastIndexOf(\"/Subscriptions/\");\n entry[nameProperties[0]] = pathname.substring(\n firstIndexOfDelimiter + 1,\n lastIndexOfSubscriptionsDelimiter,\n );\n entry[nameProperties[1]] = pathname.substring(lastIndexOfSubscriptionsDelimiter + 15);\n } else if (pathname.match(\"(.*)/(.*)\")) {\n entry[nameProperties[0]] = pathname.substring(firstIndexOfDelimiter + 1);\n }\n }\n}\n\n/**\n * @internal\n * Utility to help construct the normalized `RestError` object based on given error\n * information and other data present in the received `response` object.\n */\nexport function buildError(response: FullOperationResponse): RestError {\n if (!isKnownResponseCode(response.status)) {\n throw new RestError(\n `Service returned an error response with an unrecognized HTTP status code - ${response.status}`,\n {\n code: \"ServiceError\",\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n\n const errorBody = response.parsedBody;\n let errorMessage;\n if (typeof errorBody === \"string\") {\n errorMessage = errorBody;\n } else {\n if (\n !isDefined(errorBody) ||\n !isDefined(errorBody.Error) ||\n !isDefined(errorBody.Error.Detail)\n ) {\n errorMessage =\n \"Detailed error message information not available. Look at the 'code' property on error for more information.\";\n } else {\n errorMessage = errorBody.Error.Detail;\n }\n }\n\n const errorCode = getErrorCode(response, errorMessage);\n\n const error: RestError = new RestError(errorMessage, {\n code: errorCode,\n statusCode: response.status,\n request: response.request,\n response,\n });\n return error;\n}\n\n/**\n * @internal\n * Helper utility to construct user friendly error codes based on based on given error\n * information and other data present in the received `response` object.\n */\nfunction getErrorCode(response: PipelineResponse, errorMessage: string): string {\n if (response.status === 401) {\n return \"UnauthorizedRequestError\";\n }\n if (response.status === 404) {\n return \"MessageEntityNotFoundError\";\n }\n if (response.status === 409) {\n if (response.request.method === \"DELETE\") {\n return \"ServiceError\";\n }\n\n if (response.request.method === \"PUT\" && response.request.headers.get(\"If-Match\") === \"*\") {\n return \"ServiceError\";\n }\n\n if (errorMessage && errorMessage.toLowerCase().includes(\"subcode=40901\")) {\n return \"ServiceError\";\n }\n\n return \"MessageEntityAlreadyExistsError\";\n }\n\n if (response.status === 403) {\n if (errorMessage && errorMessage.toLowerCase().includes(\"subcode=40301\")) {\n return \"InvalidOperationError\";\n }\n return \"QuotaExceededError\";\n }\n\n if (response.status === 400) {\n return \"ServiceError\";\n }\n\n if (response.status === 503) {\n return \"ServerBusyError\";\n }\n\n return (Constants.HttpResponseCodes as { [statusCode: number]: string })[response.status];\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { FullOperationResponse } from \"@azure/core-client\";\nimport {\n AtomXmlSerializer,\n deserializeAtomXmlResponse,\n serializeToAtomXmlRequest,\n} from \"../util/atomXmlHelper\";\nimport { getInteger, getString, getDate } from \"../util/utils\";\n\n/**\n * Represents the metadata related to a service bus namespace.\n *\n */\nexport interface NamespaceProperties {\n /**\n * The time at which the namespace was created.\n */\n createdAt: Date;\n /**\n * The SKU/tier of the namespace.\n * \"Basic\", \"Standard\" and \"Premium\"\n */\n messagingSku: \"Basic\" | \"Premium\" | \"Standard\";\n /**\n * The last time at which the namespace was modified.\n */\n modifiedAt: Date;\n /**\n * Name of the namespace.\n */\n name: string;\n /**\n * Number of messaging units allocated for namespace.\n * Valid only for Premium namespaces.\n * messagingUnits would be set to `undefined` for Basic and Standard namespaces.\n */\n messagingUnits: number | undefined;\n}\n\n/**\n * @internal\n * Builds the namespace object from the raw json object gotten after deserializing the\n * response from the service\n */\nexport function buildNamespace(rawNamespace: Record<string, any>): NamespaceProperties {\n const messagingSku = <\"Basic\" | \"Premium\" | \"Standard\">(\n getString(rawNamespace[\"MessagingSKU\"], \"messagingSku\")\n );\n return {\n createdAt: getDate(rawNamespace[\"CreatedTime\"], \"createdAt\"),\n messagingSku: messagingSku,\n modifiedAt: getDate(rawNamespace[\"ModifiedTime\"], \"modifiedAt\"),\n name: getString(rawNamespace[\"Name\"], \"name\"),\n messagingUnits:\n messagingSku === \"Premium\"\n ? getInteger(rawNamespace[\"MessagingUnits\"], \"messagingUnits\")\n : undefined,\n };\n}\n\n/**\n * @internal\n * Atom XML Serializer for Namespaces.\n */\nexport class NamespaceResourceSerializer implements AtomXmlSerializer {\n serialize(): Record<string, unknown> {\n return serializeToAtomXmlRequest(\"NamespaceProperties\", {});\n }\n\n async deserialize(response: FullOperationResponse): Promise<FullOperationResponse> {\n return deserializeAtomXmlResponse([\"name\"], response);\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { FullOperationResponse, OperationOptions } from \"@azure/core-client\";\nimport {\n AtomXmlSerializer,\n deserializeAtomXmlResponse,\n serializeToAtomXmlRequest,\n} from \"../util/atomXmlHelper\";\nimport * as Constants from \"../util/constants\";\nimport {\n AuthorizationRule,\n getAuthorizationRulesOrUndefined,\n getBoolean,\n getMessageCountDetails,\n getInteger,\n getIntegerOrUndefined,\n getRawAuthorizationRules,\n getString,\n getStringOrUndefined,\n getDate,\n EntityStatus,\n EntityAvailabilityStatus,\n} from \"../util/utils\";\n\n/**\n * @internal\n * Builds the queue options object from the user provided options.\n * Handles the differences in casing for the property names,\n * converts values to string and ensures the right order as expected by the service\n */\nexport function buildQueueOptions(queue: CreateQueueOptions): InternalQueueOptions {\n return {\n // NOTE: this ordering is extremely important. As an example, misordering of the ForwardTo property\n // resulted in a customer bug where the Forwarding attributes appeared to be set but the portal was\n // not picking up on it.\n //\n // The authority on this ordering is here:\n // https://github.com/Azure/azure-sdk-for-net/blob/8af2dfc32c96ef3e340f9d20013bf588d97ea756/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/QueuePropertiesExtensions.cs#L20\n\n LockDuration: queue.lockDuration,\n MaxSizeInMegabytes: getStringOrUndefined(queue.maxSizeInMegabytes),\n RequiresDuplicateDetection: getStringOrUndefined(queue.requiresDuplicateDetection),\n RequiresSession: getStringOrUndefined(queue.requiresSession),\n DefaultMessageTimeToLive: queue.defaultMessageTimeToLive,\n DeadLetteringOnMessageExpiration: getStringOrUndefined(queue.deadLetteringOnMessageExpiration),\n DuplicateDetectionHistoryTimeWindow: queue.duplicateDetectionHistoryTimeWindow,\n MaxDeliveryCount: getStringOrUndefined(queue.maxDeliveryCount),\n EnableBatchedOperations: getStringOrUndefined(queue.enableBatchedOperations),\n AuthorizationRules: getRawAuthorizationRules(queue.authorizationRules),\n Status: getStringOrUndefined(queue.status),\n ForwardTo: getStringOrUndefined(queue.forwardTo),\n UserMetadata: getStringOrUndefined(queue.userMetadata),\n AutoDeleteOnIdle: getStringOrUndefined(queue.autoDeleteOnIdle),\n EnablePartitioning: getStringOrUndefined(queue.enablePartitioning),\n ForwardDeadLetteredMessagesTo: getStringOrUndefined(queue.forwardDeadLetteredMessagesTo),\n EntityAvailabilityStatus: getStringOrUndefined(queue.availabilityStatus),\n EnableExpress: getStringOrUndefined(queue.enableExpress),\n MaxMessageSizeInKilobytes: getStringOrUndefined(queue.maxMessageSizeInKilobytes),\n };\n}\n\n/**\n * @internal\n * Builds the queue object from the raw json object gotten after deserializing the\n * response from the service\n */\nexport function buildQueue(rawQueue: Record<string, any>): QueueProperties {\n return {\n name: getString(rawQueue[Constants.QUEUE_NAME], \"queueName\"),\n\n forwardTo: getStringOrUndefined(rawQueue[Constants.FORWARD_TO]),\n userMetadata: rawQueue[Constants.USER_METADATA],\n\n lockDuration: getString(rawQueue[Constants.LOCK_DURATION], \"lockDuration\"),\n maxSizeInMegabytes: getInteger(rawQueue[Constants.MAX_SIZE_IN_MEGABYTES], \"maxSizeInMegabytes\"),\n\n maxDeliveryCount: getInteger(rawQueue[Constants.MAX_DELIVERY_COUNT], \"maxDeliveryCount\"),\n\n enablePartitioning: getBoolean(rawQueue[Constants.ENABLE_PARTITIONING], \"enablePartitioning\"),\n requiresSession: getBoolean(rawQueue[Constants.REQUIRES_SESSION], \"requiresSession\"),\n enableBatchedOperations: getBoolean(\n rawQueue[Constants.ENABLE_BATCHED_OPERATIONS],\n \"enableBatchedOperations\",\n ),\n\n defaultMessageTimeToLive: getString(\n rawQueue[Constants.DEFAULT_MESSAGE_TIME_TO_LIVE],\n \"defaultMessageTimeToLive\",\n ),\n autoDeleteOnIdle: rawQueue[Constants.AUTO_DELETE_ON_IDLE],\n\n requiresDuplicateDetection: getBoolean(\n rawQueue[Constants.REQUIRES_DUPLICATE_DETECTION],\n \"requiresDuplicateDetection\",\n ),\n duplicateDetectionHistoryTimeWindow: getString(\n rawQueue[Constants.DUPLICATE_DETECTION_HISTORY_TIME_WINDOW],\n \"duplicateDetectionHistoryTimeWindow\",\n ),\n deadLetteringOnMessageExpiration: getBoolean(\n rawQueue[Constants.DEAD_LETTERING_ON_MESSAGE_EXPIRATION],\n \"deadLetteringOnMessageExpiration\",\n ),\n forwardDeadLetteredMessagesTo: getStringOrUndefined(\n rawQueue[Constants.FORWARD_DEADLETTERED_MESSAGES_TO],\n ),\n\n authorizationRules: getAuthorizationRulesOrUndefined(rawQueue[Constants.AUTHORIZATION_RULES]),\n\n status: rawQueue[Constants.STATUS],\n\n enableExpress: getBoolean(rawQueue[Constants.ENABLE_EXPRESS], \"enableExpress\"),\n\n availabilityStatus: rawQueue[Constants.ENTITY_AVAILABILITY_STATUS],\n\n maxMessageSizeInKilobytes: getIntegerOrUndefined(\n rawQueue[Constants.MAX_MESSAGE_SIZE_IN_KILOBYTES],\n ),\n };\n}\n\n/**\n * @internal\n * Builds the queue runtime info object from the raw json object gotten after deserializing the\n * response from the service\n */\nexport function buildQueueRuntimeProperties(rawQueue: Record<string, any>): QueueRuntimeProperties {\n const messageCountDetails = getMessageCountDetails(rawQueue[Constants.COUNT_DETAILS]);\n return {\n name: getString(rawQueue[Constants.QUEUE_NAME], \"queueName\"),\n sizeInBytes: getIntegerOrUndefined(rawQueue[Constants.SIZE_IN_BYTES]),\n totalMessageCount: getIntegerOrUndefined(rawQueue[Constants.MESSAGE_COUNT]),\n ...messageCountDetails,\n createdAt: getDate(rawQueue[Constants.CREATED_AT], \"createdAt\"),\n modifiedAt: getDate(rawQueue[Constants.UPDATED_AT], \"modifiedAt\"),\n accessedAt: getDate(rawQueue[Constants.ACCESSED_AT], \"accessedAt\"),\n };\n}\n\n/**\n * Represents settable options on a queue\n */\nexport interface CreateQueueOptions extends OperationOptions {\n /**\n * Determines the amount of time in seconds in which a message should be locked for\n * processing by a receiver. After this period, the message is unlocked and available\n * for consumption by the next receiver.\n * (If sessions are enabled, this lock duration is applicable for sessions and not for messages.)\n *\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n lockDuration?: string;\n\n /**\n * Specifies the maximum queue size in megabytes. Any attempt to enqueue a message that\n * will cause the queue to exceed this value will fail.\n */\n maxSizeInMegabytes?: number;\n\n /**\n * The maximum message size in kilobytes for messages sent to this queue.\n *\n * (Configurable only for Premium Tier Service Bus namespace.)\n */\n maxMessageSizeInKilobytes?: number;\n\n /**\n * If enabled, the topic will detect duplicate messages within the time\n * span specified by the DuplicateDetectionHistoryTimeWindow property.\n * Settable only at queue creation time.\n */\n requiresDuplicateDetection?: boolean;\n\n /**\n * If set to true, the queue will be session-aware and only SessionReceiver\n * will be supported. Session-aware queues are not supported through REST.\n * Settable only at queue creation time.\n */\n requiresSession?: boolean;\n\n /**\n * Depending on whether DeadLettering is enabled, a message is automatically\n * moved to the dead-letter sub-queue or deleted if it has been stored in the\n * queue for longer than the specified time.\n * This value is overwritten by a TTL specified on the message\n * if and only if the message TTL is smaller than the TTL set on the queue.\n * This value is immutable after the Queue has been created.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n defaultMessageTimeToLive?: string;\n\n /**\n * If it is enabled and a message expires, the Service Bus moves the message\n * from the queue into the queue’s dead-letter sub-queue. If disabled,\n * message will be permanently deleted from the queue.\n * Settable only at queue creation time.\n */\n deadLetteringOnMessageExpiration?: boolean;\n\n /**\n * Specifies the time span during which the Service Bus detects message duplication.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n duplicateDetectionHistoryTimeWindow?: string;\n\n /**\n * The maximum delivery count of messages after which if it is still not settled,\n * gets moved to the dead-letter sub-queue.\n */\n maxDeliveryCount?: number;\n\n /**\n * Specifies if batched operations should be allowed.\n */\n enableBatchedOperations?: boolean;\n\n /**\n * Authorization rules on the queue\n */\n authorizationRules?: AuthorizationRule[];\n\n /**\n * Status of the messaging entity.\n */\n status?: EntityStatus;\n\n /**\n * Absolute URL or the name of the queue or topic the\n * messages are to be forwarded to.\n * For example, an absolute URL input would be of the form\n * `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`\n */\n forwardTo?: string;\n\n /**\n * The user provided metadata information associated with the queue.\n * Used to specify textual content such as tags, labels, etc.\n * Value must not exceed 1024 bytes encoded in utf-8.\n */\n userMetadata?: string;\n\n /**\n * Max idle time before entity is deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n autoDeleteOnIdle?: string;\n\n /**\n * Specifies whether the queue should be partitioned.\n */\n enablePartitioning?: boolean;\n\n /**\n * Absolute URL or the name of the queue or topic the dead-lettered\n * messages are to be forwarded to.\n * For example, an absolute URL input would be of the form\n * `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`\n */\n forwardDeadLetteredMessagesTo?: string;\n\n /**\n * Specifies whether express entities are enabled on queue.\n */\n enableExpress?: boolean;\n\n /**\n * Availability status of the messaging entity.\n */\n availabilityStatus?: EntityAvailabilityStatus;\n}\n\n/**\n * Represents the input for updateQueue.\n *\n */\nexport interface QueueProperties {\n /**\n * Name of the queue\n */\n readonly name: string;\n\n /**\n * Determines the amount of time in seconds in which a message should be locked for\n * processing by a receiver. After this period, the message is unlocked and available\n * for consumption by the next receiver.\n * (If sessions are enabled, this lock duration is applicable for sessions and not for messages.)\n *\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n lockDuration: string;\n\n /**\n * Specifies the maximum queue size in megabytes. Any attempt to enqueue a message that\n * will cause the queue to exceed this value will fail.\n */\n maxSizeInMegabytes: number;\n\n /**\n * The maximum message size in kilobytes for messages sent to this queue.\n *\n * Not applicable if service version \"2017-04\" is chosen when creating the `ServiceBusAdministrationClient`.\n */\n maxMessageSizeInKilobytes?: number;\n\n /**\n * If enabled, the topic will detect duplicate messages within the time\n * span specified by the DuplicateDetectionHistoryTimeWindow property.\n * Settable only at queue creation time.\n */\n readonly requiresDuplicateDetection: boolean;\n\n /**\n * If set to true, the queue will be session-aware and only SessionReceiver\n * will be supported. Session-aware queues are not supported through REST.\n * Settable only at queue creation time.\n */\n readonly requiresSession: boolean;\n\n /**\n * Depending on whether DeadLettering is enabled, a message is automatically\n * moved to the dead-letter sub-queue or deleted if it has been stored in the\n * queue for longer than the specified time.\n * This value is overwritten by a TTL specified on the message\n * if and only if the message TTL is smaller than the TTL set on the queue.\n * This value is immutable after the Queue has been created.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n defaultMessageTimeToLive: string;\n\n /**\n * If it is enabled and a message expires, the Service Bus moves the message\n * from the queue into the queue’s dead-letter sub-queue. If disabled,\n * message will be permanently deleted from the queue.\n * Settable only at queue creation time.\n */\n deadLetteringOnMessageExpiration: boolean;\n\n /**\n * Specifies the time span during which the Service Bus detects message duplication.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n duplicateDetectionHistoryTimeWindow: string;\n\n /**\n * The maximum delivery count of messages after which if it is still not settled,\n * gets moved to the dead-letter sub-queue.\n */\n maxDeliveryCount: number;\n\n /**\n * Specifies if batched operations should be allowed.\n */\n enableBatchedOperations: boolean;\n\n /**\n * Authorization rules on the queue\n */\n authorizationRules?: AuthorizationRule[];\n\n /**\n * Status of the messaging entity.\n */\n status: EntityStatus;\n\n /**\n * Absolute URL or the name of the queue or topic the\n * messages are to be forwarded to.\n * For example, an absolute URL input would be of the form\n * `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`\n */\n forwardTo?: string;\n\n /**\n * The user provided metadata information associated with the queue.\n * Used to specify textual content such as tags, labels, etc.\n * Value must not exceed 1024 bytes encoded in utf-8.\n */\n userMetadata: string;\n\n /**\n * Max idle time before entity is deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n autoDeleteOnIdle: string;\n\n /**\n * Specifies whether the queue should be partitioned.\n */\n readonly enablePartitioning: boolean;\n\n /**\n * Absolute URL or the name of the queue or topic the dead-lettered\n * messages are to be forwarded to.\n * For example, an absolute URL input would be of the form\n * `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`\n */\n forwardDeadLetteredMessagesTo?: string;\n\n /**\n * Specifies whether express entities are enabled on queue.\n */\n readonly enableExpress: boolean;\n\n /**\n * Availability status of the messaging entity.\n */\n readonly availabilityStatus: EntityAvailabilityStatus;\n}\n/**\n * @internal\n * Internal representation of settable options on a queue\n */\nexport interface InternalQueueOptions {\n /**\n * Determines the amount of time in seconds in which a message should be locked for\n * processing by a receiver. After this period, the message is unlocked and\n * can be consumed by the next receiver.\n * (If sessions are enabled, this lock duration is applicable for sessions and not for messages.)\n *\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n LockDuration?: string;\n\n /**\n * The max size in MegaBytes\n *\n */\n MaxSizeInMegabytes?: string;\n\n /**\n * The maximum message size in kilobytes for messages sent to this queue/topic.\n */\n MaxMessageSizeInKilobytes?: string;\n\n /**\n * If enabled, the topic will detect duplicate messages within the time\n * span specified by the DuplicateDetectionHistoryTimeWindow property.\n * Settable only at queue creation time.\n */\n RequiresDuplicateDetection?: string;\n\n /**\n * If set to true, the queue will be session-aware and only SessionReceiver\n * will be supported. Session-aware queues are not supported through REST.\n * Settable only at queue creation time.\n */\n RequiresSession?: string;\n\n /**\n * Depending on whether DeadLettering is enabled, a message is automatically moved to\n * the DeadLetterQueue or deleted if it has been stored in the queue for longer than\n * the specified time. This value is overwritten by a TTL specified on the message\n * if and only if the message TTL is smaller than the TTL set on the queue.\n * This value is immutable after the Queue has been created.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n DefaultMessageTimeToLive?: string;\n\n /**\n * If it is enabled and a message expires, the Service Bus moves the message\n * from the queue into the queue’s dead-letter sub-queue. If disabled,\n * message will be permanently deleted from the queue.\n * Settable only at queue creation time.\n */\n DeadLetteringOnMessageExpiration?: string;\n\n /**\n * Specifies the time span during which the Service Bus detects message duplication.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n DuplicateDetectionHistoryTimeWindow?: string;\n\n /**\n * The maximum delivery count of messages after which if it is still not settled,\n * gets moved to the dead-letter sub-queue.\n *\n */\n MaxDeliveryCount?: string;\n\n /**\n * Specifies if batched operations should be allowed.\n */\n EnableBatchedOperations?: string;\n\n /**\n * Authorization rules on the queue\n */\n AuthorizationRules?: any;\n\n /**\n * Status of the messaging entity.\n */\n Status?: string;\n\n /**\n * Absolute URL or the name of the queue or topic the\n * messages are to be forwarded to.\n * For example, an absolute URL input would be of the form\n * `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`\n */\n ForwardTo?: string;\n\n /**\n * The user provided metadata information associated with the queue.\n * Used to specify textual content such as tags, labels, etc.\n * Value must not exceed 1024 bytes encoded in utf-8.\n */\n UserMetadata?: string;\n\n /**\n * Max idle time before entity is deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n AutoDeleteOnIdle?: string;\n\n /**\n * Specifies whether the queue should be partitioned.\n */\n EnablePartitioning?: string;\n\n /**\n * Absolute URL or the name of the queue or topic the dead-lettered\n * messages are to be forwarded to.\n * For example, an absolute URL input would be of the form\n * `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`\n */\n ForwardDeadLetteredMessagesTo?: string;\n\n /**\n * Specifies whether express entities are enabled on queue.\n */\n EnableExpress?: string;\n\n /**\n * Availability status of the messaging entity.\n */\n EntityAvailabilityStatus?: string;\n}\n\n/**\n * Represents runtime info attributes of a queue entity\n */\nexport interface QueueRuntimeProperties {\n /**\n * Name of the queue\n */\n name: string;\n\n /**\n * Created at timestamp\n */\n createdAt: Date;\n\n /**\n * Updated at timestamp\n */\n modifiedAt: Date;\n\n /**\n * Accessed at timestamp\n */\n accessedAt: Date;\n\n /**\n * The entity's message count.\n *\n */\n totalMessageCount?: number;\n\n /**\n * The number of active messages in the queue.\n */\n activeMessageCount: number;\n\n /**\n * The number of messages that have been dead lettered.\n */\n deadLetterMessageCount: number;\n\n /**\n * The number of scheduled messages.\n */\n scheduledMessageCount: number;\n\n /**\n * The number of messages transferred to another queue, topic, or subscription\n */\n transferMessageCount: number;\n\n /**\n * The number of messages transferred to the dead letter queue.\n */\n transferDeadLetterMessageCount: number;\n\n /**\n * The entity's size in bytes.\n *\n */\n sizeInBytes?: number;\n}\n\n/**\n * @internal\n * Atom XML Serializer for Queues.\n */\nexport class QueueResourceSerializer implements AtomXmlSerializer {\n serialize(resource: InternalQueueOptions): Record<string, unknown> {\n return serializeToAtomXmlRequest(\"QueueDescription\", resource);\n }\n\n async deserialize(response: FullOperationResponse): Promise<FullOperationResponse> {\n return deserializeAtomXmlResponse([\"QueueName\"], response);\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { FullOperationResponse } from \"@azure/core-client\";\nimport { CorrelationRuleFilter } from \"../core/managementClient\";\nimport {\n AtomXmlSerializer,\n deserializeAtomXmlResponse,\n serializeToAtomXmlRequest,\n} from \"../util/atomXmlHelper\";\nimport * as Constants from \"../util/constants\";\nimport { isDefined, isObjectWithProperties } from \"@azure/core-util\";\nimport { getString, getStringOrUndefined } from \"../util/utils\";\n\n/**\n * @internal\n * Builds the rule object from the raw json object gotten after deserializing the\n * response from the service\n */\nexport function buildRule(rawRule: Record<string, any>): RuleProperties {\n return {\n name: getString(rawRule[\"RuleName\"], \"ruleName\"),\n filter: getTopicFilter(rawRule[\"Filter\"]),\n action: getRuleAction(rawRule[\"Action\"]),\n };\n}\n\n/**\n * @internal\n * Helper utility to retrieve `filter` value from given input,\n * or undefined if not passed in.\n */\nfunction getTopicFilter(value: any): SqlRuleFilter | CorrelationRuleFilter {\n let result: SqlRuleFilter | CorrelationRuleFilter;\n\n if (isDefined(value[\"SqlExpression\"])) {\n result = {\n sqlExpression: value[\"SqlExpression\"],\n sqlParameters: getKeyValuePairsOrUndefined(value[\"Parameters\"], \"SQLParameters\"),\n };\n } else {\n result = {\n correlationId: getStringOrUndefined(value[\"CorrelationId\"]),\n subject: getStringOrUndefined(value[\"Label\"]),\n to: getStringOrUndefined(value[\"To\"]),\n replyTo: getStringOrUndefined(value[\"ReplyTo\"]),\n replyToSessionId: getStringOrUndefined(value[\"ReplyToSessionId\"]),\n sessionId: getStringOrUndefined(value[\"SessionId\"]),\n messageId: getStringOrUndefined(value[\"MessageId\"]),\n contentType: getStringOrUndefined(value[\"ContentType\"]),\n applicationProperties: getKeyValuePairsOrUndefined(\n value[\"Properties\"],\n \"ApplicationProperties\",\n ),\n };\n }\n return result;\n}\n\n/**\n * @internal\n * Helper utility to retrieve rule `action` value from given input.\n */\nfunction getRuleAction(value: any): SqlRuleAction {\n return {\n sqlExpression: value[\"SqlExpression\"],\n sqlParameters: getKeyValuePairsOrUndefined(value[\"Parameters\"], \"SQLParameters\"),\n };\n}\n\n/**\n * Represents the options to create a rule for a subscription.\n * @internal\n */\nexport interface CreateRuleOptions {\n /**\n * Name of the rule\n */\n name: string;\n\n /**\n * Defines the filter expression that the rule evaluates. For `SqlRuleFilter` input,\n * the expression string is interpreted as a SQL92 expression which must\n * evaluate to True or False. Only one between a `CorrelationRuleFilter` or\n * a `SqlRuleFilter` can be defined.\n */\n filter?: SqlRuleFilter | CorrelationRuleFilter;\n\n /**\n * The SQL like expression that can be executed on the message should the\n * associated filter apply.\n */\n action?: SqlRuleAction;\n}\n\n/**\n * Represents all the attributes of a rule.\n */\nexport interface RuleProperties {\n /**\n * Name of the rule\n */\n readonly name: string;\n\n /**\n * Defines the filter expression that the rule evaluates. For `SqlRuleFilter` input,\n * the expression string is interpreted as a SQL92 expression which must\n * evaluate to True or False. Only one between a `CorrelationRuleFilter` or\n * a `SqlRuleFilter` can be defined.\n */\n filter: SqlRuleFilter | CorrelationRuleFilter;\n\n /**\n * The SQL like expression that can be executed on the message should the\n * associated filter apply.\n */\n action: SqlRuleAction;\n}\n\n/**\n * Represents all possible fields on SqlRuleAction\n */\nexport type SqlRuleAction = {\n /**\n * SQL expression to use in the rule action.\n */\n sqlExpression?: string;\n\n /**\n * SQL parameters to the SQL expression in the rule action.\n */\n sqlParameters?: { [key: string]: string | number | boolean };\n};\n\n/**\n * Represents all possible fields on SqlRuleFilter\n */\nexport interface SqlRuleFilter {\n /**\n * SQL expression to use in the rule filter. It is evaluated against the messages'\n * user-defined properties and system properties. All system properties will be prefixed with\n * `sys.` in the condition expression.\n * Defaults to creating a true filter if none specified\n */\n sqlExpression: string;\n\n /**\n * SQL parameters to the SQL expression in the rule filter.\n */\n sqlParameters?: { [key: string]: string | number | boolean };\n}\n\n/**\n * @internal\n *\n */\nexport interface InternalRuleOptions {\n Name: string;\n Filter: any;\n Action: any;\n}\n\n/**\n * @internal\n *\n */\nexport function buildInternalRuleResource(rule: CreateRuleOptions): InternalRuleOptions {\n const resource: InternalRuleOptions = {\n Filter: {},\n Action: {},\n Name: rule.name,\n };\n\n if (!isDefined(rule.filter)) {\n // Defaults to creating a true filter if none specified\n resource.Filter = {\n SqlExpression: \"1=1\",\n };\n resource.Filter[Constants.XML_METADATA_MARKER] = {\n \"p4:type\": \"SqlFilter\",\n \"xmlns:p4\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n } else {\n if (isObjectWithProperties(rule.filter, [\"sqlExpression\"])) {\n const sqlFilter: SqlRuleFilter = rule.filter as SqlRuleFilter;\n resource.Filter = {\n SqlExpression: sqlFilter.sqlExpression,\n Parameters: buildInternalRawKeyValuePairs(sqlFilter.sqlParameters, \"sqlParameters\"),\n };\n resource.Filter[Constants.XML_METADATA_MARKER] = {\n \"p4:type\": \"SqlFilter\",\n \"xmlns:p4\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n } else {\n const correlationFilter: CorrelationRuleFilter = rule.filter as CorrelationRuleFilter;\n\n resource.Filter = {\n CorrelationId: correlationFilter.correlationId,\n Label: correlationFilter.subject,\n To: correlationFilter.to,\n ReplyTo: correlationFilter.replyTo,\n ReplyToSessionId: correlationFilter.replyToSessionId,\n ContentType: correlationFilter.contentType,\n SessionId: correlationFilter.sessionId,\n MessageId: correlationFilter.messageId,\n Properties: buildInternalRawKeyValuePairs(\n correlationFilter.applicationProperties,\n \"applicationProperties\",\n ),\n };\n resource.Filter[Constants.XML_METADATA_MARKER] = {\n \"p4:type\": \"CorrelationFilter\",\n \"xmlns:p4\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n }\n }\n\n if (!isDefined(rule.action) || !isDefined(rule.action.sqlExpression)) {\n // Defaults to creating an empty rule action instance if none specified\n resource.Action = {};\n resource.Action[Constants.XML_METADATA_MARKER] = {\n \"p4:type\": \"EmptyRuleAction\",\n \"xmlns:p4\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n } else {\n resource.Action = {\n SqlExpression: rule.action.sqlExpression,\n Parameters: buildInternalRawKeyValuePairs(rule.action.sqlParameters, \"sqlParameters\"),\n };\n resource.Action[Constants.XML_METADATA_MARKER] = {\n \"p4:type\": \"SqlRuleAction\",\n \"xmlns:p4\": \"http://www.w3.org/2001/XMLSchema-instance\",\n };\n }\n\n return resource;\n}\n\n/**\n * @internal\n * RuleResourceSerializer for serializing / deserializing Rule entities\n */\nexport class RuleResourceSerializer implements AtomXmlSerializer {\n serialize(rule: RuleProperties): Record<string, unknown> {\n return serializeToAtomXmlRequest(\"RuleDescription\", buildInternalRuleResource(rule));\n }\n\n async deserialize(response: FullOperationResponse): Promise<FullOperationResponse> {\n return deserializeAtomXmlResponse([\"TopicName\", \"SubscriptionName\", \"RuleName\"], response);\n }\n}\n\n/**\n * @internal\n */\nexport function isSqlRuleAction(action: unknown): action is SqlRuleAction {\n return isObjectWithProperties(action, [\"sqlExpression\"]);\n}\n\n/**\n * Service expects the XML request with the special type names serialized in the request,\n * the request would fail otherwise.\n *\n * @internal\n */\nenum TypeMapForRequestSerialization {\n double = \"l28:double\",\n string = \"l28:string\",\n long = \"l28:long\",\n date = \"l28:dateTime\",\n boolean = \"l28:boolean\",\n}\n\n/**\n * @internal\n */\nenum TypeMapForResponseDeserialization {\n int = \"int\",\n double = \"double\",\n string = \"string\",\n boolean = \"boolean\",\n date = \"dateTime\",\n}\n\n/**\n * @internal\n * Internal representation of key-value pair\n */\ntype RawKeyValuePair = {\n Key: string;\n Value: any;\n};\n\n/**\n * @internal\n */\ninterface InternalRawKeyValuePairs {\n KeyValueOfstringanyType: RawKeyValuePair[];\n}\n\n/**\n * Key-value pairs are supposed to be wrapped with this tag in the XML request, they are ignored otherwise.\n *\n * @internal\n */\nconst keyValuePairXMLTag = \"KeyValueOfstringanyType\";\n\n/**\n * @internal\n * Helper utility to retrieve the key-value pairs from the RawKeyValue object from given input,\n * or undefined if not passed in.\n */\nfunction getKeyValuePairsOrUndefined(\n value: any,\n attribute: \"ApplicationProperties\" | \"SQLParameters\",\n): { [key: string]: any } | undefined {\n if (!value) {\n return undefined;\n }\n const properties: any = {};\n let rawProperties;\n if (!Array.isArray(value[keyValuePairXMLTag]) && value[keyValuePairXMLTag]?.Key) {\n // When a single property is present,\n // value[\"KeyValueOfstringanyType\"] is { Key: <key>, Value: [Object] }\n // When multiple properties are present,\n // value[\"KeyValueOfstringanyType\"] is [ { Key: <key-1>, Value: [Object] }, { Key: <key-2>, Value: [Object] } ]\n // For consistency, wrapping `value[\"KeyValueOfstringanyType\"]` as an array for the \"single property\" case.\n rawProperties = [value[keyValuePairXMLTag]];\n } else {\n rawProperties = value[keyValuePairXMLTag];\n }\n if (Array.isArray(rawProperties)) {\n for (const rawProperty of rawProperties) {\n const key = rawProperty.Key;\n const _value = rawProperty.Value[\"_\"];\n const encodedValueType = rawProperty.Value[\"$\"][\"i:type\"].toString().substring(5);\n if (\n encodedValueType === TypeMapForResponseDeserialization.int ||\n encodedValueType === TypeMapForResponseDeserialization.double\n ) {\n properties[key] = Number(_value);\n } else if (encodedValueType === TypeMapForResponseDeserialization.string) {\n properties[key] = _value;\n } else if (encodedValueType === TypeMapForResponseDeserialization.boolean) {\n properties[key] = _value === \"true\" ? true : false;\n } else if (encodedValueType === TypeMapForResponseDeserialization.date) {\n properties[key] = new Date(_value);\n } else {\n throw new TypeError(\n `Unable to parse the key-value pairs in the response - ${JSON.stringify(rawProperty)}`,\n );\n }\n }\n } else {\n throw new TypeError(\n `${attribute} in the response is not an array, unable to parse the response - ${JSON.stringify(\n value,\n )}`,\n );\n }\n return properties;\n}\n\n/**\n * @internal\n * Helper utility to extract array of user properties key-value instances from given input,\n * or undefined if not passed in.\n */\nexport function buildInternalRawKeyValuePairs(\n parameters: { [key: string]: any } | undefined,\n attribute: \"applicationProperties\" | \"sqlParameters\",\n): InternalRawKeyValuePairs | undefined {\n if (!isDefined(parameters)) {\n return undefined;\n }\n if (\n Array.isArray(parameters) ||\n typeof parameters === \"string\" ||\n typeof parameters !== \"object\" ||\n Object.entries(parameters).length < 1\n ) {\n throw new TypeError(\n `Unsupported value for the ${attribute} ${JSON.stringify(\n parameters,\n )}, expected a JSON object with key-value pairs.`,\n );\n }\n const rawParameters: RawKeyValuePair[] = [];\n for (const key of Object.keys(parameters)) {\n let type: string | number | boolean;\n let value = parameters[key];\n if (typeof value === \"number\") {\n type = TypeMapForRequestSerialization.double;\n } else if (typeof value === \"string\") {\n type = TypeMapForRequestSerialization.string;\n } else if (typeof value === \"boolean\") {\n type = TypeMapForRequestSerialization.boolean;\n } else if (value instanceof Date && !isNaN(value.valueOf())) {\n type = TypeMapForRequestSerialization.date;\n value = value.toJSON();\n } else {\n throw new TypeError(\n `Unsupported type for the value in the ${attribute} for the key '${key}'`,\n );\n }\n\n const rawParameter: RawKeyValuePair = {\n Key: key,\n Value: {\n [Constants.XML_METADATA_MARKER]: {\n \"p4:type\": type,\n \"xmlns:l28\": \"http://www.w3.org/2001/XMLSchema\",\n },\n [Constants.XML_VALUE_MARKER]: value,\n },\n };\n rawParameters.push(rawParameter);\n }\n return {\n [keyValuePairXMLTag]: rawParameters,\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { FullOperationResponse, OperationOptions } from \"@azure/core-client\";\nimport { CorrelationRuleFilter } from \"..\";\nimport {\n AtomXmlSerializer,\n deserializeAtomXmlResponse,\n serializeToAtomXmlRequest,\n} from \"../util/atomXmlHelper\";\nimport * as Constants from \"../util/constants\";\nimport {\n EntityStatus,\n EntityAvailabilityStatus,\n getBoolean,\n getMessageCountDetails,\n getInteger,\n getString,\n getStringOrUndefined,\n getDate,\n} from \"../util/utils\";\nimport {\n buildInternalRuleResource,\n InternalRuleOptions,\n SqlRuleAction,\n SqlRuleFilter,\n} from \"./ruleResourceSerializer\";\n\n/**\n * @internal\n * Builds the subscription options object from the user provided options.\n * Handles the differences in casing for the property names,\n * converts values to string and ensures the right order as expected by the service\n */\nexport function buildSubscriptionOptions(\n subscription: CreateSubscriptionOptions,\n): InternalSubscriptionOptions {\n return {\n // NOTE: this ordering is extremely important. As an example, misordering of the ForwardTo property\n // resulted in a customer bug where the Forwarding attributes appeared to be set but the portal was\n // not picking up on it.\n //\n // The authority on this ordering is here:\n // https://github.com/Azure/azure-sdk-for-net/blob/8af2dfc32c96ef3e340f9d20013bf588d97ea756/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/SubscriptionPropertiesExtensions.cs#L191\n LockDuration: subscription.lockDuration,\n RequiresSession: getStringOrUndefined(subscription.requiresSession),\n DefaultMessageTimeToLive: getStringOrUndefined(subscription.defaultMessageTimeToLive),\n DeadLetteringOnMessageExpiration: getStringOrUndefined(\n subscription.deadLetteringOnMessageExpiration,\n ),\n DeadLetteringOnFilterEvaluationExceptions: getStringOrUndefined(\n subscription.deadLetteringOnFilterEvaluationExceptions,\n ),\n DefaultRuleDescription: subscription.defaultRuleOptions\n ? buildInternalRuleResource(subscription.defaultRuleOptions)\n : undefined,\n MaxDeliveryCount: getStringOrUndefined(subscription.maxDeliveryCount),\n EnableBatchedOperations: getStringOrUndefined(subscription.enableBatchedOperations),\n Status: getStringOrUndefined(subscription.status),\n ForwardTo: getStringOrUndefined(subscription.forwardTo),\n UserMetadata: getStringOrUndefined(subscription.userMetadata),\n ForwardDeadLetteredMessagesTo: getStringOrUndefined(subscription.forwardDeadLetteredMessagesTo),\n AutoDeleteOnIdle: getStringOrUndefined(subscription.autoDeleteOnIdle),\n EntityAvailabilityStatus: getStringOrUndefined(subscription.availabilityStatus),\n };\n}\n\n/**\n * @internal\n * Builds the subscription object from the raw json object gotten after deserializing\n * the response from the service\n */\nexport function buildSubscription(rawSubscription: Record<string, any>): SubscriptionProperties {\n return {\n subscriptionName: getString(rawSubscription[Constants.SUBSCRIPTION_NAME], \"subscriptionName\"),\n topicName: getString(rawSubscription[Constants.TOPIC_NAME], \"topicName\"),\n\n lockDuration: getString(rawSubscription[Constants.LOCK_DURATION], \"lockDuration\"),\n maxDeliveryCount: getInteger(rawSubscription[Constants.MAX_DELIVERY_COUNT], \"maxDeliveryCount\"),\n\n requiresSession: getBoolean(rawSubscription[Constants.REQUIRES_SESSION], \"requiresSession\"),\n enableBatchedOperations: getBoolean(\n rawSubscription[Constants.ENABLE_BATCHED_OPERATIONS],\n \"enableBatchedOperations\",\n ),\n\n defaultMessageTimeToLive: getString(\n rawSubscription[Constants.DEFAULT_MESSAGE_TIME_TO_LIVE],\n \"defaultMessageTimeToLive\",\n ),\n autoDeleteOnIdle: getString(rawSubscription[Constants.AUTO_DELETE_ON_IDLE], \"autoDeleteOnIdle\"),\n\n deadLetteringOnMessageExpiration: getBoolean(\n rawSubscription[Constants.DEAD_LETTERING_ON_MESSAGE_EXPIRATION],\n \"deadLetteringOnMessageExpiration\",\n ),\n deadLetteringOnFilterEvaluationExceptions: getBoolean(\n rawSubscription[Constants.DEAD_LETTERING_ON_FILTER_EVALUATION_EXCEPTIONS],\n \"deadLetteringOnFilterEvaluationExceptions\",\n ),\n forwardDeadLetteredMessagesTo: getStringOrUndefined(\n rawSubscription[Constants.FORWARD_DEADLETTERED_MESSAGES_TO],\n ),\n\n forwardTo: getStringOrUndefined(rawSubscription[Constants.FORWARD_TO]),\n userMetadata: rawSubscription[Constants.USER_METADATA],\n\n status: getString(rawSubscription[Constants.STATUS], \"status\") as EntityStatus,\n\n availabilityStatus: getString(\n rawSubscription[Constants.ENTITY_AVAILABILITY_STATUS],\n \"availabilityStatus\",\n ) as EntityAvailabilityStatus,\n };\n}\n\n/**\n * @internal\n * Builds the subscription runtime info object from the raw json object gotten after deserializing\n * the response from the service\n */\nexport function buildSubscriptionRuntimeProperties(\n rawSubscription: Record<string, any>,\n): SubscriptionRuntimeProperties {\n const messageCountDetails = getMessageCountDetails(rawSubscription[Constants.COUNT_DETAILS]);\n return {\n subscriptionName: getString(rawSubscription[Constants.SUBSCRIPTION_NAME], \"subscriptionName\"),\n topicName: getString(rawSubscription[Constants.TOPIC_NAME], \"topicName\"),\n totalMessageCount: getInteger(rawSubscription[Constants.MESSAGE_COUNT], \"messageCount\"),\n activeMessageCount: messageCountDetails.activeMessageCount,\n deadLetterMessageCount: messageCountDetails.deadLetterMessageCount,\n transferDeadLetterMessageCount: messageCountDetails.transferDeadLetterMessageCount,\n transferMessageCount: messageCountDetails.transferMessageCount,\n createdAt: getDate(rawSubscription[Constants.CREATED_AT], \"createdAt\"),\n modifiedAt: getDate(rawSubscription[Constants.UPDATED_AT], \"modifiedAt\"),\n accessedAt: getDate(rawSubscription[Constants.ACCESSED_AT], \"accessedAt\"),\n };\n}\n\n/**\n * Represents settable options on a subscription\n */\nexport interface CreateSubscriptionOptions extends OperationOptions {\n /**\n * The default lock duration is applied to subscriptions that do not define a lock\n * duration.\n * (If sessions are enabled, this lock duration is applicable for sessions and not for messages.)\n *\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n lockDuration?: string;\n\n /**\n * If set to true, the subscription will be session-aware and only SessionReceiver\n * will be supported. Session-aware subscription are not supported through REST.\n * Settable only at subscription creation time.\n */\n requiresSession?: boolean;\n\n /**\n * Determines how long a message lives in the subscription. Based on whether\n * dead-lettering is enabled, a message whose TTL has expired will either be moved\n * to the subscription’s associated DeadLtterQueue or permanently deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n defaultMessageTimeToLive?: string;\n\n /**\n * If it is enabled and a message expires, the Service Bus moves the message from\n * the queue into the subscription’s dead-letter sub-queue. If disabled, message\n * will be permanently deleted from the subscription’s main queue.\n * Settable only at subscription creation time.\n */\n deadLetteringOnMessageExpiration?: boolean;\n\n /**\n * Determines how the Service Bus handles a message that causes an exception during\n * a subscription’s filter evaluation. If the value is set to true, the message that\n * caused the exception will be moved to the subscription’s dead-letter sub-queue.\n * Otherwise, it will be discarded. By default this parameter is set to true,\n * allowing the user a chance to investigate the cause of the exception.\n * It can occur from a malformed message or some incorrect assumptions being made\n * in the filter about the form of the message. Settable only at topic creation time.\n */\n deadLetteringOnFilterEvaluationExceptions?: boolean;\n\n /**\n * Represents the options to create the default rule for the subscription.\n */\n defaultRuleOptions?: {\n /**\n * Name of the rule\n */\n name: string;\n\n /**\n * Defines the filter expression that the rule evaluates. For `SqlRuleFilter` input,\n * the expression string is interpreted as a SQL92 expression which must\n * evaluate to True or False. Only one between a `CorrelationRuleFilter` or\n * a `SqlRuleFilter` can be defined.\n */\n filter?: SqlRuleFilter | CorrelationRuleFilter;\n\n /**\n * The SQL like expression that can be executed on the message should the\n * associated filter apply.\n */\n action?: SqlRuleAction;\n };\n\n /**\n * The maximum delivery count of messages after which if it is still not settled,\n * gets moved to the dead-letter sub-queue.\n *\n */\n maxDeliveryCount?: number;\n\n /**\n * Specifies if batched operations should be allowed.\n */\n enableBatchedOperations?: boolean;\n\n /**\n * Status of the messaging entity.\n */\n status?: EntityStatus;\n\n /**\n * Absolute URL or the name of the queue or topic the\n * messages are to be forwarded to.\n * For example, an absolute URL input would be of the form\n * `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`\n */\n forwardTo?: string;\n\n /**\n * The user provided metadata information associated with the subscription.\n * Used to specify textual content such as tags, labels, etc.\n * Value must not exceed 1024 bytes encoded in utf-8.\n */\n userMetadata?: string;\n\n /**\n * Absolute URL or the name of the queue or topic the dead-lettered\n * messages are to be forwarded to.\n * For example, an absolute URL input would be of the form\n * `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`\n */\n forwardDeadLetteredMessagesTo?: string;\n\n /**\n * Max idle time before entity is deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n autoDeleteOnIdle?: string;\n\n /**\n * Availability status of the messaging entity.\n */\n availabilityStatus?: EntityAvailabilityStatus;\n}\n\n/**\n * Represents the input for updateSubscription.\n *\n */\nexport interface SubscriptionProperties {\n /**\n * Name of the subscription\n */\n readonly subscriptionName: string;\n\n /**\n * Name of the topic\n */\n readonly topicName: string;\n\n /**\n * The default lock duration is applied to subscriptions that do not define a lock\n * duration.\n * (If sessions are enabled, this lock duration is applicable for sessions and not for messages.)\n *\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n lockDuration: string;\n\n /**\n * If set to true, the subscription will be session-aware and only SessionReceiver\n * will be supported. Session-aware subscription are not supported through REST.\n * Settable only at subscription creation time.\n */\n readonly requiresSession: boolean;\n\n /**\n * Determines how long a message lives in the subscription. Based on whether\n * dead-lettering is enabled, a message whose TTL has expired will either be moved\n * to the subscription’s associated DeadLtterQueue or permanently deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n defaultMessageTimeToLive: string;\n\n /**\n * If it is enabled and a message expires, the Service Bus moves the message from\n * the queue into the subscription’s dead-letter sub-queue. If disabled, message\n * will be permanently deleted from the subscription’s main queue.\n * Settable only at subscription creation time.\n */\n deadLetteringOnMessageExpiration: boolean;\n\n /**\n * Determines how the Service Bus handles a message that causes an exception during\n * a subscription’s filter evaluation. If the value is set to true, the message that\n * caused the exception will be moved to the subscription’s dead-letter sub-queue.\n * Otherwise, it will be discarded. By default this parameter is set to true,\n * allowing the user a chance to investigate the cause of the exception.\n * It can occur from a malformed message or some incorrect assumptions being made\n * in the filter about the form of the message. Settable only at topic creation time.\n */\n deadLetteringOnFilterEvaluationExceptions: boolean;\n\n /**\n * The maximum delivery count of messages after which if it is still not settled,\n * gets moved to the dead-letter sub-queue.\n *\n */\n maxDeliveryCount: number;\n\n /**\n * Specifies if batched operations should be allowed.\n */\n enableBatchedOperations: boolean;\n\n /**\n * Status of the messaging entity.\n */\n status: EntityStatus;\n\n /**\n * Absolute URL or the name of the queue or topic the\n * messages are to be forwarded to.\n * For example, an absolute URL input would be of the form\n * `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`\n */\n forwardTo?: string;\n\n /**\n * The user provided metadata information associated with the subscription.\n * Used to specify textual content such as tags, labels, etc.\n * Value must not exceed 1024 bytes encoded in utf-8.\n */\n userMetadata?: string;\n\n /**\n * Absolute URL or the name of the queue or topic the dead-lettered\n * messages are to be forwarded to.\n * For example, an absolute URL input would be of the form\n * `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`\n */\n forwardDeadLetteredMessagesTo?: string;\n\n /**\n * Max idle time before entity is deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n autoDeleteOnIdle: string;\n\n /**\n * Availability status of the messaging entity.\n */\n availabilityStatus?: EntityAvailabilityStatus;\n}\n\n/**\n * @internal\n * Internal representation of settable options on a subscription\n */\nexport interface InternalSubscriptionOptions {\n /**\n * The default lock duration is applied to subscriptions that do not define a lock\n * duration.\n * (If sessions are enabled, this lock duration is applicable for sessions and not for messages.)\n *\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n LockDuration?: string;\n\n /**\n * If set to true, the subscription will be session-aware and only SessionReceiver\n * will be supported. Session-aware subscription are not supported through REST.\n * Settable only at subscription creation time.\n */\n RequiresSession?: string;\n\n /**\n * Determines how long a message lives in the subscription. Based on whether\n * dead-lettering is enabled, a message whose TTL has expired will either be moved\n * to the subscription’s associated DeadLtterQueue or permanently deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n DefaultMessageTimeToLive?: string;\n\n /**\n * If it is enabled and a message expires, the Service Bus moves the message from\n * the queue into the subscription’s dead-letter sub-queue. If disabled, message\n * will be permanently deleted from the subscription’s main queue.\n * Settable only at subscription creation time.\n */\n DeadLetteringOnMessageExpiration?: string;\n\n /**\n * Determines how the Service Bus handles a message that causes an exception during\n * a subscription’s filter evaluation. If the value is set to true, the message\n * that caused the exception will be moved to the subscription’s dead-letter sub-queue.\n * Otherwise, it will be discarded. By default this parameter is set to true, allowing\n * the user a chance to investigate the cause of the exception. It can occur from a\n * malformed message or some incorrect assumptions being made in the filter about the\n * form of the message. Settable only at topic creation time.\n */\n DeadLetteringOnFilterEvaluationExceptions?: string;\n\n /**\n * The maximum delivery count of messages after which if it is still not settled,\n * gets moved to the dead-letter sub-queue.\n *\n */\n MaxDeliveryCount?: string;\n\n /**\n * Specifies if batched operations should be allowed.\n */\n EnableBatchedOperations?: string;\n\n /**\n * Status of the messaging entity.\n */\n Status?: string;\n\n /**\n * Absolute URL or the name of the queue or topic the\n * messages are to be forwarded to.\n * For example, an absolute URL input would be of the form\n * `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`\n */\n ForwardTo?: string;\n\n /**\n * The user provided metadata information associated with the subscription.\n * Used to specify textual content such as tags, labels, etc.\n * Value must not exceed 1024 bytes encoded in utf-8.\n */\n UserMetadata?: string;\n\n /**\n * Absolute URL or the name of the queue or topic the dead-lettered\n * messages are to be forwarded to.\n * For example, an absolute URL input would be of the form\n * `sb://<your-service-bus-namespace-endpoint>/<queue-or-topic-name>`\n */\n ForwardDeadLetteredMessagesTo?: string;\n\n /**\n * Max idle time before entity is deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n AutoDeleteOnIdle?: string;\n\n /**\n * Availability status of the messaging entity.\n */\n EntityAvailabilityStatus?: string;\n\n DefaultRuleDescription?: InternalRuleOptions;\n}\n\n/**\n * Represents runtime info attributes of a subscription entity\n */\nexport interface SubscriptionRuntimeProperties {\n /**\n * Name of the subscription\n */\n subscriptionName: string;\n\n /**\n * Name of the topic\n */\n topicName: string;\n\n /**\n * The entity's message count.\n *\n */\n totalMessageCount: number;\n\n /**\n * The number of active messages in the queue.\n */\n activeMessageCount: number;\n\n /**\n * The number of messages that have been dead lettered.\n */\n deadLetterMessageCount: number;\n\n /**\n * The number of messages transferred to another queue, topic, or subscription\n */\n transferMessageCount: number;\n\n /**\n * The number of messages transferred to the dead letter queue.\n */\n transferDeadLetterMessageCount: number;\n\n /**\n * Created at timestamp\n */\n createdAt: Date;\n\n /**\n * Updated at timestamp\n */\n modifiedAt: Date;\n\n /**\n * Accessed at timestamp\n */\n accessedAt: Date;\n}\n\n/**\n * @internal\n * SubscriptionResourceSerializer for serializing / deserializing Subscription entities\n */\nexport class SubscriptionResourceSerializer implements AtomXmlSerializer {\n serialize(resource: InternalSubscriptionOptions): Record<string, unknown> {\n return serializeToAtomXmlRequest(\"SubscriptionDescription\", resource);\n }\n\n async deserialize(response: FullOperationResponse): Promise<FullOperationResponse> {\n return deserializeAtomXmlResponse([\"TopicName\", \"SubscriptionName\"], response);\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { FullOperationResponse, OperationOptions } from \"@azure/core-client\";\nimport {\n AtomXmlSerializer,\n deserializeAtomXmlResponse,\n serializeToAtomXmlRequest,\n} from \"../util/atomXmlHelper\";\nimport * as Constants from \"../util/constants\";\nimport {\n AuthorizationRule,\n EntityStatus,\n EntityAvailabilityStatus,\n getAuthorizationRulesOrUndefined,\n getBoolean,\n getInteger,\n getIntegerOrUndefined,\n getRawAuthorizationRules,\n getString,\n getStringOrUndefined,\n getDate,\n getMessageCountDetails,\n} from \"../util/utils\";\n\n/**\n * @internal\n * Builds the topic options object from the user provided options.\n * Handles the differences in casing for the property names,\n * converts values to string and ensures the right order as expected by the service\n */\nexport function buildTopicOptions(topic: CreateTopicOptions): InternalTopicOptions {\n return {\n // NOTE: this ordering is extremely important. As an example, misordering of the ForwardTo property\n // resulted in a customer bug where the Forwarding attributes appeared to be set but the portal was\n // not picking up on it.\n //\n // The authority on this ordering is here:\n // https://github.com/Azure/azure-sdk-for-net/blob/8af2dfc32c96ef3e340f9d20013bf588d97ea756/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/TopicPropertiesExtensions.cs#L175\n\n DefaultMessageTimeToLive: topic.defaultMessageTimeToLive,\n MaxSizeInMegabytes: getStringOrUndefined(topic.maxSizeInMegabytes),\n RequiresDuplicateDetection: getStringOrUndefined(topic.requiresDuplicateDetection),\n DuplicateDetectionHistoryTimeWindow: topic.duplicateDetectionHistoryTimeWindow,\n EnableBatchedOperations: getStringOrUndefined(topic.enableBatchedOperations),\n AuthorizationRules: getRawAuthorizationRules(topic.authorizationRules),\n Status: getStringOrUndefined(topic.status),\n UserMetadata: getStringOrUndefined(topic.userMetadata),\n SupportOrdering: getStringOrUndefined(topic.supportOrdering),\n AutoDeleteOnIdle: getStringOrUndefined(topic.autoDeleteOnIdle),\n EnablePartitioning: getStringOrUndefined(topic.enablePartitioning),\n EntityAvailabilityStatus: getStringOrUndefined(topic.availabilityStatus),\n EnableExpress: getStringOrUndefined(topic.enableExpress),\n MaxMessageSizeInKilobytes: getStringOrUndefined(topic.maxMessageSizeInKilobytes),\n };\n}\n\n/**\n * @internal\n * Builds the topic object from the raw json object gotten after deserializing the\n * response from the service\n */\nexport function buildTopic(rawTopic: Record<string, any>): TopicProperties {\n return {\n name: getString(rawTopic[Constants.TOPIC_NAME], \"topicName\"),\n maxSizeInMegabytes: getInteger(rawTopic[Constants.MAX_SIZE_IN_MEGABYTES], \"maxSizeInMegabytes\"),\n\n enablePartitioning: getBoolean(rawTopic[Constants.ENABLE_PARTITIONING], \"enablePartitioning\"),\n supportOrdering: getBoolean(rawTopic[Constants.SUPPORT_ORDERING], \"supportOrdering\"),\n enableBatchedOperations: getBoolean(\n rawTopic[Constants.ENABLE_BATCHED_OPERATIONS],\n \"enableBatchedOperations\",\n ),\n\n defaultMessageTimeToLive: getString(\n rawTopic[Constants.DEFAULT_MESSAGE_TIME_TO_LIVE],\n \"defaultMessageTimeToLive\",\n ),\n autoDeleteOnIdle: rawTopic[Constants.AUTO_DELETE_ON_IDLE],\n\n requiresDuplicateDetection: getBoolean(\n rawTopic[Constants.REQUIRES_DUPLICATE_DETECTION],\n \"requiresDuplicateDetection\",\n ),\n duplicateDetectionHistoryTimeWindow: getString(\n rawTopic[Constants.DUPLICATE_DETECTION_HISTORY_TIME_WINDOW],\n \"duplicateDetectionHistoryTimeWindow\",\n ),\n\n authorizationRules: getAuthorizationRulesOrUndefined(rawTopic[Constants.AUTHORIZATION_RULES]),\n userMetadata: rawTopic[Constants.USER_METADATA],\n\n status: rawTopic[Constants.STATUS],\n\n enableExpress: getBoolean(rawTopic[Constants.ENABLE_EXPRESS], \"enableExpress\"),\n\n availabilityStatus: rawTopic[Constants.ENTITY_AVAILABILITY_STATUS],\n\n maxMessageSizeInKilobytes: getIntegerOrUndefined(\n rawTopic[Constants.MAX_MESSAGE_SIZE_IN_KILOBYTES],\n ),\n };\n}\n\n/**\n * @internal\n * Builds the topic runtime info object from the raw json object gotten after deserializing the\n * response from the service\n */\nexport function buildTopicRuntimeProperties(rawTopic: Record<string, any>): TopicRuntimeProperties {\n return {\n name: getString(rawTopic[Constants.TOPIC_NAME], \"topicName\"),\n sizeInBytes: getIntegerOrUndefined(rawTopic[Constants.SIZE_IN_BYTES]),\n subscriptionCount: getIntegerOrUndefined(rawTopic[Constants.SUBSCRIPTION_COUNT]),\n createdAt: getDate(rawTopic[Constants.CREATED_AT], \"createdAt\"),\n scheduledMessageCount: getMessageCountDetails(rawTopic[Constants.COUNT_DETAILS])\n .scheduledMessageCount,\n modifiedAt: getDate(rawTopic[Constants.UPDATED_AT], \"modifiedAt\"),\n accessedAt: getDate(rawTopic[Constants.ACCESSED_AT], \"accessedAt\"),\n };\n}\n\n/**\n * Represents settable options on a topic\n */\nexport interface CreateTopicOptions extends OperationOptions {\n /**\n * Determines how long a message lives in the associated subscriptions.\n * Subscriptions inherit the TTL from the topic unless they are created explicitly\n * with a smaller TTL. Based on whether dead-lettering is enabled, a message whose\n * TTL has expired will either be moved to the subscription’s associated dead-letter\n * sub-queue or will be permanently deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n defaultMessageTimeToLive?: string;\n\n /**\n * Specifies the maximum topic size in megabytes. Any attempt to enqueue a message\n * that will cause the topic to exceed this value will fail. All messages that are\n * stored in the topic or any of its subscriptions count towards this value.\n * Multiple copies of a message that reside in one or multiple subscriptions count\n * as a single messages. For example, if message m exists once in subscription s1\n * and twice in subscription s2, m is counted as a single message.\n */\n maxSizeInMegabytes?: number;\n\n /**\n * The maximum message size in kilobytes for messages sent to this topic.\n *\n * (Configurable only for Premium Tier Service Bus namespace.)\n */\n maxMessageSizeInKilobytes?: number;\n\n /**\n * If enabled, the topic will detect duplicate messages within the time span\n * specified by the DuplicateDetectionHistoryTimeWindow property.\n * Settable only at topic creation time.\n */\n requiresDuplicateDetection?: boolean;\n\n /**\n * Specifies the time span during which the Service Bus will detect message duplication.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n duplicateDetectionHistoryTimeWindow?: string;\n\n /**\n * Specifies if batched operations should be allowed.\n */\n enableBatchedOperations?: boolean;\n\n /**\n * Authorization rules on the topic\n */\n authorizationRules?: AuthorizationRule[];\n\n /**\n * Status of the messaging entity.\n */\n status?: EntityStatus;\n\n /**\n * The user provided metadata information associated with the topic.\n * Used to specify textual content such as tags, labels, etc.\n * Value must not exceed 1024 bytes encoded in utf-8.\n */\n userMetadata?: string;\n\n /**\n * Specifies whether the topic supports message ordering.\n */\n supportOrdering?: boolean;\n\n /**\n * Max idle time before entity is deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n autoDeleteOnIdle?: string;\n\n /**\n * Specifies whether the topic should be partitioned\n */\n enablePartitioning?: boolean;\n\n /**\n * Specifies whether express entities are enabled on topic.\n */\n enableExpress?: boolean;\n\n /**\n * Availability status of the messaging entity.\n */\n availabilityStatus?: EntityAvailabilityStatus;\n}\n\n/**\n * Represents the input for updateTopic.\n *\n */\nexport interface TopicProperties {\n /**\n * Name of the topic\n */\n readonly name: string;\n\n /**\n * Determines how long a message lives in the associated subscriptions.\n * Subscriptions inherit the TTL from the topic unless they are created explicitly\n * with a smaller TTL. Based on whether dead-lettering is enabled, a message whose\n * TTL has expired will either be moved to the subscription’s associated dead-letter\n * sub-queue or will be permanently deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n defaultMessageTimeToLive: string;\n\n /**\n * Specifies the maximum topic size in megabytes. Any attempt to enqueue a message\n * that will cause the topic to exceed this value will fail. All messages that are\n * stored in the topic or any of its subscriptions count towards this value.\n * Multiple copies of a message that reside in one or multiple subscriptions count\n * as a single messages. For example, if message m exists once in subscription s1\n * and twice in subscription s2, m is counted as a single message.\n */\n maxSizeInMegabytes: number;\n\n /**\n * The maximum message size in kilobytes for messages sent to this queue/topic.\n *\n * Not applicable if service version \"2017-04\" is chosen when creating the `ServiceBusAdministrationClient`.\n */\n maxMessageSizeInKilobytes?: number;\n\n /**\n * If enabled, the topic will detect duplicate messages within the time span\n * specified by the DuplicateDetectionHistoryTimeWindow property.\n * Settable only at topic creation time.\n */\n readonly requiresDuplicateDetection: boolean;\n\n /**\n * Specifies the time span during which the Service Bus will detect message duplication.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n duplicateDetectionHistoryTimeWindow: string;\n\n /**\n * Specifies if batched operations should be allowed.\n */\n enableBatchedOperations: boolean;\n\n /**\n * Authorization rules on the topic\n */\n authorizationRules?: AuthorizationRule[];\n\n /**\n * Status of the messaging entity.\n */\n status: EntityStatus;\n\n /**\n * The user provided metadata information associated with the topic.\n * Used to specify textual content such as tags, labels, etc.\n * Value must not exceed 1024 bytes encoded in utf-8.\n */\n userMetadata: string;\n\n /**\n * Specifies whether the topic supports message ordering.\n */\n supportOrdering: boolean;\n\n /**\n * Max idle time before entity is deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n autoDeleteOnIdle: string;\n\n /**\n * Specifies whether the topic should be partitioned\n */\n readonly enablePartitioning: boolean;\n\n /**\n * Specifies whether express entities are enabled on topic.\n */\n readonly enableExpress: boolean;\n\n /**\n * Availability status of the messaging entity.\n */\n readonly availabilityStatus: EntityAvailabilityStatus;\n}\n\n/**\n * @internal\n * Internal representation of settable options on a topic\n */\nexport interface InternalTopicOptions {\n /**\n * Determines how long a message lives in the associated subscriptions. Subscriptions\n * inherit the TTL from the topic unless they are created explicitly with a smaller TTL.\n * Based on whether dead-lettering is enabled, a message whose TTL has expired will\n * either be moved to the subscription’s associated DeadLtterQueue or will be\n * permanently deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n DefaultMessageTimeToLive?: string;\n\n /**\n * Specifies the maximum topic size in megabytes. Any attempt to enqueue a message\n * that will cause the topic to exceed this value will fail. All messages that are\n * stored in the topic or any of its subscriptions count towards this value.\n * Multiple copies of a message that reside in one or multiple subscriptions count\n * as a single messages. For example, if message m exists once in subscription s1\n * and twice in subscription s2, m is counted as a single message.\n */\n MaxSizeInMegabytes?: string;\n\n /**\n * The maximum message size in kilobytes for messages sent to this queue/topic\n *\n */\n MaxMessageSizeInKilobytes?: string;\n\n /**\n * If enabled, the topic will detect duplicate messages within the time span\n * specified by the DuplicateDetectionHistoryTimeWindow property.\n * Settable only at topic creation time.\n */\n RequiresDuplicateDetection?: string;\n\n /**\n * Specifies the time span during which the Service Bus will detect message\n * duplication.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n DuplicateDetectionHistoryTimeWindow?: string;\n\n /**\n * Specifies if batched operations should be allowed.\n */\n EnableBatchedOperations?: string;\n\n /**\n * Authorization rules on the topic\n */\n AuthorizationRules?: any;\n\n /**\n * Status of the messaging entity.\n */\n Status?: string;\n\n /**\n * The user provided metadata information associated with the topic.\n * Used to specify textual content such as tags, labels, etc.\n * Value must not exceed 1024 bytes encoded in utf-8.\n */\n UserMetadata?: string;\n\n /**\n * Specifies whether the topic supports message ordering.\n */\n SupportOrdering?: string;\n\n /**\n * Max idle time before entity is deleted.\n * This is to be specified in ISO-8601 duration format\n * such as \"PT1M\" for 1 minute, \"PT5S\" for 5 seconds.\n *\n * More on ISO-8601 duration format: https://en.wikipedia.org/wiki/ISO_8601#Durations\n */\n AutoDeleteOnIdle?: string;\n\n /**\n * Specifies whether the topic should be partitioned\n */\n EnablePartitioning?: string;\n\n /**\n * Specifies whether express entities are enabled on queue.\n */\n EnableExpress?: string;\n\n /**\n * Availability status of the messaging entity.\n */\n EntityAvailabilityStatus?: string;\n}\n\n/**\n * Represents runtime info attributes of a topic entity\n */\nexport interface TopicRuntimeProperties {\n /**\n * Name of the topic\n */\n name: string;\n\n /**\n * Specifies the topic size in bytes.\n */\n sizeInBytes?: number;\n\n /**\n * The subscription count on given topic.\n *\n */\n subscriptionCount?: number;\n\n /**\n * The number of scheduled messages.\n */\n scheduledMessageCount: number;\n\n /**\n * Created at timestamp\n */\n createdAt: Date;\n\n /**\n * Updated at timestamp\n */\n modifiedAt: Date;\n\n /**\n * Accessed at timestamp\n */\n accessedAt: Date;\n}\n\n/**\n * @internal\n * TopicResourceSerializer for serializing / deserializing Topic entities\n */\nexport class TopicResourceSerializer implements AtomXmlSerializer {\n serialize(resource: InternalTopicOptions): Record<string, unknown> {\n return serializeToAtomXmlRequest(\"TopicDescription\", resource);\n }\n async deserialize(response: FullOperationResponse): Promise<FullOperationResponse> {\n return deserializeAtomXmlResponse([\"TopicName\"], response);\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport crypto from \"crypto\";\n\n/**\n * @internal\n */\nexport async function generateKey(secret: string, stringToSign: string): Promise<string> {\n const result = encodeURIComponent(\n crypto.createHmac(\"sha256\", secret).update(stringToSign).digest(\"base64\"),\n );\n return result;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AccessToken, NamedKeyCredential } from \"@azure/core-auth\";\nimport { createHttpHeaders, PipelineRequest } from \"@azure/core-rest-pipeline\";\nimport { generateKey } from \"./crypto\";\nimport { createSasTokenProvider, SasTokenProvider } from \"@azure/core-amqp\";\n\n/**\n * @internal\n */\nexport class SasServiceClientCredentials {\n /**\n * The NamedKeyCredential containing the key name and secret key value.\n */\n private _credential: NamedKeyCredential;\n\n /**\n * A SasTokenProvider provides a method to retrieve an `AccessToken`.\n */\n private _tokenProvider: SasTokenProvider;\n /**\n * Creates a new sasServiceClientCredentials object.\n *\n * @param credential - The NamedKeyCredential containing the key name and secret key value.\n */\n constructor(credential: NamedKeyCredential) {\n this._credential = credential;\n this._tokenProvider = createSasTokenProvider(credential);\n }\n\n private async _generateSignature(targetUri: string, expirationDate: number): Promise<string> {\n const stringToSign = `${targetUri}\\n${expirationDate}`;\n const result = await generateKey(this._credential.key, stringToSign);\n return result;\n }\n\n /**\n * Signs a request with the Authentication header.\n *\n * @param request - The {@link PipelineRequest} to be signed.\n * @returns The signed request object.\n */\n async signRequest(request: PipelineRequest): Promise<PipelineRequest> {\n if (!request.headers) request.headers = createHttpHeaders();\n\n const targetUri = encodeURIComponent(request.url.toLowerCase()).toLowerCase();\n\n const date = new Date();\n date.setMinutes(date.getMinutes() + 5);\n const expirationDate = Math.round(date.getTime() / 1000);\n const signature = await this._generateSignature(targetUri, expirationDate);\n request.headers.set(\n \"authorization\",\n `SharedAccessSignature sig=${signature}&se=${expirationDate}&skn=${this._credential.name}&sr=${targetUri}`,\n );\n request.withCredentials = true;\n return request;\n }\n\n getToken(audience: string): Promise<AccessToken> {\n return this._tokenProvider.getToken(audience);\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createTracingClient, TracingSpanOptions, TracingSpanKind } from \"@azure/core-tracing\";\nimport { ConnectionConfig } from \"@azure/core-amqp\";\nimport { packageJsonInfo } from \"../util/constants\";\n\n/**\n * The names of the operations that can be instrumented.\n */\nexport type MessagingOperationNames = \"publish\" | \"receive\" | \"process\" | \"settle\";\n\n/**\n * The {@link TracingClient} that is used to add tracing spans.\n */\nexport const tracingClient = createTracingClient({\n namespace: \"Microsoft.ServiceBus\",\n packageName: packageJsonInfo.name,\n packageVersion: packageJsonInfo.version,\n});\n\n/**\n * Creates {@link TracingSpanOptions} from the provided data.\n * @param serviceBusConfig - The configuration object containing initial attributes to set on the span.\n * @param spanKind - The {@link TracingSpanKind} for the newly created span.\n * @param operation - The operation type.\n * @returns a {@link TracingSpanOptions} that can be passed to a {@link TracingClient}\n */\nexport function toSpanOptions(\n serviceBusConfig: Pick<ConnectionConfig, \"host\"> & { entityPath: string },\n operation: MessagingOperationNames,\n spanKind?: TracingSpanKind,\n): TracingSpanOptions {\n const propertyName =\n operation === \"process\" || operation === \"receive\"\n ? \"messaging.source.name\"\n : \"messaging.destination.name\";\n\n const spanOptions: TracingSpanOptions = {\n spanAttributes: {\n \"messaging.system\": \"servicebus\",\n [propertyName]: serviceBusConfig.entityPath,\n \"messaging.operation\": operation,\n \"net.peer.name\": serviceBusConfig.host,\n },\n };\n if (spanKind) {\n spanOptions.spanKind = spanKind;\n }\n return spanOptions;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Constants as AMQPConstants, parseConnectionString } from \"@azure/core-amqp\";\nimport {\n TokenCredential,\n isTokenCredential,\n NamedKeyCredential,\n isNamedKeyCredential,\n} from \"@azure/core-auth\";\nimport {\n ServiceClient,\n OperationOptions,\n CommonClientOptions,\n FullOperationResponse,\n} from \"@azure/core-client\";\nimport { PagedAsyncIterableIterator, PageSettings } from \"@azure/core-paging\";\nimport {\n bearerTokenAuthenticationPolicy,\n RestError,\n PipelineResponse,\n createPipelineFromOptions,\n PipelineRequest,\n createPipelineRequest,\n PipelinePolicy,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { CorrelationRuleFilter } from \"./core/managementClient\";\nimport { administrationLogger as logger } from \"./log\";\nimport {\n buildNamespace,\n NamespaceProperties,\n NamespaceResourceSerializer,\n} from \"./serializers/namespaceResourceSerializer\";\nimport {\n buildQueue,\n buildQueueOptions,\n buildQueueRuntimeProperties,\n CreateQueueOptions,\n InternalQueueOptions,\n QueueProperties,\n QueueResourceSerializer,\n QueueRuntimeProperties,\n} from \"./serializers/queueResourceSerializer\";\nimport {\n buildRule,\n CreateRuleOptions,\n isSqlRuleAction,\n RuleProperties,\n RuleResourceSerializer,\n SqlRuleAction,\n SqlRuleFilter,\n} from \"./serializers/ruleResourceSerializer\";\nimport {\n buildSubscription,\n buildSubscriptionOptions,\n buildSubscriptionRuntimeProperties,\n CreateSubscriptionOptions,\n InternalSubscriptionOptions,\n SubscriptionProperties,\n SubscriptionResourceSerializer,\n SubscriptionRuntimeProperties,\n} from \"./serializers/subscriptionResourceSerializer\";\nimport {\n buildTopic,\n buildTopicOptions,\n buildTopicRuntimeProperties,\n CreateTopicOptions,\n InternalTopicOptions,\n TopicProperties,\n TopicResourceSerializer,\n TopicRuntimeProperties,\n} from \"./serializers/topicResourceSerializer\";\nimport { AtomXmlSerializer, executeAtomXmlOperation } from \"./util/atomXmlHelper\";\nimport * as Constants from \"./util/constants\";\nimport { parseURL } from \"./util/parseUrl\";\nimport { SasServiceClientCredentials } from \"./util/sasServiceClientCredentials\";\nimport { tracingClient } from \"./diagnostics/tracing\";\nimport { isDefined } from \"@azure/core-util\";\nimport {\n formatUserAgentPrefix,\n getHttpResponseOnly,\n isAbsoluteUrl,\n isJSONLikeObject,\n ServiceBusAtomAPIVersion,\n} from \"./util/utils\";\nimport { HttpResponse } from \"./util/compat\";\n\n/**\n * Request options for list<entity-type>() operations\n */\nexport interface ListRequestOptions {\n /**\n * Count of entities to fetch.\n */\n maxCount?: number;\n\n /**\n * Count of entities to skip from being fetched.\n */\n skip?: number;\n}\n\n/**\n * Represents the returned response of the operation along with the raw response.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type WithResponse<T extends object> = T & {\n /**\n * The underlying HTTP response.\n */\n _response: HttpResponse;\n};\n\n/**\n * Represents the client options of the `ServiceBusAdministrationClient`.\n */\nexport interface ServiceBusAdministrationClientOptions extends CommonClientOptions {\n /**\n * Service version of the ATOM API.\n *\n * Currently supported = \"2021-05\" | \"2017-04\"\n *\n * Defaults to \"2021-05\".\n */\n serviceVersion?: \"2021-05\" | \"2017-04\";\n}\n\n/**\n * Represents the result of list operation on entities which also contains the `continuationToken` to start iterating over from.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type EntitiesResponse<T extends object> = WithResponse<Array<T>> &\n Pick<PageSettings, \"continuationToken\">;\n\nfunction signingPolicy(credentials: {\n signRequest(request: PipelineRequest): Promise<PipelineRequest>;\n}): PipelinePolicy {\n return {\n name: \"signingPolicy\",\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const signed = await credentials.signRequest(request);\n return next(signed);\n },\n };\n}\n\n/**\n * All operations return promises that resolve to an object that has the relevant output.\n * These objects also have a property called `_response` that you can use if you want to\n * access the direct response from the service.\n */\nexport class ServiceBusAdministrationClient extends ServiceClient {\n /**\n * Reference to the endpoint as extracted from input connection string.\n */\n private endpoint: string;\n\n /**\n * Reference to the endpoint with protocol prefix as extracted from input connection string.\n */\n private endpointWithProtocol: string;\n\n private serviceVersion: ServiceBusAtomAPIVersion;\n\n /**\n * Singleton instances of serializers used across the various operations.\n */\n private namespaceResourceSerializer: AtomXmlSerializer;\n private queueResourceSerializer: AtomXmlSerializer;\n private topicResourceSerializer: AtomXmlSerializer;\n private subscriptionResourceSerializer: AtomXmlSerializer;\n private ruleResourceSerializer: AtomXmlSerializer;\n\n /**\n * Credentials used to generate tokens as required for the various operations.\n */\n private credentials: SasServiceClientCredentials | TokenCredential;\n\n /**\n * Initializes a new instance of the ServiceBusAdministrationClient class.\n * @param connectionString - The connection string needed for the client to connect to Azure.\n * @param options - PipelineOptions\n */\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n constructor(connectionString: string, options?: ServiceBusAdministrationClientOptions);\n /**\n *\n * @param fullyQualifiedNamespace - The fully qualified namespace of your Service Bus instance which is\n * likely to be similar to <yournamespace>.servicebus.windows.net.\n * @param credential - A credential object used by the client to get the token to authenticate the connection\n * with the Azure Service Bus. See @azure/identity for creating the credentials.\n * If you're using your own implementation of the `TokenCredential` interface against AAD, then set the \"scopes\" for service-bus\n * to be `[\"https://servicebus.azure.net//user_impersonation\"]` to get the appropriate token.\n * Use the `AzureNamedKeyCredential` from @azure/core-auth if you want to pass in a `SharedAccessKeyName`\n * and `SharedAccessKey` without using a connection string. These fields map to the `name` and `key` field respectively\n * in `AzureNamedKeyCredential`.\n * @param options - PipelineOptions\n */\n constructor(\n fullyQualifiedNamespace: string,\n credential: TokenCredential | NamedKeyCredential,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: ServiceBusAdministrationClientOptions,\n );\n constructor(\n fullyQualifiedNamespaceOrConnectionString1: string,\n credentialOrOptions2?:\n | TokenCredential\n | NamedKeyCredential\n | ServiceBusAdministrationClientOptions,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options3?: ServiceBusAdministrationClientOptions,\n ) {\n let options: ServiceBusAdministrationClientOptions;\n let fullyQualifiedNamespace: string;\n let credentials: SasServiceClientCredentials | TokenCredential;\n let authPolicy: PipelinePolicy;\n if (isTokenCredential(credentialOrOptions2)) {\n fullyQualifiedNamespace = fullyQualifiedNamespaceOrConnectionString1;\n options = options3 || {};\n credentials = credentialOrOptions2;\n authPolicy = bearerTokenAuthenticationPolicy({\n credential: credentials,\n scopes: AMQPConstants.aadServiceBusScope,\n });\n } else if (isNamedKeyCredential(credentialOrOptions2)) {\n fullyQualifiedNamespace = fullyQualifiedNamespaceOrConnectionString1;\n credentials = new SasServiceClientCredentials(credentialOrOptions2);\n options = options3 || {};\n authPolicy = signingPolicy(credentials as SasServiceClientCredentials);\n } else {\n const connectionString = fullyQualifiedNamespaceOrConnectionString1;\n options = credentialOrOptions2 || {};\n const connectionStringObj: any = parseConnectionString(connectionString);\n if (connectionStringObj.Endpoint === undefined) {\n throw new Error(\"Missing Endpoint in connection string.\");\n }\n try {\n fullyQualifiedNamespace = connectionStringObj.Endpoint.match(\".*://([^/]*)\")[1];\n } catch (error: any) {\n throw new Error(\"Endpoint in the connection string is not valid.\");\n }\n credentials = new SasServiceClientCredentials({\n key: connectionStringObj.SharedAccessKey,\n name: connectionStringObj.SharedAccessKeyName,\n });\n authPolicy = signingPolicy(credentials as SasServiceClientCredentials);\n }\n\n const userAgentPrefix = formatUserAgentPrefix(options.userAgentOptions?.userAgentPrefix);\n const serviceClientOptions = createPipelineFromOptions({\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n });\n serviceClientOptions.addPolicy(authPolicy);\n super({ pipeline: serviceClientOptions });\n this.endpoint = fullyQualifiedNamespace;\n this.endpointWithProtocol = fullyQualifiedNamespace.endsWith(\"/\")\n ? \"sb://\" + fullyQualifiedNamespace\n : \"sb://\" + fullyQualifiedNamespace + \"/\";\n this.serviceVersion = options.serviceVersion ?? Constants.CURRENT_API_VERSION;\n this.credentials = credentials;\n this.namespaceResourceSerializer = new NamespaceResourceSerializer();\n this.queueResourceSerializer = new QueueResourceSerializer();\n this.topicResourceSerializer = new TopicResourceSerializer();\n this.subscriptionResourceSerializer = new SubscriptionResourceSerializer();\n this.ruleResourceSerializer = new RuleResourceSerializer();\n }\n\n /**\n * Returns an object representing the metadata related to a service bus namespace.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n */\n async getNamespaceProperties(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n ): Promise<WithResponse<NamespaceProperties>> {\n logger.verbose(`Performing management operation - getNamespaceProperties()`);\n\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getNamespaceProperties\",\n operationOptions,\n async (updatedOptions) => {\n const response = await this.getResource(\n \"$namespaceinfo\",\n this.namespaceResourceSerializer,\n updatedOptions,\n );\n return this.buildNamespacePropertiesResponse(response);\n },\n );\n }\n\n /**\n * Creates a queue with given name, configured using the given options\n * @param options - Options to configure the Queue being created(For example, you can configure a queue to support partitions or sessions)\n * and the operation options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityAlreadyExistsError` when requested messaging entity already exists,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `QuotaExceededError` when requested operation fails due to quote limits exceeding from service side,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async createQueue(\n queueName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: CreateQueueOptions = {},\n ): Promise<WithResponse<QueueProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.createQueue\",\n options,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - createQueue() for \"${queueName}\" with options: %j`,\n options,\n );\n const response = await this.putResource(\n queueName,\n buildQueueOptions(options || {}),\n this.queueResourceSerializer,\n false,\n updatedOptions,\n );\n\n return this.buildQueueResponse(response);\n },\n );\n }\n\n /**\n * Returns an object representing the Queue and its properties.\n * If you want to get the Queue runtime info like message count details, use `getQueueRuntimeProperties` API.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async getQueue(\n queueName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n ): Promise<WithResponse<QueueProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getQueue\",\n operationOptions,\n async (updatedOptions) => {\n logger.verbose(`Performing management operation - getQueue() for \"${queueName}\"`);\n const response = await this.getResource(\n queueName,\n this.queueResourceSerializer,\n updatedOptions,\n );\n\n return this.buildQueueResponse(response);\n },\n );\n }\n\n /**\n * Returns an object representing the Queue runtime info like message count details.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async getQueueRuntimeProperties(\n queueName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n ): Promise<WithResponse<QueueRuntimeProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getQueueRuntimeProperties\",\n operationOptions,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - getQueueRuntimeProperties() for \"${queueName}\"`,\n );\n const response = await this.getResource(\n queueName,\n this.queueResourceSerializer,\n updatedOptions,\n );\n\n return this.buildQueueRuntimePropertiesResponse(response);\n },\n );\n }\n\n /**\n * Returns a list of objects, each representing a Queue along with its properties.\n * If you want to get the runtime info of the queues like message count, use `getQueuesRuntimeProperties` API instead.\n * @param options - The options include the maxCount and the count of entities to skip, the operation options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n private async getQueues(\n options: ListRequestOptions & OperationOptions = {},\n ): Promise<EntitiesResponse<QueueProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getQueues\",\n options,\n async (updatedOptions) => {\n logger.verbose(`Performing management operation - getQueues() with options: %j`, options);\n const response = await this.listResources(\n \"$Resources/Queues\",\n updatedOptions,\n this.queueResourceSerializer,\n );\n\n return this.buildListQueuesResponse(response);\n },\n );\n }\n\n private async *listQueuesPage(\n marker?: string,\n options: OperationOptions & Pick<PageSettings, \"maxPageSize\"> = {},\n ): AsyncIterableIterator<EntitiesResponse<QueueProperties>> {\n let listResponse;\n do {\n listResponse = await this.getQueues({\n skip: Number(marker),\n maxCount: options.maxPageSize,\n ...options,\n });\n marker = listResponse.continuationToken;\n yield listResponse;\n } while (marker);\n }\n\n private async *listQueuesAll(\n options: OperationOptions = {},\n ): AsyncIterableIterator<QueueProperties> {\n let marker: string | undefined;\n for await (const segment of this.listQueuesPage(marker, options)) {\n yield* segment;\n }\n }\n\n /**\n * Returns an async iterable iterator to list all the queues.\n *\n * .byPage() returns an async iterable iterator to list the queues in pages.\n *\n * @returns An asyncIterableIterator that supports paging.\n */\n public listQueues(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: OperationOptions,\n ): PagedAsyncIterableIterator<QueueProperties, EntitiesResponse<QueueProperties>> {\n logger.verbose(`Performing management operation - listQueues() with options: %j`, options);\n const iter = this.listQueuesAll(options);\n return {\n /**\n */\n next() {\n return iter.next();\n },\n /**\n */\n [Symbol.asyncIterator]() {\n return this;\n },\n /**\n */\n byPage: (settings: PageSettings = {}) => {\n this.throwIfInvalidContinuationToken(settings.continuationToken);\n return this.listQueuesPage(settings.continuationToken, {\n maxPageSize: settings.maxPageSize,\n ...options,\n });\n },\n };\n }\n\n /**\n * Returns a list of objects, each representing a Queue's runtime info like message count details.\n * @param options - The options include the maxCount and the count of entities to skip, the operation options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n private async getQueuesRuntimeProperties(\n options: ListRequestOptions & OperationOptions = {},\n ): Promise<EntitiesResponse<QueueRuntimeProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getQueuesRuntimeProperties\",\n options,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - getQueuesRuntimeProperties() with options: %j`,\n options,\n );\n const response = await this.listResources(\n \"$Resources/Queues\",\n updatedOptions,\n this.queueResourceSerializer,\n );\n\n return this.buildListQueuesRuntimePropertiesResponse(response);\n },\n );\n }\n\n private async *listQueuesRuntimePropertiesPage(\n marker?: string,\n options: OperationOptions & Pick<PageSettings, \"maxPageSize\"> = {},\n ): AsyncIterableIterator<EntitiesResponse<QueueRuntimeProperties>> {\n let listResponse;\n do {\n listResponse = await this.getQueuesRuntimeProperties({\n skip: Number(marker),\n maxCount: options.maxPageSize,\n ...options,\n });\n marker = listResponse.continuationToken;\n yield listResponse;\n } while (marker);\n }\n\n private async *listQueuesRuntimePropertiesAll(\n options: OperationOptions = {},\n ): AsyncIterableIterator<QueueRuntimeProperties> {\n let marker: string | undefined;\n for await (const segment of this.listQueuesRuntimePropertiesPage(marker, options)) {\n yield* segment;\n }\n }\n\n /**\n * Returns an async iterable iterator to list runtime info of the queues.\n *\n * .byPage() returns an async iterable iterator to list runtime info of the queues in pages.\n *\n *\n * @returns An asyncIterableIterator that supports paging.\n */\n public listQueuesRuntimeProperties(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: OperationOptions,\n ): PagedAsyncIterableIterator<QueueRuntimeProperties, EntitiesResponse<QueueRuntimeProperties>> {\n logger.verbose(\n `Performing management operation - listQueuesRuntimeProperties() with options: %j`,\n options,\n );\n const iter = this.listQueuesRuntimePropertiesAll(options);\n return {\n /**\n */\n next() {\n return iter.next();\n },\n /**\n */\n [Symbol.asyncIterator]() {\n return this;\n },\n /**\n */\n byPage: (settings: PageSettings = {}) => {\n this.throwIfInvalidContinuationToken(settings.continuationToken);\n return this.listQueuesRuntimePropertiesPage(settings.continuationToken, {\n maxPageSize: settings.maxPageSize,\n ...options,\n });\n },\n };\n }\n\n /**\n * Updates the queue based on the queue properties provided.\n * All queue properties must be set even though only a subset of them are actually updatable.\n * Therefore, the suggested flow is to use the output from `getQueue()`, update the desired properties in it, and then pass the modified object to `updateQueue()`.\n *\n * The properties that cannot be updated are marked as readonly in the `QueueProperties` interface.\n *\n * @param queue - Object representing the properties of the queue and the raw response.\n * `requiresSession`, `requiresDuplicateDetection`, `enablePartitioning`, and `name` can't be updated after creating the queue.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async updateQueue(\n queue: WithResponse<QueueProperties>,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n ): Promise<WithResponse<QueueProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.updateQueue\",\n operationOptions,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - updateQueue() for \"${queue.name}\" with options: %j`,\n queue,\n );\n\n if (!isJSONLikeObject(queue) || queue == null) {\n throw new TypeError(\n `Parameter \"queue\" must be an object of type \"QueueDescription\" and cannot be undefined or null.`,\n );\n }\n\n if (!queue.name) {\n throw new TypeError(`\"name\" attribute of the parameter \"queue\" cannot be undefined.`);\n }\n\n const response = await this.putResource(\n queue.name,\n buildQueueOptions(queue),\n this.queueResourceSerializer,\n true,\n updatedOptions,\n );\n\n return this.buildQueueResponse(response);\n },\n );\n }\n\n /**\n * Deletes a queue.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async deleteQueue(\n queueName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n // eslint-disable-next-line @typescript-eslint/ban-types\n ): Promise<WithResponse<{}>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.deleteQueue\",\n operationOptions,\n async (updatedOptions) => {\n logger.verbose(`Performing management operation - deleteQueue() for \"${queueName}\"`);\n const response = await this.deleteResource(\n queueName,\n this.queueResourceSerializer,\n updatedOptions,\n );\n\n return { _response: getHttpResponseOnly(response) };\n },\n );\n }\n\n /**\n * Checks whether a given queue exists or not.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n */\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n async queueExists(queueName: string, operationOptions: OperationOptions = {}): Promise<boolean> {\n logger.verbose(`Performing management operation - queueExists() for \"${queueName}\"`);\n const { span, updatedOptions } = tracingClient.startSpan(\n \"ServiceBusAdministrationClient.queueExists\",\n operationOptions,\n );\n try {\n await this.getQueue(queueName, updatedOptions);\n span.setStatus({ status: \"success\" });\n return true;\n } catch (e: any) {\n span.setStatus({ status: \"error\", error: e });\n return false;\n } finally {\n span.end();\n }\n }\n\n /**\n * Creates a topic with given name, configured using the given options\n * @param options - Options to configure the Topic being created(For example, you can configure a topic to support partitions)\n * and the operation options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityAlreadyExistsError` when requested messaging entity already exists,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `QuotaExceededError` when requested operation fails due to quote limits exceeding from service side,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async createTopic(\n topicName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: CreateTopicOptions = {},\n ): Promise<WithResponse<TopicProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.createTopic\",\n options,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - createTopic() for \"${topicName}\" with options: %j`,\n options,\n );\n const response = await this.putResource(\n topicName,\n buildTopicOptions(options || {}),\n this.topicResourceSerializer,\n false,\n updatedOptions,\n );\n\n return this.buildTopicResponse(response);\n },\n );\n }\n\n /**\n * Returns an object representing the Topic and its properties.\n * If you want to get the Topic runtime info like subscription count details, use `getTopicRuntimeProperties` API.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async getTopic(\n topicName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n ): Promise<WithResponse<TopicProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getTopic\",\n operationOptions,\n async (updatedOptions) => {\n logger.verbose(`Performing management operation - getTopic() for \"${topicName}\"`);\n const response = await this.getResource(\n topicName,\n this.topicResourceSerializer,\n updatedOptions,\n );\n\n return this.buildTopicResponse(response);\n },\n );\n }\n\n /**\n * Returns an object representing the Topic runtime info like subscription count.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async getTopicRuntimeProperties(\n topicName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n ): Promise<WithResponse<TopicRuntimeProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getTopicRuntimeProperties\",\n operationOptions,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - getTopicRuntimeProperties() for \"${topicName}\"`,\n );\n const response = await this.getResource(\n topicName,\n this.topicResourceSerializer,\n updatedOptions,\n );\n\n return this.buildTopicRuntimePropertiesResponse(response);\n },\n );\n }\n\n /**\n * Returns a list of objects, each representing a Topic along with its properties.\n * If you want to get the runtime info of the topics like subscription count, use `getTopicsRuntimeProperties` API instead.\n * @param options - The options include the maxCount and the count of entities to skip, the operation options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n private async getTopics(\n options: ListRequestOptions & OperationOptions = {},\n ): Promise<EntitiesResponse<TopicProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getTopics\",\n options,\n async (updatedOptions) => {\n logger.verbose(`Performing management operation - getTopics() with options: %j`, options);\n const response = await this.listResources(\n \"$Resources/Topics\",\n updatedOptions,\n this.topicResourceSerializer,\n );\n\n return this.buildListTopicsResponse(response);\n },\n );\n }\n\n private async *listTopicsPage(\n marker?: string,\n options: OperationOptions & Pick<PageSettings, \"maxPageSize\"> = {},\n ): AsyncIterableIterator<EntitiesResponse<TopicProperties>> {\n let listResponse;\n do {\n listResponse = await this.getTopics({\n skip: Number(marker),\n maxCount: options.maxPageSize,\n ...options,\n });\n marker = listResponse.continuationToken;\n yield listResponse;\n } while (marker);\n }\n\n private async *listTopicsAll(\n options: OperationOptions = {},\n ): AsyncIterableIterator<TopicProperties> {\n let marker: string | undefined;\n for await (const segment of this.listTopicsPage(marker, options)) {\n yield* segment;\n }\n }\n\n /**\n * Returns an async iterable iterator to list all the topics.\n *\n * .byPage() returns an async iterable iterator to list the topics in pages.\n *\n *\n * @returns An asyncIterableIterator that supports paging.\n */\n public listTopics(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: OperationOptions,\n ): PagedAsyncIterableIterator<TopicProperties, EntitiesResponse<TopicProperties>> {\n logger.verbose(`Performing management operation - listTopics() with options: %j`, options);\n const iter = this.listTopicsAll(options);\n return {\n /**\n */\n next() {\n return iter.next();\n },\n /**\n */\n [Symbol.asyncIterator]() {\n return this;\n },\n /**\n */\n byPage: (settings: PageSettings = {}) => {\n this.throwIfInvalidContinuationToken(settings.continuationToken);\n return this.listTopicsPage(settings.continuationToken, {\n maxPageSize: settings.maxPageSize,\n ...options,\n });\n },\n };\n }\n\n /**\n * Returns a list of objects, each representing a Topic's runtime info like subscription count.\n * @param options - The options include the maxCount and the count of entities to skip, the operation options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n private async getTopicsRuntimeProperties(\n options: ListRequestOptions & OperationOptions = {},\n ): Promise<EntitiesResponse<TopicRuntimeProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getTopicsRuntimeProperties\",\n\n options,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - getTopicsRuntimeProperties() with options: %j`,\n options,\n );\n const response = await this.listResources(\n \"$Resources/Topics\",\n updatedOptions,\n this.topicResourceSerializer,\n );\n\n return this.buildListTopicsRuntimePropertiesResponse(response);\n },\n );\n }\n\n private async *listTopicsRuntimePropertiesPage(\n marker?: string,\n options: OperationOptions & Pick<PageSettings, \"maxPageSize\"> = {},\n ): AsyncIterableIterator<EntitiesResponse<TopicRuntimeProperties>> {\n let listResponse;\n do {\n listResponse = await this.getTopicsRuntimeProperties({\n skip: Number(marker),\n maxCount: options.maxPageSize,\n ...options,\n });\n marker = listResponse.continuationToken;\n yield listResponse;\n } while (marker);\n }\n\n private async *listTopicsRuntimePropertiesAll(\n options: OperationOptions = {},\n ): AsyncIterableIterator<TopicRuntimeProperties> {\n let marker: string | undefined;\n for await (const segment of this.listTopicsRuntimePropertiesPage(marker, options)) {\n yield* segment;\n }\n }\n\n /**\n * Returns an async iterable iterator to list runtime info of the topics.\n *\n * .byPage() returns an async iterable iterator to list runtime info of the topics in pages.\n *\n *\n * @returns An asyncIterableIterator that supports paging.\n */\n public listTopicsRuntimeProperties(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: OperationOptions,\n ): PagedAsyncIterableIterator<TopicRuntimeProperties, EntitiesResponse<TopicRuntimeProperties>> {\n logger.verbose(\n `Performing management operation - listTopicsRuntimeProperties() with options: %j`,\n options,\n );\n const iter = this.listTopicsRuntimePropertiesAll(options);\n return {\n /**\n * The next method, part of the iteration protocol\n */\n next() {\n return iter.next();\n },\n /**\n * The connection to the async iterator, part of the iteration protocol\n */\n [Symbol.asyncIterator]() {\n return this;\n },\n /**\n * Return an AsyncIterableIterator that works a page at a time\n */\n byPage: (settings: PageSettings = {}) => {\n this.throwIfInvalidContinuationToken(settings.continuationToken);\n return this.listTopicsRuntimePropertiesPage(settings.continuationToken, {\n maxPageSize: settings.maxPageSize,\n ...options,\n });\n },\n };\n }\n\n /**\n * Updates the topic based on the topic properties provided.\n * All topic properties must be set even though only a subset of them are actually updatable.\n * Therefore, the suggested flow is to use the output from `getTopic()`, update the desired properties in it, and then pass the modified object to `updateTopic()`.\n *\n * The properties that cannot be updated are marked as readonly in the `TopicProperties` interface.\n *\n * @param topic - Object representing the properties of the topic and the raw response.\n * `requiresDuplicateDetection`, `enablePartitioning`, and `name` can't be updated after creating the topic.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async updateTopic(\n topic: WithResponse<TopicProperties>,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n ): Promise<WithResponse<TopicProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.updateTopic\",\n\n operationOptions,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - updateTopic() for \"${topic.name}\" with options: %j`,\n topic,\n );\n\n if (!isJSONLikeObject(topic) || topic == null) {\n throw new TypeError(\n `Parameter \"topic\" must be an object of type \"TopicDescription\" and cannot be undefined or null.`,\n );\n }\n\n if (!topic.name) {\n throw new TypeError(`\"name\" attribute of the parameter \"topic\" cannot be undefined.`);\n }\n\n const response = await this.putResource(\n topic.name,\n buildTopicOptions(topic),\n this.topicResourceSerializer,\n true,\n updatedOptions,\n );\n\n return this.buildTopicResponse(response);\n },\n );\n }\n\n /**\n * Deletes a topic.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async deleteTopic(\n topicName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n // eslint-disable-next-line @typescript-eslint/ban-types\n ): Promise<WithResponse<{}>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.deleteTopic\",\n operationOptions,\n async (updatedOptions) => {\n logger.verbose(`Performing management operation - deleteTopic() for \"${topicName}\"`);\n const response = await this.deleteResource(\n topicName,\n this.topicResourceSerializer,\n updatedOptions,\n );\n\n return { _response: getHttpResponseOnly(response) };\n },\n );\n }\n\n /**\n * Checks whether a given topic exists or not.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n */\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n async topicExists(topicName: string, operationOptions?: OperationOptions): Promise<boolean> {\n logger.verbose(`Performing management operation - topicExists() for \"${topicName}\"`);\n const { span, updatedOptions } = tracingClient.startSpan(\n \"ServiceBusAdministrationClient.topicExists\",\n operationOptions,\n );\n try {\n span.setStatus({ status: \"success\" });\n await this.getTopic(topicName, updatedOptions);\n return true;\n } catch (e: any) {\n span.setStatus({ status: \"error\", error: e });\n return false;\n } finally {\n span.end();\n }\n }\n\n /**\n * Creates a subscription with given name, configured using the given options\n * @param options - Options to configure the Subscription being created(For example, you can configure a Subscription to support partitions or sessions)\n * and the operation options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityAlreadyExistsError` when requested messaging entity already exists,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `QuotaExceededError` when requested operation fails due to quote limits exceeding from service side,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async createSubscription(\n topicName: string,\n subscriptionName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: CreateSubscriptionOptions = {},\n ): Promise<WithResponse<SubscriptionProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.createSubscription\",\n options,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - createSubscription() for \"${subscriptionName}\" with options: %j`,\n options,\n );\n const fullPath = this.getSubscriptionPath(topicName, subscriptionName);\n const response = await this.putResource(\n fullPath,\n buildSubscriptionOptions(options || {}),\n this.subscriptionResourceSerializer,\n false,\n updatedOptions,\n );\n\n return this.buildSubscriptionResponse(response);\n },\n );\n }\n\n /**\n * Returns an object representing the Subscription and its properties.\n * If you want to get the Subscription runtime info like message count details, use `getSubscriptionRuntimeProperties` API.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async getSubscription(\n topicName: string,\n subscriptionName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n ): Promise<WithResponse<SubscriptionProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getSubscription\",\n operationOptions,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - getSubscription() for \"${subscriptionName}\"`,\n );\n const fullPath = this.getSubscriptionPath(topicName, subscriptionName);\n const response = await this.getResource(\n fullPath,\n this.subscriptionResourceSerializer,\n updatedOptions,\n );\n\n return this.buildSubscriptionResponse(response);\n },\n );\n }\n\n /**\n * Returns an object representing the Subscription runtime info like message count details.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async getSubscriptionRuntimeProperties(\n topicName: string,\n subscriptionName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n ): Promise<WithResponse<SubscriptionRuntimeProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getSubscriptionRuntimeProperties\",\n operationOptions,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - getSubscriptionRuntimeProperties() for \"${subscriptionName}\"`,\n );\n const fullPath = this.getSubscriptionPath(topicName, subscriptionName);\n const response = await this.getResource(\n fullPath,\n this.subscriptionResourceSerializer,\n updatedOptions,\n );\n\n return this.buildSubscriptionRuntimePropertiesResponse(response);\n },\n );\n }\n\n /**\n * Returns a list of objects, each representing a Subscription along with its properties.\n * If you want to get the runtime info of the subscriptions like message count, use `getSubscriptionsRuntimeProperties` API instead.\n * @param options - The options include the maxCount and the count of entities to skip, the operation options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n private async getSubscriptions(\n topicName: string,\n options: ListRequestOptions & OperationOptions = {},\n ): Promise<EntitiesResponse<SubscriptionProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getSubscriptions\",\n options,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - getSubscriptions() with options: %j`,\n options,\n );\n const response = await this.listResources(\n topicName + \"/Subscriptions/\",\n updatedOptions,\n this.subscriptionResourceSerializer,\n );\n\n return this.buildListSubscriptionsResponse(response);\n },\n );\n }\n\n private async *listSubscriptionsPage(\n topicName: string,\n marker?: string,\n options: OperationOptions & Pick<PageSettings, \"maxPageSize\"> = {},\n ): AsyncIterableIterator<EntitiesResponse<SubscriptionProperties>> {\n let listResponse;\n do {\n listResponse = await this.getSubscriptions(topicName, {\n skip: Number(marker),\n maxCount: options.maxPageSize,\n ...options,\n });\n marker = listResponse.continuationToken;\n yield listResponse;\n } while (marker);\n }\n\n private async *listSubscriptionsAll(\n topicName: string,\n options: OperationOptions = {},\n ): AsyncIterableIterator<SubscriptionProperties> {\n let marker: string | undefined;\n for await (const segment of this.listSubscriptionsPage(topicName, marker, options)) {\n yield* segment;\n }\n }\n\n /**\n *\n * Returns an async iterable iterator to list all the subscriptions\n * under the specified topic.\n *\n * .byPage() returns an async iterable iterator to list the subscriptions in pages.\n *\n * @returns An asyncIterableIterator that supports paging.\n */\n public listSubscriptions(\n topicName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: OperationOptions,\n ): PagedAsyncIterableIterator<SubscriptionProperties, EntitiesResponse<SubscriptionProperties>> {\n logger.verbose(\n `Performing management operation - listSubscriptions() with options: %j`,\n options,\n );\n const iter = this.listSubscriptionsAll(topicName, options);\n return {\n /**\n */\n next() {\n return iter.next();\n },\n /**\n */\n [Symbol.asyncIterator]() {\n return this;\n },\n /**\n */\n byPage: (settings: PageSettings = {}) => {\n this.throwIfInvalidContinuationToken(settings.continuationToken);\n return this.listSubscriptionsPage(topicName, settings.continuationToken, {\n maxPageSize: settings.maxPageSize,\n ...options,\n });\n },\n };\n }\n\n /**\n * Returns a list of objects, each representing a Subscription's runtime info like message count details.\n * @param options - The options include the maxCount and the count of entities to skip, the operation options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n private async getSubscriptionsRuntimeProperties(\n topicName: string,\n options: ListRequestOptions & OperationOptions = {},\n ): Promise<EntitiesResponse<SubscriptionRuntimeProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getSubscriptionsRuntimeProperties\",\n options,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - getSubscriptionsRuntimeProperties() with options: %j`,\n options,\n );\n const response = await this.listResources(\n topicName + \"/Subscriptions/\",\n updatedOptions,\n this.subscriptionResourceSerializer,\n );\n\n return this.buildListSubscriptionsRuntimePropertiesResponse(response);\n },\n );\n }\n\n private async *listSubscriptionsRuntimePropertiesPage(\n topicName: string,\n marker?: string,\n options: OperationOptions & Pick<PageSettings, \"maxPageSize\"> = {},\n ): AsyncIterableIterator<EntitiesResponse<SubscriptionRuntimeProperties>> {\n let listResponse;\n do {\n listResponse = await this.getSubscriptionsRuntimeProperties(topicName, {\n skip: Number(marker),\n maxCount: options.maxPageSize,\n ...options,\n });\n marker = listResponse.continuationToken;\n yield listResponse;\n } while (marker);\n }\n\n private async *listSubscriptionsRuntimePropertiesAll(\n topicName: string,\n options: OperationOptions = {},\n ): AsyncIterableIterator<SubscriptionRuntimeProperties> {\n let marker: string | undefined;\n for await (const segment of this.listSubscriptionsRuntimePropertiesPage(\n topicName,\n marker,\n options,\n )) {\n yield* segment;\n }\n }\n\n /**\n * Returns an async iterable iterator to list runtime info of the subscriptions\n * under the specified topic.\n *\n * .byPage() returns an async iterable iterator to list runtime info of subscriptions in pages.\n *\n * @returns An asyncIterableIterator that supports paging.\n */\n public listSubscriptionsRuntimeProperties(\n topicName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: OperationOptions,\n ): PagedAsyncIterableIterator<\n SubscriptionRuntimeProperties,\n EntitiesResponse<SubscriptionRuntimeProperties>\n > {\n logger.verbose(\n `Performing management operation - listSubscriptionsRuntimeProperties() with options: %j`,\n options,\n );\n const iter = this.listSubscriptionsRuntimePropertiesAll(topicName, options);\n return {\n /**\n */\n next() {\n return iter.next();\n },\n /**\n */\n [Symbol.asyncIterator]() {\n return this;\n },\n /**\n */\n byPage: (settings: PageSettings = {}) => {\n this.throwIfInvalidContinuationToken(settings.continuationToken);\n return this.listSubscriptionsRuntimePropertiesPage(topicName, settings.continuationToken, {\n maxPageSize: settings.maxPageSize,\n ...options,\n });\n },\n };\n }\n\n /**\n * Updates the subscription based on the subscription properties provided.\n * All subscription properties must be set even though only a subset of them are actually updatable.\n * Therefore, the suggested flow is to use the output from `getSubscription()`, update the desired properties in it, and then pass the modified object to `updateSubscription()`.\n *\n * The properties that cannot be updated are marked as readonly in the `SubscriptionProperties` interface.\n * @param subscription - Object representing the properties of the subscription and the raw response.\n * `subscriptionName`, `topicName`, and `requiresSession` can't be updated after creating the subscription.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async updateSubscription(\n subscription: WithResponse<SubscriptionProperties>,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n ): Promise<WithResponse<SubscriptionProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.updateSubscription\",\n\n operationOptions,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - updateSubscription() for \"${subscription.subscriptionName}\" with options: %j`,\n subscription,\n );\n\n if (!isJSONLikeObject(subscription) || subscription == null) {\n throw new TypeError(\n `Parameter \"subscription\" must be an object of type \"SubscriptionDescription\" and cannot be undefined or null.`,\n );\n }\n\n if (!subscription.topicName || !subscription.subscriptionName) {\n throw new TypeError(\n `The attributes \"topicName\" and \"subscriptionName\" of the parameter \"subscription\" cannot be undefined.`,\n );\n }\n\n const fullPath = this.getSubscriptionPath(\n subscription.topicName,\n subscription.subscriptionName,\n );\n\n const response = await this.putResource(\n fullPath,\n buildSubscriptionOptions(subscription),\n this.subscriptionResourceSerializer,\n true,\n updatedOptions,\n );\n\n return this.buildSubscriptionResponse(response);\n },\n );\n }\n\n /**\n * Deletes a subscription.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async deleteSubscription(\n topicName: string,\n subscriptionName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n // eslint-disable-next-line @typescript-eslint/ban-types\n ): Promise<WithResponse<{}>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.deleteSubscription\",\n\n operationOptions,\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - deleteSubscription() for \"${subscriptionName}\"`,\n );\n const fullPath = this.getSubscriptionPath(topicName, subscriptionName);\n const response = await this.deleteResource(\n fullPath,\n this.subscriptionResourceSerializer,\n updatedOptions,\n );\n\n return { _response: getHttpResponseOnly(response) };\n },\n );\n }\n\n /**\n * Checks whether a given subscription exists in the topic or not.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n */\n async subscriptionExists(\n topicName: string,\n subscriptionName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n ): Promise<boolean> {\n logger.verbose(\n `Performing management operation - subscriptionExists() for \"${topicName}\" and \"${subscriptionName}\"`,\n );\n const { span, updatedOptions } = tracingClient.startSpan(\n \"ServiceBusAdministrationClient.subscriptionExists\",\n operationOptions,\n );\n try {\n span.setStatus({ status: \"success\" });\n await this.getSubscription(topicName, subscriptionName, updatedOptions);\n return true;\n } catch (e: any) {\n span.setStatus({ status: \"error\", error: e });\n return false;\n } finally {\n span.end();\n }\n }\n\n /**\n * Creates a rule with given name, configured using the given options.\n * @param ruleFilter - Defines the filter expression that the rule evaluates.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityAlreadyExistsError` when requested messaging entity already exists,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `QuotaExceededError` when requested operation fails due to quote limits exceeding from service side,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n createRule(\n topicName: string,\n subscriptionName: string,\n ruleName: string,\n ruleFilter: SqlRuleFilter | CorrelationRuleFilter,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions?: OperationOptions,\n ): Promise<WithResponse<RuleProperties>>;\n /**\n * Creates a rule with given name, configured using the given options.\n * @param ruleFilter - Defines the filter expression that the rule evaluates.\n * @param ruleAction - The SQL like expression that can be executed on the message should the associated filter apply.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityAlreadyExistsError` when requested messaging entity already exists,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `QuotaExceededError` when requested operation fails due to quote limits exceeding from service side,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n createRule(\n topicName: string,\n subscriptionName: string,\n ruleName: string,\n ruleFilter: SqlRuleFilter | CorrelationRuleFilter,\n ruleAction: SqlRuleAction,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions?: OperationOptions,\n ): Promise<WithResponse<RuleProperties>>;\n async createRule(\n topicName: string,\n subscriptionName: string,\n ruleName: string,\n ruleFilter: SqlRuleFilter | CorrelationRuleFilter,\n ruleActionOrOperationOptions?: SqlRuleAction | OperationOptions,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions?: OperationOptions,\n ): Promise<WithResponse<RuleProperties>> {\n let ruleAction: SqlRuleAction | undefined = undefined;\n let operOptions: OperationOptions | undefined;\n if (ruleActionOrOperationOptions) {\n if (isSqlRuleAction(ruleActionOrOperationOptions)) {\n // Overload#2 - where the sqlExpression in the ruleAction is defined\n ruleAction = ruleActionOrOperationOptions;\n operOptions = operationOptions;\n } else {\n // Overload#1\n // Overload#2 - where the sqlExpression in the ruleAction is undefined\n operOptions = { ...ruleActionOrOperationOptions, ...operationOptions };\n }\n }\n\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.createRule\",\n operOptions ?? {},\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - createRule() for \"${ruleName}\" with filter: \"%j\"`,\n ruleFilter,\n );\n const fullPath = this.getRulePath(topicName, subscriptionName, ruleName);\n const response = await this.putResource(\n fullPath,\n { name: ruleName, filter: ruleFilter, action: ruleAction },\n this.ruleResourceSerializer,\n false,\n updatedOptions,\n );\n return this.buildRuleResponse(response);\n },\n );\n }\n\n /**\n * Returns an object representing the Rule with the given name along with all its properties.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async getRule(\n topicName: string,\n subscriptionName: string,\n ruleName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n ): Promise<WithResponse<RuleProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getRule\",\n operationOptions,\n async (updatedOptions) => {\n logger.verbose(`Performing management operation - getRule() for \"${ruleName}\"`);\n const fullPath = this.getRulePath(topicName, subscriptionName, ruleName);\n const response = await this.getResource(\n fullPath,\n this.ruleResourceSerializer,\n updatedOptions,\n );\n\n return this.buildRuleResponse(response);\n },\n );\n }\n\n /**\n * Lists existing rules.\n * @param options - The options include the maxCount and the count of entities to skip, the operation options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n private async getRules(\n topicName: string,\n subscriptionName: string,\n options: ListRequestOptions & OperationOptions = {},\n ): Promise<EntitiesResponse<RuleProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getRules\",\n\n options,\n async (updatedOptions) => {\n logger.verbose(`Performing management operation - getRules() with options: %j`, options);\n const fullPath = this.getSubscriptionPath(topicName, subscriptionName) + \"/Rules/\";\n const response = await this.listResources(\n fullPath,\n updatedOptions,\n this.ruleResourceSerializer,\n );\n\n return this.buildListRulesResponse(response);\n },\n );\n }\n\n private async *listRulesPage(\n topicName: string,\n subscriptionName: string,\n marker?: string,\n options: OperationOptions & Pick<PageSettings, \"maxPageSize\"> = {},\n ): AsyncIterableIterator<EntitiesResponse<RuleProperties>> {\n let listResponse;\n do {\n listResponse = await this.getRules(topicName, subscriptionName, {\n skip: Number(marker),\n maxCount: options.maxPageSize,\n ...options,\n });\n marker = listResponse.continuationToken;\n yield listResponse;\n } while (marker);\n }\n\n private async *listRulesAll(\n topicName: string,\n subscriptionName: string,\n options: OperationOptions = {},\n ): AsyncIterableIterator<RuleProperties> {\n let marker: string | undefined;\n for await (const segment of this.listRulesPage(topicName, subscriptionName, marker, options)) {\n yield* segment;\n }\n }\n\n /**\n * Returns an async iterable iterator to list all the rules\n * under the specified subscription.\n *\n * .byPage() returns an async iterable iterator to list the rules in pages.\n *\n * @returns An asyncIterableIterator that supports paging.\n */\n public listRules(\n topicName: string,\n subscriptionName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: OperationOptions,\n ): PagedAsyncIterableIterator<RuleProperties, EntitiesResponse<RuleProperties>> {\n logger.verbose(`Performing management operation - listRules() with options: %j`, options);\n const iter = this.listRulesAll(topicName, subscriptionName, options);\n return {\n /**\n */\n next() {\n return iter.next();\n },\n /**\n */\n [Symbol.asyncIterator]() {\n return this;\n },\n /**\n */\n byPage: (settings: PageSettings = {}) => {\n this.throwIfInvalidContinuationToken(settings.continuationToken);\n return this.listRulesPage(topicName, subscriptionName, settings.continuationToken, {\n maxPageSize: settings.maxPageSize,\n ...options,\n });\n },\n };\n }\n\n /**\n * Updates properties on the Rule by the given name based on the given options.\n * All rule properties must be set even if one of them is being updated.\n * Therefore, the suggested flow is to use the output from `getRule()`, update the desired properties in it, and then pass the modified object to `updateRule()`.\n *\n * @param rule - Options to configure the Rule being updated and the raw response.\n * For example, you can configure the filter to apply on associated Topic/Subscription.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async updateRule(\n topicName: string,\n subscriptionName: string,\n rule: WithResponse<RuleProperties>,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions?: OperationOptions,\n ): Promise<WithResponse<RuleProperties>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.updateRule\",\n operationOptions ?? {},\n async (updatedOptions) => {\n logger.verbose(\n `Performing management operation - updateRule() for \"${rule.name}\" with options: %j`,\n rule,\n );\n\n if (!isJSONLikeObject(rule) || rule === null) {\n throw new TypeError(\n `Parameter \"rule\" must be an object of type \"RuleDescription\" and cannot be undefined or null.`,\n );\n }\n\n if (!rule.name) {\n throw new TypeError(`\"name\" attribute of the parameter \"rule\" cannot be undefined.`);\n }\n\n const fullPath = this.getRulePath(topicName, subscriptionName, rule.name);\n const response = await this.putResource(\n fullPath,\n rule,\n this.ruleResourceSerializer,\n true,\n updatedOptions,\n );\n\n return this.buildRuleResponse(response);\n },\n );\n }\n\n /**\n * Deletes a rule.\n * @param operationOptions - The options that can be used to abort, trace and control other configurations on the HTTP request.\n *\n * Following are errors that can be expected from this operation\n * @throws `RestError` with code `UnauthorizedRequestError` when given request fails due to authorization problems,\n * @throws `RestError` with code `MessageEntityNotFoundError` when requested messaging entity does not exist,\n * @throws `RestError` with code `InvalidOperationError` when requested operation is invalid and we encounter a 403 HTTP status code,\n * @throws `RestError` with code `ServerBusyError` when the request fails due to server being busy,\n * @throws `RestError` with code `ServiceError` when receiving unrecognized HTTP status or for a scenarios such as\n * bad requests or requests resulting in conflicting operation on the server,\n * @throws `RestError` with code and statusCode representing the standard set of REST API errors.\n */\n async deleteRule(\n topicName: string,\n subscriptionName: string,\n ruleName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions?: OperationOptions,\n // eslint-disable-next-line @typescript-eslint/ban-types\n ): Promise<WithResponse<{}>> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.deleteRule\",\n operationOptions ?? {},\n async (updatedOptions) => {\n logger.verbose(`Performing management operation - deleteRule() for \"${ruleName}\"`);\n const fullPath = this.getRulePath(topicName, subscriptionName, ruleName);\n const response = await this.deleteResource(\n fullPath,\n this.ruleResourceSerializer,\n updatedOptions,\n );\n\n return { _response: getHttpResponseOnly(response) };\n },\n );\n }\n\n /**\n * Checks whether a given rule exists or not.\n *\n */\n async ruleExists(\n topicName: string,\n subscriptionName: string,\n ruleName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n operationOptions: OperationOptions = {},\n ): Promise<boolean> {\n logger.verbose(`Performing management operation - ruleExists() for \"${ruleName}\"`);\n const { span, updatedOptions } = tracingClient.startSpan(\n \"ServiceBusAdministrationClient.ruleExists\",\n operationOptions,\n );\n try {\n span.setStatus({ status: \"success\" });\n await this.getRule(topicName, subscriptionName, ruleName, updatedOptions);\n return true;\n } catch (e: any) {\n span.setStatus({ status: \"error\", error: e });\n return false;\n } finally {\n span.end();\n }\n }\n\n /**\n * Creates or updates a resource based on `isUpdate` parameter.\n */\n private async putResource(\n name: string,\n entityFields:\n | InternalQueueOptions\n | InternalTopicOptions\n | InternalSubscriptionOptions\n | CreateRuleOptions,\n serializer: AtomXmlSerializer,\n isUpdate: boolean = false,\n operationOptions: OperationOptions = {},\n ): Promise<PipelineResponse> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.putResource\",\n operationOptions,\n async (updatedOptions) => {\n const request: PipelineRequest = createPipelineRequest({\n url: this.getUrl(name),\n method: \"PUT\",\n });\n if (isUpdate) {\n request.headers.set(\"If-Match\", \"*\");\n }\n\n const queueOrSubscriptionFields = entityFields as\n | InternalQueueOptions\n | InternalSubscriptionOptions;\n if (\n queueOrSubscriptionFields.ForwardTo ||\n queueOrSubscriptionFields.ForwardDeadLetteredMessagesTo\n ) {\n const token =\n this.credentials instanceof SasServiceClientCredentials\n ? (await this.credentials.getToken(this.endpoint)).token\n : (await this.credentials.getToken([AMQPConstants.aadServiceBusScope]))!.token;\n\n if (queueOrSubscriptionFields.ForwardTo) {\n request.headers.set(\"ServiceBusSupplementaryAuthorization\", token);\n if (!isAbsoluteUrl(queueOrSubscriptionFields.ForwardTo)) {\n queueOrSubscriptionFields.ForwardTo = this.endpointWithProtocol.concat(\n queueOrSubscriptionFields.ForwardTo,\n );\n }\n }\n if (queueOrSubscriptionFields.ForwardDeadLetteredMessagesTo) {\n request.headers.set(\"ServiceBusDlqSupplementaryAuthorization\", token);\n if (!isAbsoluteUrl(queueOrSubscriptionFields.ForwardDeadLetteredMessagesTo)) {\n queueOrSubscriptionFields.ForwardDeadLetteredMessagesTo =\n this.endpointWithProtocol.concat(\n queueOrSubscriptionFields.ForwardDeadLetteredMessagesTo,\n );\n }\n }\n }\n\n request.headers.set(\"content-type\", \"application/atom+xml;type=entry;charset=utf-8\");\n\n return executeAtomXmlOperation(this, request, serializer, updatedOptions, entityFields);\n },\n );\n }\n\n /**\n * Gets a resource.\n */\n private async getResource(\n name: string,\n serializer: AtomXmlSerializer,\n operationOptions: OperationOptions = {},\n ): Promise<FullOperationResponse> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.getResource\",\n operationOptions,\n async (updatedOptions) => {\n const request = createPipelineRequest({\n url: this.getUrl(name),\n method: \"GET\",\n });\n\n const response = await executeAtomXmlOperation(this, request, serializer, updatedOptions);\n if (\n !isDefined(response.parsedBody) ||\n (Array.isArray(response.parsedBody) && response.parsedBody.length === 0)\n ) {\n const err = new RestError(\n `The messaging entity \"${name}\" being requested cannot be found.`,\n {\n code: \"MessageEntityNotFoundError\",\n statusCode: response.status,\n request,\n response,\n },\n );\n throw err;\n }\n return response;\n },\n );\n }\n\n /**\n * Lists existing resources\n */\n private async listResources(\n name: string,\n options: ListRequestOptions & OperationOptions = {},\n serializer: AtomXmlSerializer,\n ): Promise<FullOperationResponse> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.listResources\",\n options,\n async (updatedOptions) => {\n const queryParams: { [key: string]: string } = {};\n if (options) {\n if (options.skip) {\n queryParams[\"$skip\"] = options.skip.toString();\n }\n if (options.maxCount) {\n queryParams[\"$top\"] = options.maxCount.toString();\n }\n }\n\n const request = createPipelineRequest({\n url: this.getUrl(name, queryParams),\n method: \"GET\",\n });\n\n return executeAtomXmlOperation(this, request, serializer, updatedOptions);\n },\n );\n }\n\n /**\n * Deletes a resource.\n */\n private async deleteResource(\n name: string,\n serializer: AtomXmlSerializer,\n operationOptions: OperationOptions = {},\n ): Promise<FullOperationResponse> {\n return tracingClient.withSpan(\n \"ServiceBusAdministrationClient.deleteResource\",\n operationOptions,\n async (updatedOptions) => {\n const request = createPipelineRequest({\n url: this.getUrl(name),\n method: \"DELETE\",\n });\n return executeAtomXmlOperation(this, request, serializer, updatedOptions);\n },\n );\n }\n\n private getUrl(path: string, queryParams?: { [key: string]: string }): string {\n const baseUri = `https://${this.endpoint}/${path}`;\n\n const requestUrl = new URL(baseUri);\n requestUrl.searchParams.set(Constants.API_VERSION_QUERY_KEY, this.serviceVersion);\n\n if (queryParams) {\n for (const key of Object.keys(queryParams)) {\n requestUrl.searchParams.set(key, queryParams[key]);\n }\n }\n\n return requestUrl.toString();\n }\n\n private getSubscriptionPath(topicName: string, subscriptionName: string): string {\n return topicName + \"/Subscriptions/\" + subscriptionName;\n }\n\n private getRulePath(topicName: string, subscriptionName: string, ruleName: string): string {\n return topicName + \"/Subscriptions/\" + subscriptionName + \"/Rules/\" + ruleName;\n }\n\n private getMarkerFromNextLinkUrl(url: string): string | undefined {\n if (!url) {\n return undefined;\n }\n try {\n const value = parseURL(url).searchParams.get(Constants.XML_METADATA_MARKER + \"skip\");\n return value !== null ? value : undefined;\n } catch (error: any) {\n throw new Error(\n `Unable to parse the '${Constants.XML_METADATA_MARKER}skip' from the next-link in the response ` +\n error,\n );\n }\n }\n\n private buildNamespacePropertiesResponse(\n response: FullOperationResponse,\n ): WithResponse<NamespaceProperties> {\n try {\n const namespace = buildNamespace(response.parsedBody);\n const namespaceResponse: WithResponse<NamespaceProperties> = Object.defineProperty(\n namespace || {},\n \"_response\",\n { value: getHttpResponseOnly(response) },\n ) as WithResponse<NamespaceProperties>;\n return namespaceResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a namespace object using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private buildListQueuesResponse(\n response: FullOperationResponse,\n ): EntitiesResponse<QueueProperties> {\n try {\n const queues: QueueProperties[] = [];\n const nextMarker = this.getMarkerFromNextLinkUrl(response.parsedBody.nextLink);\n if (!Array.isArray(response.parsedBody)) {\n throw new TypeError(`${response.parsedBody} was expected to be of type Array`);\n }\n const rawQueueArray: any = response.parsedBody;\n for (let i = 0; i < rawQueueArray.length; i++) {\n const queue = buildQueue(rawQueueArray[i]);\n if (queue) {\n queues.push(queue);\n }\n }\n const listQueuesResponse: EntitiesResponse<QueueProperties> = Object.defineProperty(\n queues,\n \"_response\",\n {\n value: getHttpResponseOnly(response),\n },\n ) as EntitiesResponse<QueueProperties>;\n listQueuesResponse.continuationToken = nextMarker;\n return listQueuesResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a list of queues using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private buildListQueuesRuntimePropertiesResponse(\n response: FullOperationResponse,\n ): EntitiesResponse<QueueRuntimeProperties> {\n try {\n const queues: QueueRuntimeProperties[] = [];\n const nextMarker = this.getMarkerFromNextLinkUrl(response.parsedBody.nextLink);\n if (!Array.isArray(response.parsedBody)) {\n throw new TypeError(`${response.parsedBody} was expected to be of type Array`);\n }\n const rawQueueArray: any = response.parsedBody;\n for (let i = 0; i < rawQueueArray.length; i++) {\n const queue = buildQueueRuntimeProperties(rawQueueArray[i]);\n if (queue) {\n queues.push(queue);\n }\n }\n const listQueuesResponse: EntitiesResponse<QueueRuntimeProperties> = Object.defineProperty(\n queues,\n \"_response\",\n {\n value: getHttpResponseOnly(response),\n },\n ) as EntitiesResponse<QueueRuntimeProperties>;\n listQueuesResponse.continuationToken = nextMarker;\n return listQueuesResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a list of queues using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private buildQueueResponse(response: FullOperationResponse): WithResponse<QueueProperties> {\n try {\n const queue = buildQueue(response.parsedBody);\n const queueResponse: WithResponse<QueueProperties> = Object.defineProperty(\n queue || {},\n \"_response\",\n {\n value: getHttpResponseOnly(response),\n },\n ) as WithResponse<QueueProperties>;\n return queueResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a queue object using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private buildQueueRuntimePropertiesResponse(\n response: FullOperationResponse,\n ): WithResponse<QueueRuntimeProperties> {\n try {\n const queue = buildQueueRuntimeProperties(response.parsedBody);\n const queueResponse: WithResponse<QueueRuntimeProperties> = Object.defineProperty(\n queue || {},\n \"_response\",\n {\n value: getHttpResponseOnly(response),\n },\n ) as WithResponse<QueueRuntimeProperties>;\n return queueResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a queue object using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private buildListTopicsResponse(\n response: FullOperationResponse,\n ): EntitiesResponse<TopicProperties> {\n try {\n const topics: TopicProperties[] = [];\n const nextMarker = this.getMarkerFromNextLinkUrl(response.parsedBody.nextLink);\n if (!Array.isArray(response.parsedBody)) {\n throw new TypeError(`${response.parsedBody} was expected to be of type Array`);\n }\n const rawTopicArray: any = response.parsedBody;\n for (let i = 0; i < rawTopicArray.length; i++) {\n const topic = buildTopic(rawTopicArray[i]);\n if (topic) {\n topics.push(topic);\n }\n }\n const listTopicsResponse: EntitiesResponse<TopicProperties> = Object.defineProperty(\n topics,\n \"_response\",\n {\n value: getHttpResponseOnly(response),\n },\n ) as EntitiesResponse<TopicProperties>;\n listTopicsResponse.continuationToken = nextMarker;\n return listTopicsResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a list of topics using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private buildListTopicsRuntimePropertiesResponse(\n response: FullOperationResponse,\n ): EntitiesResponse<TopicRuntimeProperties> {\n try {\n const topics: TopicRuntimeProperties[] = [];\n const nextMarker = this.getMarkerFromNextLinkUrl(response.parsedBody.nextLink);\n if (!Array.isArray(response.parsedBody)) {\n throw new TypeError(`${response.parsedBody} was expected to be of type Array`);\n }\n const rawTopicArray: any = response.parsedBody;\n for (let i = 0; i < rawTopicArray.length; i++) {\n const topic = buildTopicRuntimeProperties(rawTopicArray[i]);\n if (topic) {\n topics.push(topic);\n }\n }\n const listTopicsResponse: EntitiesResponse<TopicRuntimeProperties> = Object.defineProperty(\n topics,\n \"_response\",\n {\n value: getHttpResponseOnly(response),\n },\n ) as EntitiesResponse<TopicRuntimeProperties>;\n listTopicsResponse.continuationToken = nextMarker;\n return listTopicsResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a list of topics using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n private buildTopicResponse(response: FullOperationResponse): WithResponse<TopicProperties> {\n try {\n const topic = buildTopic(response.parsedBody);\n const topicResponse: WithResponse<TopicProperties> = Object.defineProperty(\n topic || {},\n \"_response\",\n {\n value: getHttpResponseOnly(response),\n },\n ) as WithResponse<TopicProperties>;\n return topicResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a topic object using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private buildTopicRuntimePropertiesResponse(\n response: FullOperationResponse,\n ): WithResponse<TopicRuntimeProperties> {\n try {\n const topic = buildTopicRuntimeProperties(response.parsedBody);\n const topicResponse: WithResponse<TopicRuntimeProperties> = Object.defineProperty(\n topic || {},\n \"_response\",\n {\n value: getHttpResponseOnly(response),\n },\n ) as WithResponse<TopicRuntimeProperties>;\n return topicResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a topic object using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private buildListSubscriptionsResponse(\n response: FullOperationResponse,\n ): EntitiesResponse<SubscriptionProperties> {\n try {\n const subscriptions: SubscriptionProperties[] = [];\n const nextMarker = this.getMarkerFromNextLinkUrl(response.parsedBody.nextLink);\n if (!Array.isArray(response.parsedBody)) {\n throw new TypeError(`${response.parsedBody} was expected to be of type Array`);\n }\n const rawSubscriptionArray: any = response.parsedBody;\n for (let i = 0; i < rawSubscriptionArray.length; i++) {\n const subscription = buildSubscription(rawSubscriptionArray[i]);\n if (subscription) {\n subscriptions.push(subscription);\n }\n }\n const listSubscriptionsResponse: EntitiesResponse<SubscriptionProperties> =\n Object.defineProperty(subscriptions, \"_response\", {\n value: getHttpResponseOnly(response),\n }) as EntitiesResponse<SubscriptionProperties>;\n listSubscriptionsResponse.continuationToken = nextMarker;\n return listSubscriptionsResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a list of subscriptions using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private buildListSubscriptionsRuntimePropertiesResponse(\n response: FullOperationResponse,\n ): EntitiesResponse<SubscriptionRuntimeProperties> {\n try {\n const subscriptions: SubscriptionRuntimeProperties[] = [];\n const nextMarker = this.getMarkerFromNextLinkUrl(response.parsedBody.nextLink);\n if (!Array.isArray(response.parsedBody)) {\n throw new TypeError(`${response.parsedBody} was expected to be of type Array`);\n }\n const rawSubscriptionArray: any = response.parsedBody;\n for (let i = 0; i < rawSubscriptionArray.length; i++) {\n const subscription = buildSubscriptionRuntimeProperties(rawSubscriptionArray[i]);\n if (subscription) {\n subscriptions.push(subscription);\n }\n }\n const listSubscriptionsResponse: EntitiesResponse<SubscriptionRuntimeProperties> =\n Object.defineProperty(subscriptions, \"_response\", {\n value: getHttpResponseOnly(response),\n }) as EntitiesResponse<SubscriptionRuntimeProperties>;\n listSubscriptionsResponse.continuationToken = nextMarker;\n return listSubscriptionsResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a list of subscriptions using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private buildSubscriptionResponse(\n response: FullOperationResponse,\n ): WithResponse<SubscriptionProperties> {\n try {\n const subscription = buildSubscription(response.parsedBody);\n const subscriptionResponse: WithResponse<SubscriptionProperties> = Object.defineProperty(\n subscription || {},\n \"_response\",\n {\n value: getHttpResponseOnly(response),\n },\n ) as WithResponse<SubscriptionProperties>;\n return subscriptionResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a subscription object using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private buildSubscriptionRuntimePropertiesResponse(\n response: FullOperationResponse,\n ): WithResponse<SubscriptionRuntimeProperties> {\n try {\n const subscription = buildSubscriptionRuntimeProperties(response.parsedBody);\n const subscriptionResponse: WithResponse<SubscriptionRuntimeProperties> =\n Object.defineProperty(subscription || {}, \"_response\", {\n value: getHttpResponseOnly(response),\n }) as WithResponse<SubscriptionRuntimeProperties>;\n return subscriptionResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a subscription object using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private buildListRulesResponse(\n response: FullOperationResponse,\n ): EntitiesResponse<RuleProperties> {\n try {\n const rules: RuleProperties[] = [];\n const nextMarker = this.getMarkerFromNextLinkUrl(response.parsedBody.nextLink);\n if (!Array.isArray(response.parsedBody)) {\n throw new TypeError(`${response.parsedBody} was expected to be of type Array`);\n }\n const rawRuleArray: any = response.parsedBody;\n for (let i = 0; i < rawRuleArray.length; i++) {\n const rule = buildRule(rawRuleArray[i]);\n if (rule) {\n rules.push(rule);\n }\n }\n const listRulesResponse: EntitiesResponse<RuleProperties> = Object.defineProperty(\n rules,\n \"_response\",\n {\n value: getHttpResponseOnly(response),\n },\n ) as EntitiesResponse<RuleProperties>;\n listRulesResponse.continuationToken = nextMarker;\n return listRulesResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a list of rules using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private buildRuleResponse(response: FullOperationResponse): WithResponse<RuleProperties> {\n try {\n const rule = buildRule(response.parsedBody);\n const ruleResponse: WithResponse<RuleProperties> = Object.defineProperty(\n rule || {},\n \"_response\",\n {\n value: getHttpResponseOnly(response),\n },\n ) as WithResponse<RuleProperties>;\n return ruleResponse;\n } catch (err: any) {\n logger.logError(err, \"Failure parsing response from service\");\n throw new RestError(\n `Error occurred while parsing the response body - cannot form a rule object using the response from the service.`,\n {\n code: RestError.PARSE_ERROR,\n statusCode: response.status,\n request: response.request,\n response,\n },\n );\n }\n }\n\n private throwIfInvalidContinuationToken(token: string | undefined): void {\n if (!(token === undefined || (typeof token === \"string\" && Number(token) >= 0))) {\n throw new Error(`Invalid continuationToken ${token} provided`);\n }\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { message } from \"rhea-promise\";\nimport isBuffer from \"is-buffer\";\nimport { Buffer } from \"buffer\";\nimport { logErrorStackTrace, logger } from \"./log\";\n\n/** @internal */\nexport const dataSectionTypeCode = 0x75 as const;\n/** @internal */\nexport const sequenceSectionTypeCode = 0x76 as const;\n/** @internal */\nexport const valueSectionTypeCode = 0x77 as const;\n\n/**\n * Mirror of the internal Section interface in rhea.\n *\n * @internal\n */\nexport interface RheaAmqpSection {\n typecode:\n | typeof dataSectionTypeCode\n | typeof sequenceSectionTypeCode\n | typeof valueSectionTypeCode;\n content: any;\n}\n\n/**\n * The default data transformer that will be used by the Azure SDK.\n * @internal\n */\nexport const defaultDataTransformer = {\n /**\n * A function that takes the body property from an EventData object\n * and returns an encoded body (some form of AMQP type).\n *\n * @param body - The AMQP message body\n * @returns The encoded AMQP message body as an AMQP Data type\n * (data section in rhea terms). Section object with following properties:\n * - typecode: 117 (0x75)\n * - content: The given AMQP message body as a Buffer.\n * - multiple: true | undefined.\n */\n encode(body: unknown, bodyType: \"data\" | \"value\" | \"sequence\"): any {\n let result: any;\n if (bodyType === \"value\") {\n // TODO: Expose value_section from `rhea` similar to the data_section and sequence_section. Right now there isn't a way to create a value section officially.\n result = message.data_section(body);\n result.typecode = valueSectionTypeCode;\n } else if (bodyType === \"sequence\") {\n result = message.sequence_section(body);\n } else if (isBuffer(body) || body instanceof Uint8Array) {\n result = message.data_section(body);\n } else {\n // string, undefined, null, boolean, array, object, number should end up here\n // coercing undefined to null as that will ensure that null value will be given to the\n // customer on receive.\n if (body === undefined) body = null; // tslint:disable-line\n try {\n const bodyStr = JSON.stringify(body);\n result = message.data_section(Buffer.from(bodyStr, \"utf8\"));\n } catch (err: any) {\n const msg =\n `An error occurred while executing JSON.stringify() on the given body ` +\n body +\n `${err ? err.stack : JSON.stringify(err)}`;\n logger.warning(\"[encode] \" + msg);\n logErrorStackTrace(logger, err);\n throw new Error(msg);\n }\n }\n return result;\n },\n /**\n * A function that takes the body property from an AMQP message\n * (an AMQP Data type (data section in rhea terms)) and returns the decoded message body.\n * If it cannot decode the body then it returns the body\n * as-is.\n *\n * NOTE: Use this to decode a message body when you know that the entire contents are _only_ contained\n * in the 'data' section of the message (for instance, messages from the $mgmt link). Otherwise\n * use 'defaultDataTransformer.decodeWithType', which can handle data coming from separate sections\n * of the AMQP mesage.\n *\n * @param body - The AMQP message body\n * @param skipParsingBodyAsJson - Boolean to skip running JSON.parse() on message body content.\n * @returns decoded body or the given body as-is.\n */\n decode(body: unknown, skipParsingBodyAsJson: boolean): unknown {\n let actualContent = body;\n\n if (isRheaAmqpSection(body)) {\n actualContent = body.content;\n }\n\n return skipParsingBodyAsJson ? actualContent : tryToJsonDecode(actualContent);\n },\n /**\n * A function that takes the body property from an AMQP message, which can come from either\n * the 'data', 'value' or 'sequence' sections of an AMQP message.\n *\n * If the body is not a JSON string the the raw contents will be returned, along with the bodyType\n * indicating which part of the AMQP message the body was decoded from.\n *\n * @param body - The AMQP message body as received from rhea.\n * @param skipParsingBodyAsJson - Boolean to skip running JSON.parse() on message body.\n * @returns The decoded/raw body and the body type.\n */\n decodeWithType(\n body: unknown | RheaAmqpSection,\n skipParsingBodyAsJson: boolean,\n ): { body: unknown; bodyType: \"data\" | \"sequence\" | \"value\" } {\n try {\n if (isRheaAmqpSection(body)) {\n switch (body.typecode) {\n case dataSectionTypeCode:\n return {\n body: skipParsingBodyAsJson ? body.content : tryToJsonDecode(body.content),\n bodyType: \"data\",\n };\n case sequenceSectionTypeCode:\n // typecode:\n // handle sequences\n return { body: body.content, bodyType: \"sequence\" };\n case valueSectionTypeCode:\n // value\n return { body: body.content, bodyType: \"value\" };\n }\n } else {\n // not sure - we have to try to infer the proper bodyType and content\n if (isBuffer(body)) {\n // This indicates that we are getting the AMQP described type. Let us try decoding it.\n return { body: skipParsingBodyAsJson ? body : tryToJsonDecode(body), bodyType: \"data\" };\n } else {\n return { body: body, bodyType: \"value\" };\n }\n }\n } catch (err: any) {\n logger.verbose(\n \"[decode] An error occurred while decoding the received message body. The error is: %O\",\n err,\n );\n throw err;\n }\n },\n};\n\n/** @internal */\nexport function isRheaAmqpSection(\n possibleSection: any | RheaAmqpSection,\n): possibleSection is RheaAmqpSection {\n return (\n possibleSection != null &&\n typeof possibleSection.typecode === \"number\" &&\n (possibleSection.typecode === dataSectionTypeCode ||\n possibleSection.typecode === valueSectionTypeCode ||\n possibleSection.typecode === sequenceSectionTypeCode)\n );\n}\n\n/**\n * Attempts to decode 'body' as a JSON string. If it fails it returns body\n * verbatim.\n *\n * @param body - An AMQP message body.\n * @returns A JSON decoded object, or body if body was not a JSON string.\n *\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function tryToJsonDecode(body: any): any {\n let processedBody = body;\n try {\n // Trying to stringify and JSON.parse() anything else will fail flat and we shall return\n // the original type back\n const bodyStr: string = processedBody.toString(\"utf8\");\n processedBody = JSON.parse(bodyStr);\n } catch (err: any) {\n logger.verbose(\n \"[decode] An error occurred while trying JSON.parse() on the received body. \" +\n \"The error is %O\",\n err,\n );\n }\n return processedBody;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AmqpAnnotatedMessage, Constants } from \"@azure/core-amqp\";\nimport { Buffer } from \"buffer\";\nimport Long from \"long\";\nimport {\n Delivery,\n DeliveryAnnotations,\n MessageAnnotations,\n uuid_to_string,\n Message as RheaMessage,\n} from \"rhea-promise\";\nimport { defaultDataTransformer } from \"./dataTransformer\";\nimport { messageLogger as logger } from \"./log\";\nimport { ReceiveMode } from \"./models\";\nimport { isDefined, isObjectWithProperties } from \"@azure/core-util\";\nimport { reorderLockToken } from \"./util/utils\";\n\n/**\n * @internal\n */\nexport enum DispositionType {\n complete = \"complete\",\n deadletter = \"deadletter\",\n abandon = \"abandon\",\n defer = \"defer\",\n}\n\n/**\n * @internal\n * Describes the delivery annotations for Service Bus.\n */\nexport interface ServiceBusDeliveryAnnotations extends DeliveryAnnotations {\n /**\n * The offset of the last event.\n */\n last_enqueued_offset?: string;\n /**\n * The sequence number of the last event.\n */\n last_enqueued_sequence_number?: number;\n /**\n * The enqueued time of the last event.\n */\n last_enqueued_time_utc?: number;\n /**\n * The retrieval time of the last event.\n */\n runtime_info_retrieval_time_utc?: number;\n /**\n * Any unknown delivery annotations.\n */\n [x: string]: any;\n}\n\n/**\n * @internal\n * Describes the message annotations for Service Bus.\n */\nexport interface ServiceBusMessageAnnotations extends MessageAnnotations {\n /**\n * Annotation for the partition key set for the event.\n */\n \"x-opt-partition-key\"?: string | null;\n /**\n * Annontation for the sequence number of the event.\n */\n \"x-opt-sequence-number\"?: number;\n /**\n * Annotation for the enqueued time of the event.\n */\n \"x-opt-enqueued-time\"?: number;\n /**\n * Annotation for the offset of the event.\n */\n \"x-opt-offset\"?: string;\n /**\n * Annotation for the message being locked until.\n */\n \"x-opt-locked-until\"?: Date | number;\n /**\n * Annotation for the message state.\n */\n \"x-opt-message-state\"?: number;\n}\n\n/**\n * Describes the reason and error description for dead lettering a message using the `deadLetter()`\n * method on the message received from Service Bus.\n */\nexport interface DeadLetterOptions {\n /**\n * The reason for deadlettering the message.\n */\n deadLetterReason: string;\n /**\n * The error description for deadlettering the message.\n */\n deadLetterErrorDescription: string;\n}\n\n/**\n * Describes the message to be sent to Service Bus.\n */\nexport interface ServiceBusMessage {\n /**\n * The message body that needs to be sent or is received.\n * If the application receiving the message is not using this SDK,\n * convert your body payload to a byte array or Buffer for better\n * cross-language compatibility.\n */\n body: any;\n /**\n * The message identifier is an\n * application-defined value that uniquely identifies the message and its payload.\n *\n * Note: Numbers that are not whole integers are not allowed.\n */\n messageId?: string | number | Buffer;\n /**\n * The content type of the message. Optionally describes\n * the payload of the message, with a descriptor following the format of RFC2045, Section 5, for\n * example \"application/json\".\n */\n contentType?: string;\n /**\n * The correlation identifier that allows an\n * application to specify a context for the message for the purposes of correlation, for example\n * reflecting the MessageId of a message that is being replied to.\n * See {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n correlationId?: string | number | Buffer;\n /**\n * The partition key for sending a message to a partitioned entity.\n * Maximum length is 128 characters. For {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-partitioning | partitioned entities},\n * setting this value enables assigning related messages to the same internal partition,\n * so that submission sequence order is correctly recorded. The partition is chosen by a hash\n * function over this value and cannot be chosen directly.\n * - For session-aware entities, the `sessionId` property overrides this value.\n * - For non partitioned entities, partition key will be ignored\n *\n */\n partitionKey?: string;\n /**\n * The partition key for sending a message into an entity\n * via a partitioned transfer queue. Maximum length is 128 characters. If a message is sent via a\n * transfer queue in the scope of a transaction, this value selects the transfer queue partition:\n * This is functionally equivalent to `partitionKey` property and ensures that messages are kept\n * together and in order as they are transferred.\n * See {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-transactions#transfers-and-send-via | Transfers and Send Via}.\n */\n\n // Will be required later for implementing Transactions\n // viaPartitionKey?: string;\n\n /**\n * The session identifier for a session-aware entity. Maximum\n * length is 128 characters. For session-aware entities, this application-defined value specifies\n * the session affiliation of the message. Messages with the same session identifier are subject\n * to summary locking and enable exact in-order processing and demultiplexing. For\n * session-unaware entities, this value is ignored.\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions | Message Sessions}.\n */\n sessionId?: string;\n /**\n * The session identifier augmenting the `replyTo` address.\n * Maximum length is 128 characters. This value augments the ReplyTo information and specifies\n * which SessionId should be set for the reply when sent to the reply entity.\n * See {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n replyToSessionId?: string;\n /**\n * The message’s time to live value. This value is the relative\n * duration after which the message expires, starting from the instant the message has been\n * accepted and stored by the broker, as captured in `enqueuedTimeUtc`. When not set explicitly,\n * the assumed value is the DefaultTimeToLive for the respective queue or topic. A message-level\n * `timeToLive` value cannot be longer than the entity's DefaultTimeToLive setting and it is\n * silently adjusted if it does. See\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-expiration | Expiration}.\n */\n timeToLive?: number;\n /**\n * The application specific label. This property enables the\n * application to indicate the purpose of the message to the receiver in a standardized. fashion,\n * similar to an email subject line. The mapped AMQP property is \"subject\".\n */\n subject?: string;\n /**\n * The \"to\" address. This property is reserved for future use in routing\n * scenarios and presently ignored by the broker itself. Applications can use this value in\n * rule-driven {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-auto-forwarding | auto-forward chaining}\n * scenarios to indicate the intended logical destination of the message.\n */\n to?: string;\n /**\n * The address of an entity to send replies to. This optional and\n * application-defined value is a standard way to express a reply path to the receiver of the\n * message. When a sender expects a reply, it sets the value to the absolute or relative path of\n * the queue or topic it expects the reply to be sent to. See\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n replyTo?: string;\n /**\n * The date and time in UTC at which the message will\n * be enqueued. This property returns the time in UTC; when setting the property, the\n * supplied DateTime value must also be in UTC. This value is for delayed message sending.\n * It is utilized to delay messages sending to a specific time in the future. Message enqueuing\n * time does not mean that the message will be sent at the same time. It will get enqueued,\n * but the actual sending time depends on the queue's workload and its state.\n */\n scheduledEnqueueTimeUtc?: Date;\n /**\n * The application specific properties which can be\n * used for custom message metadata.\n */\n applicationProperties?: { [key: string]: number | boolean | string | Date | null };\n}\n\n/**\n * @internal\n * Gets the error message for when a property on given message is not of expected type\n */\nexport function getMessagePropertyTypeMismatchError(msg: ServiceBusMessage): Error | undefined {\n if (msg.contentType != null && typeof msg.contentType !== \"string\") {\n return new TypeError(\"The property 'contentType' on the message must be of type 'string'\");\n }\n\n if (msg.subject != null && typeof msg.subject !== \"string\") {\n return new TypeError(\"The property 'label' on the message must be of type 'string'\");\n }\n\n if (msg.to != null && typeof msg.to !== \"string\") {\n return new TypeError(\"The property 'to' on the message must be of type 'string'\");\n }\n\n if (msg.replyTo != null && typeof msg.replyTo !== \"string\") {\n return new TypeError(\"The property 'replyTo' on the message must be of type 'string'\");\n }\n\n if (msg.replyToSessionId != null && typeof msg.replyToSessionId !== \"string\") {\n return new TypeError(\"The property 'replyToSessionId' on the message must be of type 'string'\");\n }\n\n if (msg.timeToLive != null && typeof msg.timeToLive !== \"number\") {\n return new TypeError(\"The property 'timeToLive' on the message must be of type 'number'\");\n }\n\n if (msg.sessionId != null && typeof msg.sessionId !== \"string\") {\n return new TypeError(\"The property 'sessionId' on the message must be of type 'string'\");\n }\n\n if (\n msg.messageId != null &&\n typeof msg.messageId !== \"string\" &&\n typeof msg.messageId !== \"number\" &&\n !Buffer.isBuffer(msg.messageId)\n ) {\n return new TypeError(\n \"The property 'messageId' on the message must be of type string, number or Buffer\",\n );\n }\n\n if (\n msg.correlationId != null &&\n typeof msg.correlationId !== \"string\" &&\n typeof msg.correlationId !== \"number\" &&\n !Buffer.isBuffer(msg.correlationId)\n ) {\n return new TypeError(\n \"The property 'correlationId' on the message must be of type string, number or Buffer\",\n );\n }\n return;\n}\n\n/**\n * @internal\n * Converts given ServiceBusMessage to RheaMessage\n */\nexport function toRheaMessage(\n msg: ServiceBusMessage | ServiceBusReceivedMessage | AmqpAnnotatedMessage,\n encoder: Pick<typeof defaultDataTransformer, \"encode\">,\n): RheaMessage {\n let amqpMsg: RheaMessage;\n if (isAmqpAnnotatedMessage(msg)) {\n amqpMsg = {\n ...AmqpAnnotatedMessage.toRheaMessage(msg),\n body: encoder.encode(msg.body, msg.bodyType ?? \"data\"),\n };\n } else {\n let bodyType: \"data\" | \"sequence\" | \"value\" = \"data\";\n\n if (isServiceBusReceivedMessage(msg)) {\n /*\n * TODO: this is a bit complicated.\n *\n * It seems reasonable to expect to be able to round-trip a message (ie,\n * receive a message, and then send it again, possibly to another queue / topic).\n * If the user does that we need to make sure to respect their original AMQP\n * type so when the message is re - encoded we don't put 'body' into the wrong spot.\n *\n * The complication is that we need to decide if we're okay with respecting a field\n * from the rawAmqpMessage, which up until now we've treated as just vestigial\n * information on send. My hope is that the use case of \"alter the sb message in some\n * incompatible way with the underying _rawAmqpMessage.bodyType\" is not common\n * enough for us to try to do anything more than what I'm doing here.\n */\n bodyType = msg._rawAmqpMessage.bodyType ?? \"data\";\n }\n\n // TODO: it seems sensible that we'd also do this for AMQPAnnotated message.\n const validationError = getMessagePropertyTypeMismatchError(msg);\n\n if (validationError) {\n throw validationError;\n }\n\n amqpMsg = {\n body: encoder.encode(msg.body, bodyType),\n message_annotations: {},\n };\n\n if (msg.timeToLive) {\n amqpMsg.ttl = Math.min(msg.timeToLive, Constants.maxUint32Value);\n amqpMsg.creation_time = new Date();\n amqpMsg.absolute_expiry_time = new Date(\n Math.min(amqpMsg.creation_time.getTime() + amqpMsg.ttl, Constants.maxAbsoluteExpiryTime),\n );\n }\n }\n\n if (isAmqpAnnotatedMessage(msg)) {\n return amqpMsg;\n }\n\n if (msg.applicationProperties != null) {\n amqpMsg.application_properties = msg.applicationProperties;\n }\n if (msg.contentType != null) {\n amqpMsg.content_type = msg.contentType;\n }\n if (msg.sessionId != null) {\n if (msg.sessionId.length > Constants.maxSessionIdLength) {\n throw new Error(\n \"Length of 'sessionId' property on the message cannot be greater than 128 characters.\",\n );\n }\n\n amqpMsg.group_id = msg.sessionId;\n }\n if (msg.replyTo != null) {\n amqpMsg.reply_to = msg.replyTo;\n }\n if (msg.to != null) {\n amqpMsg.to = msg.to;\n }\n if (msg.subject != null) {\n amqpMsg.subject = msg.subject;\n }\n\n updateMessageId(amqpMsg, msg.messageId);\n\n if (msg.correlationId != null) {\n amqpMsg.correlation_id = msg.correlationId;\n }\n if (msg.replyToSessionId != null) {\n amqpMsg.reply_to_group_id = msg.replyToSessionId;\n }\n if (msg.partitionKey != null) {\n if (msg.partitionKey.length > Constants.maxPartitionKeyLength) {\n throw new Error(\n \"Length of 'partitionKey' property on the message cannot be greater than 128 characters.\",\n );\n }\n amqpMsg.message_annotations![Constants.partitionKey] = msg.partitionKey;\n }\n\n // Will be required later for implementing Transactions\n // if (msg.viaPartitionKey != null) {\n // if (msg.viaPartitionKey.length > Constants.maxPartitionKeyLength) {\n // throw new Error(\n // \"Length of 'viaPartitionKey' property on the message cannot be greater than 128 characters.\"\n // );\n // }\n // amqpMsg.message_annotations![Constants.viaPartitionKey] = msg.viaPartitionKey;\n // }\n\n updateScheduledTime(amqpMsg, msg.scheduledEnqueueTimeUtc);\n\n logger.verbose(\"SBMessage to RheaMessage: %O\", amqpMsg);\n return amqpMsg;\n}\n\n/** @internal */\nexport function updateMessageId(\n rheaMessage: RheaMessage,\n messageId: RheaMessage[\"message_id\"],\n): void {\n if (messageId != null) {\n if (typeof messageId === \"string\" && messageId.length > Constants.maxMessageIdLength) {\n throw new Error(\n `Length of 'messageId' property on the message cannot be greater than ${Constants.maxMessageIdLength} characters.`,\n );\n }\n\n rheaMessage.message_id = messageId;\n }\n}\n\n/** @internal */\nexport function updateScheduledTime(\n rheaMessage: RheaMessage,\n scheduledEnqueuedTimeUtc: Date | undefined,\n): void {\n if (scheduledEnqueuedTimeUtc != null) {\n rheaMessage.message_annotations = rheaMessage.message_annotations ?? {};\n rheaMessage.message_annotations[Constants.scheduledEnqueueTime] = scheduledEnqueuedTimeUtc;\n }\n}\n\n/**\n * Describes the message received from Service Bus during peek operations and so cannot be settled.\n */\nexport interface ServiceBusReceivedMessage extends ServiceBusMessage {\n /**\n * The reason for deadlettering the message.\n * @readonly\n */\n readonly deadLetterReason?: string;\n /**\n * The error description for deadlettering the message.\n * @readonly\n */\n readonly deadLetterErrorDescription?: string;\n /**\n * The lock token is a reference to the lock that is being held by the broker in\n * `peekLock` receive mode. Locks are used internally settle messages as explained in the\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement | product documentation in more detail}\n * - Not applicable when the message is received in `receiveAndDelete` receive mode.\n * mode.\n * @readonly\n */\n readonly lockToken?: string;\n /**\n * Number of deliveries that have been attempted for this message. The count is\n * incremented when a message lock expires, or the message is explicitly abandoned using the\n * `abandon()` method on the message.\n * @readonly\n */\n readonly deliveryCount?: number;\n /**\n * The UTC instant at which the message has been accepted and stored in Service Bus.\n * @readonly\n */\n readonly enqueuedTimeUtc?: Date;\n /**\n * The UTC instant at which the message is marked for removal and no longer available for\n * retrieval from the entity due to expiration. This property is computed from 2 other properties\n * on the message: `enqueuedTimeUtc` + `timeToLive`.\n */\n readonly expiresAtUtc?: Date;\n /**\n * The UTC instant until which the message is held locked in the queue/subscription.\n * When the lock expires, the `deliveryCount` is incremented and the message is again available\n * for retrieval.\n * - Not applicable when the message is received in `receiveAndDelete` receive mode.\n * mode.\n */\n lockedUntilUtc?: Date;\n /**\n * The original sequence number of the message. For\n * messages that have been auto-forwarded, this property reflects the sequence number that had\n * first been assigned to the message at its original point of submission.\n * @readonly\n */\n readonly enqueuedSequenceNumber?: number;\n /**\n * The unique number assigned to a message by Service Bus.\n * The sequence number is a unique 64-bit integer assigned to a message as it is accepted\n * and stored by the broker and functions as its true identifier. For partitioned entities,\n * the topmost 16 bits reflect the partition identifier. Sequence numbers monotonically increase.\n * They roll over to 0 when the 48-64 bit range is exhausted.\n *\n * **Max safe integer** that Javascript currently supports is `2^53 - 1`. The sequence number\n * is an AMQP `Long` type which can be upto 64 bits long. To represent that we are using a\n * library named {@link https://github.com/dcodeIO/long.js | long.js}. We expect customers\n * to use the **`Long`** type exported by this library.\n * @readonly\n */\n readonly sequenceNumber?: Long;\n /**\n * The name of the queue or subscription that this message\n * was enqueued on, before it was deadlettered. Only set in messages that have been dead-lettered\n * and subsequently auto-forwarded from the dead-letter sub-queue to another entity. Indicates the\n * entity in which the message was dead-lettered.\n * @readonly\n */\n readonly deadLetterSource?: string;\n /**\n * State of the message can be active, deferred or scheduled. Deferred messages have deferred state,\n * scheduled messages have scheduled state, all other messages have active state.\n */\n readonly state: \"active\" | \"deferred\" | \"scheduled\";\n /**\n * The underlying raw amqp message.\n * @readonly\n */\n readonly _rawAmqpMessage: AmqpAnnotatedMessage;\n}\n\n/**\n * @internal\n * Converts given RheaMessage to ServiceBusReceivedMessage\n */\nexport function fromRheaMessage(\n rheaMessage: RheaMessage,\n options: {\n skipParsingBodyAsJson: boolean;\n skipConvertingDate?: boolean;\n delivery?: Delivery;\n shouldReorderLockToken?: boolean;\n },\n): ServiceBusReceivedMessage {\n if (!rheaMessage) {\n rheaMessage = {\n body: undefined,\n };\n }\n const {\n skipParsingBodyAsJson,\n delivery,\n shouldReorderLockToken,\n skipConvertingDate = false,\n } = options;\n const { body, bodyType } = defaultDataTransformer.decodeWithType(\n rheaMessage.body,\n skipParsingBodyAsJson,\n );\n\n const sbmsg: ServiceBusMessage = {\n body: body,\n };\n\n if (rheaMessage.application_properties != null) {\n sbmsg.applicationProperties = skipConvertingDate\n ? rheaMessage.application_properties\n : convertDatesToNumbers(rheaMessage.application_properties);\n }\n if (rheaMessage.content_type != null) {\n sbmsg.contentType = rheaMessage.content_type;\n }\n if (rheaMessage.group_id != null) {\n sbmsg.sessionId = rheaMessage.group_id;\n }\n if (rheaMessage.reply_to != null) {\n sbmsg.replyTo = rheaMessage.reply_to;\n }\n if (rheaMessage.to != null) {\n sbmsg.to = rheaMessage.to;\n }\n if (rheaMessage.subject != null) {\n sbmsg.subject = rheaMessage.subject;\n }\n if (rheaMessage.message_id != null) {\n sbmsg.messageId = rheaMessage.message_id;\n }\n if (rheaMessage.correlation_id != null) {\n sbmsg.correlationId = rheaMessage.correlation_id;\n }\n if (rheaMessage.reply_to_group_id != null) {\n sbmsg.replyToSessionId = rheaMessage.reply_to_group_id;\n }\n\n if (rheaMessage.message_annotations != null) {\n if (rheaMessage.message_annotations[Constants.partitionKey] != null) {\n sbmsg.partitionKey = rheaMessage.message_annotations[Constants.partitionKey];\n }\n\n // Will be required later for implementing Transactions\n // if (msg.message_annotations[Constants.viaPartitionKey] != null) {\n // sbmsg.viaPartitionKey = msg.message_annotations[Constants.viaPartitionKey];\n // }\n\n if (rheaMessage.message_annotations[Constants.scheduledEnqueueTime] != null) {\n sbmsg.scheduledEnqueueTimeUtc =\n rheaMessage.message_annotations[Constants.scheduledEnqueueTime];\n }\n }\n\n type PartialWritable<T> = Partial<{\n -readonly [P in keyof T]: T[P];\n }>;\n const props: PartialWritable<ServiceBusReceivedMessage> & {\n state: \"active\" | \"deferred\" | \"scheduled\";\n } = { state: \"active\" };\n if (rheaMessage.message_annotations != null) {\n if (rheaMessage.message_annotations[Constants.deadLetterSource] != null) {\n props.deadLetterSource = rheaMessage.message_annotations[Constants.deadLetterSource];\n }\n const messageState = rheaMessage.message_annotations[Constants.messageState];\n if (messageState === 1) {\n props.state = \"deferred\";\n } else if (messageState === 2) {\n props.state = \"scheduled\";\n }\n if (rheaMessage.message_annotations[Constants.enqueueSequenceNumber] != null) {\n props.enqueuedSequenceNumber =\n rheaMessage.message_annotations[Constants.enqueueSequenceNumber];\n }\n if (rheaMessage.message_annotations[Constants.sequenceNumber] != null) {\n if (Buffer.isBuffer(rheaMessage.message_annotations[Constants.sequenceNumber])) {\n props.sequenceNumber = Long.fromBytesBE(\n rheaMessage.message_annotations[Constants.sequenceNumber],\n );\n } else {\n props.sequenceNumber = Long.fromNumber(\n rheaMessage.message_annotations[Constants.sequenceNumber],\n );\n }\n }\n if (rheaMessage.message_annotations[Constants.enqueuedTime] != null) {\n props.enqueuedTimeUtc = new Date(\n rheaMessage.message_annotations[Constants.enqueuedTime] as number,\n );\n }\n if (rheaMessage.message_annotations[Constants.lockedUntil] != null) {\n props.lockedUntilUtc = new Date(\n rheaMessage.message_annotations[Constants.lockedUntil] as number,\n );\n }\n }\n\n const rawMessage = AmqpAnnotatedMessage.fromRheaMessage(rheaMessage);\n rawMessage.bodyType = bodyType;\n if (rheaMessage.ttl == null) {\n rheaMessage.ttl = rawMessage.header?.timeToLive ?? Constants.maxDurationValue;\n }\n if (props.enqueuedTimeUtc) {\n props.expiresAtUtc = new Date(\n Math.min(props.enqueuedTimeUtc.getTime() + rheaMessage.ttl, Constants.maxDurationValue),\n );\n }\n\n if (rawMessage.applicationProperties) {\n rawMessage.applicationProperties = skipConvertingDate\n ? rawMessage.applicationProperties\n : convertDatesToNumbers(rawMessage.applicationProperties);\n }\n if (rawMessage.deliveryAnnotations) {\n rawMessage.deliveryAnnotations = skipConvertingDate\n ? rawMessage.deliveryAnnotations\n : convertDatesToNumbers(rawMessage.deliveryAnnotations);\n }\n if (rawMessage.messageAnnotations) {\n rawMessage.messageAnnotations = skipConvertingDate\n ? rawMessage.messageAnnotations\n : convertDatesToNumbers(rawMessage.messageAnnotations);\n }\n\n if (rawMessage.header?.timeToLive) {\n sbmsg.timeToLive = rawMessage.header.timeToLive;\n }\n\n const rcvdsbmsg: ServiceBusReceivedMessage = {\n _rawAmqpMessage: rawMessage,\n deliveryCount: rheaMessage.delivery_count,\n lockToken:\n delivery && delivery.tag && delivery.tag.length !== 0\n ? uuid_to_string(\n shouldReorderLockToken === true\n ? reorderLockToken(\n typeof delivery.tag === \"string\" ? Buffer.from(delivery.tag) : delivery.tag,\n )\n : typeof delivery.tag === \"string\"\n ? Buffer.from(delivery.tag)\n : delivery.tag,\n )\n : undefined,\n ...sbmsg,\n ...props,\n deadLetterReason: sbmsg.applicationProperties?.DeadLetterReason as string | undefined,\n deadLetterErrorDescription: sbmsg.applicationProperties?.DeadLetterErrorDescription as\n | string\n | undefined,\n };\n\n logger.verbose(\"AmqpMessage to ServiceBusReceivedMessage: %O\", rcvdsbmsg);\n return rcvdsbmsg;\n}\n\n/**\n * @internal\n */\nexport function isServiceBusMessage(possible: unknown): possible is ServiceBusMessage {\n return isObjectWithProperties(possible, [\"body\"]);\n}\n\n/**\n * @internal\n */\nexport function isAmqpAnnotatedMessage(possible: unknown): possible is AmqpAnnotatedMessage {\n return (\n isObjectWithProperties(possible, [\"body\", \"bodyType\"]) &&\n possible.constructor.name !== ServiceBusMessageImpl.name\n );\n}\n\n/**\n * @internal\n */\nexport function isServiceBusReceivedMessage(\n possible: unknown,\n): possible is ServiceBusReceivedMessage {\n return isServiceBusMessage(possible) && \"_rawAmqpMessage\" in possible;\n}\n\n/**\n * Describes the message received from Service Bus.\n *\n * @internal\n */\nexport class ServiceBusMessageImpl implements ServiceBusReceivedMessage {\n /**\n * The message body that needs to be sent or is received.\n */\n body: any;\n /**\n * The application specific properties.\n */\n applicationProperties?: { [key: string]: any };\n /**\n * The message identifier is an\n * application-defined value that uniquely identifies the message and its payload. The identifier\n * is a free-form string and can reflect a GUID or an identifier derived from the application\n * context. If enabled, the\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/duplicate-detection | duplicate detection}\n * identifies and removes second and further submissions of messages with the same MessageId.\n */\n messageId?: string | number | Buffer;\n /**\n * The content type of the message. Optionally describes\n * the payload of the message, with a descriptor following the format of RFC2045, Section 5, for\n * example \"application/json\".\n */\n contentType?: string;\n /**\n * The correlation identifier that allows an\n * application to specify a context for the message for the purposes of correlation, for example\n * reflecting the MessageId of a message that is being replied to.\n * See {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n correlationId?: string | number | Buffer;\n /**\n * The partition key for sending a message to a\n * partitioned entity. Maximum length is 128 characters. For {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-partitioning | partitioned entities},\n * setting this value enables assigning related messages to the same internal partition,\n * so that submission sequence order is correctly recorded. The partition is chosen by a hash\n * function over this value and cannot be chosen directly. For session-aware entities,\n * the `sessionId` property overrides this value.\n */\n partitionKey?: string;\n /**\n * The partition key for sending a message into an entity\n * via a partitioned transfer queue. Maximum length is 128 characters. If a message is sent via a\n * transfer queue in the scope of a transaction, this value selects the transfer queue partition:\n * This is functionally equivalent to `partitionKey` property and ensures that messages are kept\n * together and in order as they are transferred.\n * See {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-transactions#transfers-and-send-via | Transfers and Send Via}.\n */\n // Will be required later for implementing Transactions\n // viaPartitionKey?: string;\n /**\n * The session identifier for a session-aware entity. Maximum\n * length is 128 characters. For session-aware entities, this application-defined value specifies\n * the session affiliation of the message. Messages with the same session identifier are subject\n * to summary locking and enable exact in-order processing and demultiplexing. For\n * session-unaware entities, this value is ignored.\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions | Message Sessions}.\n */\n sessionId?: string;\n /**\n * The session identifier augmenting the `replyTo` address.\n * Maximum length is 128 characters. This value augments the ReplyTo information and specifies\n * which SessionId should be set for the reply when sent to the reply entity.\n * See {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n replyToSessionId?: string;\n /**\n * The message’s time to live value. This value is the relative\n * duration after which the message expires, starting from the instant the message has been\n * accepted and stored by the broker, as captured in `enqueuedTimeUtc`. When not set explicitly,\n * the assumed value is the DefaultTimeToLive for the respective queue or topic. A message-level\n * `timeToLive` value cannot be longer than the entity's DefaultTimeToLive setting and it is\n * silently adjusted if it does. See\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-expiration | Expiration}.\n */\n timeToLive?: number;\n /**\n * The application specific label. This property enables the\n * application to indicate the purpose of the message to the receiver in a standardized. fashion,\n * similar to an email subject line. The mapped AMQP property is \"subject\".\n */\n subject?: string;\n /**\n * The \"to\" address. This property is reserved for future use in routing\n * scenarios and presently ignored by the broker itself. Applications can use this value in\n * rule-driven {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-auto-forwarding | auto-forward chaining}\n * scenarios to indicate the intended logical destination of the message.\n */\n to?: string;\n /**\n * The address of an entity to send replies to. This optional and\n * application-defined value is a standard way to express a reply path to the receiver of the\n * message. When a sender expects a reply, it sets the value to the absolute or relative path of\n * the queue or topic it expects the reply to be sent to. See\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/service-bus-messages-payloads?#message-routing-and-correlation | Message Routing and Correlation}.\n */\n replyTo?: string;\n /**\n * The date and time in UTC at which the message will\n * be enqueued. This property returns the time in UTC; when setting the property, the\n * supplied DateTime value must also be in UTC. This value is for delayed message sending.\n * It is utilized to delay messages sending to a specific time in the future. Message enqueuing\n * time does not mean that the message will be sent at the same time. It will get enqueued,\n * but the actual sending time depends on the queue's workload and its state.\n */\n scheduledEnqueueTimeUtc?: Date;\n /**\n * The lock token is a reference to the lock that is being held by the broker in\n * `peekLock` receive mode. Locks are used internally settle messages as explained in the\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement | product documentation in more detail}\n * - Not applicable when the message is received in `receiveAndDelete` receive mode.\n * mode.\n * @readonly\n */\n readonly lockToken?: string;\n /**\n * Number of deliveries that have been attempted for this message. The count is\n * incremented when a message lock expires, or the message is explicitly abandoned using the\n * `abandon()` method on the message.\n * @readonly\n */\n readonly deliveryCount?: number;\n /**\n * The UTC instant at which the message has been accepted and stored in Service Bus.\n * @readonly\n */\n readonly enqueuedTimeUtc?: Date;\n /**\n * The UTC instant at which the message is marked for removal and no longer available for\n * retrieval from the entity due to expiration. This property is computed from 2 other properties\n * on the message: `enqueuedTimeUtc` + `timeToLive`.\n */\n readonly expiresAtUtc?: Date;\n /**\n * The UTC instant until which the message is held locked in the queue/subscription.\n * When the lock expires, the `deliveryCount` is incremented and the message is again available\n * for retrieval.\n * - Not applicable when the message is received in `receiveAndDelete` receive mode.\n * mode.\n */\n lockedUntilUtc?: Date;\n /**\n * The original sequence number of the message. For\n * messages that have been auto-forwarded, this property reflects the sequence number that had\n * first been assigned to the message at its original point of submission.\n * @readonly\n */\n readonly enqueuedSequenceNumber?: number;\n /**\n * The unique number assigned to a message by Service Bus.\n * The sequence number is a unique 64-bit integer assigned to a message as it is accepted\n * and stored by the broker and functions as its true identifier. For partitioned entities,\n * the topmost 16 bits reflect the partition identifier. Sequence numbers monotonically increase.\n * They roll over to 0 when the 48-64 bit range is exhausted.\n * @readonly\n */\n readonly sequenceNumber?: Long;\n /**\n * The name of the queue or subscription that this message\n * was enqueued on, before it was deadlettered. Only set in messages that have been dead-lettered\n * and subsequently auto-forwarded from the dead-letter sub-queue to another entity. Indicates the\n * entity in which the message was dead-lettered.\n * @readonly\n */\n readonly deadLetterSource?: string;\n /**\n * State of the message can be active, deferred or scheduled. Deferred messages have deferred state,\n * scheduled messages have scheduled state, all other messages have active state.\n */\n readonly state: \"active\" | \"deferred\" | \"scheduled\";\n /**\n * The associated delivery of the received message.\n */\n readonly delivery: Delivery;\n /**\n * The underlying raw amqp annotated message.\n * @readonly\n */\n readonly _rawAmqpMessage: AmqpAnnotatedMessage;\n /**\n * The reason for deadlettering the message.\n * @readonly\n */\n readonly deadLetterReason?: string;\n /**\n * The error description for deadlettering the message.\n * @readonly\n */\n readonly deadLetterErrorDescription?: string;\n /**\n * @internal\n */\n constructor(\n msg: RheaMessage,\n delivery: Delivery,\n shouldReorderLockToken: boolean,\n receiveMode: ReceiveMode,\n skipParsingBodyAsJson: boolean,\n skipConvertingDate: boolean,\n ) {\n const { _rawAmqpMessage, ...restOfMessageProps } = fromRheaMessage(\n msg,\n\n { skipParsingBodyAsJson, delivery, shouldReorderLockToken, skipConvertingDate },\n );\n this._rawAmqpMessage = _rawAmqpMessage; // need to initialize _rawAmqpMessage property to make compiler happy\n Object.assign(this, restOfMessageProps);\n this.state = restOfMessageProps.state; // to suppress error TS2564: Property 'state' has no initializer and is not definitely assigned in the constructor.\n\n // Lock on a message is applicable only in peekLock mode, but the service sets\n // the lock token even in receiveAndDelete mode if the entity in question is partitioned.\n if (receiveMode === \"receiveAndDelete\") {\n this.lockToken = undefined;\n }\n this.delivery = delivery;\n }\n\n /**\n * Creates a clone of the current message to allow it to be re-sent to the queue\n * @returns ServiceBusMessage\n */\n clone(): ServiceBusMessage {\n // We are returning a ServiceBusMessage object because that object can then be sent to Service Bus\n const clone: ServiceBusMessage = {\n body: this.body,\n contentType: this.contentType,\n correlationId: this.correlationId,\n subject: this.subject,\n messageId: this.messageId,\n partitionKey: this.partitionKey,\n replyTo: this.replyTo,\n replyToSessionId: this.replyToSessionId,\n scheduledEnqueueTimeUtc: this.scheduledEnqueueTimeUtc,\n sessionId: this.sessionId,\n timeToLive: this.timeToLive,\n to: this.to,\n applicationProperties: this.applicationProperties,\n // Will be required later for implementing Transactions\n // viaPartitionKey: this.viaPartitionKey\n };\n\n return clone;\n }\n}\n\n/**\n * Converts any Date objects into a number representing date.getTime().\n * Recursively checks for any Date objects in arrays and objects.\n * @internal\n */\nfunction convertDatesToNumbers<T = unknown>(thing: T): T {\n // fast exit\n if (!isDefined(thing)) return thing;\n\n // When 'thing' is a Date, return the number representation\n if (\n typeof thing === \"object\" &&\n isObjectWithProperties(thing, [\"getTime\"]) &&\n typeof thing.getTime === \"function\"\n ) {\n return thing.getTime();\n }\n\n /*\n Examples:\n [0, 'foo', new Date(), { nested: new Date()}]\n */\n if (Array.isArray(thing)) {\n const result = [];\n for (const element of thing) {\n result.push(convertDatesToNumbers(element));\n }\n return result as unknown as T;\n }\n\n /*\n Examples:\n { foo: new Date(), children: { nested: new Date() }}\n */\n if (typeof thing === \"object\" && isDefined<object>(thing)) {\n const thingShallowCopy = { ...thing };\n for (const key of Object.keys(thingShallowCopy)) {\n (thingShallowCopy as any)[key] = convertDatesToNumbers((thingShallowCopy as any)[key]);\n }\n return thingShallowCopy;\n }\n\n return thing;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n Constants,\n TokenType,\n defaultCancellableLock,\n RequestResponseLink,\n StandardAbortMessage,\n isSasTokenProvider,\n} from \"@azure/core-amqp\";\nimport { AccessToken } from \"@azure/core-auth\";\nimport { ConnectionContext } from \"../connectionContext\";\nimport {\n AwaitableSender,\n AwaitableSenderOptions,\n generate_uuid,\n Receiver,\n ReceiverOptions,\n SenderOptions,\n} from \"rhea-promise\";\nimport { getUniqueName } from \"../util/utils\";\nimport { AbortError, AbortSignalLike } from \"@azure/abort-controller\";\nimport { ServiceBusLogger } from \"../log\";\nimport { ServiceBusError } from \"../serviceBusError\";\n\n/**\n * @internal\n * Options passed to the constructor of LinkEntity\n */\nexport interface LinkEntityOptions {\n /**\n * The client entity address in one of the following forms:\n */\n address?: string;\n /**\n * The client entity token audience in one of the following forms:\n */\n audience?: string;\n}\n\n/**\n * A simple grouping of the sender and receiver options. Only used\n * with the ManagementClient today.\n *\n * @internal\n */\nexport interface RequestResponseLinkOptions {\n senderOptions: SenderOptions;\n receiverOptions: ReceiverOptions;\n name?: string;\n}\n\n/**\n * @internal\n */\nexport type NonSessionReceiverType =\n | \"batching\" // batching receiver\n | \"streaming\"; // streaming receiver\n\n/**\n * @internal\n */\nexport type ReceiverType = NonSessionReceiverType | \"session\"; // message session\n\n/**\n * @internal\n */\ntype LinkOptionsT<LinkT extends Receiver | AwaitableSender | RequestResponseLink> =\n LinkT extends Receiver\n ? ReceiverOptions\n : LinkT extends AwaitableSender\n ? AwaitableSenderOptions\n : LinkT extends RequestResponseLink\n ? RequestResponseLinkOptions\n : never;\n\n/**\n * @internal\n */\ntype LinkTypeT<LinkT extends Receiver | AwaitableSender | RequestResponseLink> =\n LinkT extends Receiver\n ? ReceiverType\n : LinkT extends AwaitableSender\n ? \"sender\" // sender\n : LinkT extends RequestResponseLink\n ? \"mgmt\" // management link\n : never;\n\n/**\n * @internal\n * Describes the base class for entities like MessageSender, MessageReceiver and Management client.\n */\nexport abstract class LinkEntity<LinkT extends Receiver | AwaitableSender | RequestResponseLink> {\n /**\n * The unique name for the entity in the format:\n * `${name of the entity}-${guid}`.\n */\n name: string;\n /**\n * The client entity address in one of the following forms:\n *\n * **Sender**\n * - `\"<queue-name>\"`.\n * - `\"<topic-name>\"`.\n *\n * **Receiver**\n * - `\"<queue-name>\"`.\n * - `\"<topic-name>\"`.\n *\n * **ManagementClient**\n * -`\"$management\"`.\n */\n address: string;\n /**\n * The client entity token audience in one of the following forms:\n *\n * **Sender**\n * - `\"sb://<yournamespace>.servicebus.windows.net/<queue-name>\"`\n * - `\"sb://<yournamespace>.servicebus.windows.net/<topic-name>\"`\n *\n * **Receiver**\n * - `\"sb://<yournamespace>.servicebus.windows.net/<queue-name>\"`\n * - `\"sb://<yournamespace>.servicebus.windows.net/<topic-name>\"`\n *\n * **ManagementClient**\n * - `\"sb://<your-namespace>.servicebus.windows.net/<queue-name>/$management\"`.\n * - `\"sb://<your-namespace>.servicebus.windows.net/<topic-name>/$management\"`.\n */\n audience: string;\n /**\n * Provides relevant information about the amqp connection,\n * cbs and $management sessions, token provider, sender and receivers.\n */\n protected _context: ConnectionContext;\n /**\n * The token renewal timer that keeps track of when\n * the Client Entity is due for token renewal.\n */\n private _tokenRenewalTimer?: NodeJS.Timeout;\n /**\n * Indicates token timeout\n */\n protected _tokenTimeout?: number;\n\n /**\n * The actual rhea link (of type Receiver or AwaitableSender) or RequestResponseLink\n */\n private _link?: LinkT;\n\n /**\n * The log prefix for any log messages.\n */\n private _logPrefix: string;\n\n public get logPrefix(): string {\n return this._logPrefix;\n }\n\n /**\n * Indicates that close() has been called on this link and\n * that it should not be allowed to reopen.\n */\n private _wasClosedPermanently: boolean = false;\n\n /**\n * A lock that ensures that opening and closing this\n * link properly cooperate.\n */\n private _openLock: string = `linkEntity-${generate_uuid()}`;\n\n /**\n * Creates a new ClientEntity instance.\n * @param baseName - The base name to use for the link. A unique ID will be appended to this.\n * @param entityPath - The entity path (ex: 'your-queue')\n * @param context - The connection context.\n * @param options - Options that can be provided while creating the LinkEntity.\n */\n constructor(\n public readonly baseName: string,\n public readonly entityPath: string,\n context: ConnectionContext,\n private _linkType: LinkTypeT<LinkT>,\n private _logger: ServiceBusLogger,\n options?: LinkEntityOptions,\n ) {\n if (!options) options = {};\n this._context = context;\n this.address = options.address || \"\";\n this.audience = options.audience || \"\";\n this.name = getUniqueName(baseName);\n this._logPrefix = `[${context.connectionId}|${this._linkType}:${this.name}]`;\n }\n\n /**\n * Determines whether the AMQP link is open. If open then returns true else returns false.\n */\n isOpen(): boolean {\n const result: boolean = this._link ? this._link.isOpen() : false;\n this._logger.verbose(`${this._logPrefix} is open? ${result}`);\n return result;\n }\n\n /**\n * Initializes this LinkEntity, setting this._link with the result of `createRheaLink`, which\n * is implemented by child classes.\n *\n * @returns A Promise that resolves when the link has been properly initialized\n * @throws `AbortError` if the link has been closed via 'close'\n */\n async initLink(options: LinkOptionsT<LinkT>, abortSignal?: AbortSignalLike): Promise<void> {\n // we'll check that the connection isn't in the process of recycling (and if so, wait for it to complete)\n await this._context.readyToOpenLink();\n\n this._logger.verbose(\n `${this._logPrefix} Attempting to acquire lock token ${this._openLock} for initializing link`,\n );\n return defaultCancellableLock.acquire(\n this._openLock,\n () => {\n this._logger.verbose(\n `${this._logPrefix} Lock ${this._openLock} acquired for initializing link`,\n );\n return this._initLinkImpl(options, abortSignal);\n },\n {\n abortSignal: abortSignal,\n timeoutInMs: Constants.defaultOperationTimeoutInMs,\n },\n );\n }\n\n private async _initLinkImpl(\n options: LinkOptionsT<LinkT>,\n abortSignal?: AbortSignalLike,\n ): Promise<void> {\n const checkAborted = (): void => {\n if (abortSignal?.aborted) {\n throw new AbortError(StandardAbortMessage);\n }\n };\n\n const connectionId = this._context.connectionId;\n checkAborted();\n\n if (options.name) {\n this.name = options.name;\n this._logPrefix = `[${connectionId}|${this._linkType}:${this.name}]`;\n }\n\n if (this._wasClosedPermanently) {\n this._logger.verbose(`${this._logPrefix} Link has been permanently closed. Not reopening.`);\n throw new AbortError(`Link has been permanently closed. Not reopening.`);\n }\n\n if (this.isOpen()) {\n this._logger.verbose(`${this._logPrefix} Link is already open. Returning.`);\n return;\n }\n\n this._logger.verbose(\n `${this._logPrefix} Is not open and is not currently connecting. Opening.`,\n );\n\n try {\n await this._negotiateClaim({\n abortSignal,\n setTokenRenewal: false,\n timeoutInMs: Constants.defaultOperationTimeoutInMs,\n });\n\n checkAborted();\n this.checkIfConnectionReady();\n\n this._logger.verbose(`${this._logPrefix} Creating with options %O`, options);\n this._link = await this.createRheaLink(options);\n checkAborted();\n\n this._ensureTokenRenewal();\n\n this._logger.verbose(`${this._logPrefix} Link has been created.`);\n } catch (err: any) {\n this._logger.logError(err, `${this._logPrefix} Error thrown when creating the link`);\n await this.closeLinkImpl();\n throw err;\n }\n }\n\n /**\n * Clears token renewal for current link, removes current LinkEntity instance from cache,\n * and closes the underlying AMQP link.\n * Once closed, this instance of LinkEntity is not meant to be re-used.\n */\n async close(): Promise<void> {\n // Set the flag to indicate that this instance of LinkEntity is not meant to be re-used.\n this._wasClosedPermanently = true;\n\n this._logger.verbose(`${this.logPrefix} permanently closing this link.`);\n\n this.removeLinkFromContext();\n\n await this.closeLink();\n this._logger.verbose(`${this.logPrefix} permanently closed this link.`);\n }\n\n /**\n * NOTE: This method should be implemented by any child classes to actually create the underlying\n * Rhea link (AwaitableSender or Receiver or RequestResponseLink)\n *\n */\n protected abstract createRheaLink(_options: LinkOptionsT<LinkT>): Promise<LinkT>;\n\n /**\n * Clears this link from context's link cache.\n */\n protected abstract removeLinkFromContext(): void;\n\n /**\n * Closes the internally held rhea link, stops the token renewal timer and sets\n * the this._link field to undefined.\n */\n protected closeLink(): Promise<void> {\n this._logger.verbose(\n `${this._logPrefix} Attempting to acquire lock token ${this._openLock} for closing link`,\n );\n return defaultCancellableLock.acquire(\n this._openLock,\n () => {\n this._logger.verbose(`${this._logPrefix} Lock ${this._openLock} acquired for closing link`);\n return this.closeLinkImpl();\n },\n { abortSignal: undefined, timeoutInMs: undefined },\n );\n }\n\n private async closeLinkImpl(): Promise<void> {\n this._logger.verbose(`${this._logPrefix} closeLinkImpl() called`);\n\n clearTimeout(this._tokenRenewalTimer as NodeJS.Timeout);\n this._tokenRenewalTimer = undefined;\n\n if (this._link) {\n try {\n const link = this._link;\n this._link = undefined;\n\n // This should take care of closing the link and it's underlying session. This should also\n // remove them from the internal map.\n await link.close();\n this._logger.verbose(`${this._logPrefix} closed.`);\n } catch (err: any) {\n this._logger.logError(err, `${this._logPrefix} An error occurred while closing the link`);\n }\n }\n }\n\n /**\n * Provides the current type of the ClientEntity.\n * @returns The entity type.\n */\n private get _type(): string {\n let result = \"LinkEntity\";\n if ((this as any).constructor && (this as any).constructor.name) {\n result = (this as any).constructor.name;\n }\n return result;\n }\n\n protected get wasClosedPermanently(): boolean {\n return this._wasClosedPermanently;\n }\n\n protected get link(): LinkT | undefined {\n return this._link;\n }\n\n /**\n * Negotiates the cbs claim for the ClientEntity.\n * @param setTokenRenewal - Set the token renewal timer. Default false.\n */\n private async _negotiateClaim({\n abortSignal,\n setTokenRenewal,\n timeoutInMs,\n }: {\n setTokenRenewal: boolean;\n abortSignal: AbortSignalLike | undefined;\n timeoutInMs: number;\n }): Promise<void> {\n this._logger.verbose(`${this._logPrefix} negotiateclaim() has been called`);\n\n // Wait for the connectionContext to be ready to open the link.\n this.checkIfConnectionReady();\n\n // Acquire the lock and establish a cbs session if it does not exist on the connection.\n // Although node.js is single threaded, we need a locking mechanism to ensure that a\n // race condition does not happen while creating a shared resource (in this case the\n // cbs session, since we want to have exactly 1 cbs session per connection).\n this._logger.verbose(\n \"%s Acquiring cbs lock: '%s' for creating the cbs session while creating the %s: \" +\n \"'%s' with address: '%s'.\",\n this.logPrefix,\n this._context.cbsSession.cbsLock,\n this._type,\n this.name,\n this.address,\n );\n\n const startTime = Date.now();\n if (!this._context.cbsSession.isOpen()) {\n await defaultCancellableLock.acquire(\n this._context.cbsSession.cbsLock,\n () => {\n this.checkIfConnectionReady();\n return this._context.cbsSession.init({ abortSignal, timeoutInMs });\n },\n {\n abortSignal,\n timeoutInMs: timeoutInMs - (Date.now() - startTime),\n },\n );\n }\n\n let tokenObject: AccessToken;\n let tokenType: TokenType;\n if (isSasTokenProvider(this._context.tokenCredential)) {\n tokenObject = await this._context.tokenCredential.getToken(this.audience);\n tokenType = TokenType.CbsTokenTypeSas;\n\n // renew sas token in every 45 minutes\n this._tokenTimeout = (3600 - 900) * 1000;\n } else {\n const aadToken = await this._context.tokenCredential.getToken(Constants.aadServiceBusScope);\n if (!aadToken) {\n throw new Error(`Failed to get token from the provided \"TokenCredential\" object`);\n }\n tokenObject = aadToken;\n tokenType = TokenType.CbsTokenTypeJwt;\n this._tokenTimeout = tokenObject.expiresOnTimestamp - Date.now() - 2 * 60 * 1000;\n }\n this._logger.verbose(\n \"%s %s: calling negotiateClaim for audience '%s'.\",\n this.logPrefix,\n this._type,\n this.audience,\n );\n // Acquire the lock to negotiate the CBS claim.\n this._logger.verbose(\n \"%s Acquiring cbs lock: '%s' for cbs auth for %s: '%s' with address '%s'.\",\n this.logPrefix,\n this._context.negotiateClaimLock,\n this._type,\n this.name,\n this.address,\n );\n if (!tokenObject) {\n throw new Error(\"Token cannot be null\");\n }\n await defaultCancellableLock.acquire(\n this._context.negotiateClaimLock,\n () => {\n this.checkIfConnectionReady();\n return this._context.cbsSession.negotiateClaim(\n this.audience,\n tokenObject.token,\n tokenType,\n {\n abortSignal,\n timeoutInMs: timeoutInMs - (Date.now() - startTime),\n },\n );\n },\n {\n abortSignal,\n timeoutInMs: timeoutInMs - (Date.now() - startTime),\n },\n );\n this._logger.verbose(\n \"%s Negotiated claim for %s '%s' with with address: %s\",\n this.logPrefix,\n this._type,\n this.name,\n this.address,\n );\n if (setTokenRenewal) {\n this._ensureTokenRenewal();\n }\n }\n\n /**\n * Checks to see if the connection is in a \"reopening\" state. If it is\n * we need to _not_ use it otherwise we'll trigger some race conditions\n * within rhea (for instance, errors about _process not being defined).\n */\n private checkIfConnectionReady(): void {\n if (!this._context.isConnectionClosing()) {\n return;\n }\n\n this._logger.verbose(\n `${this._logPrefix} Connection is reopening, aborting link initialization.`,\n );\n const err = new ServiceBusError(\n \"Connection is reopening, aborting link initialization.\",\n \"GeneralError\",\n );\n err.retryable = true;\n throw err;\n }\n\n /**\n * Ensures that the token is renewed within the predefined renewal margin.\n */\n private _ensureTokenRenewal(): void {\n if (!this._tokenTimeout) {\n return;\n }\n // Clear the existing token renewal timer.\n // This scenario can happen if the connection goes down and is brought back up\n // before the `nextRenewalTimeout` was reached.\n if (this._tokenRenewalTimer) {\n clearTimeout(this._tokenRenewalTimer);\n }\n this._tokenRenewalTimer = setTimeout(async () => {\n try {\n await this._negotiateClaim({\n setTokenRenewal: true,\n abortSignal: undefined,\n timeoutInMs: Constants.defaultOperationTimeoutInMs,\n });\n } catch (err: any) {\n this._logger.logError(\n err,\n \"%s %s '%s' with address %s, an error occurred while renewing the token\",\n this.logPrefix,\n this._type,\n this.name,\n this.address,\n );\n }\n }, this._tokenTimeout);\n this._logger.verbose(\n \"%s %s '%s' with address %s, has next token renewal in %d milliseconds @(%s).\",\n this.logPrefix,\n this._type,\n this.name,\n this.address,\n this._tokenTimeout,\n new Date(Date.now() + this._tokenTimeout).toString(),\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport Long from \"long\";\nimport { ConnectionContext } from \"../connectionContext\";\nimport { logger, receiverLogger } from \"../log\";\nimport { ReceiveMode } from \"../models\";\nimport {\n isAmqpAnnotatedMessage,\n isServiceBusMessage,\n ServiceBusReceivedMessage,\n} from \"../serviceBusMessage\";\nimport { isDefined } from \"@azure/core-util\";\n\n/**\n * Error message to use when EntityPath in connection string does not match the\n * queue or topic name passed to the methods in the ServiceBusClient that create\n * senders and receivers.\n *\n * @internal\n */\nexport const entityPathMisMatchError =\n \"The queue or topic name provided does not match the EntityPath in the connection string passed to the ServiceBusClient constructor.\";\n\n/**\n * Error message for when maxMessageCount provided is invalid.\n *\n * @internal\n */\nexport const InvalidMaxMessageCountError = \"'maxMessageCount' must be a number greater than 0.\";\n\n/**\n * @internal\n * Logs and throws Error if the current AMQP connection is closed.\n * @param context - The ConnectionContext associated with the current AMQP connection.\n */\nexport function throwErrorIfConnectionClosed(context: ConnectionContext): void {\n if (context && context.wasConnectionCloseCalled) {\n const errorMessage = \"The underlying AMQP connection is closed.\";\n const error = new Error(errorMessage);\n logger.warning(`[${context.connectionId}] %O`, error);\n throw error;\n }\n}\n\n/**\n * @internal\n * Gets the error message when a sender is used when its already closed\n * @param entityPath - Value of the `entityPath` property on the client which denotes its name\n */\nexport function getSenderClosedErrorMsg(entityPath: string): string {\n return (\n `The sender for \"${entityPath}\" has been closed and can no longer be used. ` +\n `Please create a new sender using the \"createSender\" method on the ServiceBusClient.`\n );\n}\n\n/**\n * @internal\n * Gets the error message when a receiver is used when its already closed\n * @param entityPath - Value of the `entityPath` property on the client which denotes its name\n * @param sessionId - If using session receiver, then the id of the session\n */\nexport function getReceiverClosedErrorMsg(entityPath: string, sessionId?: string): string {\n if (!isDefined(sessionId)) {\n return (\n `The receiver for \"${entityPath}\" has been closed and can no longer be used. ` +\n `Please create a new receiver using the \"createReceiver\" method on the ServiceBusClient.`\n );\n }\n return (\n `The receiver for session \"${sessionId}\" in \"${entityPath}\" has been closed and can no ` +\n `longer be used. Please create a new receiver using the \"acceptSession\" or \"acceptNextSession\" method on the ServiceBusClient.`\n );\n}\n\n/**\n * @internal\n * @param entityPath - Value of the `entityPath` property on the client which denotes its name\n * @param sessionId - If using session receiver, then the id of the session\n */\nexport function getAlreadyReceivingErrorMsg(entityPath: string, sessionId?: string): string {\n if (!isDefined(sessionId)) {\n return `The receiver for \"${entityPath}\" is already receiving messages.`;\n }\n return `The receiver for session \"${sessionId}\" for \"${entityPath}\" is already receiving messages.`;\n}\n\n/**\n * @internal\n * Logs and Throws TypeError if given parameter is undefined or null\n * @param connectionId - Id of the underlying AMQP connection used for logging\n * @param parameterName - Name of the parameter to check\n * @param parameterValue - Value of the parameter to check\n */\nexport function throwTypeErrorIfParameterMissing(\n connectionId: string,\n parameterName: string,\n parameterValue: unknown,\n): void {\n if (parameterValue === undefined || parameterValue === null) {\n const error = new TypeError(`Missing parameter \"${parameterName}\"`);\n logger.warning(`[${connectionId}] %O`, error);\n throw error;\n }\n}\n\n/**\n * @internal\n * Logs and Throws TypeError if given parameter is not an instance of expected type\n * @param connectionId - Id of the underlying AMQP connection used for logging\n * @param parameterName - Name of the parameter to type check\n * @param parameterValue - Value of the parameter to type check\n * @param constructor - Constructor function of the expected parameter type\n */\nexport function throwTypeErrorIfNotInstanceOfParameterType(\n connectionId: string,\n parameterName: string,\n parameterValue: unknown,\n // eslint-disable-next-line @typescript-eslint/ban-types\n constructor: Function,\n): void {\n if (!(parameterValue instanceof constructor)) {\n const error = new TypeError(\n `The parameter \"${parameterName}\" should be an instance of \"${constructor.name}\"`,\n );\n logger.warning(`[${connectionId}] %O`, error);\n throw error;\n }\n}\n\n/**\n * @internal\n * Logs and Throws TypeError if given parameter is not of expected type\n * @param connectionId - Id of the underlying AMQP connection used for logging\n * @param parameterName - Name of the parameter to type check\n * @param parameterValue - Value of the parameter to type check\n * @param expectedType - Expected type of the parameter\n */\nexport function throwTypeErrorIfParameterTypeMismatch(\n connectionId: string,\n parameterName: string,\n parameterValue: unknown,\n expectedType: string,\n): void {\n if (typeof parameterValue !== expectedType) {\n const error = new TypeError(\n `The parameter \"${parameterName}\" should be of type \"${expectedType}\"`,\n );\n logger.warning(`[${connectionId}] %O`, error);\n throw error;\n }\n}\n\n/**\n * @internal\n * Logs and Throws TypeError if given parameter is not of type `Long` or an array of type `Long`\n * @param connectionId - Id of the underlying AMQP connection used for logging\n * @param parameterName - Name of the parameter to type check\n * @param parameterValue - Value of the parameter to type check\n */\nexport function throwTypeErrorIfParameterNotLong(\n connectionId: string,\n parameterName: string,\n parameterValue: unknown,\n): TypeError | undefined {\n if (Array.isArray(parameterValue)) {\n return throwTypeErrorIfParameterNotLongArray(connectionId, parameterName, parameterValue);\n }\n if (Long.isLong(parameterValue)) {\n return;\n }\n const error = new TypeError(`The parameter \"${parameterName}\" should be of type \"Long\"`);\n logger.warning(`[${connectionId}] %O`, error);\n throw error;\n}\n\n/**\n * @internal\n * Logs and Throws TypeError if given parameter is not an array of type `Long`\n * @param connectionId - Id of the underlying AMQP connection used for logging\n * @param parameterName - Name of the parameter to type check\n * @param parameterValue - Value of the parameter to type check\n */\nexport function throwTypeErrorIfParameterNotLongArray(\n connectionId: string,\n parameterName: string,\n parameterValue: any[],\n): TypeError | undefined {\n if (parameterValue.every((item) => Long.isLong(item))) {\n return;\n }\n const error = new TypeError(`The parameter \"${parameterName}\" should be an array of type \"Long\"`);\n logger.warning(`[${connectionId}] %O`, error);\n throw error;\n}\n\n/**\n * @internal\n * Logs and Throws TypeError if given parameter is an empty string\n * @param connectionId - Id of the underlying AMQP connection used for logging\n * @param parameterName - Name of the parameter to type check\n * @param parameterValue - Value of the parameter to type check\n */\nexport function throwTypeErrorIfParameterIsEmptyString(\n connectionId: string,\n parameterName: string,\n parameterValue: string,\n): TypeError | undefined {\n if (parameterValue !== \"\") {\n return;\n }\n const error = new TypeError(`Empty string not allowed in parameter \"${parameterName}\"`);\n logger.warning(`[${connectionId}] %O`, error);\n throw error;\n}\n\n/**\n * @internal\n * The error message for operations on the receiver that are invalid for a message received in receiveAndDelete mode.\n */\nexport const InvalidOperationInReceiveAndDeleteMode =\n \"The operation is not supported in 'receiveAndDelete' receive mode.\";\n\n/**\n * @internal\n * The error message for operations on the receiver that are invalid for a peeked message.\n */\nexport const InvalidOperationForPeekedMessage =\n \"This operation is not supported for peeked messages. Only messages received using 'receiveMessages()', 'subscribe()' and 'getMessageIterator()' methods on the receiver in 'peekLock' receive mode can be settled.\";\n\n/**\n * @internal\n * The error message for when one attempts to settle an already settled message.\n */\nexport const MessageAlreadySettled = \"The message has either been deleted or already settled\";\n\n/**\n * Throws error if the ServiceBusReceivedMessage cannot be settled.\n * @internal\n */\nexport function throwErrorIfInvalidOperationOnMessage(\n message: ServiceBusReceivedMessage,\n receiveMode: ReceiveMode,\n connectionId: string,\n): void {\n let error: Error | undefined;\n\n if (receiveMode === \"receiveAndDelete\") {\n error = new Error(InvalidOperationInReceiveAndDeleteMode);\n } else if (!message.lockToken) {\n error = new Error(InvalidOperationForPeekedMessage);\n }\n\n if (error) {\n receiverLogger.logError(\n error,\n \"[%s] An error occurred for message with id '%s'\",\n connectionId,\n message.messageId,\n );\n throw error;\n }\n}\n\n/**\n * Error message for when the ServiceBusMessage provided by the user has different values\n * for partitionKey and sessionId.\n * @internal\n */\nexport const PartitionKeySessionIdMismatchError =\n \"The fields 'partitionKey' and 'sessionId' cannot have different values.\";\n/**\n * Throws error if the given object is not a valid ServiceBusMessage\n * @internal\n * @param msg - The object that needs to be validated as a ServiceBusMessage\n * @param errorMessageForWrongType - The error message to use when given object is not a ServiceBusMessage\n */\nexport function throwIfNotValidServiceBusMessage(\n msg: unknown,\n errorMessageForWrongType: string,\n): void {\n if (!isServiceBusMessage(msg) && !isAmqpAnnotatedMessage(msg)) {\n throw new TypeError(errorMessageForWrongType);\n }\n\n if (isServiceBusMessage(msg)) {\n if (msg.partitionKey && msg.sessionId && msg.partitionKey !== msg.sessionId) {\n throw new TypeError(PartitionKeySessionIdMismatchError);\n }\n }\n}\n\n/** @internal */\nexport const errorInvalidMessageTypeSingleOrArray =\n \"Provided value for 'messages' must be of type: ServiceBusMessage, AmqpAnnotatedMessage, ServiceBusMessageBatch or an array of type ServiceBusMessage or AmqpAnnotatedMessage.\";\n\n/** @internal */\nexport const errorInvalidMessageTypeSingle =\n \"Provided value for 'message' must be of type: ServiceBusMessage or AmqpAnnotatedMessage.\";\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport Long from \"long\";\nimport {\n EventContext,\n ReceiverOptions,\n message as RheaMessageUtil,\n SenderOptions,\n generate_uuid,\n string_to_uuid,\n types,\n Typed,\n ReceiverEvents,\n Message as RheaMessage,\n} from \"rhea-promise\";\nimport {\n ConditionErrorNameMapper,\n Constants,\n defaultCancellableLock,\n MessagingError,\n RequestResponseLink,\n SendRequestOptions,\n RetryOptions,\n AmqpAnnotatedMessage,\n} from \"@azure/core-amqp\";\nimport { ConnectionContext } from \"../connectionContext\";\nimport {\n DispositionType,\n ServiceBusReceivedMessage,\n ServiceBusMessage,\n ServiceBusMessageImpl,\n toRheaMessage,\n fromRheaMessage,\n updateScheduledTime,\n updateMessageId,\n} from \"../serviceBusMessage\";\nimport { LinkEntity, RequestResponseLinkOptions } from \"./linkEntity\";\nimport { managementClientLogger, receiverLogger, senderLogger, ServiceBusLogger } from \"../log\";\nimport { toBuffer, waitForSendable } from \"../util/utils\";\nimport {\n InvalidMaxMessageCountError,\n throwErrorIfConnectionClosed,\n throwTypeErrorIfParameterIsEmptyString,\n throwTypeErrorIfParameterMissing,\n throwTypeErrorIfParameterNotLong,\n throwTypeErrorIfParameterTypeMismatch,\n} from \"../util/errors\";\nimport { max32BitNumber } from \"../util/constants\";\nimport { Buffer } from \"buffer\";\nimport { OperationOptionsBase } from \"./../modelsToBeSharedWithEventHubs\";\nimport { AbortController, AbortSignalLike } from \"@azure/abort-controller\";\nimport { ReceiveMode } from \"../models\";\nimport { translateServiceBusError } from \"../serviceBusError\";\nimport { defaultDataTransformer, tryToJsonDecode } from \"../dataTransformer\";\nimport { delay, isDefined, isObjectWithProperties } from \"@azure/core-util\";\nimport {\n RuleProperties,\n SqlRuleAction,\n SqlRuleFilter,\n} from \"../serializers/ruleResourceSerializer\";\nimport { ListRequestOptions } from \"../serviceBusAtomManagementClient\";\n\n/**\n * @internal\n */\nexport interface SendManagementRequestOptions extends SendRequestOptions {\n /**\n * The name of the sender or receiver link associated with the managmenet operations.\n * This is used for service side optimization.\n */\n associatedLinkName?: string;\n /**\n * Option to disable the client from running JSON.parse() on the message body when receiving the message.\n * Not applicable if the message was sent with AMQP body type value or sequence. Use this option when you\n * prefer to work directly with the bytes present in the message body than have the client attempt to parse it.\n */\n skipParsingBodyAsJson?: boolean;\n /**\n * Whether to skip converting Date type on properties of message annotations\n * or application properties into numbers when receiving the message. By\n * default, properties of Date type is converted into UNIX epoch number for\n * compatibility.\n */\n skipConvertingDate?: boolean;\n}\n\n/**\n * Represents the correlation filter expression.\n * A CorrelationRuleFilter holds a set of conditions that are matched against user and system properties\n * of incoming messages from a Subscription.\n */\nexport interface CorrelationRuleFilter {\n /**\n * Value to be matched with the `correlationId` property of the incoming message.\n */\n correlationId?: string;\n /**\n * Value to be matched with the `messageId` property of the incoming message.\n */\n messageId?: string;\n /**\n * Value to be matched with the `to` property of the incoming message.\n */\n to?: string;\n /**\n * Value to be matched with the `replyTo` property of the incoming message.\n */\n replyTo?: string;\n /**\n * Value to be matched with the `subject` property of the incoming message.\n */\n subject?: string;\n /**\n * Value to be matched with the `sessionId` property of the incoming message.\n */\n sessionId?: string;\n /**\n * Value to be matched with the `replyToSessionId` property of the incoming message.\n */\n replyToSessionId?: string;\n /**\n * Value to be matched with the `contentType` property of the incoming message.\n */\n contentType?: string;\n /**\n * Value to be matched with the user properties of the incoming message.\n */\n applicationProperties?: { [key: string]: string | number | boolean | Date };\n}\n\n/**\n * @internal\n */\nconst sqlRuleProperties = [\"sqlExpression\"];\n\nfunction isSqlRuleFilter(obj: unknown): obj is SqlRuleFilter {\n if (obj) {\n return sqlRuleProperties.some((validProperty) => isObjectWithProperties(obj, [validProperty]));\n }\n\n return false;\n}\n\n/**\n * @internal\n */\nconst correlationProperties = [\n \"correlationId\",\n \"messageId\",\n \"to\",\n \"replyTo\",\n \"subject\",\n \"sessionId\",\n \"replyToSessionId\",\n \"contentType\",\n \"applicationProperties\",\n];\n\nfunction isCorrelationRuleFilter(obj: unknown): obj is CorrelationRuleFilter {\n if (obj) {\n return correlationProperties.some((validProperty) =>\n isObjectWithProperties(obj, [validProperty]),\n );\n }\n\n return false;\n}\n\n/**\n * @internal\n * Options to set when updating the disposition status\n */\nexport interface DispositionStatusOptions extends OperationOptionsBase {\n /**\n * A map of Service Bus brokered message properties\n * to modify.\n */\n propertiesToModify?: { [key: string]: any };\n /**\n * The deadletter reason. May be set if disposition status\n * is set to suspended.\n */\n deadLetterReason?: string;\n /**\n * The deadletter description. May be set if disposition status\n * is set to suspended.\n */\n deadLetterDescription?: string;\n /**\n * This should only be provided if `session` is enabled for a Queue or Topic.\n */\n sessionId?: string;\n /**\n * Retry options.\n */\n retryOptions: RetryOptions | undefined;\n}\n\n/**\n * @internal\n * Options passed to the constructor of ManagementClient\n */\nexport interface ManagementClientOptions {\n address?: string;\n audience?: string;\n}\n\n/**\n * @internal\n * Describes the ServiceBus Management Client that talks\n * to the $management endpoint over AMQP connection.\n */\nexport class ManagementClient extends LinkEntity<RequestResponseLink> {\n /**\n * The reply to Guid for the management client.\n */\n replyTo: string = generate_uuid();\n /**\n * Provides the sequence number of the last peeked message.\n */\n private _lastPeekedSequenceNumber: Long = Long.ZERO;\n /**\n * lock token for init operation\n */\n private _initLock: string = `initMgmtLink-${generate_uuid()}`;\n /**\n * Instantiates the management client.\n * @param context - The connection context\n * @param entityPath - The name/path of the entity (queue/topic/subscription name)\n * for which the management request needs to be made.\n * @param options - Options to be provided for creating the\n * \"$management\" client.\n */\n constructor(context: ConnectionContext, entityPath: string, options?: ManagementClientOptions) {\n super(`${entityPath}/$management`, entityPath, context, \"mgmt\", managementClientLogger, {\n address: options && options.address ? options.address : Constants.management,\n audience:\n options && options.audience\n ? options.audience\n : `${context.config.endpoint}${entityPath}/$management`,\n });\n this._context = context;\n }\n\n /**\n * initialize link with unique this.replyTo address.\n * @param options -\n * @returns updated options bag that has adjusted `timeoutInMs` to account for init time\n */\n private async initWithUniqueReplyTo(\n options: SendManagementRequestOptions = {},\n ): Promise<SendManagementRequestOptions> {\n const retryTimeoutInMs = options.timeoutInMs ?? Constants.defaultOperationTimeoutInMs;\n const initOperationStartTime = Date.now();\n return defaultCancellableLock.acquire(\n this._initLock,\n async () => {\n managementClientLogger.verbose(\n `${this.logPrefix} lock acquired for initializing replyTo address and link`,\n );\n if (!this.isOpen()) {\n this.replyTo = generate_uuid();\n managementClientLogger.verbose(\n `${this.logPrefix} new replyTo address: ${this.replyTo} generated`,\n );\n }\n const { abortSignal } = options ?? {};\n const aborter = new AbortController();\n const { signal } = new AbortController([\n aborter.signal,\n ...(abortSignal ? [abortSignal] : []),\n ]);\n\n if (!this.isOpen()) {\n await Promise.race([\n this._init(signal),\n delay(retryTimeoutInMs, { abortSignal: aborter.signal }).then(() => {\n throw {\n name: \"OperationTimeoutError\",\n message: \"The management request timed out. Please try again later.\",\n };\n }),\n ]).finally(() => aborter.abort());\n }\n\n // time taken by the init operation\n const timeTakenByInit = Date.now() - initOperationStartTime;\n return {\n ...options,\n // Left over time\n timeoutInMs: retryTimeoutInMs - timeTakenByInit,\n };\n },\n {\n abortSignal: options.abortSignal,\n timeoutInMs: retryTimeoutInMs,\n },\n );\n }\n\n private async _init(abortSignal?: AbortSignalLike): Promise<void> {\n throwErrorIfConnectionClosed(this._context);\n try {\n const rxopt: ReceiverOptions = {\n source: { address: this.address },\n name: this.replyTo,\n target: { address: this.replyTo },\n onSessionError: (context: EventContext) => {\n const sbError = translateServiceBusError(context.session!.error!);\n managementClientLogger.logError(\n sbError,\n `${this.logPrefix} An error occurred on the session for request/response links for $management`,\n );\n },\n };\n const sropt: SenderOptions = {\n target: { address: this.address },\n onError: (context: EventContext) => {\n const ehError = translateServiceBusError(context.sender!.error!);\n managementClientLogger.logError(\n ehError,\n `${this.logPrefix} An error occurred on the $management sender link`,\n );\n },\n };\n\n // Even if multiple parallel requests reach here, the initLink secures a lock\n // to ensure there won't be multiple initializations\n await this.initLink(\n {\n senderOptions: sropt,\n receiverOptions: rxopt,\n },\n abortSignal,\n );\n } catch (err: any) {\n const translatedError = translateServiceBusError(err);\n managementClientLogger.logError(\n translatedError,\n `${this.logPrefix} An error occurred while establishing the $management links`,\n );\n throw translatedError;\n }\n }\n\n protected async createRheaLink(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: RequestResponseLinkOptions,\n ): Promise<RequestResponseLink> {\n const rheaLink = await RequestResponseLink.create(\n this._context.connection,\n options.senderOptions,\n options.receiverOptions,\n );\n // Attach listener for the `receiver_error` events to log the errors.\n\n // \"message\" event listener is added in core-amqp.\n // \"rhea\" doesn't allow setting only the \"onError\" handler in the options if it is not accompanied by an \"onMessage\" handler.\n // Hence, not passing onError handler in the receiver options, adding a handler below.\n rheaLink.receiver.on(ReceiverEvents.receiverError, (context: EventContext) => {\n const ehError = translateServiceBusError(context.receiver!.error!);\n managementClientLogger.logError(\n ehError,\n `${this.logPrefix} An error occurred on the $management receiver link`,\n );\n });\n return rheaLink;\n }\n\n /**\n * Given array of typed values, returns the element in given index\n */\n private _safelyGetTypedValueFromArray(data: Typed[], index: number): any {\n return Array.isArray(data) && data.length > index && data[index]\n ? data[index].value\n : undefined;\n }\n\n private _decodeApplicationPropertiesMap(\n obj: Typed,\n ): Record<string, string | number | boolean | Date> {\n if (!types.is_map(obj)) {\n throw new Error(\"object to decode is not of Map types\");\n }\n const array = obj.value as Array<Typed>;\n const result: Record<string, string | number | boolean | Date> = {};\n for (let i = 0; i < array.length; i += 2) {\n const key = array[i].value as string;\n result[key] = array[i + 1].value as string | number | boolean | Date;\n }\n\n return result;\n }\n\n private async _makeManagementRequest(\n request: RheaMessage,\n internalLogger: ServiceBusLogger,\n sendRequestOptions: SendManagementRequestOptions = {},\n ): Promise<RheaMessage> {\n if (request.message_id === undefined) {\n request.message_id = generate_uuid();\n }\n\n try {\n const { timeoutInMs } = sendRequestOptions;\n await waitForSendable(\n internalLogger,\n this.logPrefix,\n this.name,\n timeoutInMs ?? Constants.defaultOperationTimeoutInMs,\n this.link?.sender,\n this.link?.session?.outgoing?.available(),\n );\n\n return await this.link!.sendRequest(request, sendRequestOptions);\n } catch (err: any) {\n const translatedError = translateServiceBusError(err);\n internalLogger.logError(\n translatedError,\n \"%s An error occurred during send on management request-response link with address '%s'\",\n this.logPrefix,\n this.address,\n );\n throw translatedError;\n }\n }\n\n /**\n * Closes the AMQP management session to the ServiceBus namespace for this client,\n * returning a promise that will be resolved when disconnection is completed.\n */\n async close(): Promise<void> {\n try {\n // Always clear the timeout, as the isOpen check may report\n // false without ever having cleared the timeout otherwise.\n\n // NOTE: management link currently doesn't have a separate concept of \"detaching\" like\n // the other links do. When we add handling of this (via the onDetached call, like other links)\n // we can change this back to closeLink(\"permanent\").\n await this.closeLink();\n managementClientLogger.verbose(\"Successfully closed the management session.\");\n } catch (err: any) {\n managementClientLogger.logError(\n err,\n `${this.logPrefix} An error occurred while closing the management session`,\n );\n throw err;\n }\n }\n\n /**\n * Fetches the next batch of active messages. The first call to `peek()` fetches the first\n * active message for this client. Each subsequent call fetches the subsequent message in the\n * entity.\n *\n * Unlike a `received` message, `peeked` message will not have lock token associated with it,\n * and hence it cannot be `Completed/Abandoned/Deferred/Deadlettered/Renewed`. This method will\n * also fetch even Deferred messages (but not Deadlettered message).\n *\n * @param messageCount - The number of messages to retrieve. Default value `1`.\n * @param omitMessageBody - Whether to omit message body when peeking. Default value `false`.\n */\n async peek(\n messageCount: number,\n omitMessageBody?: boolean,\n options?: OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<ServiceBusReceivedMessage[]> {\n throwErrorIfConnectionClosed(this._context);\n return this.peekBySequenceNumber(\n this._lastPeekedSequenceNumber.add(1),\n messageCount,\n undefined,\n omitMessageBody,\n options,\n );\n }\n\n /**\n * Fetches the next batch of active messages in the current MessageSession. The first call to\n * `peek()` fetches the first active message for this client. Each subsequent call fetches the\n * subsequent message in the entity.\n *\n * Unlike a `received` message, `peeked` message will not have lock token associated with it,\n * and hence it cannot be `Completed/Abandoned/Deferred/Deadlettered/Renewed`. This method will\n * also fetch even Deferred messages (but not Deadlettered message).\n *\n * @param sessionId - The sessionId from which messages need to be peeked.\n * @param messageCount - The number of messages to retrieve. Default value `1`.\n * @param omitMessageBody - Whether to omit message body when peeking Default value `false`.\n */\n async peekMessagesBySession(\n sessionId: string,\n messageCount: number,\n omitMessageBody?: boolean,\n options?: OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<ServiceBusReceivedMessage[]> {\n throwErrorIfConnectionClosed(this._context);\n return this.peekBySequenceNumber(\n this._lastPeekedSequenceNumber.add(1),\n messageCount,\n sessionId,\n omitMessageBody,\n options,\n );\n }\n\n /**\n * Peeks the desired number of messages from the specified sequence number.\n *\n * @param fromSequenceNumber - The sequence number from where to read the message.\n * @param messageCount - The number of messages to retrieve. Default value `1`.\n * @param sessionId - The sessionId from which messages need to be peeked.\n * @param omitMessageBody - Whether to omit message body when peeking. Default value `false`.\n */\n async peekBySequenceNumber(\n fromSequenceNumber: Long,\n maxMessageCount: number,\n sessionId?: string,\n omitMessageBody?: boolean,\n options?: OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<ServiceBusReceivedMessage[]> {\n throwErrorIfConnectionClosed(this._context);\n const connId = this._context.connectionId;\n\n // Checks for fromSequenceNumber\n throwTypeErrorIfParameterMissing(connId, \"fromSequenceNumber\", fromSequenceNumber);\n throwTypeErrorIfParameterNotLong(connId, \"fromSequenceNumber\", fromSequenceNumber);\n\n // Checks for maxMessageCount\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n );\n throwTypeErrorIfParameterTypeMismatch(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n \"number\",\n );\n\n if (isNaN(maxMessageCount) || maxMessageCount < 1) {\n throw new TypeError(InvalidMaxMessageCountError);\n }\n\n const messageList: ServiceBusReceivedMessage[] = [];\n try {\n const messageBody: any = {};\n messageBody[Constants.fromSequenceNumber] = types.wrap_long(\n Buffer.from(fromSequenceNumber.toBytesBE()),\n );\n messageBody[Constants.messageCount] = types.wrap_int(maxMessageCount!);\n if (isDefined(sessionId)) {\n messageBody[Constants.sessionIdMapKey] = sessionId;\n }\n if (isDefined(omitMessageBody)) {\n const omitMessageBodyKey = \"omit-message-body\"; // TODO: Service Bus specific. Put it somewhere\n messageBody[omitMessageBodyKey] = types.wrap_boolean(omitMessageBody);\n }\n const updatedOptions = await this.initWithUniqueReplyTo(options);\n const request: RheaMessage = {\n body: messageBody,\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.peekMessage,\n },\n };\n if (updatedOptions?.associatedLinkName) {\n request.application_properties![Constants.associatedLinkName] =\n updatedOptions?.associatedLinkName;\n }\n request.application_properties![Constants.trackingId] = generate_uuid();\n\n // TODO: it'd be nice to attribute this peek request to the actual receiver that made it. So have them pass in a\n // log prefix rather than just falling back to the management links.\n receiverLogger.verbose(\n \"%s Peek by sequence number request body: %O.\",\n this.logPrefix,\n request.body,\n );\n\n const result = await this._makeManagementRequest(request, receiverLogger, updatedOptions);\n if (result.application_properties!.statusCode !== 204) {\n const messages = result.body.messages as { message: Buffer }[];\n for (const msg of messages) {\n const decodedMessage = RheaMessageUtil.decode(msg.message);\n const message = fromRheaMessage(decodedMessage as any, {\n skipParsingBodyAsJson: updatedOptions?.skipParsingBodyAsJson ?? false,\n skipConvertingDate: updatedOptions?.skipConvertingDate ?? false,\n });\n messageList.push(message);\n this._lastPeekedSequenceNumber = message.sequenceNumber!;\n }\n }\n } catch (err: any) {\n const error = translateServiceBusError(err) as MessagingError;\n receiverLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the request to peek messages to $management endpoint`,\n );\n // statusCode == 404 then do not throw\n if (error.code !== ConditionErrorNameMapper[\"com.microsoft:message-not-found\"]) {\n throw error;\n }\n }\n return messageList;\n }\n\n /**\n * Renews the lock on the message. The lock will be renewed based on the setting specified on\n * the queue.\n *\n * When a message is received in `PeekLock` mode, the message is locked on the server for this\n * receiver instance for a duration as specified during the Queue/Subscription creation\n * (LockDuration). If processing of the message requires longer than this duration, the\n * lock needs to be renewed. For each renewal, it resets the time the message is locked by the\n * LockDuration set on the Entity.\n *\n * @param lockToken - Lock token of the message\n * @param options - Options that can be set while sending the request.\n * @returns New lock token expiry date and time in UTC format.\n */\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n async renewLock(lockToken: string, options?: SendManagementRequestOptions): Promise<Date> {\n throwErrorIfConnectionClosed(this._context);\n if (!options) options = {};\n if (options.timeoutInMs == null) options.timeoutInMs = 5000;\n\n try {\n const messageBody: any = {};\n\n messageBody[Constants.lockTokens] = types.wrap_array(\n [string_to_uuid(lockToken)],\n 0x98,\n undefined,\n );\n const updatedOptions = await this.initWithUniqueReplyTo(options);\n const request: RheaMessage = {\n body: messageBody,\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.renewLock,\n },\n };\n request.application_properties![Constants.trackingId] = generate_uuid();\n if (updatedOptions.associatedLinkName) {\n request.application_properties![Constants.associatedLinkName] =\n updatedOptions.associatedLinkName;\n }\n receiverLogger.verbose(\n \"[%s] Renew message Lock request: %O.\",\n this._context.connectionId,\n request,\n );\n const result = await this._makeManagementRequest(request, receiverLogger, {\n abortSignal: updatedOptions?.abortSignal,\n requestName: \"renewLock\",\n });\n const lockedUntilUtc = new Date(result.body.expirations[0]);\n return lockedUntilUtc;\n } catch (err: any) {\n const error = translateServiceBusError(err);\n receiverLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the renew lock request to $management endpoint`,\n );\n throw error;\n }\n }\n\n /**\n * Schedules an array of messages to appear on Service Bus at a later time.\n *\n * @param scheduledEnqueueTimeUtc - The UTC time at which the messages should be enqueued.\n * @param messages - An array of messages that needs to be scheduled.\n * @returns The sequence numbers of messages that were scheduled.\n */\n async scheduleMessages(\n scheduledEnqueueTimeUtc: Date,\n messages: ServiceBusMessage[] | AmqpAnnotatedMessage[],\n options?: OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<Long[]> {\n throwErrorIfConnectionClosed(this._context);\n if (!messages.length) {\n return [];\n }\n const messageBody: any[] = [];\n for (let i = 0; i < messages.length; i++) {\n const item = messages[i];\n\n try {\n const rheaMessage = toRheaMessage(item, defaultDataTransformer);\n updateMessageId(rheaMessage, rheaMessage.message_id || generate_uuid());\n updateScheduledTime(rheaMessage, scheduledEnqueueTimeUtc);\n\n const entry: {\n message: Buffer;\n [\"message-id\"]: ServiceBusMessage[\"messageId\"];\n [\"partition-key\"]?: ServiceBusMessage[\"partitionKey\"];\n [Constants.sessionIdMapKey]?: string | undefined;\n } = {\n message: RheaMessageUtil.encode(rheaMessage),\n \"message-id\": rheaMessage.message_id,\n };\n\n if (rheaMessage.group_id) {\n entry[Constants.sessionIdMapKey] = rheaMessage.group_id;\n }\n\n if (rheaMessage.message_annotations?.[Constants.partitionKey]) {\n entry[\"partition-key\"] = rheaMessage.message_annotations[Constants.partitionKey];\n }\n\n // Will be required later for implementing Transactions\n // if (item.viaPartitionKey) {\n // entry[\"via-partition-key\"] = item.viaPartitionKey;\n // }\n\n const wrappedEntry = types.wrap_map(entry);\n messageBody.push(wrappedEntry);\n } catch (err: any) {\n const error = translateServiceBusError(err);\n senderLogger.logError(\n error,\n `${this.logPrefix} An error occurred while encoding the item at position ${i} in the messages array`,\n );\n throw error;\n }\n }\n const updatedOptions = await this.initWithUniqueReplyTo(options);\n try {\n const request: RheaMessage = {\n body: { messages: messageBody },\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.scheduleMessage,\n },\n };\n if (updatedOptions?.associatedLinkName) {\n request.application_properties![Constants.associatedLinkName] =\n updatedOptions?.associatedLinkName;\n }\n request.application_properties![Constants.trackingId] = generate_uuid();\n senderLogger.verbose(\"%s Schedule messages request body: %O.\", this.logPrefix, request.body);\n const result = await this._makeManagementRequest(request, senderLogger, updatedOptions);\n const sequenceNumbers = result.body[Constants.sequenceNumbers];\n const sequenceNumbersAsLong = [];\n for (let i = 0; i < sequenceNumbers.length; i++) {\n if (typeof sequenceNumbers[i] === \"number\") {\n sequenceNumbersAsLong.push(Long.fromNumber(sequenceNumbers[i]));\n } else {\n sequenceNumbersAsLong.push(Long.fromBytesBE(sequenceNumbers[i]));\n }\n }\n return sequenceNumbersAsLong;\n } catch (err: any) {\n const error = translateServiceBusError(err);\n senderLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the request to schedule messages to $management endpoint`,\n );\n throw error;\n }\n }\n\n /**\n * Cancels an array of messages that were scheduled.\n * @param sequenceNumbers - An Array of sequence numbers of the message to be cancelled.\n */\n async cancelScheduledMessages(\n sequenceNumbers: Long[],\n options?: OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<void> {\n throwErrorIfConnectionClosed(this._context);\n if (!sequenceNumbers.length) {\n return;\n }\n const messageBody: any = {};\n messageBody[Constants.sequenceNumbers] = [];\n for (let i = 0; i < sequenceNumbers.length; i++) {\n const sequenceNumber = sequenceNumbers[i];\n try {\n messageBody[Constants.sequenceNumbers].push(Buffer.from(sequenceNumber.toBytesBE()));\n } catch (err: any) {\n const error = translateServiceBusError(err);\n senderLogger.logError(\n error,\n `${this.logPrefix} An error occurred while encoding the item at position ${i} in the sequenceNumbers array`,\n );\n throw error;\n }\n }\n\n try {\n messageBody[Constants.sequenceNumbers] = types.wrap_array(\n messageBody[Constants.sequenceNumbers],\n 0x81,\n undefined,\n );\n const updatedOptions = await this.initWithUniqueReplyTo(options);\n const request: RheaMessage = {\n body: messageBody,\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.cancelScheduledMessage,\n },\n };\n\n if (updatedOptions?.associatedLinkName) {\n request.application_properties![Constants.associatedLinkName] =\n updatedOptions?.associatedLinkName;\n }\n request.application_properties![Constants.trackingId] = generate_uuid();\n senderLogger.verbose(\n \"%s Cancel scheduled messages request body: %O.\",\n this.logPrefix,\n request.body,\n );\n\n await this._makeManagementRequest(request, senderLogger, updatedOptions);\n return;\n } catch (err: any) {\n const error = translateServiceBusError(err);\n senderLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the request to cancel the scheduled message to $management endpoint`,\n );\n throw error;\n }\n }\n\n /**\n * Receives a list of deferred messages identified by `sequenceNumbers`.\n *\n * @param sequenceNumbers - A list containing the sequence numbers to receive.\n * @param receiveMode - The mode in which the receiver was created.\n * @returns a list of messages identified by the given sequenceNumbers or an empty list if no messages are found.\n * - Throws an error if the messages have not been deferred.\n */\n async receiveDeferredMessages(\n sequenceNumbers: Long[],\n receiveMode: ReceiveMode,\n sessionId?: string,\n options?: OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<ServiceBusMessageImpl[]> {\n throwErrorIfConnectionClosed(this._context);\n\n if (!sequenceNumbers.length) {\n return [];\n }\n\n const messageList: ServiceBusMessageImpl[] = [];\n const messageBody: any = {};\n messageBody[Constants.sequenceNumbers] = [];\n for (let i = 0; i < sequenceNumbers.length; i++) {\n const sequenceNumber = sequenceNumbers[i];\n try {\n messageBody[Constants.sequenceNumbers].push(Buffer.from(sequenceNumber.toBytesBE()));\n } catch (err: any) {\n const error = translateServiceBusError(err);\n receiverLogger.logError(\n error,\n `${this.logPrefix} An error occurred while encoding the item at position ${i} in the sequenceNumbers array`,\n );\n throw error;\n }\n }\n\n try {\n messageBody[Constants.sequenceNumbers] = types.wrap_array(\n messageBody[Constants.sequenceNumbers],\n 0x81,\n undefined,\n );\n const receiverSettleMode: number = receiveMode === \"receiveAndDelete\" ? 0 : 1;\n messageBody[Constants.receiverSettleMode] = types.wrap_uint(receiverSettleMode);\n if (sessionId != null) {\n messageBody[Constants.sessionIdMapKey] = sessionId;\n }\n const updatedOptions = await this.initWithUniqueReplyTo(options);\n const request: RheaMessage = {\n body: messageBody,\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.receiveBySequenceNumber,\n },\n };\n if (updatedOptions?.associatedLinkName) {\n request.application_properties![Constants.associatedLinkName] =\n updatedOptions?.associatedLinkName;\n }\n request.application_properties![Constants.trackingId] = generate_uuid();\n receiverLogger.verbose(\n \"%s Receive deferred messages request body: %O.\",\n this.logPrefix,\n request.body,\n );\n\n const result = await this._makeManagementRequest(request, receiverLogger, updatedOptions);\n const messages = result.body.messages as {\n message: Buffer;\n \"lock-token\": Buffer;\n }[];\n for (const msg of messages) {\n const decodedMessage = RheaMessageUtil.decode(msg.message);\n const message = new ServiceBusMessageImpl(\n decodedMessage as any,\n { tag: msg[\"lock-token\"] } as any,\n false,\n receiveMode,\n updatedOptions?.skipParsingBodyAsJson ?? false,\n false,\n );\n messageList.push(message);\n }\n return messageList;\n } catch (err: any) {\n const error = translateServiceBusError(err);\n receiverLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the request to receive deferred messages to $management endpoint`,\n );\n throw error;\n }\n }\n\n private async _deleteMessages(\n messageCount: number,\n enqueueTimeUtcOlderThan: Date,\n sessionId?: string,\n options?: OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<number> {\n try {\n const messageBody: any = {};\n messageBody[Constants.messageCount] = types.wrap_int(messageCount);\n messageBody[Constants.enqueuedTimeUtc] = enqueueTimeUtcOlderThan;\n if (isDefined(sessionId)) {\n messageBody[Constants.sessionIdMapKey] = sessionId;\n }\n\n const updatedOptions = await this.initWithUniqueReplyTo(options);\n const request: RheaMessage = {\n body: messageBody,\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.deleteMessages,\n },\n };\n if (updatedOptions?.associatedLinkName) {\n request.application_properties![Constants.associatedLinkName] =\n updatedOptions?.associatedLinkName;\n }\n request.application_properties![Constants.trackingId] = generate_uuid();\n receiverLogger.verbose(\"%s delete messages request body: %O.\", this.logPrefix, request.body);\n\n const result = await this._makeManagementRequest(request, receiverLogger, updatedOptions);\n if (result.application_properties!.statusCode === 200) {\n return result.body[\"message-count\"];\n } else if (\n result.application_properties!.statusCode === 204 &&\n result.application_properties!.errorCondition === \"com.microsoft:message-not-found\"\n ) {\n return 0;\n } else {\n throw new Error(\n `Unexpected response with status code of ${result.application_properties!.statusCode}`,\n );\n }\n } catch (err: any) {\n const error = translateServiceBusError(err) as MessagingError;\n receiverLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the request to delete messages to $management endpoint`,\n );\n throw error;\n }\n }\n\n /**\n * Delete messages. If no option is specified, all messages will be deleted.\n *\n * @param messageCount - number of messages to delete in a batch.\n * @param enqueueTimeUtcOlderThan - Delete messages whose enqueue time (UTC) are older than this.\n * @returns number of messages deleted.\n */\n async deleteMessages(\n messageCount: number,\n enqueueTimeUtcOlderThan?: Date,\n sessionId?: string,\n options: OperationOptionsBase & SendManagementRequestOptions = {},\n ): Promise<number> {\n throwTypeErrorIfParameterMissing(this._context.connectionId, \"messageCount\", messageCount);\n throwTypeErrorIfParameterTypeMismatch(\n this._context.connectionId,\n \"messageCount\",\n messageCount,\n \"number\",\n );\n\n if (isNaN(messageCount) || messageCount < 1) {\n throw new TypeError(\"'messageCount' must be a number greater than 0.\");\n }\n\n enqueueTimeUtcOlderThan ??= new Date();\n\n return this._deleteMessages(messageCount, enqueueTimeUtcOlderThan, sessionId, options);\n }\n\n /**\n * Updates the disposition status of deferred messages.\n *\n * @param lockTokens - Message lock tokens to update disposition status.\n * @param dispositionStatus - The disposition status to be set\n * @param options - Optional parameters that can be provided while updating the disposition status.\n */\n async updateDispositionStatus(\n lockToken: string,\n dispositionType: DispositionType,\n // TODO: mgmt link retry<> will come in the next PR.\n options?: Omit<DispositionStatusOptions, \"retryOptions\"> & SendManagementRequestOptions,\n ): Promise<void> {\n throwErrorIfConnectionClosed(this._context);\n if (!options) options = {};\n try {\n let dispositionStatus: \"completed\" | \"defered\" | \"suspended\" | \"abandoned\";\n\n if (dispositionType === DispositionType.abandon) dispositionStatus = \"abandoned\";\n else if (dispositionType === DispositionType.complete) dispositionStatus = \"completed\";\n else if (dispositionType === DispositionType.defer) dispositionStatus = \"defered\";\n else if (dispositionType === DispositionType.deadletter) dispositionStatus = \"suspended\";\n else throw new Error(`Provided \"dispositionType\" - ${dispositionType} is invalid`);\n\n const messageBody: any = {};\n const lockTokenBuffer: Buffer[] = [];\n lockTokenBuffer.push(string_to_uuid(lockToken));\n messageBody[Constants.lockTokens] = types.wrap_array(lockTokenBuffer, 0x98, undefined);\n messageBody[Constants.dispositionStatus] = dispositionStatus;\n if (options.deadLetterDescription != null) {\n messageBody[Constants.deadLetterDescription] = options.deadLetterDescription;\n }\n if (options.deadLetterReason != null) {\n messageBody[Constants.deadLetterReason] = options.deadLetterReason;\n }\n if (options.propertiesToModify != null) {\n messageBody[Constants.propertiesToModify] = options.propertiesToModify;\n }\n if (options.sessionId != null) {\n messageBody[Constants.sessionIdMapKey] = options.sessionId;\n }\n const updatedOptions = await this.initWithUniqueReplyTo(options);\n const request: RheaMessage = {\n body: messageBody,\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.updateDisposition,\n },\n };\n if (updatedOptions.associatedLinkName) {\n request.application_properties![Constants.associatedLinkName] =\n updatedOptions.associatedLinkName;\n }\n request.application_properties![Constants.trackingId] = generate_uuid();\n receiverLogger.verbose(\n \"%s Update disposition status request body: %O.\",\n this.logPrefix,\n request.body,\n );\n await this._makeManagementRequest(request, receiverLogger, updatedOptions);\n } catch (err: any) {\n const error = translateServiceBusError(err);\n receiverLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the request to update disposition status to $management endpoint`,\n );\n throw error;\n }\n }\n\n /**\n * Renews the lock for the specified session.\n *\n * @param sessionId - Id of the session for which the lock needs to be renewed\n * @param options - Options that can be set while sending the request.\n * @returns New lock token expiry date and time in UTC format.\n */\n async renewSessionLock(\n sessionId: string,\n options?: OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<Date> {\n throwErrorIfConnectionClosed(this._context);\n try {\n const messageBody: any = {};\n messageBody[Constants.sessionIdMapKey] = sessionId;\n const updatedOptions = await this.initWithUniqueReplyTo(options);\n const request: RheaMessage = {\n body: messageBody,\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.renewSessionLock,\n },\n };\n request.application_properties![Constants.trackingId] = generate_uuid();\n if (updatedOptions?.associatedLinkName) {\n request.application_properties![Constants.associatedLinkName] =\n updatedOptions?.associatedLinkName;\n }\n receiverLogger.verbose(\n \"%s Renew Session Lock request body: %O.\",\n this.logPrefix,\n request.body,\n );\n const result = await this._makeManagementRequest(request, receiverLogger, updatedOptions);\n const lockedUntilUtc = new Date(result.body.expiration);\n receiverLogger.verbose(\n \"%s Lock for session '%s' will expire at %s.\",\n this.logPrefix,\n sessionId,\n lockedUntilUtc.toString(),\n );\n return lockedUntilUtc;\n } catch (err: any) {\n const error = translateServiceBusError(err);\n receiverLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the renew lock request to $management endpoint`,\n );\n throw error;\n }\n }\n\n /**\n * Sets the state of the specified session.\n *\n * @param sessionId - The session for which the state needs to be set\n * @param state - The state that needs to be set.\n */\n async setSessionState(\n sessionId: string,\n state: unknown,\n options?: OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<void> {\n throwErrorIfConnectionClosed(this._context);\n\n try {\n const messageBody: any = {};\n messageBody[Constants.sessionIdMapKey] = sessionId;\n messageBody[\"session-state\"] = toBuffer(state);\n const updatedOptions = await this.initWithUniqueReplyTo(options);\n const request: RheaMessage = {\n body: messageBody,\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.setSessionState,\n },\n };\n if (updatedOptions?.associatedLinkName) {\n request.application_properties![Constants.associatedLinkName] =\n updatedOptions?.associatedLinkName;\n }\n request.application_properties![Constants.trackingId] = generate_uuid();\n receiverLogger.verbose(\n \"%s Set Session state request body: %O.\",\n this.logPrefix,\n request.body,\n );\n await this._makeManagementRequest(request, receiverLogger, updatedOptions);\n } catch (err: any) {\n const error = translateServiceBusError(err);\n receiverLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the renew lock request to $management endpoint`,\n );\n throw error;\n }\n }\n\n /**\n * Gets the state of the specified session.\n *\n * @param sessionId - The session for which the state needs to be retrieved.\n * @returns The state of that session\n */\n async getSessionState(\n sessionId: string,\n options?: OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<any> {\n throwErrorIfConnectionClosed(this._context);\n try {\n const messageBody: any = {};\n messageBody[Constants.sessionIdMapKey] = sessionId;\n const updatedOptions = await this.initWithUniqueReplyTo(options);\n const request: RheaMessage = {\n body: messageBody,\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.getSessionState,\n },\n };\n if (updatedOptions?.associatedLinkName) {\n request.application_properties![Constants.associatedLinkName] =\n updatedOptions?.associatedLinkName;\n }\n request.application_properties![Constants.trackingId] = generate_uuid();\n receiverLogger.verbose(\n \"%s Get session state request body: %O.\",\n this.logPrefix,\n request.body,\n );\n const result = await this._makeManagementRequest(request, receiverLogger, updatedOptions);\n return result.body[\"session-state\"]\n ? tryToJsonDecode(result.body[\"session-state\"])\n : result.body[\"session-state\"];\n } catch (err: any) {\n const error = translateServiceBusError(err);\n receiverLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the renew lock request to $management endpoint`,\n );\n throw error;\n }\n }\n\n /**\n * Lists the sessions on the ServiceBus Queue/Topic.\n * @param lastUpdateTime - Filter to include only sessions updated after a given time.\n * @param skip - The number of sessions to skip\n * @param top - Maximum numer of sessions.\n * @returns A list of session ids.\n */\n async listMessageSessions(\n skip: number,\n top: number,\n lastUpdatedTime?: Date,\n options?: OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<string[]> {\n throwErrorIfConnectionClosed(this._context);\n const defaultLastUpdatedTimeForListingSessions: number = 259200000; // 3 * 24 * 3600 * 1000\n if (typeof skip !== \"number\") {\n throw new Error(\"'skip' is a required parameter and must be of type 'number'.\");\n }\n if (typeof top !== \"number\") {\n throw new Error(\"'top' is a required parameter and must be of type 'number'.\");\n }\n if (lastUpdatedTime && !(lastUpdatedTime instanceof Date)) {\n throw new Error(\"'lastUpdatedTime' must be of type 'Date'.\");\n }\n if (!lastUpdatedTime) {\n lastUpdatedTime = new Date(Date.now() - defaultLastUpdatedTimeForListingSessions);\n }\n try {\n const messageBody: any = {};\n messageBody[\"last-updated-time\"] = lastUpdatedTime;\n messageBody[\"skip\"] = types.wrap_int(skip);\n messageBody[\"top\"] = types.wrap_int(top);\n const updatedOptions = await this.initWithUniqueReplyTo(options);\n const request: RheaMessage = {\n body: messageBody,\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.enumerateSessions,\n },\n };\n request.application_properties![Constants.trackingId] = generate_uuid();\n managementClientLogger.verbose(\n \"%s List sessions request body: %O.\",\n this.logPrefix,\n request.body,\n );\n const response = await this._makeManagementRequest(\n request,\n managementClientLogger,\n updatedOptions,\n );\n\n return (response && response.body && response.body[\"sessions-ids\"]) || [];\n } catch (err: any) {\n const error = translateServiceBusError(err);\n managementClientLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the renew lock request to $management endpoint`,\n );\n throw error;\n }\n }\n\n /**\n * Get all the rules on the Subscription.\n * @returns A list of rules.\n */\n async getRules(\n options?: ListRequestOptions & OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<RuleProperties[]> {\n throwErrorIfConnectionClosed(this._context);\n try {\n const updatedOptions = (await this.initWithUniqueReplyTo(options)) as ListRequestOptions &\n OperationOptionsBase &\n SendManagementRequestOptions;\n const request: RheaMessage = {\n body: {\n top: updatedOptions?.maxCount\n ? types.wrap_int(updatedOptions.maxCount)\n : types.wrap_int(max32BitNumber),\n skip: updatedOptions?.skip ? types.wrap_int(updatedOptions.skip) : types.wrap_int(0),\n },\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.enumerateRules,\n },\n };\n request.application_properties![Constants.trackingId] = generate_uuid();\n\n managementClientLogger.verbose(\n \"%s Get rules request body: %O.\",\n this.logPrefix,\n request.body,\n );\n const response = await this._makeManagementRequest(\n request,\n managementClientLogger,\n updatedOptions,\n );\n if (\n response.application_properties!.statusCode === 204 ||\n !response.body ||\n !Array.isArray(response.body.rules)\n ) {\n return [];\n }\n\n // Reference: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-amqp-request-response#response-11\n const result: { \"rule-description\": Typed }[] = response.body.rules || [];\n const rules: RuleProperties[] = [];\n result.forEach((x) => {\n const ruleDescriptor = x[\"rule-description\"];\n let filter: SqlRuleFilter | CorrelationRuleFilter;\n\n // We use the first three elements of the `ruleDescriptor.value` to get filter, action, name\n if (\n !ruleDescriptor ||\n !ruleDescriptor.descriptor ||\n ruleDescriptor.descriptor.value !== Constants.descriptorCodes.ruleDescriptionList ||\n !Array.isArray(ruleDescriptor.value) ||\n ruleDescriptor.value.length < 3\n ) {\n return;\n }\n\n const filtersRawData: Typed = ruleDescriptor.value[0];\n const actionsRawData: Typed = ruleDescriptor.value[1];\n let sqlRuleAction: SqlRuleAction;\n if (\n actionsRawData.descriptor.value === Constants.descriptorCodes.sqlRuleActionList &&\n Array.isArray(actionsRawData.value) &&\n actionsRawData.value.length\n ) {\n sqlRuleAction = {\n sqlExpression: this._safelyGetTypedValueFromArray(actionsRawData.value, 0),\n };\n } else {\n sqlRuleAction = {};\n }\n\n switch (filtersRawData.descriptor.value) {\n case Constants.descriptorCodes.trueFilterList:\n filter = {\n sqlExpression: \"1=1\",\n };\n break;\n case Constants.descriptorCodes.falseFilterList:\n filter = {\n sqlExpression: \"1=0\",\n };\n break;\n case Constants.descriptorCodes.sqlFilterList:\n filter = {\n sqlExpression: this._safelyGetTypedValueFromArray(filtersRawData.value, 0),\n };\n break;\n case Constants.descriptorCodes.correlationFilterList:\n filter = {\n correlationId: this._safelyGetTypedValueFromArray(filtersRawData.value, 0),\n messageId: this._safelyGetTypedValueFromArray(filtersRawData.value, 1),\n to: this._safelyGetTypedValueFromArray(filtersRawData.value, 2),\n replyTo: this._safelyGetTypedValueFromArray(filtersRawData.value, 3),\n subject: this._safelyGetTypedValueFromArray(filtersRawData.value, 4),\n sessionId: this._safelyGetTypedValueFromArray(filtersRawData.value, 5),\n replyToSessionId: this._safelyGetTypedValueFromArray(filtersRawData.value, 6),\n contentType: this._safelyGetTypedValueFromArray(filtersRawData.value, 7),\n applicationProperties:\n Array.isArray(filtersRawData.value) &&\n filtersRawData.value.length > 8 &&\n filtersRawData.value[8]\n ? this._decodeApplicationPropertiesMap(filtersRawData.value[8])\n : undefined,\n };\n break;\n default:\n throw new Error(\n `${this.logPrefix} Found unexpected descriptor code for the filter: ${filtersRawData.descriptor.value}`,\n );\n }\n\n const rule: RuleProperties = {\n name: ruleDescriptor.value[2].value,\n filter,\n action: sqlRuleAction,\n };\n rules.push(rule);\n });\n\n return rules;\n } catch (err: any) {\n const error = translateServiceBusError(err);\n managementClientLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the get rules request to $management endpoint`,\n );\n throw error;\n }\n }\n\n /**\n * Removes the rule on the Subscription identified by the given rule name.\n */\n async removeRule(\n ruleName: string,\n options?: OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<void> {\n throwErrorIfConnectionClosed(this._context);\n throwTypeErrorIfParameterMissing(this._context.connectionId, \"ruleName\", ruleName);\n ruleName = String(ruleName);\n throwTypeErrorIfParameterIsEmptyString(this._context.connectionId, \"ruleName\", ruleName);\n\n try {\n const updatedOptions = await this.initWithUniqueReplyTo(options);\n const request: RheaMessage = {\n body: {\n \"rule-name\": types.wrap_string(ruleName),\n },\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.removeRule,\n },\n };\n request.application_properties![Constants.trackingId] = generate_uuid();\n\n managementClientLogger.verbose(\n \"%s Remove Rule request body: %O.\",\n this.logPrefix,\n request.body,\n );\n await this._makeManagementRequest(request, managementClientLogger, updatedOptions);\n } catch (err: any) {\n const error = translateServiceBusError(err);\n managementClientLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the remove rule request to $management endpoint`,\n );\n throw error;\n }\n }\n\n /**\n * Adds a rule on the subscription as defined by the given rule name, filter and action\n * @param ruleName - Name of the rule\n * @param filter - A Boolean, SQL expression or a Correlation filter\n * @param sqlRuleActionExpression - Action to perform if the message satisfies the filtering expression\n */\n async addRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n sqlRuleActionExpression?: string,\n options?: OperationOptionsBase & SendManagementRequestOptions,\n ): Promise<void> {\n throwErrorIfConnectionClosed(this._context);\n\n throwTypeErrorIfParameterMissing(this._context.connectionId, \"ruleName\", ruleName);\n ruleName = String(ruleName);\n throwTypeErrorIfParameterIsEmptyString(this._context.connectionId, \"ruleName\", ruleName);\n\n throwTypeErrorIfParameterMissing(this._context.connectionId, \"filter\", filter);\n if (!isSqlRuleFilter(filter) && !isCorrelationRuleFilter(filter)) {\n throw new TypeError(\n `The parameter \"filter\" should implement either the SqlRuleFilter or the CorrelationRuleFilter interface.`,\n );\n }\n\n try {\n const ruleDescription: any = {};\n if (isSqlRuleFilter(filter)) {\n ruleDescription[\"sql-filter\"] = {\n expression: filter.sqlExpression,\n };\n } else {\n ruleDescription[\"correlation-filter\"] = {\n \"correlation-id\": filter.correlationId,\n \"message-id\": filter.messageId,\n to: filter.to,\n \"reply-to\": filter.replyTo,\n label: filter.subject,\n \"session-id\": filter.sessionId,\n \"reply-to-session-id\": filter.replyToSessionId,\n \"content-type\": filter.contentType,\n properties: filter.applicationProperties,\n };\n }\n\n if (sqlRuleActionExpression !== undefined) {\n ruleDescription[\"sql-rule-action\"] = {\n expression: String(sqlRuleActionExpression),\n };\n }\n const updatedOptions = await this.initWithUniqueReplyTo(options);\n const request: RheaMessage = {\n body: {\n \"rule-name\": types.wrap_string(ruleName),\n \"rule-description\": types.wrap_map(ruleDescription),\n },\n reply_to: this.replyTo,\n application_properties: {\n operation: Constants.operations.addRule,\n },\n };\n request.application_properties![Constants.trackingId] = generate_uuid();\n\n managementClientLogger.verbose(\"%s Add Rule request body: %O.\", this.logPrefix, request.body);\n await this._makeManagementRequest(request, managementClientLogger, updatedOptions);\n } catch (err: any) {\n const error = translateServiceBusError(err);\n managementClientLogger.logError(\n error,\n `${this.logPrefix} An error occurred while sending the Add rule request to $management endpoint`,\n );\n throw error;\n }\n }\n\n protected removeLinkFromContext(): void {\n delete this._context.managementClients[this.name];\n }\n}\n\n/**\n * Converts an AmqpAnnotatedMessage or ServiceBusMessage into a properly formatted\n * message for sending to the mgmt link for scheduling.\n *\n * @internal\n * @hidden\n */\nexport function toScheduleableMessage(\n item: ServiceBusMessage | AmqpAnnotatedMessage,\n scheduledEnqueueTimeUtc: Date,\n): Record<string, unknown> {\n const rheaMessage = toRheaMessage(item, defaultDataTransformer);\n updateMessageId(rheaMessage, rheaMessage.message_id || generate_uuid());\n updateScheduledTime(rheaMessage, scheduledEnqueueTimeUtc);\n\n const entry: Record<string, unknown> = {\n message: RheaMessageUtil.encode(rheaMessage),\n \"message-id\": rheaMessage.message_id,\n };\n\n rheaMessage.message_annotations = {\n ...rheaMessage.message_annotations,\n [Constants.scheduledEnqueueTime]: scheduledEnqueueTimeUtc,\n };\n\n if (rheaMessage.group_id) {\n entry[Constants.sessionIdMapKey] = rheaMessage.group_id;\n }\n\n const partitionKey =\n rheaMessage.message_annotations && rheaMessage.message_annotations[Constants.partitionKey];\n\n if (partitionKey) {\n entry[\"partition-key\"] = partitionKey;\n }\n return entry;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as os from \"os\";\n\n/**\n * Returns information about the platform this function is being run on.\n * @hidden\n * @internal\n */\nexport function getRuntimeInfo(): string {\n const runtimeInfo = {\n key: \"Node\",\n value: process.version,\n };\n\n const osInfo = {\n key: \"OS\",\n value: `(${os.arch()}-${os.type()}-${os.release()})`,\n };\n\n return `${runtimeInfo.key}/${runtimeInfo.value} ${osInfo.key}/${osInfo.value}`;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { connectionLogger as logger } from \"./log\";\nimport { packageJsonInfo } from \"./util/constants\";\nimport {\n ConnectionConfig,\n ConnectionContextBase,\n CreateConnectionContextBaseParameters,\n SasTokenProvider,\n} from \"@azure/core-amqp\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { ServiceBusClientOptions } from \"./constructorHelpers\";\nimport {\n AmqpError,\n Connection,\n ConnectionError,\n ConnectionEvents,\n EventContext,\n OnAmqpEvent,\n} from \"rhea-promise\";\nimport { MessageSender } from \"./core/messageSender\";\nimport { MessageSession } from \"./session/messageSession\";\nimport { MessageReceiver } from \"./core/messageReceiver\";\nimport { ManagementClient } from \"./core/managementClient\";\nimport { formatUserAgentPrefix } from \"./util/utils\";\nimport { getRuntimeInfo } from \"./util/runtimeInfo\";\nimport { NonSessionReceiverType, ReceiverType } from \"./core/linkEntity\";\nimport { ServiceBusError } from \"./serviceBusError\";\n\n/**\n * @internal\n * Provides contextual information like the underlying amqp connection, cbs session, management session,\n * tokenCredential, senders, receivers, etc. about the ServiceBus client.\n */\nexport interface ConnectionContext extends ConnectionContextBase {\n /**\n * The credential to be used for Authentication.\n * Default value: SasTokenProvider.\n */\n tokenCredential: SasTokenProvider | TokenCredential;\n /**\n * A map of active Service Bus Senders with sender name as key.\n */\n senders: { [name: string]: MessageSender };\n /**\n * A map of active Service Bus receivers for non session enabled queues/subscriptions\n * with receiver name as key.\n */\n messageReceivers: { [name: string]: MessageReceiver };\n /**\n * A map of active Service Bus receivers for session enabled queues/subscriptions\n * with receiver name as key.\n */\n messageSessions: { [name: string]: MessageSession };\n /**\n * A map of ManagementClient instances for operations over the $management link\n * with key as the entity path.\n */\n managementClients: { [name: string]: ManagementClient };\n /**\n * Function returning a promise that resolves once the connectionContext is ready to open an AMQP link.\n * ConnectionContext will be ready to open an AMQP link when:\n * - The AMQP connection is already open on both sides.\n * - The AMQP connection has been closed or disconnected. In this case, a new AMQP connection is expected\n * to be created first.\n * An AMQP link cannot be opened if the AMQP connection\n * is in the process of closing or disconnecting.\n */\n readyToOpenLink(): Promise<void>;\n /**\n * Fetches the receiver from the cache in ConnectionContext based on the receiverName given.\n * Useful for when a message needs to be settled or have its lock renewed.\n *\n * TODO: Track the right receiver on the message instead of the ConnectionContext to remove\n * the need for this helper.\n */\n getReceiverFromCache(\n receiverName: string,\n sessionId?: string,\n ): MessageReceiver | MessageSession | undefined;\n /**\n * Gets the management client for given entity path from the cache\n * Creates one if none exists in the cache\n */\n getManagementClient(entityPath: string): ManagementClient;\n /**\n * Indicates whether the connection is in the process of closing.\n * When this returns `true`, a `disconnected` event will be received\n * after the connection is closed.\n */\n isConnectionClosing(): boolean;\n}\n\n/**\n * Describes the members on the ConnectionContext that are only\n * used by it internally.\n * @hidden\n * @internal\n */\nexport interface ConnectionContextInternalMembers extends ConnectionContext {\n /**\n * Resolves once the context's connection emits a `disconnected` event.\n */\n waitForDisconnectedEvent(): Promise<void>;\n /**\n * Resolves once the connection has finished being reset.\n * Connections are reset as part of reacting to a `disconnected` event.\n */\n waitForConnectionReset(): Promise<void>;\n}\n\n/**\n * @internal\n * Helper type to get the names of all the functions on an object.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T];\n/**\n * @internal\n * Helper type to get the types of all the functions on an object.\n */\ntype FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>;\n/**\n * @internal\n * Helper type to get the types of all the functions on ConnectionContext\n * and the internal methods from ConnectionContextInternalMembers.\n * Note that this excludes the functions that ConnectionContext inherits.\n * Each function also has its `this` type set as `ConnectionContext`.\n */\ntype ConnectionContextMethods = Omit<\n FunctionProperties<ConnectionContextInternalMembers>,\n FunctionPropertyNames<ConnectionContextBase>\n> &\n ThisType<ConnectionContextInternalMembers>;\n\n/**\n * @internal\n * Helper method to call onDetached on the non-sessions batching and streaming receivers from the connection context upon seeing an error.\n */\nasync function callOnDetachedOnReceivers(\n connectionContext: ConnectionContext,\n contextOrConnectionError: Error | ConnectionError | AmqpError | undefined,\n receiverType: NonSessionReceiverType,\n): Promise<void[]> {\n const detachCalls: Promise<void>[] = [];\n\n // Iterating over non-sessions batching and streaming receivers\n for (const receiverName of Object.keys(connectionContext.messageReceivers)) {\n const receiver = connectionContext.messageReceivers[receiverName];\n if (receiver && receiver.receiverType === receiverType) {\n logger.verbose(\n \"[%s] calling detached on %s receiver '%s'.\",\n connectionContext.connection.id,\n receiver.receiverType,\n receiver.name,\n );\n detachCalls.push(\n receiver.onDetached(contextOrConnectionError).catch((err) => {\n logger.logError(\n err,\n \"[%s] An error occurred while calling onDetached() on the %s receiver '%s'\",\n connectionContext.connection.id,\n receiver.receiverType,\n receiver.name,\n );\n }),\n );\n }\n }\n return Promise.all(detachCalls);\n}\n\n/**\n * @internal\n * Helper method to call onDetached on the session receivers from the connection context upon seeing an error.\n */\nasync function callOnDetachedOnSessionReceivers(\n connectionContext: ConnectionContext,\n contextOrConnectionError: Error | ConnectionError | AmqpError | undefined,\n): Promise<void[]> {\n const getSessionError = (sessionId: string, entityPath: string): ServiceBusError => {\n const sessionInfo =\n `The receiver for session \"${sessionId}\" in \"${entityPath}\" has been closed and can no longer be used. ` +\n `Please create a new receiver using the \"acceptSession\" or \"acceptNextSession\" method on the ServiceBusClient.`;\n\n const errorMessage =\n contextOrConnectionError == null\n ? `Unknown error occurred on the AMQP connection while receiving messages. ` + sessionInfo\n : `Error occurred on the AMQP connection while receiving messages. ` +\n sessionInfo +\n `\\nMore info - \\n${contextOrConnectionError}`;\n\n const error = new ServiceBusError(errorMessage, \"SessionLockLost\");\n error.retryable = false;\n return error;\n };\n\n const detachCalls: Promise<void>[] = [];\n\n for (const receiverName of Object.keys(connectionContext.messageSessions)) {\n const receiver = connectionContext.messageSessions[receiverName];\n logger.verbose(\n \"[%s] calling detached on %s receiver(sessions).\",\n connectionContext.connection.id,\n receiver.name,\n );\n detachCalls.push(\n receiver.onDetached(getSessionError(receiver.sessionId, receiver.entityPath)).catch((err) => {\n logger.logError(\n err,\n \"[%s] An error occurred while calling onDetached() on the session receiver(sessions) '%s'\",\n connectionContext.connection.id,\n receiver.name,\n );\n }),\n );\n }\n\n return Promise.all(detachCalls);\n}\n\n/**\n * @internal\n * Helper method to get the number of receivers of specified type from the connectionContext.\n */\nfunction getNumberOfReceivers(\n connectionContext: Pick<ConnectionContext, \"messageReceivers\" | \"messageSessions\">,\n receiverType: ReceiverType,\n): number {\n if (receiverType === \"session\") {\n const receivers = connectionContext.messageSessions;\n return Object.keys(receivers).length;\n }\n const receivers = connectionContext.messageReceivers;\n const receiverNames = Object.keys(receivers);\n const count = receiverNames.reduce(\n (acc, name) => (receivers[name].receiverType === receiverType ? ++acc : acc),\n 0,\n );\n return count;\n}\n\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace ConnectionContext {\n export function create(\n config: ConnectionConfig,\n tokenCredential: SasTokenProvider | TokenCredential,\n options?: ServiceBusClientOptions,\n ): ConnectionContext {\n if (!options) options = {};\n const userAgent = `${formatUserAgentPrefix(\n options.userAgentOptions?.userAgentPrefix,\n )} ${getRuntimeInfo()}`;\n const parameters: CreateConnectionContextBaseParameters = {\n config: config,\n // re-enabling this will be a post-GA discussion similar to event-hubs.\n // dataTransformer: options.dataTransformer,\n isEntityPathRequired: false,\n connectionProperties: {\n product: \"MSJSClient\",\n userAgent,\n version: packageJsonInfo.version,\n },\n };\n // Let us create the base context and then add ServiceBus specific ConnectionContext properties.\n const connectionContext = ConnectionContextBase.create(parameters) as ConnectionContext;\n connectionContext.tokenCredential = tokenCredential;\n connectionContext.senders = {};\n connectionContext.messageReceivers = {};\n connectionContext.messageSessions = {};\n connectionContext.managementClients = {};\n\n let waitForConnectionRefreshResolve: () => void;\n let waitForConnectionRefreshPromise: Promise<void> | undefined;\n Object.assign<ConnectionContext, ConnectionContextMethods>(connectionContext, {\n isConnectionClosing() {\n // When the connection is not open, but the remote end is open,\n // then the rhea connection is in the process of terminating.\n return Boolean(!this.connection.isOpen() && this.connection.isRemoteOpen());\n },\n async readyToOpenLink() {\n logger.verbose(\n `[${this.connectionId}] Waiting until the connection is ready to open link.`,\n );\n // Check that the connection isn't in the process of closing.\n // This can happen when the idle timeout has been reached but\n // the underlying socket is waiting to be destroyed.\n if (this.isConnectionClosing()) {\n logger.verbose(\n `[${this.connectionId}] Connection is closing, waiting for disconnected event`,\n );\n // Wait for the disconnected event that indicates the underlying socket has closed.\n await this.waitForDisconnectedEvent();\n }\n\n // Wait for the connection to be reset.\n await this.waitForConnectionReset();\n logger.verbose(`[${this.connectionId}] Connection is ready to open link.`);\n },\n waitForDisconnectedEvent() {\n return new Promise((resolve) => {\n logger.verbose(\n `[${this.connectionId}] Attempting to reinitialize connection` +\n ` but the connection is in the process of closing.` +\n ` Waiting for the disconnect event before continuing.`,\n );\n this.connection.once(ConnectionEvents.disconnected, resolve);\n });\n },\n waitForConnectionReset() {\n // Check if the connection is currently in the process of disconnecting.\n if (waitForConnectionRefreshPromise) {\n logger.verbose(`[${this.connectionId}] Waiting for connection reset`);\n return waitForConnectionRefreshPromise;\n }\n\n logger.verbose(\n `[${this.connectionId}] Connection not waiting to be reset. Resolving immediately.`,\n );\n return Promise.resolve();\n },\n getReceiverFromCache(\n receiverName: string,\n sessionId?: string,\n ): MessageReceiver | MessageSession | undefined {\n if (sessionId != null && this.messageSessions[receiverName]) {\n return this.messageSessions[receiverName];\n }\n\n if (this.messageReceivers[receiverName]) {\n return this.messageReceivers[receiverName];\n }\n\n let existingReceivers = \"\";\n if (sessionId != null) {\n for (const messageSessionName of Object.keys(this.messageSessions)) {\n if (this.messageSessions[messageSessionName].sessionId === sessionId) {\n existingReceivers = this.messageSessions[messageSessionName].name;\n break;\n }\n }\n } else {\n existingReceivers +=\n (existingReceivers ? \", \" : \"\") + Object.keys(this.messageReceivers).join(\",\");\n }\n\n logger.verbose(\n \"[%s] Failed to find receiver '%s' among existing receivers: %s\",\n this.connectionId,\n receiverName,\n existingReceivers,\n );\n return;\n },\n getManagementClient(entityPath: string): ManagementClient {\n if (!this.managementClients[entityPath]) {\n this.managementClients[entityPath] = new ManagementClient(this, entityPath, {\n address: `${entityPath}/$management`,\n });\n }\n return this.managementClients[entityPath];\n },\n });\n\n // Define listeners to be added to the connection object for\n // \"connection_open\" and \"connection_error\" events.\n const onConnectionOpen: OnAmqpEvent = () => {\n connectionContext.wasConnectionCloseCalled = false;\n logger.verbose(\n \"[%s] setting 'wasConnectionCloseCalled' property of connection context to %s.\",\n connectionContext.connection.id,\n connectionContext.wasConnectionCloseCalled,\n );\n };\n\n const disconnected: OnAmqpEvent = async (context: EventContext) => {\n if (waitForConnectionRefreshPromise) {\n return;\n }\n\n waitForConnectionRefreshPromise = new Promise((resolve) => {\n waitForConnectionRefreshResolve = resolve;\n });\n\n const connectionError =\n context.connection && context.connection.error ? context.connection.error : undefined;\n if (connectionError) {\n logger.logError(\n connectionError,\n \"[%s] Error (context.connection.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n const contextError = context.error;\n if (contextError) {\n logger.logError(\n contextError,\n \"[%s] Error (context.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n const state: Readonly<{\n wasConnectionCloseCalled: boolean;\n numSenders: number;\n numReceivers: number;\n }> = {\n wasConnectionCloseCalled: connectionContext.wasConnectionCloseCalled,\n numSenders: Object.keys(connectionContext.senders).length,\n numReceivers:\n Object.keys(connectionContext.messageReceivers).length +\n Object.keys(connectionContext.messageSessions).length,\n };\n\n // Clear internal map maintained by rhea to avoid reconnecting of old links once the\n // connection is back up.\n connectionContext.connection.removeAllSessions();\n\n // Close the cbs session to ensure all the event handlers are released.\n await connectionContext.cbsSession.close();\n\n // Close the management sessions to ensure all the event handlers are released.\n for (const entityPath of Object.keys(connectionContext.managementClients)) {\n await connectionContext.managementClients[entityPath].close();\n }\n\n if (state.wasConnectionCloseCalled) {\n // Do Nothing\n } else {\n // Calling onDetached on sender\n if (state.numSenders) {\n // We don't do recovery for the sender:\n // Because we don't want to keep the sender active all the time\n // and the \"next\" send call would bear the burden of creating the link.\n // Call onDetached() on sender so that it can gracefully shutdown\n // by cleaning up the timers and closing the links.\n // We don't call onDetached for sender after `refreshConnection()`\n // because any new send calls that potentially initialize links would also get affected if called later.\n logger.verbose(\n `[${connectionContext.connection.id}] connection.close() was not called from the sdk and there were ${state.numSenders} ` +\n `senders. We should not reconnect.`,\n );\n const detachCalls: Promise<void>[] = [];\n for (const senderName of Object.keys(connectionContext.senders)) {\n const sender = connectionContext.senders[senderName];\n if (sender) {\n logger.verbose(\n \"[%s] calling detached on sender '%s'.\",\n connectionContext.connection.id,\n sender.name,\n );\n detachCalls.push(\n sender.onDetached().catch((err) => {\n logger.logError(\n err,\n \"[%s] An error occurred while calling onDetached() the sender '%s'\",\n connectionContext.connection.id,\n sender.name,\n );\n }),\n );\n }\n }\n await Promise.all(detachCalls);\n }\n\n // Calling onDetached on batching receivers for the same reasons as sender\n const numBatchingReceivers = getNumberOfReceivers(connectionContext, \"batching\");\n if (numBatchingReceivers) {\n logger.verbose(\n `[${connectionContext.connection.id}] connection.close() was not called from the sdk and there were ${numBatchingReceivers} ` +\n `batching receivers. We should not reconnect.`,\n );\n\n // Call onDetached() on receivers so that batching receivers it can gracefully close any ongoing batch operation\n await callOnDetachedOnReceivers(\n connectionContext,\n connectionError || contextError,\n \"batching\",\n );\n }\n\n // Calling onDetached on session receivers\n const numSessionReceivers = getNumberOfReceivers(connectionContext, \"session\");\n if (numSessionReceivers) {\n logger.verbose(\n `[${connectionContext.connection.id}] connection.close() was not called from the sdk and there were ${numSessionReceivers} ` +\n `session receivers. We should close them.`,\n );\n\n await callOnDetachedOnSessionReceivers(\n connectionContext,\n connectionError || contextError,\n );\n }\n }\n await refreshConnection();\n waitForConnectionRefreshResolve();\n waitForConnectionRefreshPromise = undefined;\n // The connection should always be brought back up if the sdk did not call connection.close()\n // and there was at least one receiver link on the connection before it went down.\n logger.verbose(\"[%s] state: %O\", connectionContext.connectionId, state);\n\n // Calling onDetached on streaming receivers\n const numStreamingReceivers = getNumberOfReceivers(connectionContext, \"streaming\");\n if (!state.wasConnectionCloseCalled && numStreamingReceivers) {\n logger.verbose(\n `[${connectionContext.connection.id}] connection.close() was not called from the sdk and there were ${numStreamingReceivers} ` +\n `streaming receivers. We should reconnect.`,\n );\n\n // Calling `onDetached()` on streaming receivers after the refreshConnection() since `onDetached()` would\n // recover the streaming receivers and that would only be possible after the connection is refreshed.\n //\n // This is different from the batching receiver since `onDetached()` for the batching receiver would\n // return the outstanding messages and close the receive link.\n await callOnDetachedOnReceivers(\n connectionContext,\n connectionError || contextError,\n \"streaming\",\n );\n }\n };\n\n const protocolError: OnAmqpEvent = async (context: EventContext) => {\n if (context.connection && context.connection.error) {\n logger.logError(\n context.connection.error,\n \"[%s] Error (context.connection.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n if (context.error) {\n logger.logError(\n context.error,\n \"[%s] Error (context.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n };\n\n const error: OnAmqpEvent = async (context: EventContext) => {\n if (context.connection && context.connection.error) {\n logger.logError(\n context.connection.error,\n \"[%s] Error (context.connection.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n if (context.error) {\n logger.logError(\n context.error,\n \"[%s] Error (context.error) occurred on the amqp connection\",\n connectionContext.connection.id,\n );\n }\n };\n\n async function refreshConnection(): Promise<void> {\n const originalConnectionId = connectionContext.connectionId;\n try {\n await cleanConnectionContext();\n } catch (err: any) {\n logger.logError(\n err,\n `[${connectionContext.connectionId}] There was an error closing the connection before reconnecting`,\n );\n }\n // Create a new connection, id, locks, and cbs client.\n connectionContext.refreshConnection();\n addConnectionListeners(connectionContext.connection);\n logger.verbose(\n `The connection \"${originalConnectionId}\" has been updated to \"${connectionContext.connectionId}\".`,\n );\n }\n\n function addConnectionListeners(connection: Connection): void {\n // Add listeners on the connection object.\n connection.on(ConnectionEvents.connectionOpen, onConnectionOpen);\n connection.on(ConnectionEvents.disconnected, disconnected);\n connection.on(ConnectionEvents.protocolError, protocolError);\n connection.on(ConnectionEvents.error, error);\n }\n\n async function cleanConnectionContext(): Promise<void> {\n // Remove listeners from the connection object.\n connectionContext.connection.removeListener(\n ConnectionEvents.connectionOpen,\n onConnectionOpen,\n );\n connectionContext.connection.removeListener(ConnectionEvents.disconnected, disconnected);\n connectionContext.connection.removeListener(ConnectionEvents.protocolError, protocolError);\n connectionContext.connection.removeListener(ConnectionEvents.error, error);\n // Close the connection\n await connectionContext.connection.close();\n }\n\n addConnectionListeners(connectionContext.connection);\n\n logger.verbose(\"[%s] Created connection context successfully.\", connectionContext.connectionId);\n\n return connectionContext;\n }\n\n /**\n * Closes the AMQP connection created by this ServiceBusClient along with AMQP links for\n * sender/receivers created by the queue/topic/subscription clients created by this\n * ServiceBusClient.\n * Once closed,\n * - the clients created by this ServiceBusClient cannot be used to send/receive messages anymore.\n * - this ServiceBusClient cannot be used to create any new queues/topics/subscriptions clients.\n */\n export async function close(context: ConnectionContext): Promise<void> {\n const logPrefix = `[${context.connectionId}]`;\n\n try {\n logger.verbose(`${logPrefix} Permanently closing the amqp connection on the client.`);\n\n const senderNames = Object.keys(context.senders);\n const messageReceiverNames = Object.keys(context.messageReceivers);\n const messageSessionNames = Object.keys(context.messageSessions);\n const managementClientsEntityPaths = Object.keys(context.managementClients);\n logger.verbose(\n `${logPrefix} Permanently closing all the senders(${senderNames.length}), MessageReceivers(${messageReceiverNames.length}), MessageSessions(${messageSessionNames.length}), and ManagementClients(${managementClientsEntityPaths.length}).`,\n );\n await Promise.all([\n ...senderNames.map((n) => context.senders[n].close()),\n ...messageReceiverNames.map((n) => context.messageReceivers[n].close()),\n ...messageSessionNames.map((n) => context.messageSessions[n].close()),\n ...managementClientsEntityPaths.map((p) => context.managementClients[p].close()),\n ]);\n\n logger.verbose(`${logPrefix} Permanently closing cbsSession`);\n await context.cbsSession.close();\n\n logger.verbose(`${logPrefix} Permanently closing internal connection`);\n await context.connection.close();\n context.wasConnectionCloseCalled = true;\n logger.verbose(`[${logPrefix} Permanently closed the amqp connection on the client.`);\n } catch (err: any) {\n const errObj = err instanceof Error ? err : new Error(JSON.stringify(err));\n logger.logError(err, `${logPrefix} An error occurred while closing the connection`);\n throw errObj;\n }\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { parseConnectionString } from \"@azure/core-amqp\";\n\n/**\n * The set of properties that comprise a Service Bus connection string.\n */\nexport interface ServiceBusConnectionStringProperties {\n /**\n * The fully qualified Service Bus namespace extracted from the \"Endpoint\" in the\n * connection string. This is likely to be similar to `{yournamespace}.servicebus.windows.net`.\n * This is typically used to construct the ServiceBusClient.\n */\n fullyQualifiedNamespace: string;\n /**\n * The value for \"Endpoint\" in the connection string.\n */\n endpoint: string;\n /**\n * The value for \"EntityPath\" in the connection string which would be the name of the queue or\n * topic associated with the connection string.\n * Connection string from a Shared Access Policy created at the namespace level\n * will not have the EntityPath in it.\n */\n entityPath?: string;\n /**\n * The value for \"SharedAccessKey\" in the connection string. This along with the \"SharedAccessKeyName\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKey?: string;\n /**\n * The value for \"SharedAccessKeyName\" in the connection string. This along with the \"SharedAccessKey\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKeyName?: string;\n /**\n * The value for \"SharedAccessSignature\" in the connection string. This is typically not present in the\n * connection string generated for a Shared Access Policy. It is instead generated by the\n * user and appended to the connection string for ease of use.\n */\n sharedAccessSignature?: string;\n}\n\n/**\n * Parses given connection string into the different properties applicable to Azure Service Bus.\n * The properties are useful to then construct a ServiceBusClient.\n * @param connectionString - The connection string associated with the Shared Access Policy created\n * for the Service Bus namespace, queue or topic.\n */\nexport function parseServiceBusConnectionString(\n connectionString: string,\n): ServiceBusConnectionStringProperties {\n const parsedResult = parseConnectionString<{\n Endpoint: string;\n EntityPath?: string;\n SharedAccessSignature?: string;\n SharedAccessKey?: string;\n SharedAccessKeyName?: string;\n }>(connectionString);\n if (!parsedResult.Endpoint) {\n throw new Error(\"Connection string should have an Endpoint key.\");\n }\n\n if (parsedResult.SharedAccessSignature) {\n if (parsedResult.SharedAccessKey || parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string cannot have both SharedAccessSignature and SharedAccessKey keys.\",\n );\n }\n } else if (parsedResult.SharedAccessKey && !parsedResult.SharedAccessKeyName) {\n throw new Error(\"Connection string with SharedAccessKey should have SharedAccessKeyName.\");\n } else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string with SharedAccessKeyName should have SharedAccessKey as well.\",\n );\n }\n\n const output: ServiceBusConnectionStringProperties = {\n fullyQualifiedNamespace: (parsedResult.Endpoint.match(\".*://([^/]*)\") || [])[1],\n endpoint: parsedResult.Endpoint,\n };\n if (parsedResult.EntityPath) {\n output.entityPath = parsedResult.EntityPath;\n }\n if (parsedResult.SharedAccessSignature) {\n output.sharedAccessSignature = parsedResult.SharedAccessSignature;\n }\n if (parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n output.sharedAccessKey = parsedResult.SharedAccessKey;\n output.sharedAccessKeyName = parsedResult.SharedAccessKeyName;\n }\n return output;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n ConnectionConfig,\n createSasTokenProvider,\n RetryOptions,\n SasTokenProvider,\n WebSocketOptions,\n} from \"@azure/core-amqp\";\nimport {\n isNamedKeyCredential,\n isSASCredential,\n NamedKeyCredential,\n SASCredential,\n TokenCredential,\n} from \"@azure/core-auth\";\nimport { ConnectionContext } from \"./connectionContext\";\nimport { UserAgentPolicyOptions } from \"@azure/core-rest-pipeline\";\nimport {\n parseServiceBusConnectionString,\n ServiceBusConnectionStringProperties,\n} from \"./util/connectionStringUtils\";\n\n/**\n * Describes the options that can be provided while creating the ServiceBusClient.\n *\n * - `webSocketOptions` : Options to configure the channelling of the AMQP connection over Web Sockets.\n * - `websocket` : The WebSocket constructor used to create an AMQP connection if you choose to make the connection\n * over a WebSocket.\n * - `webSocketConstructorOptions` : Options to pass to the Websocket constructor when you choose to make the connection\n * over a WebSocket.\n * - `retryOptions` : The retry options for all the operations on the client.\n * - `maxRetries` : The number of times the operation can be retried in case of a retryable error.\n * - `maxRetryDelayInMs`: The maximum delay between retries. Applicable only when performing exponential retries.\n * - `mode`: Which retry mode to apply, specified by the `RetryMode` enum. Options are `Exponential` and `Fixed`. Defaults to `Fixed`.\n * - `retryDelayInMs`: Amount of time to wait in milliseconds before making the next attempt. When `mode` is set to `Exponential`,\n * this is used to compute the exponentially increasing delays between retries. Default: 30000 milliseconds.\n * - `timeoutInMs`: Amount of time in milliseconds to wait before the operation times out. This will trigger a retry if there are any\n * retry attempts remaining. Minimum value: 60000 milliseconds.\n */\nexport interface ServiceBusClientOptions {\n /**\n * ID to identify this client. This can be used to correlate logs and exceptions.\n */\n identifier?: string;\n /**\n * A custom endpoint to use when connecting to the Service Bus service.\n * This can be useful when your network does not allow connecting to the\n * standard Azure Service Bus endpoint address, but does allow connecting\n * through an intermediary.\n *\n * Example: \"https://my.custom.endpoint:100/\"\n */\n customEndpointAddress?: string;\n /**\n * Retry policy options that determine the mode, number of retries, retry interval etc.\n */\n retryOptions?: RetryOptions;\n /**\n * Options to configure the channelling of the AMQP connection over Web Sockets.\n */\n webSocketOptions?: WebSocketOptions;\n /**\n * Options for adding user agent details to outgoing requests.\n */\n userAgentOptions?: UserAgentPolicyOptions;\n}\n\n// TODO: extract parseEndpoint and setCustomEndpointAddress into core-amqp\n// ConnectionConfig so that it can be shared between Event Hubs and Service Bus\n/**\n * Parses the host, hostname, and port from an endpoint.\n * @param endpoint - And endpoint to parse.\n * @internal\n */\nexport function parseEndpoint(endpoint: string): { host: string; hostname: string; port?: string } {\n const hostMatch = endpoint.match(/.*:\\/\\/([^/]*)/);\n if (!hostMatch) {\n throw new TypeError(`Invalid endpoint missing host: ${endpoint}`);\n }\n\n const [, host] = hostMatch;\n const [hostname, port] = host.split(\":\");\n\n return { host, hostname, port };\n}\n/**\n * Updates the provided ConnectionConfig to use the custom endpoint address.\n * @param config - An existing connection configuration to be updated.\n * @param customEndpointAddress - The custom endpoint address to use.\n */\nfunction setCustomEndpointAddress(config: ConnectionConfig, customEndpointAddress: string): void {\n // The amqpHostname should match the host prior to using the custom endpoint.\n config.amqpHostname = config.host;\n const { hostname, port } = parseEndpoint(customEndpointAddress);\n // Since we specify the port separately, set host to the customEndpointAddress hostname.\n config.host = hostname;\n if (port) {\n config.port = parseInt(port, 10);\n }\n}\n\n/**\n * @internal\n *\n */\nexport function createConnectionContext(\n connectionString: string,\n credential: SasTokenProvider | TokenCredential,\n options: ServiceBusClientOptions,\n): ConnectionContext {\n const config = ConnectionConfig.create(connectionString);\n\n config.webSocket = options?.webSocketOptions?.webSocket;\n config.webSocketEndpointPath = \"$servicebus/websocket\";\n config.webSocketConstructorOptions = options?.webSocketOptions?.webSocketConstructorOptions;\n\n if (options?.customEndpointAddress) {\n setCustomEndpointAddress(config, options.customEndpointAddress);\n }\n\n return ConnectionContext.create(config, credential, options);\n}\n\n/**\n * @internal\n */\nexport function createConnectionContextForConnectionString(\n connectionString: string,\n options: ServiceBusClientOptions = {},\n): ConnectionContext {\n const parsed = parseServiceBusConnectionString(connectionString) as Required<\n | Pick<ServiceBusConnectionStringProperties, \"sharedAccessKey\" | \"sharedAccessKeyName\">\n | Pick<ServiceBusConnectionStringProperties, \"sharedAccessSignature\">\n >;\n const sasTokenProvider = createSasTokenProvider(parsed);\n return createConnectionContext(connectionString, sasTokenProvider, options);\n}\n\n/**\n *\n * @internal\n */\nexport function createConnectionContextForCredential(\n credential: TokenCredential | NamedKeyCredential | SASCredential,\n host: string,\n options: ServiceBusClientOptions = {},\n): ConnectionContext {\n if (typeof host !== \"string\") {\n throw new TypeError(\"`host` parameter is not a string\");\n }\n\n let tokenProvider: TokenCredential | SasTokenProvider;\n\n // host, credential and options based constructor was invoked\n if (!host.endsWith(\"/\")) {\n host += \"/\";\n }\n if (isNamedKeyCredential(credential) || isSASCredential(credential)) {\n tokenProvider = createSasTokenProvider(credential);\n } else {\n tokenProvider = credential;\n }\n const connectionString = `Endpoint=sb://${host};SharedAccessKeyName=defaultKeyName;SharedAccessKey=defaultKeyValue;`;\n return createConnectionContext(connectionString, tokenProvider, options);\n}\n\n/**\n * Parses a connection string and extracts the EntityPath named entity out.\n * @param connectionString - An entity specific Service Bus connection string.\n * @internal\n */\nexport function getEntityNameFromConnectionString(connectionString: string): string {\n const entityPathMatch = connectionString.match(/^.+EntityPath=(.+?);{0,1}$/);\n\n if (entityPathMatch != null && entityPathMatch.length === 2) {\n return entityPathMatch[1];\n } else {\n throw new Error(\"No entity name present in the connection string\");\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Delivery, ReceiverOptions, Source } from \"rhea-promise\";\nimport { translateServiceBusError } from \"../serviceBusError\";\nimport { receiverLogger } from \"../log\";\nimport { ReceiveMode } from \"../models\";\nimport { Constants } from \"@azure/core-amqp\";\n\n/**\n * @internal\n */\nexport type ReceiverHandlers = Pick<\n ReceiverOptions,\n \"onMessage\" | \"onError\" | \"onClose\" | \"onSessionError\" | \"onSessionClose\" | \"onSettled\"\n>;\n\n/**\n * @internal\n */\nexport interface DeferredPromiseAndTimer {\n resolve: (value?: any) => void;\n reject: (reason?: any) => void;\n timer: NodeJS.Timeout;\n}\n\n/**\n * This is the shared onSettled handler for all of the receiver implementations.\n *\n * The sequence is basically:\n * 1. User calls `await <ServiceBusMessage instance>.complete()` (or other settlement methods)\n * 2. This creates a `Promise` that gets stored in the _deliveryDispositionMap\n * 3. When the service acknowledges the settlement this method gets called for that message.\n * 4. We resolve() the promise from the _deliveryDispositionMap.\n * 5. User's code after the settlement continues.\n *\n * @internal\n */\nexport function onMessageSettled(\n logPrefix: string,\n delivery: Delivery | undefined,\n deliveryDispositionMap: Map<number, DeferredPromiseAndTimer>,\n): void {\n if (delivery) {\n const id = delivery.id;\n const state = delivery.remote_state;\n const settled = delivery.remote_settled;\n receiverLogger.verbose(\n \"%s Delivery with id %d, remote_settled: %s, remote_state: %o has been \" + \"received.\",\n logPrefix,\n id,\n settled,\n state && state.error ? state.error : state,\n );\n if (settled && deliveryDispositionMap.has(id)) {\n const promise = deliveryDispositionMap.get(id) as DeferredPromiseAndTimer;\n clearTimeout(promise.timer);\n receiverLogger.verbose(\n \"%s Found the delivery with id %d in the map and cleared the timer.\",\n logPrefix,\n id,\n );\n const deleteResult = deliveryDispositionMap.delete(id);\n receiverLogger.verbose(\n \"%s Successfully deleted the delivery with id %d from the map.\",\n logPrefix,\n id,\n deleteResult,\n );\n if (state && state.error && (state.error.condition || state.error.description)) {\n const error = translateServiceBusError(state.error);\n return promise.reject(error);\n }\n\n return promise.resolve();\n }\n }\n}\n\n// Placed in Service Bus for now and can be promoted to core-amqp if also useful for Event Hubs in the future.\nconst timeoutName = `${Constants.vendorString}:timeout`;\n/**\n * Creates the options that need to be specified while creating an AMQP receiver link.\n *\n * @internal\n */\nexport function createReceiverOptions(\n name: string,\n receiveMode: ReceiveMode,\n source: Source,\n clientId: string,\n handlers: ReceiverHandlers,\n timeoutInMs?: number,\n): ReceiverOptions {\n const properties =\n timeoutInMs !== undefined\n ? { [Constants.receiverIdentifierName]: clientId, [timeoutName]: timeoutInMs }\n : { [Constants.receiverIdentifierName]: clientId };\n const rcvrOptions: ReceiverOptions = {\n name,\n // \"autoaccept\" being true in the \"receiveAndDelete\" mode sets the \"settled\" flag to true on the deliveries\n // which helps in clearing the circular buffer(size=2048) as it is needed to receive messages after 2048 of them are received.\n autoaccept: receiveMode === \"receiveAndDelete\" ? true : false,\n // receiveAndDelete -> first(0), peekLock -> second (1)\n rcv_settle_mode: receiveMode === \"receiveAndDelete\" ? 0 : 1,\n // receiveAndDelete -> settled (1), peekLock -> unsettled (0)\n snd_settle_mode: receiveMode === \"receiveAndDelete\" ? 1 : 0,\n source,\n target: clientId,\n credit_window: 0,\n properties,\n ...handlers,\n };\n\n return rcvrOptions;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n Constants,\n ErrorNameConditionMapper,\n MessagingError,\n RetryOptions,\n} from \"@azure/core-amqp\";\nimport { AmqpError, EventContext, OnAmqpEvent, Receiver, ReceiverOptions } from \"rhea-promise\";\nimport { receiverLogger as logger } from \"../log\";\nimport { LinkEntity, ReceiverType } from \"./linkEntity\";\nimport { ConnectionContext } from \"../connectionContext\";\nimport { DispositionType, ServiceBusMessageImpl } from \"../serviceBusMessage\";\nimport { getUniqueName } from \"../util/utils\";\nimport { ProcessErrorArgs, ReceiveMode, SubscribeOptions } from \"../models\";\nimport { DispositionStatusOptions } from \"./managementClient\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport {\n onMessageSettled,\n DeferredPromiseAndTimer,\n ReceiverHandlers,\n createReceiverOptions,\n} from \"./shared\";\nimport { LockRenewer } from \"./autoLockRenewer\";\nimport { translateServiceBusError } from \"../serviceBusError\";\n\n/**\n * @internal\n */\nexport interface OnAmqpEventAsPromise extends OnAmqpEvent {\n (context: EventContext): Promise<void>;\n}\n\n/**\n * @internal\n */\nexport interface ReceiveOptions extends SubscribeOptions {\n /**\n * The mode in which messages should be received.\n */\n receiveMode: ReceiveMode;\n /**\n * Retry policy options that determine the mode, number of retries, retry interval etc.\n */\n retryOptions?: RetryOptions;\n\n /**\n * A LockAutoRenewer that will automatically renew locks based on user specified interval.\n * This will be set if the user has chosen peekLock mode _and_ they've set a positive\n * maxAutoRenewLockDurationInMs value when they created their receiver.\n */\n lockRenewer: LockRenewer | undefined;\n /**\n * Option to disable the client from running JSON.parse() on the message body when receiving the message.\n * Not applicable if the message was sent with AMQP body type value or sequence. Use this option when you\n * prefer to work directly with the bytes present in the message body than have the client attempt to parse it.\n */\n skipParsingBodyAsJson: boolean;\n\n /**\n * Whether to skip converting Date type on properties of message annotations\n * or application properties into numbers when receiving the message. By\n * default, properties of Date type is converted into UNIX epoch number for\n * compatibility.\n */\n skipConvertingDate: boolean;\n}\n\n/**\n * Describes the signature of the message handler passed to `registerMessageHandler` method.\n * @internal\n */\nexport interface OnMessage {\n /**\n * Handler for processing each incoming message.\n */\n (message: ServiceBusMessageImpl): Promise<void>;\n}\n\n/**\n * Describes the signature of the error handler passed to `registerMessageHandler` method.\n *\n * @internal\n */\nexport interface OnError {\n /**\n * Handler for any error that occurs while receiving or processing messages.\n *\n * NOTE: if this signature changes make sure you reflect those same changes in the\n * `OnErrorNoContext` definition below.\n */\n (args: ProcessErrorArgs): Promise<void>;\n}\n\n/**\n * An onError method but without the context property. Used when wrapping OnError\n * with an implicit ProcessErrorContext. Used by LockRenewer.\n *\n * @internal\n */\nexport interface OnErrorNoContext {\n (error: MessagingError | Error): void;\n}\n\n/**\n * @internal\n * Describes the MessageReceiver that will receive messages from ServiceBus.\n */\nexport abstract class MessageReceiver extends LinkEntity<Receiver> {\n /**\n * The type of receiver: \"batching\" or \"streaming\".\n */\n receiverType: ReceiverType;\n /**\n * The mode in which messages should be received.\n * Default: ReceiveMode.peekLock\n */\n receiveMode: ReceiveMode;\n /**\n * Indicates whether `Message.complete()` should be called\n * automatically after the message processing is complete while receiving messages with handlers.\n * Default: false.\n */\n autoComplete: boolean;\n /**\n * Maintains a map of deliveries that\n * are being actively disposed. It acts as a store for correlating the responses received for\n * active dispositions.\n */\n protected _deliveryDispositionMap: Map<number, DeferredPromiseAndTimer> = new Map<\n number,\n DeferredPromiseAndTimer\n >();\n\n /**\n * A lock renewer that handles message lock auto-renewal. This is undefined unless the user\n * has activated autolock renewal via ReceiveOptions. A single auto lock renewer is shared\n * for all links for a `ServiceBusReceiver` instance.\n */\n protected _lockRenewer: LockRenewer | undefined;\n\n constructor(\n public identifier: string,\n context: ConnectionContext,\n entityPath: string,\n receiverType: ReceiverType,\n options: Omit<ReceiveOptions, \"maxConcurrentCalls\">,\n ) {\n super(entityPath, entityPath, context, receiverType, logger, {\n address: entityPath,\n audience: `${context.config.endpoint}${entityPath}`,\n });\n\n this.receiverType = receiverType;\n this.receiveMode = options.receiveMode || \"peekLock\";\n\n // If explicitly set to false then autoComplete is false else true (default).\n this.autoComplete =\n options.autoCompleteMessages === false ? options.autoCompleteMessages : true;\n this._lockRenewer = options.lockRenewer;\n }\n\n /**\n * Creates the options that need to be specified while creating an AMQP receiver link.\n */\n protected _createReceiverOptions(\n useNewName: boolean,\n handlers: ReceiverHandlers,\n ): ReceiverOptions {\n const rcvrOptions: ReceiverOptions = createReceiverOptions(\n useNewName ? getUniqueName(this.baseName) : this.name,\n this.receiveMode,\n {\n address: this.address,\n },\n this.identifier,\n {\n onSettled: (context: EventContext) => {\n return onMessageSettled(this.logPrefix, context.delivery, this._deliveryDispositionMap);\n },\n ...handlers,\n },\n );\n\n return rcvrOptions;\n }\n\n /**\n * Creates a new AMQP receiver under a new AMQP session.\n */\n protected async _init(options: ReceiverOptions, abortSignal?: AbortSignalLike): Promise<void> {\n try {\n await this.initLink(options, abortSignal);\n\n // It is possible for someone to close the receiver and then start it again.\n // Thus make sure that the receiver is present in the client cache.\n this._context.messageReceivers[this.name] = this as any;\n } catch (err: any) {\n const translatedError = translateServiceBusError(err);\n logger.logError(\n translatedError,\n \"%s An error occured while creating the receiver\",\n this.logPrefix,\n );\n\n // Fix the unhelpful error messages for the OperationTimeoutError that comes from `rhea-promise`.\n if ((translatedError as MessagingError).code === \"OperationTimeoutError\") {\n translatedError.message =\n \"Failed to create a receiver within allocated time and retry attempts.\";\n }\n\n throw translatedError;\n }\n }\n\n protected createRheaLink(\n options: ReceiverOptions,\n _abortSignal?: AbortSignalLike,\n ): Promise<Receiver> {\n return this._context.connection.createReceiver(options);\n }\n\n /**\n * React to receiver being detached due to given error.\n * You may want to set up retries to recover the broken link and/or report error to user.\n * @param error - The error accompanying the receiver/session error or connection disconnected events\n */\n abstract onDetached(error?: AmqpError | Error): Promise<void>;\n\n /**\n * Clears lock renewal timers on all active messages, clears token remewal for current receiver,\n * removes current MessageReceiver instance from cache, and closes the underlying AMQP receiver.\n * @returns Promise<void>.\n */\n async close(): Promise<void> {\n this._lockRenewer?.stopAll(this);\n await super.close();\n }\n\n /**\n * Settles the message with the specified disposition.\n * @param message - The ServiceBus Message that needs to be settled.\n * @param operation - The disposition type.\n * @param options - Optional parameters that can be provided while disposing the message.\n */\n async settleMessage(\n message: ServiceBusMessageImpl,\n operation: DispositionType,\n options: DispositionStatusOptions,\n ): Promise<any> {\n return new Promise((resolve, reject) => {\n if (operation.match(/^(complete|abandon|defer|deadletter)$/) == null) {\n return reject(new Error(`operation: '${operation}' is not a valid operation.`));\n }\n this._lockRenewer?.stop(this, message);\n const delivery = message.delivery;\n const timer = setTimeout(() => {\n this._deliveryDispositionMap.delete(delivery.id);\n\n logger.verbose(\n \"%s Disposition for delivery id: %d, did not complete in %d milliseconds. \" +\n \"Hence rejecting the promise with timeout error.\",\n this.logPrefix,\n delivery.id,\n Constants.defaultOperationTimeoutInMs,\n );\n\n const e: AmqpError = {\n condition: ErrorNameConditionMapper.ServiceUnavailableError,\n description:\n \"Operation to settle the message has timed out. The disposition of the \" +\n \"message may or may not be successful\",\n };\n return reject(translateServiceBusError(e));\n }, options.retryOptions?.timeoutInMs ?? Constants.defaultOperationTimeoutInMs);\n this._deliveryDispositionMap.set(delivery.id, {\n resolve: resolve,\n reject: reject,\n timer: timer,\n });\n if (operation === DispositionType.complete) {\n delivery.accept();\n } else if (operation === DispositionType.abandon) {\n const params: any = {\n undeliverable_here: false,\n };\n if (options.propertiesToModify) params.message_annotations = options.propertiesToModify;\n delivery.modified(params);\n } else if (operation === DispositionType.defer) {\n const params: any = {\n undeliverable_here: true,\n };\n if (options.propertiesToModify) params.message_annotations = options.propertiesToModify;\n delivery.modified(params);\n } else if (operation === DispositionType.deadletter) {\n const error: AmqpError = {\n condition: Constants.deadLetterName,\n info: {\n ...options.propertiesToModify,\n DeadLetterReason: options.deadLetterReason,\n DeadLetterErrorDescription: options.deadLetterDescription,\n },\n };\n delivery.reject(error);\n }\n });\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AbortError } from \"@azure/abort-controller\";\nimport { Receiver, ReceiverEvents } from \"rhea-promise\";\nimport { receiverLogger as logger } from \"../log\";\nimport { ServiceBusError } from \"../serviceBusError\";\nimport { receiveDrainTimeoutInMs } from \"../util/constants\";\n\n/**\n * Wraps the receiver with some higher level operations for managing state\n * like credits, draining, etc...\n *\n * @internal\n */\nexport class ReceiverHelper {\n private _isSuspended: boolean = true;\n\n constructor(\n private _getCurrentReceiver: () => { receiver: Receiver | undefined; logPrefix: string },\n ) {}\n\n private _getCurrentReceiverOrError():\n | \"is undefined\"\n | \"is not open\"\n | \"is suspended\"\n | { receiver: Receiver | undefined; logPrefix: string } {\n const currentReceiverData = this._getCurrentReceiver();\n\n if (currentReceiverData.receiver == null) {\n return \"is undefined\";\n }\n\n if (!currentReceiverData.receiver.isOpen()) {\n return \"is not open\";\n }\n\n if (this._isSuspended) {\n return \"is suspended\";\n }\n\n return currentReceiverData;\n }\n\n /**\n * Adds credits to the receiver, respecting any state that\n * indicates the receiver is closed or should not continue\n * to receive more messages.\n *\n * @param credits - Number of credits to add.\n * or `stopReceivingMessages` has been called.\n */\n addCredit(credits: number): void {\n const currentReceiverOrError = this._getCurrentReceiverOrError();\n\n if (typeof currentReceiverOrError === \"string\") {\n const errorMessage = `Cannot request messages on the receiver since it ${currentReceiverOrError}.`;\n\n if (currentReceiverOrError === \"is suspended\") {\n // if a user has suspended the receiver we should consider this a non-retryable\n // error since it absolutely requires user intervention.\n throw new AbortError(errorMessage);\n }\n\n throw new ServiceBusError(errorMessage, \"GeneralError\");\n }\n\n if (currentReceiverOrError.receiver != null) {\n logger.verbose(`${currentReceiverOrError.logPrefix} Adding ${credits} credits`);\n currentReceiverOrError.receiver.addCredit(credits);\n }\n }\n\n /**\n * Drains the credits for the receiver and prevents the `receiverHelper.addCredit()` method from adding credits.\n * Call `resume()` to enable the `addCredit()` method.\n */\n async suspend(): Promise<void> {\n const { receiver, logPrefix } = this._getCurrentReceiver();\n\n this._isSuspended = true;\n\n if (!this._isValidReceiver(receiver)) {\n return;\n }\n\n logger.verbose(\n `${logPrefix} User has requested to stop receiving new messages, attempting to drain.`,\n );\n\n return this.drain();\n }\n\n /**\n * Resets tracking so `addCredit` works again by toggling the `_isSuspended` flag.\n */\n resume(): void {\n this._isSuspended = false;\n }\n\n isSuspended(): boolean {\n return this._isSuspended;\n }\n\n /**\n * Initiates a drain for the current receiver and resolves when\n * the drain has completed.\n *\n * NOTE: This method returns immediately if the receiver is not valid or if there\n * are no pending credits on the receiver (ie: `receiver.credit === 0`).\n */\n async drain(): Promise<void> {\n const { receiver, logPrefix } = this._getCurrentReceiver();\n\n if (!this._isValidReceiver(receiver)) {\n // TODO: should we throw?\n return;\n }\n\n if (receiver.credit === 0) {\n // nothing to drain\n return;\n }\n\n logger.verbose(\n `${logPrefix} Receiver is starting drain. Remaining credits; ${receiver.credit}`,\n );\n\n const drainPromise = new Promise<void>((resolve) => {\n const timer = setTimeout(async () => {\n logger.warning(`${logPrefix} Time out when draining credits in suspend().`);\n // Close the receiver link since we have not received the receiver_drained event\n // to prevent out-of-sync link state between local and remote\n await receiver?.close();\n resolve();\n }, receiveDrainTimeoutInMs);\n receiver.once(ReceiverEvents.receiverDrained, () => {\n logger.verbose(`${logPrefix} Receiver has been drained.`);\n receiver.drain = false;\n clearTimeout(timer);\n resolve();\n });\n receiver.drainCredit();\n });\n\n return drainPromise;\n }\n\n private _isValidReceiver(receiver: Receiver | undefined): receiver is Receiver {\n return receiver != null && receiver.isOpen();\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TracingContext, TracingSpanLink, TracingSpanOptions } from \"@azure/core-tracing\";\nimport { ConnectionContext } from \"../connectionContext\";\nimport { OperationOptionsBase } from \"../modelsToBeSharedWithEventHubs\";\nimport { ServiceBusReceiver } from \"../receivers/receiver\";\nimport { ServiceBusMessage, ServiceBusReceivedMessage } from \"../serviceBusMessage\";\nimport { MessagingOperationNames, toSpanOptions, tracingClient } from \"./tracing\";\n\n/**\n * @internal\n */\nexport const TRACEPARENT_PROPERTY = \"Diagnostic-Id\";\n\n/**\n * @hidden\n */\nexport interface InstrumentableMessage {\n /**\n * The application specific properties which can be\n * used for custom message metadata.\n */\n applicationProperties?: { [key: string]: number | boolean | string | Date | null };\n}\n\n/**\n * Instruments an AMQP message with a proper `Diagnostic-Id` for tracing.\n *\n * @hidden\n */\nexport function instrumentMessage<T extends InstrumentableMessage>(\n message: T,\n options: OperationOptionsBase,\n entityPath: string,\n host: string,\n operation: MessagingOperationNames,\n): {\n /**\n * If instrumentation was done, a copy of the message with\n * message.applicationProperties['Diagnostic-Id'] filled\n * out appropriately.\n */\n message: T;\n\n /**\n * A valid SpanContext if this message should be linked to a parent span, or undefined otherwise.\n */\n spanContext: TracingContext | undefined;\n} {\n // check if the event has already been instrumented\n const previouslyInstrumented = Boolean(message.applicationProperties?.[TRACEPARENT_PROPERTY]);\n\n if (previouslyInstrumented) {\n return {\n message,\n spanContext: undefined,\n };\n }\n\n const { span: messageSpan, updatedOptions } = tracingClient.startSpan(\n \"message\",\n options,\n toSpanOptions({ entityPath, host }, operation, \"producer\"),\n );\n\n try {\n if (!messageSpan.isRecording()) {\n return {\n message,\n spanContext: undefined,\n };\n }\n\n const traceParent = tracingClient.createRequestHeaders(\n updatedOptions.tracingOptions?.tracingContext,\n )[\"traceparent\"];\n\n if (traceParent) {\n // create a copy so the original isn't modified\n message = {\n ...message,\n applicationProperties: {\n ...message.applicationProperties,\n [TRACEPARENT_PROPERTY]: traceParent,\n },\n };\n }\n\n return {\n message,\n spanContext: updatedOptions.tracingOptions?.tracingContext,\n };\n } finally {\n messageSpan.end();\n }\n}\n\n/**\n * Extracts the `SpanContext` from an `ServiceBusMessage` if the context exists.\n * @param message - An individual `ServiceBusMessage` object.\n * @internal\n */\nexport function extractSpanContextFromServiceBusMessage(\n message: ServiceBusMessage,\n): TracingContext | undefined {\n if (!message.applicationProperties || !message.applicationProperties[TRACEPARENT_PROPERTY]) {\n return;\n }\n\n const diagnosticId = message.applicationProperties[TRACEPARENT_PROPERTY] as string;\n return tracingClient.parseTraceparentHeader(diagnosticId);\n}\n\n/**\n * Provides an iterable over messages, whether it is a single message or multiple\n * messages.\n *\n * @param receivedMessages - A single message or a set of messages\n * @internal\n */\nfunction* getReceivedMessages(\n receivedMessages: ServiceBusReceivedMessage | ServiceBusReceivedMessage[],\n): Iterable<ServiceBusReceivedMessage> {\n if (!Array.isArray(receivedMessages)) {\n yield receivedMessages;\n } else {\n for (const message of receivedMessages) {\n yield message;\n }\n }\n}\n\n/**\n * @internal\n */\nexport function toProcessingSpanOptions(\n receivedMessages: ServiceBusReceivedMessage | ServiceBusReceivedMessage[],\n receiver: Pick<ServiceBusReceiver, \"entityPath\">,\n connectionConfig: Pick<ConnectionContext[\"config\"], \"host\">,\n operation: MessagingOperationNames,\n): TracingSpanOptions {\n const spanLinks: TracingSpanLink[] = [];\n for (const receivedMessage of getReceivedMessages(receivedMessages)) {\n const tracingContext = extractSpanContextFromServiceBusMessage(receivedMessage);\n if (tracingContext) {\n spanLinks.push({\n tracingContext,\n attributes: {\n enqueuedTime: receivedMessage.enqueuedTimeUtc?.getTime(),\n },\n });\n }\n }\n return {\n spanLinks,\n spanKind: \"consumer\",\n ...toSpanOptions({ host: connectionConfig.host, entityPath: receiver.entityPath }, operation),\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { MessageHandlers, ProcessErrorArgs } from \"../models\";\nimport { ServiceBusReceiver } from \"./receiver\";\nimport { OperationOptionsBase } from \"../modelsToBeSharedWithEventHubs\";\nimport { createServiceBusLogger, logger, receiverLogger, ServiceBusLogger } from \"../log\";\nimport { translateServiceBusError } from \"../serviceBusError\";\nimport {\n DeadLetterOptions,\n DispositionType,\n ServiceBusMessageImpl,\n ServiceBusReceivedMessage,\n} from \"../serviceBusMessage\";\nimport { DispositionStatusOptions } from \"../core/managementClient\";\nimport { ConnectionContext } from \"../connectionContext\";\nimport {\n Constants,\n ErrorNameConditionMapper,\n retry,\n RetryConfig,\n RetryMode,\n RetryOperationType,\n RetryOptions,\n} from \"@azure/core-amqp\";\nimport { MessageAlreadySettled } from \"../util/errors\";\nimport { delay, isDefined } from \"@azure/core-util\";\nimport { TracingSpanLink } from \"@azure/core-tracing\";\nimport { toSpanOptions, tracingClient } from \"../diagnostics/tracing\";\nimport { extractSpanContextFromServiceBusMessage } from \"../diagnostics/instrumentServiceBusMessage\";\n\n/**\n * @internal\n */\nexport function assertValidMessageHandlers(handlers: {\n processMessage?: unknown;\n processError?: unknown;\n}): void {\n if (\n handlers &&\n handlers.processMessage instanceof Function &&\n handlers.processError instanceof Function\n ) {\n return;\n }\n\n throw new TypeError('Invalid \"MessageHandlers\" provided.');\n}\n\n/**\n * @internal\n */\nexport async function* getMessageIterator(\n receiver: Pick<ServiceBusReceiver, \"receiveMessages\">,\n options?: OperationOptionsBase,\n): AsyncIterableIterator<ServiceBusReceivedMessage> {\n while (true) {\n const messages = await receiver.receiveMessages(1, options);\n\n if (messages.length === 0) {\n continue;\n }\n\n yield messages[0];\n }\n}\n\n/**\n * @internal\n */\nexport function wrapProcessErrorHandler(\n handlers: Pick<MessageHandlers, \"processError\">,\n loggerParam: ServiceBusLogger = receiverLogger,\n): MessageHandlers[\"processError\"] {\n return async (args: ProcessErrorArgs) => {\n try {\n args.error = translateServiceBusError(args.error);\n await handlers.processError(args);\n } catch (err: any) {\n loggerParam.logError(err, `An error was thrown from the user's processError handler`);\n }\n };\n}\n\n/**\n * @internal\n *\n */\nexport function completeMessage(\n message: ServiceBusMessageImpl,\n context: ConnectionContext,\n entityPath: string,\n retryOptions: RetryOptions | undefined,\n): Promise<void> {\n receiverLogger.verbose(\n \"[%s] Completing the message with id '%s'.\",\n context.connectionId,\n message.messageId,\n );\n const tracingContext = extractSpanContextFromServiceBusMessage(message);\n const spanLinks: TracingSpanLink[] = tracingContext ? [{ tracingContext }] : [];\n return tracingClient.withSpan(\n \"ServicebusReceiver.complete\",\n {},\n () =>\n settleMessage(message, DispositionType.complete, context, entityPath, {\n retryOptions,\n }),\n {\n spanLinks,\n ...toSpanOptions({ entityPath, host: context.config.host }, \"settle\", \"client\"),\n },\n );\n}\n\n/**\n * @internal\n *\n */\nexport function abandonMessage(\n message: ServiceBusMessageImpl,\n context: ConnectionContext,\n entityPath: string,\n propertiesToModify: { [key: string]: number | boolean | string | Date | null } | undefined,\n retryOptions: RetryOptions | undefined,\n): Promise<void> {\n receiverLogger.verbose(\n \"[%s] Abandoning the message with id '%s'.\",\n context.connectionId,\n message.messageId,\n );\n const tracingContext = extractSpanContextFromServiceBusMessage(message);\n const spanLinks: TracingSpanLink[] = tracingContext ? [{ tracingContext }] : [];\n return tracingClient.withSpan(\n \"ServicebusReceiver.abandon\",\n {},\n () =>\n settleMessage(message, DispositionType.abandon, context, entityPath, {\n propertiesToModify,\n retryOptions,\n }),\n {\n spanLinks,\n ...toSpanOptions({ entityPath, host: context.config.host }, \"settle\", \"client\"),\n },\n );\n}\n\n/**\n * @internal\n *\n */\nexport function deferMessage(\n message: ServiceBusMessageImpl,\n context: ConnectionContext,\n entityPath: string,\n propertiesToModify: { [key: string]: number | boolean | string | Date | null } | undefined,\n retryOptions: RetryOptions | undefined,\n): Promise<void> {\n receiverLogger.verbose(\n \"[%s] Deferring the message with id '%s'.\",\n context.connectionId,\n message.messageId,\n );\n const tracingContext = extractSpanContextFromServiceBusMessage(message);\n const spanLinks: TracingSpanLink[] = tracingContext ? [{ tracingContext }] : [];\n return tracingClient.withSpan(\n \"ServiceBusReceiver.defer\",\n {},\n () =>\n settleMessage(message, DispositionType.defer, context, entityPath, {\n retryOptions,\n propertiesToModify,\n }),\n {\n spanLinks,\n ...toSpanOptions({ entityPath, host: context.config.host }, \"settle\", \"client\"),\n },\n );\n}\n\n/**\n * @internal\n *\n */\nexport function deadLetterMessage(\n message: ServiceBusMessageImpl,\n context: ConnectionContext,\n entityPath: string,\n propertiesToModify:\n | (DeadLetterOptions & { [key: string]: number | boolean | string | Date | null })\n | undefined,\n retryOptions: RetryOptions | undefined,\n): Promise<void> {\n receiverLogger.verbose(\n \"[%s] Deadlettering the message with id '%s'.\",\n context.connectionId,\n message.messageId,\n );\n\n const actualPropertiesToModify: Partial<DeadLetterOptions> = {\n ...propertiesToModify,\n };\n\n // these two fields are handled specially and don't need to be in here.\n delete actualPropertiesToModify.deadLetterErrorDescription;\n delete actualPropertiesToModify.deadLetterReason;\n\n const dispositionStatusOptions: DispositionStatusOptions = {\n propertiesToModify: actualPropertiesToModify,\n deadLetterReason: propertiesToModify?.deadLetterReason,\n deadLetterDescription: propertiesToModify?.deadLetterErrorDescription,\n retryOptions,\n };\n\n const tracingContext = extractSpanContextFromServiceBusMessage(message);\n const spanLinks: TracingSpanLink[] = tracingContext ? [{ tracingContext }] : [];\n\n return tracingClient.withSpan(\n \"ServiceBusReceiver.deadLetter\",\n {},\n () =>\n settleMessage(\n message,\n DispositionType.deadletter,\n context,\n entityPath,\n dispositionStatusOptions,\n ),\n {\n spanLinks,\n ...toSpanOptions({ entityPath, host: context.config.host }, \"settle\", \"client\"),\n },\n );\n}\n\n/**\n * @internal\n */\nexport function settleMessage(\n message: ServiceBusMessageImpl,\n operation: DispositionType,\n context: ConnectionContext,\n entityPath: string,\n options: DispositionStatusOptions,\n _settleMessageOperation: typeof settleMessageOperation = settleMessageOperation,\n): Promise<void> {\n return retry({\n connectionId: context.connectionId,\n operation: () => {\n return _settleMessageOperation(message, operation, context, entityPath, options);\n },\n operationType: RetryOperationType.messageSettlement,\n abortSignal: options?.abortSignal,\n retryOptions: options?.retryOptions,\n });\n}\n\n/**\n * @internal\n *\n * NOTE: it's tempting to make this method non-async. However, doing so makes it too easy\n * to throw exceptions that will not be \"catchable\" by people chaining to the returned Promise\n * since we can throw exceptions outside of the Promise's scope.\n */\nexport async function settleMessageOperation(\n message: ServiceBusMessageImpl,\n operation: DispositionType,\n context: ConnectionContext,\n entityPath: string,\n options: DispositionStatusOptions,\n): Promise<void> {\n const isDeferredMessage = !message.delivery.link;\n const receiver = isDeferredMessage\n ? undefined\n : context.getReceiverFromCache(message.delivery.link.name, message.sessionId);\n const associatedLinkName = receiver?.name;\n\n let error: Error | undefined;\n if (message.delivery.remote_settled) {\n error = new Error(MessageAlreadySettled);\n } else if (\n !isDeferredMessage &&\n (!receiver || !receiver.isOpen()) &&\n isDefined(message.sessionId)\n ) {\n error = translateServiceBusError({\n description:\n `Failed to ${operation} the message as the AMQP link with which the message was ` +\n `received is no longer alive.`,\n condition: ErrorNameConditionMapper.SessionLockLostError,\n });\n }\n\n if (error) {\n receiverLogger.logError(\n error,\n \"[%s] An error occurred when settling a message with id '%s'\",\n context.connectionId,\n message.messageId,\n );\n throw error;\n }\n\n // Message Settlement with managementLink\n // 1. If the received message is deferred as such messages can only be settled using managementLink\n // 2. If the associated receiver link is not available. This does not apply to messages from sessions as we need a lock on the session to do so.\n if (isDeferredMessage || ((!receiver || !receiver.isOpen()) && !isDefined(message.sessionId))) {\n return context\n .getManagementClient(entityPath)\n .updateDispositionStatus(message.lockToken!, operation, {\n ...options,\n associatedLinkName,\n sessionId: message.sessionId,\n })\n .catch((err) => {\n throw translateServiceBusError(err);\n });\n }\n\n return receiver!.settleMessage(message, operation, options).catch((err) => {\n throw translateServiceBusError(err);\n });\n}\n\n/** @internal */\nexport interface RetryForeverArgs<T> {\n retryConfig: RetryConfig<T>;\n onError: (err: Error) => void;\n logger: ReturnType<typeof createServiceBusLogger>;\n logPrefix: string;\n}\n\n/**\n * Calculates delay between retries, in milliseconds.\n */\nfunction calculateDelay(\n attemptCount: number,\n retryDelayInMs: number,\n maxRetryDelayInMs: number,\n mode: RetryMode,\n): number {\n if (mode === RetryMode.Exponential) {\n const boundedRandDelta =\n retryDelayInMs * 0.8 +\n Math.floor(Math.random() * (retryDelayInMs * 1.2 - retryDelayInMs * 0.8));\n\n const incrementDelta = boundedRandDelta * (Math.pow(2, attemptCount) - 1);\n return Math.min(incrementDelta, maxRetryDelayInMs);\n }\n\n return retryDelayInMs;\n}\n\n/**\n * Retry infinitely until success, reporting in between retry attempts.\n *\n * This function will only stop retrying if:\n * - args.retryConfig.operation resolves successfully\n * - args.retryConfig.operation rejects with an `AbortError`\n *\n * @internal\n */\nexport async function retryForever<T>(\n args: RetryForeverArgs<T>,\n retryFn: typeof retry = retry,\n): Promise<T> {\n let numRetryCycles = 0;\n const config = args.retryConfig;\n if (!config.retryOptions) {\n config.retryOptions = {};\n }\n // eslint-disable-next-line eqeqeq\n if (config.retryOptions.retryDelayInMs == undefined || config.retryOptions.retryDelayInMs < 0) {\n config.retryOptions.retryDelayInMs = Constants.defaultDelayBetweenOperationRetriesInMs;\n }\n if (\n // eslint-disable-next-line eqeqeq\n config.retryOptions.maxRetryDelayInMs == undefined ||\n config.retryOptions.maxRetryDelayInMs < 0\n ) {\n config.retryOptions.maxRetryDelayInMs = Constants.defaultMaxDelayForExponentialRetryInMs;\n }\n if (!config.retryOptions.mode) {\n config.retryOptions.mode = RetryMode.Fixed;\n }\n\n // The retries are broken up into cycles, giving the user some control over how often\n // we actually attempt to retry.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n ++numRetryCycles;\n\n try {\n return await retryFn(args.retryConfig);\n } catch (err: any) {\n // if the user aborts the operation we're immediately done.\n // AbortError is also thrown by linkEntity.init() if the connection has been\n // permanently closed.\n if (err.name === \"AbortError\") {\n logger.warning(`${args.logPrefix} AbortError caught, ending retries.`);\n throw err;\n }\n\n // we only report the error here - this avoids spamming the user with too many\n // redundant reports of errors while still providing them incremental status on failures.\n try {\n args.onError(err);\n } catch (error: any) {\n logger.error(\"args.onerror has thrown\", error);\n }\n\n args.logger.logError(\n err,\n `${args.logPrefix} Error thrown in retry cycle ${numRetryCycles}, restarting retry cycle with retry options`,\n args.retryConfig,\n );\n\n const delayInMs = calculateDelay(\n numRetryCycles,\n config.retryOptions.retryDelayInMs,\n config.retryOptions.maxRetryDelayInMs,\n config.retryOptions.mode,\n );\n logger.verbose(\n \"[%s] Sleeping for %d milliseconds for '%s'.\",\n config.connectionId,\n delayInMs,\n config.operationType,\n );\n await delay(delayInMs, {\n abortSignal: config.abortSignal,\n abortErrorMsg: \"Retry cycle has been cancelled by the user.\",\n });\n\n continue;\n }\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { MessageReceiver, OnAmqpEventAsPromise, ReceiveOptions } from \"./messageReceiver\";\nimport { ConnectionContext } from \"../connectionContext\";\n\nimport { ReceiverHelper } from \"./receiverHelper\";\n\nimport { throwErrorIfConnectionClosed } from \"../util/errors\";\nimport {\n RetryOperationType,\n MessagingError,\n RetryOptions,\n ConditionErrorNameMapper,\n} from \"@azure/core-amqp\";\nimport { OperationOptionsBase } from \"../modelsToBeSharedWithEventHubs\";\nimport { receiverLogger as logger } from \"../log\";\nimport { AmqpError, EventContext, OnAmqpEvent } from \"rhea-promise\";\nimport { ServiceBusMessageImpl } from \"../serviceBusMessage\";\nimport { translateServiceBusError } from \"../serviceBusError\";\nimport { abandonMessage, completeMessage, retryForever } from \"../receivers/receiverCommon\";\nimport { ReceiverHandlers } from \"./shared\";\nimport {\n InternalMessageHandlers,\n InternalProcessErrorArgs,\n MessageHandlers,\n ProcessErrorArgs,\n SubscribeOptions,\n} from \"../models\";\nimport { toProcessingSpanOptions } from \"../diagnostics/instrumentServiceBusMessage\";\nimport { AbortError } from \"@azure/abort-controller\";\nimport { tracingClient } from \"../diagnostics/tracing\";\n\n/**\n * @internal\n */\nexport interface StreamingReceiverInitArgs\n extends ReceiveOptions,\n Pick<OperationOptionsBase, \"abortSignal\"> {\n messageHandlers: MessageHandlers;\n}\n\n/**\n * @internal\n * Describes the streaming receiver where the user can receive the message\n * by providing handler functions.\n */\nexport class StreamingReceiver extends MessageReceiver {\n /**\n * The maximum number of messages that should be\n * processed concurrently while in streaming mode. Once this limit has been reached, more\n * messages will not be received until the user's message handler has completed processing current message.\n * Default: 1\n */\n maxConcurrentCalls: number = 1;\n\n /**\n * Indicates whether the receiver is already actively\n * running `onDetached`.\n * This is expected to be true while the receiver attempts\n * to bring its link back up due to a retryable issue.\n */\n private _isDetaching: boolean = false;\n /**\n *Retry policy options that determine the mode, number of retries, retry interval etc.\n */\n private _retryOptions: RetryOptions;\n\n private _receiverHelper: ReceiverHelper;\n\n /**\n * The user's message handlers, wrapped so any thrown exceptions are properly logged\n * or forwarded to the user's processError handler.\n */\n private _messageHandlers: () => Required<InternalMessageHandlers> = () => {\n throw new Error(\"messageHandlers are not set.\");\n };\n\n /**\n * The subscribe(options) passed when the subscribe call originally happened. Stored\n * so _subscribeImpl() can re-use them later if we have to restart our subscription\n * when detach/reattaching.\n */\n private _subscribeOptions: SubscribeOptions | undefined;\n\n /**\n * Used so we can stub out retry in tests.\n */\n private _retryForeverFn: typeof retryForever = retryForever;\n\n /**\n * The message handler that will be set as the handler on the\n * underlying rhea receiver for the \"receiver_close\" event.\n */\n private _onAmqpClose: OnAmqpEventAsPromise;\n\n /**\n * The message handler that will be set as the handler on\n * the underlying rhea receiver's session for the \"session_close\" event.\n */\n private _onSessionClose: OnAmqpEventAsPromise;\n\n /**\n * The message handler that will be set as the handler on\n * the underlying rhea receiver's session for the \"session_error\" event.\n */\n private _onSessionError: OnAmqpEvent;\n /**\n * The message handler that will be set as the handler on the\n * underlying rhea receiver for the \"receiver_error\" event.\n */\n private _onAmqpError: OnAmqpEvent;\n\n /**\n * The message handler that will be set as the handler on the\n * underlying rhea receiver for the \"message\" event.\n */\n protected _onAmqpMessage: OnAmqpEventAsPromise;\n\n /**\n * Whether we are currently subscribed (or subscribing) for receiving messages.\n * (this is irrespective of receiver state, etc... - it's just a simple flag to prevent\n * multiple subscribe() calls from happening on this instance)\n */\n public get isSubscribeActive(): boolean {\n return !this._receiverHelper.isSuspended();\n }\n\n /**\n * Instantiate a new Streaming receiver for receiving messages with handlers.\n *\n * @param identifier - the name used to identifier the receiver\n * @param connectionContext - The client entity context.\n * @param options - Options for how you'd like to connect.\n */\n constructor(\n identifier: string,\n connectionContext: ConnectionContext,\n entityPath: string,\n options: ReceiveOptions,\n ) {\n super(identifier, connectionContext, entityPath, \"streaming\", options);\n\n if (typeof options?.maxConcurrentCalls === \"number\" && options?.maxConcurrentCalls > 0) {\n this.maxConcurrentCalls = options.maxConcurrentCalls;\n }\n\n this._retryOptions = options?.retryOptions || {};\n\n this._receiverHelper = new ReceiverHelper(() => ({\n receiver: this.link,\n logPrefix: this.logPrefix,\n }));\n\n this._onAmqpClose = async (context: EventContext) => {\n const receiverError = context.receiver && context.receiver.error;\n const receiver = this.link || context.receiver!;\n\n logger.logError(\n receiverError,\n `${this.logPrefix} 'receiver_close' event occurred. The associated error is`,\n );\n\n this._lockRenewer?.stopAll(this);\n\n if (receiver && !receiver.isItselfClosed()) {\n await this.onDetached(receiverError);\n } else {\n logger.verbose(\n \"%s 'receiver_close' event occurred on the receiver '%s' with address '%s' \" +\n \"because the sdk initiated it. Hence not calling detached from the _onAmqpClose\" +\n \"() handler.\",\n this.logPrefix,\n this.name,\n this.address,\n );\n }\n };\n\n this._onSessionClose = async (context: EventContext) => {\n const receiver = this.link || context.receiver!;\n const sessionError = context.session && context.session.error;\n\n logger.logError(\n sessionError,\n `${this.logPrefix} 'session_close' event occurred. The associated error is`,\n );\n\n this._lockRenewer?.stopAll(this);\n\n if (receiver && !receiver.isSessionItselfClosed()) {\n await this.onDetached(sessionError);\n } else {\n logger.verbose(\n \"%s 'session_close' event occurred on the session of receiver '%s' with address \" +\n \"'%s' because the sdk initiated it. Hence not calling detached from the _onSessionClose\" +\n \"() handler.\",\n this.logPrefix,\n this.name,\n this.address,\n );\n }\n };\n\n this._onAmqpError = (context: EventContext) => {\n const receiverError = context.receiver && context.receiver.error;\n if (receiverError) {\n const sbError = translateServiceBusError(receiverError) as MessagingError;\n logger.logError(\n sbError,\n `${this.logPrefix} 'receiver_error' event occurred. The associated error is`,\n );\n this._messageHandlers().processError({\n error: sbError,\n errorSource: \"receive\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier,\n });\n }\n };\n\n this._onSessionError = (context: EventContext) => {\n const sessionError = context.session && context.session.error;\n if (sessionError) {\n const sbError = translateServiceBusError(sessionError) as MessagingError;\n logger.logError(\n sbError,\n `${this.logPrefix} 'session_error' event occurred. The associated error is`,\n );\n this._messageHandlers().processError({\n error: sbError,\n errorSource: \"receive\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier,\n });\n }\n };\n\n this._onAmqpMessage = async (context: EventContext) => {\n // If the receiver got closed in PeekLock mode, avoid processing the message as we\n // cannot settle the message.\n if (this.receiveMode === \"peekLock\" && (!this.link || !this.link.isOpen())) {\n logger.verbose(\n \"%s Not calling the user's message handler for the current message \" +\n \"as the receiver is closed\",\n this.logPrefix,\n );\n return;\n }\n\n const bMessage: ServiceBusMessageImpl = new ServiceBusMessageImpl(\n context.message!,\n context.delivery!,\n true,\n this.receiveMode,\n options.skipParsingBodyAsJson ?? false,\n options.skipConvertingDate ?? false,\n );\n\n this._lockRenewer?.start(this, bMessage, (err) => {\n this._messageHandlers().processError({\n error: err,\n errorSource: \"renewLock\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier,\n });\n });\n\n try {\n await this._messageHandlers().processMessage(bMessage);\n } catch (err: any) {\n logger.logError(\n err,\n \"%s An error occurred while running user's message handler for the message \" +\n \"with id '%s' on the receiver '%s'\",\n this.logPrefix,\n bMessage.messageId,\n this.name,\n );\n\n // Do not want renewLock to happen unnecessarily, while abandoning the message. Hence,\n // doing this here. Otherwise, this should be done in finally.\n this._lockRenewer?.stop(this, bMessage);\n const error = translateServiceBusError(err) as MessagingError;\n // Nothing much to do if user's message handler throws. Let us try abandoning the message.\n if (\n !bMessage.delivery.remote_settled &&\n error.code !== ConditionErrorNameMapper[\"com.microsoft:message-lock-lost\"] &&\n this.receiveMode === \"peekLock\" &&\n this.isOpen() // only try to abandon the messages if the connection is still open\n ) {\n try {\n logger.logError(\n error,\n \"%s Abandoning the message with id '%s' on the receiver '%s' since \" +\n \"an error occured: %O.\",\n this.logPrefix,\n bMessage.messageId,\n this.name,\n error,\n );\n await abandonMessage(\n bMessage,\n this._context,\n entityPath,\n undefined,\n this._retryOptions,\n );\n } catch (abandonError: any) {\n const translatedError = translateServiceBusError(abandonError);\n logger.logError(\n translatedError,\n \"%s An error occurred while abandoning the message with id '%s' on the \" +\n \"receiver '%s'\",\n this.logPrefix,\n bMessage.messageId,\n this.name,\n );\n this._messageHandlers().processError({\n error: translatedError,\n errorSource: \"abandon\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier,\n });\n }\n }\n return;\n } finally {\n try {\n this._receiverHelper.addCredit(1);\n } catch (err: any) {\n // if we're aborting out of the receive operation we don't need to report it (the user already\n // knows the link is being torn down or stopped)\n if (err.name !== \"AbortError\") {\n logger.logError(\n err,\n `[${this.logPrefix}] Failed to add credit after receiving message`,\n );\n await this._reportInternalError(err);\n }\n }\n }\n\n // If we've made it this far, then user's message handler completed fine. Let us try\n // completing the message.\n if (\n this.autoComplete &&\n this.receiveMode === \"peekLock\" &&\n !bMessage.delivery.remote_settled\n ) {\n try {\n logger.verbose(\n \"%s Auto completing the message with id '%s' on \" + \"the receiver.\",\n this.logPrefix,\n bMessage.messageId,\n );\n await completeMessage(bMessage, this._context, entityPath, this._retryOptions);\n } catch (completeError: any) {\n const translatedError = translateServiceBusError(completeError);\n logger.logError(\n translatedError,\n \"%s An error occurred while completing the message with id '%s' on the \" +\n \"receiver '%s'\",\n this.logPrefix,\n bMessage.messageId,\n this.name,\n );\n this._messageHandlers().processError({\n error: translatedError,\n errorSource: \"complete\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier,\n });\n }\n }\n };\n }\n\n private _reportInternalError(error: Error): Promise<void> {\n const messageHandlers = this._messageHandlers();\n\n if (messageHandlers.forwardInternalErrors) {\n const errorArgs: InternalProcessErrorArgs = {\n error,\n entityPath: this.entityPath,\n errorSource: \"internal\",\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n };\n\n return messageHandlers.processError(errorArgs as ProcessErrorArgs);\n }\n\n return Promise.resolve();\n }\n\n private _getHandlers(): ReceiverHandlers {\n return {\n onMessage: (context: EventContext) =>\n this._onAmqpMessage(context).catch((err) => this._reportInternalError(err)),\n onClose: (context: EventContext) =>\n this._onAmqpClose(context).catch((err) => this._reportInternalError(err)),\n onSessionClose: (context: EventContext) =>\n this._onSessionClose(context).catch((err) => this._reportInternalError(err)),\n onError: this._onAmqpError,\n onSessionError: this._onSessionError,\n };\n }\n\n async stopReceivingMessages(): Promise<void> {\n await this._receiverHelper.suspend();\n\n if (this._subscribeCallPromise) {\n await this._subscribeCallPromise;\n }\n }\n\n async close(): Promise<void> {\n await this._receiverHelper.suspend();\n return super.close();\n }\n\n private _subscribeCallPromise: Promise<void> | undefined;\n\n /**\n * Starts the receiver by establishing an AMQP session and an AMQP receiver link on the session.\n *\n * Any errors thrown by this function will also be sent to the messageHandlers.processError function\n * _and_ thrown, ultimately from this method.\n *\n * NOTE: This function retries _infinitely_ until success! It is completely up to the user to break\n * out of this retry cycle otherwise by:\n * 1. closing the receiver\n * 2. Calling `close` on the subscription instance they received when they initially called subscribe().\n * 3. aborting the abortSignal they passed in when calling subscribe (this also applies to initialization calls in onDetach)\n *\n * @param onMessage - The message handler to receive servicebus messages.\n * @param onError - The error handler to receive an error that occurs while receivin messages.\n */\n async subscribe(\n messageHandlers: InternalMessageHandlers,\n subscribeOptions: SubscribeOptions | undefined,\n ): Promise<void> {\n // these options and message handlers will be re-used if/when onDetach is called.\n this._subscribeOptions = subscribeOptions;\n this._setMessageHandlers(messageHandlers, subscribeOptions);\n\n let promiseResolve: (() => void) | undefined;\n this._subscribeCallPromise = new Promise((resolve) => {\n promiseResolve = resolve;\n });\n\n try {\n this._receiverHelper.resume();\n return await this._subscribeImpl(\"subscribe\");\n } catch (err: any) {\n // callers aren't going to be in a good position to forward this error properly\n // so we do it here.\n await this._messageHandlers().processError({\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n errorSource: \"receive\",\n error: err,\n identifier: this.identifier,\n });\n\n throw err;\n } finally {\n promiseResolve?.();\n this._subscribeCallPromise = undefined;\n }\n }\n\n /**\n * Wraps the individual message handlers with tracing and proper error handling\n * and assigns them to `this._messageHandlers`\n *\n * @param userHandlers - The user's message handlers\n * @param operationOptions - The subscribe(options)\n */\n private _setMessageHandlers(\n userHandlers: InternalMessageHandlers,\n operationOptions: OperationOptionsBase | undefined,\n ): void {\n const messageHandlers = {\n processError: async (args: ProcessErrorArgs) => {\n try {\n args.error = translateServiceBusError(args.error);\n await userHandlers.processError(args);\n } catch (err: any) {\n await this._reportInternalError(err);\n logger.logError(err, `An error was thrown from the user's processError handler`);\n }\n },\n processMessage: async (message: ServiceBusMessageImpl) => {\n try {\n await tracingClient.withSpan(\n \"StreamReceiver.process\",\n operationOptions ?? {},\n () => userHandlers.processMessage(message),\n toProcessingSpanOptions(message, this, this._context.config, \"process\"),\n );\n } catch (err: any) {\n this._messageHandlers().processError({\n error: err,\n errorSource: \"processMessageCallback\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n });\n throw err;\n }\n },\n postInitialize: async () => {\n if (!userHandlers.postInitialize) {\n return;\n }\n\n return userHandlers.postInitialize().catch((err) =>\n this._messageHandlers().processError({\n error: err,\n errorSource: \"processMessageCallback\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n }),\n );\n },\n preInitialize: async () => {\n if (!userHandlers.preInitialize) {\n return;\n }\n\n return userHandlers.preInitialize().catch((err) =>\n this._messageHandlers().processError({\n error: err,\n errorSource: \"processMessageCallback\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n }),\n );\n },\n forwardInternalErrors: userHandlers.forwardInternalErrors ?? false,\n };\n\n this._messageHandlers = () => messageHandlers;\n }\n\n /**\n * Subscribes using the already assigned `this._messageHandlers` and `this._subscribeOptions`\n *\n * @returns A promise that will resolve when a link is created and we successfully add credits to it.\n */\n private async _subscribeImpl(caller: \"detach\" | \"subscribe\"): Promise<void> {\n try {\n // we don't expect to ever get an error from retryForever but bugs\n // do happen.\n return await this._retryForeverFn({\n retryConfig: {\n connectionId: this._context.connection.id,\n operationType: RetryOperationType.receiverLink,\n abortSignal: this._subscribeOptions?.abortSignal,\n retryOptions: this._retryOptions,\n operation: () => this._initAndAddCreditOperation(caller),\n },\n onError: (err) =>\n this._messageHandlers().processError({\n error: err,\n errorSource: \"receive\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n }),\n logPrefix: this.logPrefix,\n logger,\n });\n } catch (err: any) {\n try {\n await this._receiverHelper.suspend();\n } catch (error: any) {\n logger.logError(error, `${this.logPrefix} receiver.suspend threw an error`);\n }\n\n throw err;\n }\n }\n\n /**\n * Initializes the link and adds credits. If any of these operations fail any created link will\n * be closed.\n *\n * @param caller - The caller which dictates whether or not we create a new name for our created link.\n * @param catchAndReportError - A function and reports an error but does not throw it.\n */\n private async _initAndAddCreditOperation(caller: \"detach\" | \"subscribe\"): Promise<void> {\n if (this._receiverHelper.isSuspended()) {\n // user has suspended us while we were initializing\n // the connection. Abort this attempt - if they attempt\n // resubscribe we'll just reinitialize.\n // This checks should happen before throwErrorIfConnectionClosed(); otherwise\n // we won't be able to break out of the retry-for-ever loops when user suspend us.\n throw new AbortError(\"Receiver was suspended during initialization.\");\n }\n\n throwErrorIfConnectionClosed(this._context);\n\n await this._messageHandlers().preInitialize();\n\n if (this._receiverHelper.isSuspended()) {\n // Need to check again as user can suspend us in preInitialize()\n throw new AbortError(\"Receiver was suspended during initialization.\");\n }\n await this._init(\n this._createReceiverOptions(caller === \"detach\", this._getHandlers()),\n this._subscribeOptions?.abortSignal,\n );\n\n try {\n await this._messageHandlers().postInitialize();\n this._receiverHelper.addCredit(this.maxConcurrentCalls);\n } catch (err: any) {\n try {\n await this.closeLink();\n } catch (error: any) {\n await this._messageHandlers().processError({\n error,\n errorSource: \"receive\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n });\n }\n throw err;\n }\n }\n\n /**\n * Will reconnect the receiver link if necessary.\n * @param receiverError - The receiver error or connection error, if any.\n */\n async onDetached(receiverError?: AmqpError | Error): Promise<void> {\n try {\n logger.verbose(`${this.logPrefix} onDetached: reinitializing link.`);\n\n // User explicitly called `close` on the receiver, so link is already closed\n // and we can exit early.\n if (this.wasClosedPermanently) {\n logger.verbose(\n `${this.logPrefix} onDetached: link has been closed permanently, not reinitializing. `,\n );\n return;\n }\n\n // Prevent multiple onDetached invocations from running concurrently.\n if (this._isDetaching) {\n // This can happen when the network connection goes down for some amount of time.\n // The first connection `disconnect` will trigger `onDetached` and attempt to retry\n // creating the connection/receiver link.\n // While those retry attempts fail (until the network connection comes back up),\n // we'll continue to see connection `disconnect` errors.\n // These should be ignored until the already running `onDetached` completes\n // its retry attempts or errors.\n logger.verbose(\n `${this.logPrefix} onDetached: Call to detached on streaming receiver '${this.name}' is already in progress.`,\n );\n return;\n }\n\n this._isDetaching = true;\n\n const translatedError = receiverError\n ? translateServiceBusError(receiverError)\n : receiverError;\n logger.logError(\n translatedError,\n `${this.logPrefix} onDetached: Reinitializing receiver because of error`,\n );\n\n // Clears the token renewal timer. Closes the link and its session if they are open.\n // Removes the link and its session if they are present in rhea's cache.\n await this.closeLink();\n } catch (err: any) {\n logger.verbose(\n `${this.logPrefix} onDetached: Encountered an error when closing the previous link: `,\n err,\n );\n }\n\n try {\n await this._subscribeImpl(\"detach\");\n } finally {\n this._isDetaching = false;\n }\n }\n\n protected removeLinkFromContext(): void {\n delete this._context.messageReceivers[this.name];\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { receiverLogger as logger } from \"../log\";\nimport {\n AmqpError,\n EventContext,\n OnAmqpEvent,\n ReceiverEvents,\n SessionEvents,\n Receiver as RheaPromiseReceiver,\n Session,\n} from \"rhea-promise\";\nimport { ServiceBusMessageImpl } from \"../serviceBusMessage\";\nimport { MessageReceiver, OnAmqpEventAsPromise, ReceiveOptions } from \"./messageReceiver\";\nimport { ConnectionContext } from \"../connectionContext\";\nimport { throwErrorIfConnectionClosed } from \"../util/errors\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { checkAndRegisterWithAbortSignal } from \"../util/utils\";\nimport { receiveDrainTimeoutInMs } from \"../util/constants\";\nimport { OperationOptionsBase } from \"../modelsToBeSharedWithEventHubs\";\nimport { toProcessingSpanOptions } from \"../diagnostics/instrumentServiceBusMessage\";\nimport { ReceiveMode } from \"../models\";\nimport { ServiceBusError, translateServiceBusError } from \"../serviceBusError\";\nimport { tracingClient } from \"../diagnostics/tracing\";\n\n/**\n * Describes the batching receiver where the user can receive a specified number of messages for\n * a predefined time.\n * @internal\n */\nexport class BatchingReceiver extends MessageReceiver {\n /**\n * Instantiate a new BatchingReceiver.\n *\n * @param identifier - name to identify this receiver.\n * @param connectionContext - The client entity context.\n * @param options - Options for how you'd like to connect.\n */\n constructor(\n identifier: string,\n connectionContext: ConnectionContext,\n entityPath: string,\n options: ReceiveOptions,\n ) {\n super(identifier, connectionContext, entityPath, \"batching\", options);\n\n this._batchingReceiverLite = new BatchingReceiverLite(\n connectionContext,\n entityPath,\n async (abortSignal?: AbortSignalLike): Promise<MinimalReceiver | undefined> => {\n let lastError: Error | AmqpError | undefined;\n\n const rcvrOptions = this._createReceiverOptions(false, {\n onError: (context) => {\n lastError = context?.receiver?.error;\n },\n onSessionError: (context) => {\n lastError = context?.session?.error;\n },\n onClose: async () => {\n /** Nothing to do here - the next call will just fail so they'll get an appropriate error from somewhere else. */\n },\n onSessionClose: async () => {\n /** Nothing to do here - the next call will just fail so they'll get an appropriate error from somewhere else. */\n },\n onMessage: async () => {\n /** Nothing to do here - we don't add credits initially so we don't need to worry about handling any messages.*/\n },\n });\n\n await this._init(rcvrOptions, abortSignal);\n\n if (lastError != null) {\n throw lastError;\n }\n\n return this.link;\n },\n this.receiveMode,\n options.skipParsingBodyAsJson ?? false,\n options.skipConvertingDate ?? false,\n );\n }\n\n private _batchingReceiverLite: BatchingReceiverLite;\n\n get isReceivingMessages(): boolean {\n return this._batchingReceiverLite.isReceivingMessages;\n }\n\n /**\n * To be called when connection is disconnected to gracefully close ongoing receive request.\n * @param connectionError - The connection error if any.\n */\n async onDetached(connectionError?: AmqpError | Error): Promise<void> {\n await this.closeLink();\n\n if (connectionError == null) {\n connectionError = new Error(\n \"Unknown error occurred on the AMQP connection while receiving messages.\",\n );\n }\n\n this._batchingReceiverLite.terminate(connectionError);\n }\n\n /**\n * Receives a batch of messages from a ServiceBus Queue/Topic.\n * @param maxMessageCount - The maximum number of messages to receive.\n * In Peeklock mode, this number is capped at 2047 due to constraints of the underlying buffer.\n * @param maxWaitTimeInMs - The total wait time in milliseconds until which the receiver will attempt to receive specified number of messages.\n * @param maxTimeAfterFirstMessageInMs - The total amount of time to wait after the first message\n * has been received. Defaults to 1 second.\n * If this time elapses before the `maxMessageCount` is reached, then messages collected till then will be returned to the user.\n * @returns A promise that resolves with an array of Message objects.\n */\n async receive(\n maxMessageCount: number,\n maxWaitTimeInMs: number,\n maxTimeAfterFirstMessageInMs: number,\n options: OperationOptionsBase,\n ): Promise<ServiceBusMessageImpl[]> {\n throwErrorIfConnectionClosed(this._context);\n try {\n const messages = await this._batchingReceiverLite.receiveMessages({\n maxMessageCount,\n maxWaitTimeInMs,\n maxTimeAfterFirstMessageInMs,\n ...options,\n });\n\n if (this._lockRenewer) {\n for (const message of messages) {\n this._lockRenewer.start(this, message, (_error) => {\n // the auto lock renewer already logs this in a detailed way. So this hook is mainly here\n // to potentially forward the error to the user (which we're not doing yet)\n });\n }\n }\n\n return messages;\n } catch (error: any) {\n logger.logError(error, \"[%s] Rejecting receiveMessages()\", this.logPrefix);\n throw error;\n }\n }\n\n static create(\n clientId: string,\n context: ConnectionContext,\n entityPath: string,\n options: ReceiveOptions,\n ): BatchingReceiver {\n throwErrorIfConnectionClosed(context);\n const bReceiver = new BatchingReceiver(clientId, context, entityPath, options);\n context.messageReceivers[bReceiver.name] = bReceiver;\n return bReceiver;\n }\n\n protected removeLinkFromContext(): void {\n delete this._context.messageReceivers[this.name];\n }\n}\n\n/**\n * Gets a function that returns the smaller of the two timeouts,\n * taking into account elapsed time from when getRemainingWaitTimeInMsFn\n * was called.\n *\n * @param maxWaitTimeInMs - Maximum time to wait for the first message\n * @param maxTimeAfterFirstMessageInMs - Maximum time to wait after the first message before completing the receive.\n *\n * @internal\n */\nexport function getRemainingWaitTimeInMsFn(\n maxWaitTimeInMs: number,\n maxTimeAfterFirstMessageInMs: number,\n): () => number {\n const startTimeMs = Date.now();\n\n return () => {\n const remainingTimeMs = maxWaitTimeInMs - (Date.now() - startTimeMs);\n\n if (remainingTimeMs < 0) {\n return 0;\n }\n\n return Math.min(remainingTimeMs, maxTimeAfterFirstMessageInMs);\n };\n}\n\n/**\n * Useful interface that mimics EventEmitter without requiring us to actually\n * import the events definition (which is annoying with browsers).\n *\n * @internal\n */\ntype EventEmitterLike<T extends RheaPromiseReceiver | Session> = Pick<\n T,\n \"once\" | \"removeListener\" | \"on\"\n>;\n\n/**\n * The bare minimum needed to receive messages for batched\n * message receiving.\n *\n * @internal\n */\nexport type MinimalReceiver = Pick<\n RheaPromiseReceiver,\n \"name\" | \"isOpen\" | \"credit\" | \"addCredit\" | \"drain\" | \"drainCredit\" | \"close\"\n> &\n EventEmitterLike<RheaPromiseReceiver> & {\n session: EventEmitterLike<Session>;\n } & {\n connection: {\n id: string;\n };\n };\n\n/**\n * @internal\n */\ntype MessageAndDelivery = Pick<EventContext, \"message\" | \"delivery\">;\n\n/**\n * @internal\n */\ninterface ReceiveMessageArgs extends OperationOptionsBase {\n maxMessageCount: number;\n maxWaitTimeInMs: number;\n maxTimeAfterFirstMessageInMs: number;\n}\n\n/**\n * The internals of a batching receiver minus anything that would require us to hold onto a client entity context\n * or a receiver on a permanent basis.\n *\n * Usable with both session and non-session receivers.\n *\n * @internal\n */\nexport class BatchingReceiverLite {\n // testing hook\n private _drainTimeoutInMs: number = receiveDrainTimeoutInMs;\n constructor(\n private _connectionContext: ConnectionContext,\n public entityPath: string,\n private _getCurrentReceiver: (\n abortSignal?: AbortSignalLike,\n ) => Promise<MinimalReceiver | undefined>,\n private _receiveMode: ReceiveMode,\n _skipParsingBodyAsJson: boolean,\n _skipConvertingDate: boolean,\n ) {\n this._createServiceBusMessage = (context: MessageAndDelivery) => {\n return new ServiceBusMessageImpl(\n context.message!,\n context.delivery!,\n true,\n this._receiveMode,\n _skipParsingBodyAsJson,\n _skipConvertingDate,\n );\n };\n\n this._getRemainingWaitTimeInMsFn = (\n maxWaitTimeInMs: number,\n maxTimeAfterFirstMessageInMs: number,\n ) => getRemainingWaitTimeInMsFn(maxWaitTimeInMs, maxTimeAfterFirstMessageInMs);\n\n this.isReceivingMessages = false;\n }\n\n private _createServiceBusMessage: (\n context: Pick<EventContext, \"message\" | \"delivery\">,\n ) => ServiceBusMessageImpl;\n\n private _getRemainingWaitTimeInMsFn: typeof getRemainingWaitTimeInMsFn;\n private _closeHandler: ((connectionError?: AmqpError | Error) => void) | undefined;\n private _finalAction: (() => void) | undefined;\n\n isReceivingMessages: boolean;\n\n /**\n * Receives a set of messages,\n *\n * @internal\n * @hidden\n */\n public async receiveMessages(args: ReceiveMessageArgs): Promise<ServiceBusMessageImpl[]> {\n try {\n this.isReceivingMessages = true;\n const receiver = await this._getCurrentReceiver(args.abortSignal);\n\n if (receiver == null) {\n // (was somehow closed in between the init() and the return)\n throw new ServiceBusError(\"Link closed before receiving messages.\", \"GeneralError\");\n }\n\n const messages = await new Promise<ServiceBusMessageImpl[]>((resolve, reject) =>\n this._receiveMessagesImpl(receiver, args, resolve, reject),\n );\n return tracingClient.withSpan(\n \"BatchingReceiverLite.process\",\n args,\n () => messages,\n toProcessingSpanOptions(messages, this, this._connectionContext.config, \"process\"),\n );\n } finally {\n this._closeHandler = undefined;\n this.isReceivingMessages = false;\n }\n }\n\n /**\n * Closes the receiver (optionally with an error), cancelling any current operations.\n *\n * @param connectionError - An optional error (rhea doesn't always deliver one for certain disconnection events)\n */\n terminate(connectionError?: Error | AmqpError): void {\n if (this._closeHandler) {\n this._closeHandler(connectionError);\n this._closeHandler = undefined;\n }\n }\n\n private async tryDrainReceiver(\n receiver: MinimalReceiver,\n loggingPrefix: string,\n remainingWaitTimeInMs: number,\n abortSignal?: AbortSignalLike,\n ): Promise<void> {\n if (!receiver.isOpen() || receiver.credit <= 0) {\n return;\n }\n let drainTimedout: boolean = false;\n let drainTimer: ReturnType<typeof setTimeout>;\n const timeToWaitInMs = Math.max(this._drainTimeoutInMs, remainingWaitTimeInMs);\n const drainPromise = new Promise<void>((resolve) => {\n function drainListener() {\n logger.verbose(`${loggingPrefix} Receiver has been drained.`);\n clearTimeout(drainTimer);\n resolve();\n }\n function removeListeners() {\n abortSignal?.removeEventListener(\"abort\", onAbort);\n receiver.removeListener(ReceiverEvents.receiverDrained, drainListener);\n }\n function onAbort() {\n removeListeners();\n clearTimeout(drainTimer);\n resolve();\n }\n\n drainTimer = setTimeout(() => {\n drainTimedout = true;\n removeListeners();\n resolve();\n }, timeToWaitInMs);\n receiver.once(ReceiverEvents.receiverDrained, drainListener);\n abortSignal?.addEventListener(\"abort\", onAbort);\n });\n\n receiver.drainCredit();\n logger.verbose(\n `${loggingPrefix} Draining leftover credits(${receiver.credit}), waiting for event_drained event, or timing out after ${timeToWaitInMs} milliseconds...`,\n );\n await drainPromise;\n if (drainTimedout) {\n logger.warning(\n `${loggingPrefix} Time out after ${timeToWaitInMs} milliseconds when draining credits. Closing receiver...`,\n );\n // Close the receiver link since we have not received the receiver drain event\n // to prevent out-of-sync state between local and remote\n await receiver.close();\n }\n\n // Turn off draining.\n receiver.drain = false;\n }\n\n private _receiveMessagesImpl(\n receiver: MinimalReceiver,\n args: ReceiveMessageArgs,\n origResolve: (messages: ServiceBusMessageImpl[]) => void,\n origReject: (err: Error | AmqpError) => void,\n ): void {\n const getRemainingWaitTimeInMs = this._getRemainingWaitTimeInMsFn(\n args.maxWaitTimeInMs,\n args.maxTimeAfterFirstMessageInMs,\n );\n\n const brokeredMessages: ServiceBusMessageImpl[] = [];\n const loggingPrefix = `[${receiver.connection.id}|r:${receiver.name}]`;\n\n let totalWaitTimer: NodeJS.Timeout | undefined;\n // eslint-disable-next-line prefer-const\n let cleanupBeforeResolveOrReject: () => void;\n\n const rejectAfterCleanup = (err: Error | AmqpError): void => {\n cleanupBeforeResolveOrReject();\n origReject(err);\n };\n\n const resolveImmediately = (result: ServiceBusMessageImpl[]): void => {\n cleanupBeforeResolveOrReject();\n origResolve(result);\n };\n\n const resolveAfterPendingMessageCallbacks = (result: ServiceBusMessageImpl[]): void => {\n // NOTE: through rhea-promise, most of our event handlers are made asynchronous by calling setTimeout(emit).\n // However, a small set (*error and drain) execute immediately. This can lead to a situation where the logical\n // ordering of events is correct but the execution order is incorrect because the events are not all getting\n // put into the task queue the same way.\n // setTimeout() ensures that we resolve _after_ any already-queued onMessage handlers that may\n // be waiting in the task queue.\n setTimeout(() => {\n cleanupBeforeResolveOrReject();\n origResolve(result);\n });\n };\n\n const onError: OnAmqpEvent = (context: EventContext) => {\n const eventType = context.session?.error != null ? \"session_error\" : \"receiver_error\";\n let error = context.session?.error || context.receiver?.error;\n\n if (error) {\n error = translateServiceBusError(error);\n logger.logError(error, `${loggingPrefix} '${eventType}' event occurred. Received an error`);\n } else {\n error = new ServiceBusError(\"An error occurred while receiving messages.\", \"GeneralError\");\n }\n rejectAfterCleanup(error);\n };\n\n this._closeHandler = (error?: AmqpError | Error): void => {\n if (\n // no error, just closing. Go ahead and return what we have.\n error == null ||\n // Return the collected messages if in ReceiveAndDelete mode because otherwise they are lost forever\n (this._receiveMode === \"receiveAndDelete\" && brokeredMessages.length)\n ) {\n logger.verbose(\n `${loggingPrefix} Closing. Resolving with ${brokeredMessages.length} messages.`,\n );\n return resolveAfterPendingMessageCallbacks(brokeredMessages);\n }\n\n rejectAfterCleanup(translateServiceBusError(error));\n };\n\n let abortSignalCleanupFunction: (() => void) | undefined = undefined;\n\n // Final action to be performed after\n // - maxMessageCount is reached or\n // - maxWaitTime is passed or\n // - newMessageWaitTimeoutInSeconds is passed since the last message was received\n this._finalAction = async (): Promise<void> => {\n if (receiver.drain) {\n // If a drain is already in process then we should let it complete. Some messages might still be in flight, but they will\n // arrive before the drain completes.\n logger.verbose(`${loggingPrefix} Already draining.`);\n return;\n }\n\n const remainingWaitTimeInMs = getRemainingWaitTimeInMs();\n await this.tryDrainReceiver(receiver, loggingPrefix, remainingWaitTimeInMs, args.abortSignal);\n logger.verbose(\n `${loggingPrefix} Resolving receiveMessages() with ${brokeredMessages.length} messages.`,\n );\n resolveImmediately(brokeredMessages);\n };\n\n // Action to be performed on the \"message\" event.\n const onReceiveMessage: OnAmqpEventAsPromise = async (context: EventContext) => {\n // TODO: this appears to be aggravating a bug that we need to look into more deeply.\n // The same timeout+drain sequence should work fine for receiveAndDelete but it appears\n // to cause problems.\n if (this._receiveMode === \"peekLock\") {\n if (brokeredMessages.length === 0) {\n // We'll now remove the old timer (which was the overall `maxWaitTimeMs` timer)\n // and replace it with another timer that is a (probably) much shorter interval.\n //\n // This allows the user to get access to received messages earlier and also gives us\n // a chance to have fewer messages internally that could get lost if the user's\n // app crashes.\n if (totalWaitTimer) clearTimeout(totalWaitTimer);\n const remainingWaitTimeInMs = getRemainingWaitTimeInMs();\n totalWaitTimer = setTimeout(() => {\n logger.verbose(\n `${loggingPrefix} Batching, waited for ${remainingWaitTimeInMs} milliseconds after receiving the first message.`,\n );\n this._finalAction!();\n }, remainingWaitTimeInMs);\n }\n }\n\n try {\n const data: ServiceBusMessageImpl = this._createServiceBusMessage(context);\n brokeredMessages.push(data);\n\n // NOTE: we used to actually \"lose\" any extra messages. At this point I've fixed the areas that were causing us to receive\n // extra messages but if this bug arises in some other way it's better to return the message than it would be to let it be\n // silently dropped on the floor.\n if (brokeredMessages.length > args.maxMessageCount) {\n logger.warning(\n `More messages arrived than expected: ${args.maxMessageCount} vs ${brokeredMessages.length}`,\n );\n }\n } catch (err: any) {\n const errObj = err instanceof Error ? err : new Error(JSON.stringify(err));\n logger.logError(\n err,\n `${loggingPrefix} Received an error while converting AmqpMessage to ServiceBusMessage`,\n );\n rejectAfterCleanup(errObj);\n }\n if (brokeredMessages.length >= args.maxMessageCount) {\n this._finalAction!();\n }\n };\n\n const onClose: OnAmqpEventAsPromise = async (context: EventContext) => {\n const type = context.session?.error != null ? \"session_closed\" : \"receiver_closed\";\n const error = context.session?.error || context.receiver?.error;\n\n if (error) {\n logger.logError(error, `${loggingPrefix} '${type}' event occurred. The associated error`);\n }\n };\n\n cleanupBeforeResolveOrReject = (): void => {\n if (receiver != null) {\n receiver.removeListener(ReceiverEvents.receiverError, onError);\n receiver.removeListener(ReceiverEvents.message, onReceiveMessage);\n receiver.session.removeListener(SessionEvents.sessionError, onError);\n receiver.removeListener(ReceiverEvents.receiverClose, onClose);\n receiver.session.removeListener(SessionEvents.sessionClose, onClose);\n }\n\n if (totalWaitTimer) {\n clearTimeout(totalWaitTimer);\n }\n\n if (abortSignalCleanupFunction) {\n abortSignalCleanupFunction();\n }\n abortSignalCleanupFunction = undefined;\n };\n\n abortSignalCleanupFunction = checkAndRegisterWithAbortSignal((err) => {\n if (receiver.drain) {\n // If a drain is already in process and we cancel, the link state may be out of sync\n // with remote. Reset the link so that we will have fresh start.\n receiver.close();\n }\n rejectAfterCleanup(err);\n }, args.abortSignal);\n\n // By adding credit here, we let the service know that at max we can handle `maxMessageCount`\n // number of messages concurrently. We will return the user an array of messages that can\n // be of size upto maxMessageCount. Then the user needs to accordingly dispose\n // (complete/abandon/defer/deadletter) the messages from the array.\n const creditToAdd = args.maxMessageCount - receiver.credit;\n logger.verbose(\n `${loggingPrefix} Ensure enough credit for receiving ${args.maxMessageCount} messages. Current: ${receiver.credit}. To add: ${creditToAdd}.`,\n );\n\n if (creditToAdd > 0) {\n receiver.addCredit(creditToAdd);\n }\n\n logger.verbose(\n `${loggingPrefix} Setting the wait timer for ${args.maxWaitTimeInMs} milliseconds.`,\n );\n\n totalWaitTimer = setTimeout(() => {\n logger.verbose(\n `${loggingPrefix} Batching, waited for max wait time ${args.maxWaitTimeInMs} milliseconds.`,\n );\n this._finalAction!();\n }, args.maxWaitTimeInMs);\n\n receiver.on(ReceiverEvents.message, onReceiveMessage);\n receiver.on(ReceiverEvents.receiverError, onError);\n receiver.on(ReceiverEvents.receiverClose, onClose);\n\n receiver.session.on(SessionEvents.sessionError, onError);\n receiver.session.on(SessionEvents.sessionClose, onClose);\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ConnectionContext } from \"../connectionContext\";\nimport { receiverLogger as logger } from \"../log\";\nimport { ServiceBusMessageImpl } from \"../serviceBusMessage\";\nimport { calculateRenewAfterDuration } from \"../util/utils\";\nimport { LinkEntity } from \"./linkEntity\";\nimport { OnErrorNoContext } from \"./messageReceiver\";\n\n/**\n * @internal\n */\nexport type RenewableMessageProperties = Readonly<\n Pick<ServiceBusMessageImpl, \"lockToken\" | \"messageId\">\n> &\n // updated when we renew the lock\n Pick<ServiceBusMessageImpl, \"lockedUntilUtc\">;\n\n/**\n * @internal\n */\ntype MinimalLink = Pick<LinkEntity<any>, \"name\" | \"logPrefix\" | \"entityPath\">;\n\n/**\n * Tracks locks for messages, renewing until a configurable duration.\n *\n * @internal\n */\nexport class LockRenewer {\n /**\n * A map of link names to individual maps for each\n * link that map a message ID to its auto-renewal timer.\n */\n private _messageRenewLockTimers = new Map<string, Map<string, NodeJS.Timeout | undefined>>();\n\n // just here for make unit testing a bit easier.\n private _calculateRenewAfterDuration: typeof calculateRenewAfterDuration;\n\n constructor(\n private _context: Pick<ConnectionContext, \"getManagementClient\">,\n private _maxAutoRenewDurationInMs: number,\n ) {\n this._calculateRenewAfterDuration = calculateRenewAfterDuration;\n }\n\n /**\n * Creates an AutoLockRenewer.\n *\n * @param linkEntity - Your link entity instance (probably 'this')\n * @param context - The connection context for your link entity (probably 'this._context')\n * @param options - The ReceiveOptions passed through to your message receiver.\n * @returns if the lock mode is peek lock (or if is unspecified, thus defaulting to peekLock)\n * and the options.maxAutoLockRenewalDurationInMs is greater than 0..Otherwise, returns undefined.\n */\n static create(\n context: Pick<ConnectionContext, \"getManagementClient\">,\n maxAutoRenewLockDurationInMs: number,\n receiveMode: \"peekLock\" | \"receiveAndDelete\",\n ): LockRenewer | undefined {\n if (receiveMode !== \"peekLock\") {\n return undefined;\n }\n\n if (maxAutoRenewLockDurationInMs <= 0) {\n return undefined;\n }\n\n return new LockRenewer(context, maxAutoRenewLockDurationInMs);\n }\n\n /**\n * Cancels all pending lock renewals for messages on given link and removes all entries from our internal cache.\n */\n stopAll(linkEntity: MinimalLink): void {\n logger.verbose(\n `${linkEntity.logPrefix} Clearing message renew lock timers for all the active messages.`,\n );\n\n const messagesForLink = this._messageRenewLockTimers.get(linkEntity.name);\n\n if (messagesForLink == null) {\n return;\n }\n\n for (const messageId of messagesForLink.keys()) {\n this._stopAndRemoveById(linkEntity, messagesForLink, messageId);\n }\n\n this._messageRenewLockTimers.delete(linkEntity.name);\n }\n\n /**\n * Stops lock renewal for a single message.\n *\n * @param bMessage - The message whose lock renewal we will stop.\n */\n stop(linkEntity: MinimalLink, bMessage: RenewableMessageProperties): void {\n const messageId = bMessage.messageId as string;\n\n const messagesForLink = this._messageRenewLockTimers.get(linkEntity.name);\n\n if (messagesForLink == null) {\n return;\n }\n\n this._stopAndRemoveById(linkEntity, messagesForLink, messageId);\n }\n\n /**\n * Starts lock renewal for a single message.\n *\n * @param bMessage - The message whose lock renewal we will start.\n */\n start(\n linkEntity: MinimalLink,\n bMessage: RenewableMessageProperties,\n onError: OnErrorNoContext,\n ): void {\n try {\n const logPrefix = linkEntity.logPrefix;\n\n if (bMessage.lockToken == null) {\n throw new Error(\n `Can't start auto lock renewal for message with message id '${bMessage.messageId}' since it does not have a lock token.`,\n );\n }\n\n const lockToken = bMessage.lockToken;\n const linkMessageMap = this._getOrCreateMapForLink(linkEntity);\n // - We need to renew locks before they expire by looking at bMessage.lockedUntilUtc.\n // - This autorenewal needs to happen **NO MORE** than maxAutoRenewDurationInMs\n // - We should be able to clear the renewal timer when the user's message handler\n // is done (whether it succeeds or fails).\n // Setting the messageId with undefined value in the linkMessageMap because we\n // track state by checking the presence of messageId in the map. It is removed from the map\n // when an attempt is made to settle the message (either by the user or by the sdk) OR\n // when the execution of user's message handler completes.\n linkMessageMap.set(bMessage.messageId as string, undefined);\n\n logger.verbose(\n `${logPrefix} message with id '${\n bMessage.messageId\n }' is locked until ${bMessage.lockedUntilUtc!.toString()}.`,\n );\n const totalAutoLockRenewDuration = Date.now() + this._maxAutoRenewDurationInMs;\n const totalAutoLockRenewDurationDate = new Date(totalAutoLockRenewDuration);\n logger.verbose(\n `${logPrefix} Total autolockrenew duration for message with id '${\n bMessage.messageId\n }' is: ${totalAutoLockRenewDurationDate.toString()}`,\n );\n\n const autoRenewLockTask = (): void => {\n const renewalNeededToMaintainLock =\n // if the lock expires _after_ our max auto-renew duration there's no reason to\n // spin up an auto-renewer - it's already held for the duration.\n totalAutoLockRenewDurationDate > bMessage.lockedUntilUtc!;\n\n if (!renewalNeededToMaintainLock) {\n logger.verbose(\n `${logPrefix} Autolockrenew not needed as message's lockedUntilUtc ${bMessage.lockedUntilUtc} is after the total autolockrenew duration ${totalAutoLockRenewDurationDate} for message with messageId '${bMessage.messageId}'. Hence we will stop the autoLockRenewTask.`,\n );\n this.stop(linkEntity, bMessage);\n } else if (Date.now() >= totalAutoLockRenewDuration) {\n // once we've exceeded the max amount of time we'll renew we can stop.\n logger.verbose(\n `${logPrefix} Current time ${new Date()} exceeds the total autolockrenew duration ${totalAutoLockRenewDurationDate} for message with messageId '${\n bMessage.messageId\n }'. Hence we will stop the autoLockRenewTask.`,\n );\n this.stop(linkEntity, bMessage);\n } else {\n if (linkMessageMap.has(bMessage.messageId as string)) {\n // TODO: We can run into problems with clock skew between the client and the server.\n // It would be better to calculate the duration based on the \"lockDuration\" property\n // of the queue. However, we do not have the management plane of the client ready for\n // now. Hence we rely on the lockedUntilUtc property on the message set by ServiceBus.\n const amount = this._calculateRenewAfterDuration(bMessage.lockedUntilUtc!);\n\n logger.verbose(\n `${logPrefix} Sleeping for ${amount} milliseconds while renewing the lock for message with id '${bMessage.messageId}'`,\n );\n // Setting the value of the messageId to the actual timer. This will be cleared when\n // an attempt is made to settle the message (either by the user or by the sdk) OR\n // when the execution of user's message handler completes.\n const autoRenewTimer = setTimeout(async () => {\n try {\n logger.verbose(\n `${logPrefix} Attempting to renew the lock for message with id '${bMessage.messageId}'.`,\n );\n\n bMessage.lockedUntilUtc = await this._context\n .getManagementClient(linkEntity.entityPath)\n .renewLock(lockToken, {\n associatedLinkName: linkEntity.name,\n });\n logger.verbose(\n `${logPrefix} Successfully renewed the lock for message with id '${bMessage.messageId}'. Starting next auto-lock-renew cycle for message.`,\n );\n\n autoRenewLockTask();\n } catch (err: any) {\n logger.logError(\n err,\n `${logPrefix} An error occurred while auto renewing the message lock '${bMessage.lockToken}' for message with id '${bMessage.messageId}'`,\n );\n onError(err);\n }\n }, amount);\n\n // Prevent the active Timer from keeping the Node.js event loop active.\n if (typeof autoRenewTimer.unref === \"function\") {\n autoRenewTimer.unref();\n }\n\n linkMessageMap.set(bMessage.messageId as string, autoRenewTimer);\n } else {\n logger.verbose(\n `${logPrefix} Looks like the message lock renew timer has already been cleared for message with id '${bMessage.messageId}'.`,\n );\n }\n }\n };\n\n // start\n autoRenewLockTask();\n } catch (err: any) {\n onError(err);\n }\n }\n\n private _getOrCreateMapForLink(linkEntity: MinimalLink): Map<string, NodeJS.Timeout | undefined> {\n if (!this._messageRenewLockTimers.has(linkEntity.name)) {\n this._messageRenewLockTimers.set(\n linkEntity.name,\n new Map<string, NodeJS.Timeout | undefined>(),\n );\n }\n\n return this._messageRenewLockTimers.get(linkEntity.name)!;\n }\n\n private _stopAndRemoveById(\n linkEntity: MinimalLink,\n linkMessageMap: Map<string, NodeJS.Timeout | undefined>,\n messageId: string | undefined,\n ): void {\n if (messageId == null) {\n throw new Error(\"Failed to stop auto lock renewal - no message ID\");\n }\n\n // TODO: messageId doesn't actually need to be unique. Perhaps we should use lockToken\n // instead?\n if (linkMessageMap.has(messageId)) {\n clearTimeout(linkMessageMap.get(messageId) as NodeJS.Timeout);\n logger.verbose(\n `${linkEntity.logPrefix} Cleared the message renew lock timer for message with id '${messageId}'.`,\n );\n linkMessageMap.delete(messageId);\n }\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n PeekMessagesOptions,\n GetMessageIteratorOptions,\n MessageHandlers,\n ReceiveMessagesOptions,\n SubscribeOptions,\n DeleteMessagesOptions,\n PurgeMessagesOptions,\n} from \"../models\";\nimport { OperationOptionsBase } from \"../modelsToBeSharedWithEventHubs\";\nimport { ServiceBusReceivedMessage } from \"../serviceBusMessage\";\nimport { ConnectionContext } from \"../connectionContext\";\nimport {\n getAlreadyReceivingErrorMsg,\n getReceiverClosedErrorMsg,\n InvalidMaxMessageCountError,\n throwErrorIfConnectionClosed,\n throwTypeErrorIfParameterMissing,\n throwTypeErrorIfParameterNotLong,\n throwErrorIfInvalidOperationOnMessage,\n throwTypeErrorIfParameterTypeMismatch,\n} from \"../util/errors\";\nimport { ReceiveOptions } from \"../core/messageReceiver\";\nimport { StreamingReceiver } from \"../core/streamingReceiver\";\nimport { BatchingReceiver } from \"../core/batchingReceiver\";\nimport {\n abandonMessage,\n assertValidMessageHandlers,\n completeMessage,\n deadLetterMessage,\n deferMessage,\n getMessageIterator,\n} from \"./receiverCommon\";\nimport Long from \"long\";\nimport { ServiceBusMessageImpl, DeadLetterOptions } from \"../serviceBusMessage\";\nimport { Constants, RetryConfig, RetryOperationType, RetryOptions, retry } from \"@azure/core-amqp\";\nimport { LockRenewer } from \"../core/autoLockRenewer\";\nimport { receiverLogger as logger } from \"../log\";\nimport { translateServiceBusError } from \"../serviceBusError\";\nimport { ensureValidIdentifier } from \"../util/utils\";\nimport { toSpanOptions, tracingClient } from \"../diagnostics/tracing\";\nimport { extractSpanContextFromServiceBusMessage } from \"../diagnostics/instrumentServiceBusMessage\";\nimport { TracingSpanLink } from \"@azure/core-tracing\";\n\n/**\n * The default time to wait for messages _after_ the first message\n * has been received.\n *\n * This timeout only applies to receiveMessages()\n *\n * @internal\n */\nexport const defaultMaxTimeAfterFirstMessageForBatchingMs = 1000;\n\n/**\n * The maximum number of messages to delete in a single batch. This cap is established and enforced by the service.\n * @internal\n */\nexport const MaxDeleteMessageCount = 4000;\n\n/**\n * A receiver that does not handle sessions.\n */\nexport interface ServiceBusReceiver {\n /**\n * A name used to identify the receiver. This can be used to correlate logs and exceptions.\n * If not specified or empty, a random unique one will be generated.\n */\n identifier: string;\n\n /**\n * Streams messages to message handlers.\n * @param handlers - A handler that gets called for messages and errors.\n * @param options - Options for subscribe.\n * @returns An object that can be closed, sending any remaining messages to `handlers` and\n * stopping new messages from arriving.\n */\n subscribe(\n handlers: MessageHandlers,\n options?: SubscribeOptions,\n ): {\n /**\n * Causes the subscriber to stop receiving new messages.\n */\n close(): Promise<void>;\n };\n\n /**\n * Returns an iterator that can be used to receive messages from Service Bus.\n *\n * @param options - A set of options to control the receive operation.\n * - `abortSignal`: The signal to use to abort the ongoing operation.\n *\n * @throws Error if the underlying connection, client or receiver is closed.\n * @throws Error if current receiver is already in state of receiving messages.\n * @throws `ServiceBusError` if the service returns an error while receiving messages.\n */\n getMessageIterator(\n options?: GetMessageIteratorOptions,\n ): AsyncIterableIterator<ServiceBusReceivedMessage>;\n\n /**\n * Returns a promise that resolves to an array of messages received from Service Bus.\n *\n * @param maxMessageCount - The maximum number of messages to receive.\n * @param options - A set of options to control the receive operation.\n * - `maxWaitTimeInMs`: The maximum time to wait for the first message before returning an empty array if no messages are available.\n * - `abortSignal`: The signal to use to abort the ongoing operation.\n * @returns A promise that resolves with an array of messages.\n * @throws Error if the underlying connection, client or receiver is closed.\n * @throws Error if current receiver is already in state of receiving messages.\n * @throws `ServiceBusError` if the service returns an error while receiving messages.\n */\n receiveMessages(\n maxMessageCount: number,\n options?: ReceiveMessagesOptions,\n ): Promise<ServiceBusReceivedMessage[]>;\n\n /**\n * Returns a promise that resolves to an array of deferred messages identified by given `sequenceNumbers`.\n * @param sequenceNumbers - The sequence number or an array of sequence numbers for the messages that need to be received.\n * @param options - Options bag to pass an abort signal or tracing options.\n * @returns A list of messages identified by the given sequenceNumbers or an empty list if no messages are found.\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while receiving deferred messages.\n */\n receiveDeferredMessages(\n sequenceNumbers: Long | Long[],\n options?: OperationOptionsBase,\n ): Promise<ServiceBusReceivedMessage[]>;\n\n /**\n * Peek the next batch of active messages (including deferred but not deadlettered messages) on the\n * queue or subscription without modifying them.\n * - The first call to `peekMessages()` fetches the first active message. Each subsequent call fetches the\n * subsequent message.\n * - Unlike a \"received\" message, \"peeked\" message is a read-only version of the message.\n * It cannot be `Completed/Abandoned/Deferred/Deadlettered`.\n * @param maxMessageCount - The maximum number of messages to peek.\n * @param options - Options that allow to specify the maximum number of messages to peek,\n * the sequenceNumber to start peeking from or an abortSignal to abort the operation.\n */\n peekMessages(\n maxMessageCount: number,\n options?: PeekMessagesOptions,\n ): Promise<ServiceBusReceivedMessage[]>;\n\n /**\n * Delete messages. If no option is specified, all messages will be deleted.\n *\n * @param options - Options to configure the operation.\n * @returns number of messages that have been deleted.\n */\n deleteMessages(options: DeleteMessagesOptions): Promise<number>;\n\n /**\n * Attempts to purge all messages from an entity. Locked messages are not eligible for removal and\n * will remain in the entity.\n *\n * @param options - Options that allow to specify the cutoff time for deletion. Only messages that were enqueued\n * before this time will be deleted. If not specified, current time will be used.\n * @returns number of messages deleted.\n */\n purgeMessages(options?: PurgeMessagesOptions): Promise<number>;\n\n /**\n * Path of the entity for which the receiver has been created.\n */\n entityPath: string;\n /**\n * The receive mode used to create the receiver.\n */\n receiveMode: \"peekLock\" | \"receiveAndDelete\";\n /**\n * Returns `true` if either the receiver or the client that created it has been closed.\n * @readonly\n */\n isClosed: boolean;\n /**\n * Closes the receiver.\n * Once closed, the receiver cannot be used for any further operations.\n * Use the `createReceiver()` method on the ServiceBusClient to create a new Receiver.\n */\n close(): Promise<void>;\n /**\n * Removes the message from Service Bus.\n *\n * @throws Error with name `SessionLockLostError` (for messages from a Queue/Subscription with sessions enabled)\n * if the AMQP link with which the message was received is no longer alive. This can\n * happen either because the lock on the session expired or the receiver was explicitly closed by\n * the user or the AMQP link is closed by the library due to network loss or service error.\n * @throws Error with name `MessageLockLostError` (for messages from a Queue/Subscription with sessions not enabled)\n * if the lock on the message has expired or the AMQP link with which the message was received is\n * no longer alive. The latter can happen if the receiver was explicitly closed by the user or the\n * AMQP link got closed by the library due to network loss or service error.\n * @throws Error if the message is already settled.\n * property on the message if you are not sure whether the message is settled.\n * @throws Error if used in `receiveAndDelete` mode because all messages received in this mode\n * are pre-settled. To avoid this error, update your code to not settle a message which is received\n * in this mode.\n * @throws Error with name `ServiceUnavailableError` if Service Bus does not acknowledge the request to settle\n * the message in time. The message may or may not have been settled successfully.\n */\n completeMessage(message: ServiceBusReceivedMessage): Promise<void>;\n /**\n * The lock held on the message by the receiver is let go, making the message available again in\n * Service Bus for another receive operation.\n *\n * @throws `ServiceBusError` with the code `SessionLockLost` (for messages from a Queue/Subscription with sessions enabled)\n * if the AMQP link with which the message was received is no longer alive. This can\n * happen either because the lock on the session expired or the receiver was explicitly closed by\n * the user or the AMQP link is closed by the library due to network loss or service error.\n * @throws `ServiceBusError` with the code `MessageLockLost` (for messages from a Queue/Subscription with sessions not enabled)\n * if the lock on the message has expired or the AMQP link with which the message was received is\n * no longer alive. The latter can happen if the receiver was explicitly closed by the user or the\n * AMQP link got closed by the library due to network loss or service error.\n * @throws Error if the message is already settled.\n * property on the message if you are not sure whether the message is settled.\n * @throws Error if used in `receiveAndDelete` mode because all messages received in this mode\n * are pre-settled. To avoid this error, update your code to not settle a message which is received\n * in this mode.\n * @throws `ServiceBusError` with the code `ServiceTimeout` if Service Bus does not acknowledge the request to settle\n * the message in time. The message may or may not have been settled successfully.\n *\n * @param propertiesToModify - The properties of the message to modify while abandoning the message.\n */\n abandonMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void>;\n /**\n * Defers the processing of the message. Save the `sequenceNumber` of the message, in order to\n * receive it message again in the future using the `receiveDeferredMessage` method.\n *\n * @throws `ServiceBusError` with the code `SessionLockLost` (for messages from a Queue/Subscription with sessions enabled)\n * if the AMQP link with which the message was received is no longer alive. This can\n * happen either because the lock on the session expired or the receiver was explicitly closed by\n * the user or the AMQP link is closed by the library due to network loss or service error.\n * @throws `ServiceBusError` with the code `MessageLockLost` (for messages from a Queue/Subscription with sessions not enabled)\n * if the lock on the message has expired or the AMQP link with which the message was received is\n * no longer alive. The latter can happen if the receiver was explicitly closed by the user or the\n * AMQP link got closed by the library due to network loss or service error.\n * @throws Error if the message is already settled.\n * property on the message if you are not sure whether the message is settled.\n * @throws Error if used in `receiveAndDelete` mode because all messages received in this mode\n * are pre-settled. To avoid this error, update your code to not settle a message which is received\n * in this mode.\n * @throws `ServiceBusError` with the code `ServiceTimeout` if Service Bus does not acknowledge the request to settle\n * the message in time. The message may or may not have been settled successfully.\n *\n * @param propertiesToModify - The properties of the message to modify while deferring the message\n */\n deferMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void>;\n /**\n * Moves the message to the deadletter sub-queue. To receive a deadletted message, create a new\n * QueueClient/SubscriptionClient using the path for the deadletter sub-queue.\n *\n * @throws `ServiceBusError` with the code `SessionLockLost` (for messages from a Queue/Subscription with sessions enabled)\n * if the AMQP link with which the message was received is no longer alive. This can\n * happen either because the lock on the session expired or the receiver was explicitly closed by\n * the user or the AMQP link is closed by the library due to network loss or service error.\n * @throws `ServiceBusError` with the code `MessageLockLost` (for messages from a Queue/Subscription with sessions not enabled)\n * if the lock on the message has expired or the AMQP link with which the message was received is\n * no longer alive. The latter can happen if the receiver was explicitly closed by the user or the\n * AMQP link got closed by the library due to network loss or service error.\n * @throws Error if the message is already settled.\n * property on the message if you are not sure whether the message is settled.\n * @throws Error if used in `receiveAndDelete` mode because all messages received in this mode\n * are pre-settled. To avoid this error, update your code to not settle a message which is received\n * in this mode.\n * @throws `ServiceBusError` with the code `ServiceTimeout` if Service Bus does not acknowledge the request to settle\n * the message in time. The message may or may not have been settled successfully.\n *\n * @param options - The DeadLetter options that can be provided while\n * rejecting the message.\n */\n deadLetterMessage(\n message: ServiceBusReceivedMessage,\n options?: DeadLetterOptions & { [key: string]: number | boolean | string | Date | null },\n ): Promise<void>;\n /**\n * Renews the lock on the message for the duration as specified during the Queue/Subscription\n * creation.\n * - Check the `lockedUntilUtc` property on the message for the time when the lock expires.\n * - If a message is not settled (using either `complete()`, `defer()` or `deadletter()`,\n * before its lock expires, then the message lands back in the Queue/Subscription for the next\n * receive operation.\n *\n * @returns New lock token expiry date and time in UTC format.\n * @throws Error if the underlying connection, client or receiver is closed.\n * @throws ServiceBusError if the service returns an error while renewing message lock.\n */\n renewMessageLock(message: ServiceBusReceivedMessage): Promise<Date>;\n}\n\n/**\n * @internal\n */\nexport class ServiceBusReceiverImpl implements ServiceBusReceiver {\n public identifier: string;\n private _retryOptions: RetryOptions;\n /**\n * Denotes if close() was called on this receiver\n */\n private _isClosed: boolean = false;\n\n /**\n * Instance of the BatchingReceiver class to use to receive messages in pull mode.\n */\n private _batchingReceiver?: BatchingReceiver;\n\n /**\n * Instance of the StreamingReceiver class to use to receive messages in push mode.\n */\n private _streamingReceiver?: StreamingReceiver;\n private _lockRenewer: LockRenewer | undefined;\n\n private get logPrefix(): string {\n return `[${this._context.connectionId}|receiver:${this.entityPath}]`;\n }\n\n /**\n * @throws Error if the underlying connection is closed.\n */\n constructor(\n private _context: ConnectionContext,\n public entityPath: string,\n public receiveMode: \"peekLock\" | \"receiveAndDelete\",\n maxAutoRenewLockDurationInMs: number,\n private skipParsingBodyAsJson: boolean,\n private skipConvertingDate: boolean = false,\n retryOptions: RetryOptions = {},\n identifier?: string,\n ) {\n throwErrorIfConnectionClosed(_context);\n this._retryOptions = retryOptions;\n this._lockRenewer = LockRenewer.create(\n this._context,\n maxAutoRenewLockDurationInMs,\n receiveMode,\n );\n this.identifier = ensureValidIdentifier(this.entityPath, identifier);\n }\n\n private _throwIfAlreadyReceiving(): void {\n if (this._isReceivingMessages()) {\n const errorMessage = getAlreadyReceivingErrorMsg(this.entityPath);\n const error = new Error(errorMessage);\n logger.logError(error, `${this.logPrefix} is already receiving`);\n throw error;\n }\n }\n\n private _throwIfReceiverOrConnectionClosed(): void {\n throwErrorIfConnectionClosed(this._context);\n if (this.isClosed) {\n const errorMessage = getReceiverClosedErrorMsg(this.entityPath);\n const error = new Error(errorMessage);\n logger.logError(error, `${this.logPrefix} is closed`);\n throw error;\n }\n }\n\n public get isClosed(): boolean {\n return this._isClosed || this._context.wasConnectionCloseCalled;\n }\n\n async receiveMessages(\n maxMessageCount: number,\n options?: ReceiveMessagesOptions,\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n this._throwIfAlreadyReceiving();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n );\n throwTypeErrorIfParameterTypeMismatch(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n \"number\",\n );\n\n if (isNaN(maxMessageCount) || maxMessageCount < 1) {\n throw new TypeError(InvalidMaxMessageCountError);\n }\n\n const receiveMessages = async (): Promise<ServiceBusReceivedMessage[]> => {\n if (!this._batchingReceiver || !this._context.messageReceivers[this._batchingReceiver.name]) {\n const receiveOptions: ReceiveOptions = {\n maxConcurrentCalls: 0,\n receiveMode: this.receiveMode,\n lockRenewer: this._lockRenewer,\n skipParsingBodyAsJson: this.skipParsingBodyAsJson,\n skipConvertingDate: this.skipConvertingDate,\n };\n this._batchingReceiver = this._createBatchingReceiver(\n this._context,\n this.entityPath,\n receiveOptions,\n );\n }\n\n const receivedMessages = await this._batchingReceiver.receive(\n maxMessageCount,\n options?.maxWaitTimeInMs ?? Constants.defaultOperationTimeoutInMs,\n defaultMaxTimeAfterFirstMessageForBatchingMs,\n options ?? {},\n );\n\n return receivedMessages;\n };\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n connectionHost: this._context.config.host,\n connectionId: this._context.connectionId,\n operation: receiveMessages,\n operationType: RetryOperationType.receiveMessage,\n abortSignal: options?.abortSignal,\n retryOptions: this._retryOptions,\n };\n return retry<ServiceBusReceivedMessage[]>(config).catch((err) => {\n throw translateServiceBusError(err);\n });\n }\n\n getMessageIterator(\n options?: GetMessageIteratorOptions,\n ): AsyncIterableIterator<ServiceBusReceivedMessage> {\n return getMessageIterator(this, options);\n }\n\n async receiveDeferredMessages(\n sequenceNumbers: Long | Long[],\n options: OperationOptionsBase = {},\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n throwTypeErrorIfParameterNotLong(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n\n const deferredSequenceNumbers = Array.isArray(sequenceNumbers)\n ? sequenceNumbers\n : [sequenceNumbers];\n const receiveDeferredMessagesOperationPromise = async (): Promise<\n ServiceBusReceivedMessage[]\n > => {\n const deferredMessages = await this._context\n .getManagementClient(this.entityPath)\n .receiveDeferredMessages(deferredSequenceNumbers, this.receiveMode, undefined, {\n ...options,\n associatedLinkName: this._getAssociatedReceiverName(),\n requestName: \"receiveDeferredMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n skipParsingBodyAsJson: this.skipParsingBodyAsJson,\n skipConvertingDate: this.skipConvertingDate,\n });\n return deferredMessages;\n };\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: receiveDeferredMessagesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config);\n }\n\n async deleteMessages(options: DeleteMessagesOptions): Promise<number> {\n this._throwIfReceiverOrConnectionClosed();\n\n const deleteMessagesOperationPromise = (): Promise<number> => {\n return this._context\n .getManagementClient(this.entityPath)\n .deleteMessages(options.maxMessageCount, options?.beforeEnqueueTime, undefined, {\n ...options,\n associatedLinkName: this._getAssociatedReceiverName(),\n requestName: \"deleteMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<number> = {\n operation: deleteMessagesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<number>(config);\n }\n\n async purgeMessages(options?: PurgeMessagesOptions): Promise<number> {\n let deletedCount = await this.deleteMessages({\n maxMessageCount: MaxDeleteMessageCount,\n beforeEnqueueTime: options?.beforeEnqueueTime,\n });\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' deleted ${deletedCount} messages.`,\n );\n if (deletedCount > 0) {\n let batchCount = deletedCount;\n while (batchCount > 0) {\n batchCount = await this.deleteMessages({\n maxMessageCount: MaxDeleteMessageCount,\n beforeEnqueueTime: options?.beforeEnqueueTime,\n });\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' deleted ${batchCount} messages.`,\n );\n deletedCount += batchCount;\n }\n }\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' purged ${deletedCount} messages.`,\n );\n return deletedCount;\n }\n\n // ManagementClient methods # Begin\n\n async peekMessages(\n maxMessageCount: number,\n options: PeekMessagesOptions = {},\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n\n const managementRequestOptions = {\n ...options,\n associatedLinkName: this._getAssociatedReceiverName(),\n requestName: \"peekMessages\",\n timeoutInMs: this._retryOptions?.timeoutInMs,\n skipParsingBodyAsJson: this.skipParsingBodyAsJson,\n skipConvertingDate: this.skipConvertingDate,\n };\n const peekOperationPromise = async (): Promise<ServiceBusReceivedMessage[]> => {\n if (options.fromSequenceNumber !== undefined) {\n return this._context\n .getManagementClient(this.entityPath)\n .peekBySequenceNumber(\n options.fromSequenceNumber,\n maxMessageCount,\n undefined,\n options.omitMessageBody,\n managementRequestOptions,\n );\n } else {\n return this._context\n .getManagementClient(this.entityPath)\n .peek(maxMessageCount, options.omitMessageBody, managementRequestOptions);\n }\n };\n\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: peekOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config);\n }\n\n subscribe(\n handlers: MessageHandlers,\n options?: SubscribeOptions,\n ): {\n close(): Promise<void>;\n } {\n assertValidMessageHandlers(handlers);\n throwErrorIfConnectionClosed(this._context);\n this._throwIfReceiverOrConnectionClosed();\n this._throwIfAlreadyReceiving();\n\n options = {\n ...(options ?? {}),\n autoCompleteMessages: options?.autoCompleteMessages ?? true,\n };\n\n // When the user \"stops\" a streaming receiver (via the returned instance from 'subscribe' we just suspend\n // it, leaving the link open). This allows users to stop the flow of messages but still be able to settle messages\n // since the link itself hasn't been shut down.\n //\n // Users can, if they want, restart their subscription (since we've got a link already established).\n // So you'll have an instance here if the user has done:\n // 1. const subscription = receiver.subscribe()\n // 2. subscription.stop()\n // 3. receiver.subscribe()\n\n this._streamingReceiver =\n this._streamingReceiver ??\n new StreamingReceiver(this.identifier, this._context, this.entityPath, {\n ...options,\n receiveMode: this.receiveMode,\n retryOptions: this._retryOptions,\n lockRenewer: this._lockRenewer,\n skipParsingBodyAsJson: this.skipParsingBodyAsJson,\n skipConvertingDate: this.skipConvertingDate,\n });\n\n // this ensures that if the outer service bus client is closed that this receiver is cleaned up.\n // this mostly affects us if we're in the middle of init() - the connection (and receiver) are not yet\n // open but we do need to close the receiver to exit the init() loop.\n this._context.messageReceivers[this._streamingReceiver.name] = this._streamingReceiver;\n\n this._streamingReceiver.subscribe(handlers, options).catch((_) => {\n // (the error will already have been reported to the user)\n if (this._streamingReceiver) {\n delete this._context.messageReceivers[this._streamingReceiver.name];\n }\n });\n\n return {\n close: async (): Promise<void> => {\n return this._streamingReceiver?.stopReceivingMessages();\n },\n };\n }\n\n async completeMessage(message: ServiceBusReceivedMessage): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return completeMessage(msgImpl, this._context, this.entityPath, this._retryOptions);\n }\n\n async abandonMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return abandonMessage(\n msgImpl,\n this._context,\n this.entityPath,\n propertiesToModify,\n this._retryOptions,\n );\n }\n\n async deferMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return deferMessage(\n msgImpl,\n this._context,\n this.entityPath,\n propertiesToModify,\n this._retryOptions,\n );\n }\n\n async deadLetterMessage(\n message: ServiceBusReceivedMessage,\n options?: DeadLetterOptions & { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return deadLetterMessage(msgImpl, this._context, this.entityPath, options, this._retryOptions);\n }\n\n async renewMessageLock(message: ServiceBusReceivedMessage): Promise<Date> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n\n const tracingContext = extractSpanContextFromServiceBusMessage(message);\n const spanLinks: TracingSpanLink[] = tracingContext ? [{ tracingContext }] : [];\n\n return tracingClient.withSpan(\n \"ServiceBusReceiver.renewMessageLock\",\n {},\n () => {\n const msgImpl = message as ServiceBusMessageImpl;\n\n let associatedLinkName: string | undefined;\n if (msgImpl.delivery.link) {\n const associatedReceiver = this._context.getReceiverFromCache(msgImpl.delivery.link.name);\n associatedLinkName = associatedReceiver?.name;\n }\n return this._context\n .getManagementClient(this.entityPath)\n .renewLock(message.lockToken!, { associatedLinkName })\n .then((lockedUntil) => {\n message.lockedUntilUtc = lockedUntil;\n return lockedUntil;\n });\n },\n {\n spanLinks,\n ...toSpanOptions(\n { entityPath: this.entityPath, host: this._context.config.host },\n \"receive\",\n \"client\",\n ),\n },\n );\n }\n\n async close(): Promise<void> {\n try {\n this._isClosed = true;\n if (this._context.connection && this._context.connection.isOpen()) {\n // Close the streaming receiver.\n if (this._streamingReceiver) {\n await this._streamingReceiver.close();\n }\n\n // Close the batching receiver.\n if (this._batchingReceiver) {\n await this._batchingReceiver.close();\n }\n }\n } catch (err: any) {\n logger.logError(err, `${this.logPrefix} An error occurred while closing the Receiver`);\n throw err;\n }\n }\n\n /**\n * Indicates whether the receiver is currently receiving messages or not.\n * When this returns true, new `registerMessageHandler()` or `receiveMessages()` calls cannot be made.\n */\n private _isReceivingMessages(): boolean {\n if (\n this._streamingReceiver &&\n this._streamingReceiver.isOpen() &&\n this._streamingReceiver.isSubscribeActive\n ) {\n return true;\n }\n if (\n this._batchingReceiver &&\n this._batchingReceiver.isOpen() &&\n this._batchingReceiver.isReceivingMessages\n ) {\n return true;\n }\n return false;\n }\n\n private _createBatchingReceiver(\n context: ConnectionContext,\n entityPath: string,\n options: ReceiveOptions,\n ): BatchingReceiver {\n const receiver = BatchingReceiver.create(this.identifier, context, entityPath, options);\n logger.verbose(\n `[${this.logPrefix}] receiver '${receiver.name}' created, with maxConcurrentCalls set to ${options.maxConcurrentCalls}.`,\n );\n\n return receiver;\n }\n\n /**\n * Helper function to retrieve any active receiver name, regardless of streaming or\n * batching if it exists. This is used for optimization on the service side\n */\n private _getAssociatedReceiverName(): string | undefined {\n if (this._streamingReceiver && this._streamingReceiver.isOpen()) {\n return this._streamingReceiver.name;\n }\n if (\n this._batchingReceiver &&\n this._batchingReceiver.isOpen() &&\n this._batchingReceiver.isReceivingMessages\n ) {\n return this._batchingReceiver.name;\n }\n return;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ConnectionContext } from \"../connectionContext\";\nimport { MessageHandlers, ReceiveMessagesOptions, ServiceBusReceivedMessage } from \"..\";\nimport {\n PeekMessagesOptions,\n GetMessageIteratorOptions,\n SubscribeOptions,\n DeleteMessagesOptions,\n PurgeMessagesOptions,\n} from \"../models\";\nimport { MessageSession } from \"../session/messageSession\";\nimport {\n getAlreadyReceivingErrorMsg,\n getReceiverClosedErrorMsg,\n InvalidMaxMessageCountError,\n throwErrorIfConnectionClosed,\n throwTypeErrorIfParameterMissing,\n throwTypeErrorIfParameterNotLong,\n throwErrorIfInvalidOperationOnMessage,\n throwTypeErrorIfParameterTypeMismatch,\n} from \"../util/errors\";\nimport { OnError, OnMessage } from \"../core/messageReceiver\";\nimport {\n abandonMessage,\n assertValidMessageHandlers,\n completeMessage,\n deadLetterMessage,\n deferMessage,\n getMessageIterator,\n wrapProcessErrorHandler,\n} from \"./receiverCommon\";\nimport {\n defaultMaxTimeAfterFirstMessageForBatchingMs,\n MaxDeleteMessageCount,\n ServiceBusReceiver,\n} from \"./receiver\";\nimport Long from \"long\";\nimport { ServiceBusMessageImpl, DeadLetterOptions } from \"../serviceBusMessage\";\nimport {\n Constants,\n RetryConfig,\n RetryOperationType,\n RetryOptions,\n retry,\n ErrorNameConditionMapper,\n} from \"@azure/core-amqp\";\nimport { OperationOptionsBase } from \"../modelsToBeSharedWithEventHubs\";\nimport { AmqpError } from \"rhea-promise\";\nimport { toProcessingSpanOptions } from \"../diagnostics/instrumentServiceBusMessage\";\nimport { tracingClient } from \"../diagnostics/tracing\";\nimport { receiverLogger as logger } from \"../log\";\nimport { translateServiceBusError } from \"../serviceBusError\";\n\n/**\n *A receiver that handles sessions, including renewing the session lock.\n */\nexport interface ServiceBusSessionReceiver extends ServiceBusReceiver {\n /**\n * The session ID.\n */\n readonly sessionId: string;\n\n /**\n * The time in UTC until which the session is locked.\n * Every time `renewSessionLock()` is called, this time gets updated to current time plus the lock\n * duration as specified during the Queue/Subscription creation.\n *\n * Will return undefined until a AMQP receiver link has been successfully set up for the session.\n *\n * @readonly\n */\n readonly sessionLockedUntilUtc: Date;\n\n /**\n * Streams messages to message handlers.\n * @param handlers - A handler that gets called for messages and errors.\n * @param options - Options for subscribe.\n * @returns An object that can be closed, sending any remaining messages to `handlers` and\n * stopping new messages from arriving.\n */\n subscribe(\n handlers: MessageHandlers,\n options?: SubscribeOptions,\n ): {\n /**\n * Causes the subscriber to stop receiving new messages.\n */\n close(): Promise<void>;\n };\n\n /**\n * Renews the lock on the session.\n */\n renewSessionLock(options?: OperationOptionsBase): Promise<Date>;\n\n /**\n * Gets the state of the Session. For more on session states, see\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions#message-session-state | Session State}\n * @param options - Options bag to pass an abort signal or tracing options.\n * @returns The state of that session\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while retrieving session state.\n */\n getSessionState(options?: OperationOptionsBase): Promise<any>;\n\n /**\n * Sets the state on the Session. For more on session states, see\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions#message-session-state | Session State}\n * @param state - The state that needs to be set.\n * @param options - Options bag to pass an abort signal or tracing options.\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while setting the session state.\n *\n */\n setSessionState(state: any, options?: OperationOptionsBase): Promise<void>;\n}\n\n/**\n * @internal\n */\nexport class ServiceBusSessionReceiverImpl implements ServiceBusSessionReceiver {\n public sessionId: string;\n public identifier: string;\n\n /**\n * Denotes if close() was called on this receiver\n */\n private _isClosed: boolean = false;\n\n private get logPrefix(): string {\n return `[${this._context.connectionId}|session:${this.entityPath}]`;\n }\n\n /**\n * @internal\n * @throws Error if the underlying connection is closed.\n * @throws Error if an open receiver is already existing for given sessionId.\n */\n constructor(\n private _messageSession: MessageSession,\n private _context: ConnectionContext,\n public entityPath: string,\n public receiveMode: \"peekLock\" | \"receiveAndDelete\",\n private _skipParsingBodyAsJson: boolean,\n private _skipConvertingDate: boolean,\n private _retryOptions: RetryOptions = {},\n ) {\n throwErrorIfConnectionClosed(_context);\n this.sessionId = _messageSession.sessionId;\n this.identifier = _messageSession.identifier;\n }\n\n private _throwIfReceiverOrConnectionClosed(): void {\n throwErrorIfConnectionClosed(this._context);\n if (this.isClosed) {\n if (this._isClosed) {\n const errorMessage = getReceiverClosedErrorMsg(this.entityPath, this.sessionId);\n const error = new Error(errorMessage);\n logger.logError(error, `${this.logPrefix} already closed`);\n throw error;\n }\n const amqpError: AmqpError = {\n condition: ErrorNameConditionMapper.SessionLockLostError,\n description: `The session lock has expired on the session with id ${this.sessionId}`,\n };\n throw translateServiceBusError(amqpError);\n }\n }\n\n private _throwIfAlreadyReceiving(): void {\n if (this._isReceivingMessages()) {\n const errorMessage = getAlreadyReceivingErrorMsg(this.entityPath, this.sessionId);\n const error = new Error(errorMessage);\n logger.logError(error, `${this.logPrefix} is already receiving.`);\n throw error;\n }\n }\n\n public get isClosed(): boolean {\n return (\n this._isClosed ||\n !this._context.messageSessions[this._messageSession.name] ||\n !this._messageSession.isOpen()\n );\n }\n\n /**\n * The time in UTC until which the session is locked.\n * Every time `renewSessionLock()` is called, this time gets updated to current time plus the lock\n * duration as specified during the Queue/Subscription creation.\n *\n * When the lock on the session expires\n * - The current receiver can no longer be used to receive more messages.\n * Create a new receiver using `ServiceBusClient.acceptSession()` or `ServiceBusClient.acceptNextSession()`.\n * - Messages that were received in `peekLock` mode with this receiver but not yet settled\n * will land back in the Queue/Subscription with their delivery count incremented.\n *\n * @readonly\n */\n public get sessionLockedUntilUtc(): Date {\n return this._messageSession.sessionLockedUntilUtc;\n }\n\n /**\n * Renews the lock on the session for the duration as specified during the Queue/Subscription\n * creation. You can check the `sessionLockedUntilUtc` property for the time when the lock expires.\n *\n * When the lock on the session expires\n * - The current receiver can no longer be used to receive mode messages.\n * Create a new receiver using `ServiceBusClient.acceptSession()` or `ServiceBusClient.acceptNextSession()`.\n * - Messages that were received in `peekLock` mode with this receiver but not yet settled\n * will land back in the Queue/Subscription with their delivery count incremented.\n *\n * @param options - Options bag to pass an abort signal or tracing options.\n * @returns New lock token expiry date and time in UTC format.\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while renewing session lock.\n */\n async renewSessionLock(options?: OperationOptionsBase): Promise<Date> {\n this._throwIfReceiverOrConnectionClosed();\n\n return tracingClient.withSpan(\n \"ServiceBusSessionReceiver.renewSessionLock\",\n options ?? {},\n (updatedOptions) => {\n const renewSessionLockOperationPromise = async (): Promise<Date> => {\n this._messageSession!.sessionLockedUntilUtc = await this._context\n .getManagementClient(this.entityPath)\n .renewSessionLock(this.sessionId, {\n ...updatedOptions,\n associatedLinkName: this._messageSession.name,\n requestName: \"renewSessionLock\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n return this._messageSession!.sessionLockedUntilUtc!;\n };\n const config: RetryConfig<Date> = {\n operation: renewSessionLockOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<Date>(config);\n },\n );\n }\n\n /**\n * Sets the state on the Session. For more on session states, see\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions#message-session-state | Session State}\n * @param state - The state that needs to be set.\n * @param options - Options bag to pass an abort signal or tracing options.\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while setting the session state.\n */\n async setSessionState(state: unknown, options: OperationOptionsBase = {}): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n\n return tracingClient.withSpan(\n \"ServiceBusSessionReceiver.setSessionState\",\n options ?? {},\n (updatedOptions) => {\n const setSessionStateOperationPromise = async (): Promise<void> => {\n await this._context\n .getManagementClient(this.entityPath)\n .setSessionState(this.sessionId!, state, {\n ...updatedOptions,\n associatedLinkName: this._messageSession.name,\n requestName: \"setState\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n return;\n };\n const config: RetryConfig<void> = {\n operation: setSessionStateOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<void>(config);\n },\n );\n }\n\n /**\n * Gets the state of the Session. For more on session states, see\n * {@link https://docs.microsoft.com/azure/service-bus-messaging/message-sessions#message-session-state | Session State}\n * @param options - Options bag to pass an abort signal or tracing options.\n * @returns The state of that session\n * @throws Error if the underlying connection or receiver is closed.\n * @throws `ServiceBusError` if the service returns an error while retrieving session state.\n */\n async getSessionState(options: OperationOptionsBase = {}): Promise<any> {\n this._throwIfReceiverOrConnectionClosed();\n\n return tracingClient.withSpan(\n \"ServiceBusSessionReceiver.getSessionState\",\n options ?? {},\n (updatedOptions) => {\n const getSessionStateOperationPromise = async (): Promise<any> => {\n return this._context\n .getManagementClient(this.entityPath)\n .getSessionState(this.sessionId, {\n ...updatedOptions,\n associatedLinkName: this._messageSession.name,\n requestName: \"getState\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<any> = {\n operation: getSessionStateOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<any>(config);\n },\n );\n }\n\n async peekMessages(\n maxMessageCount: number,\n options: PeekMessagesOptions = {},\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n\n const managementRequestOptions = {\n ...options,\n associatedLinkName: this._messageSession.name,\n requestName: \"peekMessages\",\n timeoutInMs: this._retryOptions?.timeoutInMs,\n skipParsingBodyAsJson: this._skipParsingBodyAsJson,\n skipConvertingDate: this._skipConvertingDate,\n };\n const peekOperationPromise = async (): Promise<ServiceBusReceivedMessage[]> => {\n if (options.fromSequenceNumber !== undefined) {\n return this._context\n .getManagementClient(this.entityPath)\n .peekBySequenceNumber(\n options.fromSequenceNumber,\n maxMessageCount,\n this.sessionId,\n options.omitMessageBody,\n managementRequestOptions,\n );\n } else {\n return this._context\n .getManagementClient(this.entityPath)\n .peekMessagesBySession(\n this.sessionId,\n maxMessageCount,\n options.omitMessageBody,\n managementRequestOptions,\n );\n }\n };\n\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: peekOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config);\n }\n\n async receiveDeferredMessages(\n sequenceNumbers: Long | Long[],\n options: OperationOptionsBase = {},\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n throwTypeErrorIfParameterNotLong(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n\n const deferredSequenceNumbers = Array.isArray(sequenceNumbers)\n ? sequenceNumbers\n : [sequenceNumbers];\n const receiveDeferredMessagesOperationPromise = async (): Promise<\n ServiceBusReceivedMessage[]\n > => {\n const deferredMessages = await this._context\n .getManagementClient(this.entityPath)\n .receiveDeferredMessages(deferredSequenceNumbers, this.receiveMode, this.sessionId, {\n ...options,\n associatedLinkName: this._messageSession.name,\n requestName: \"receiveDeferredMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n skipParsingBodyAsJson: this._skipParsingBodyAsJson,\n skipConvertingDate: this._skipConvertingDate,\n });\n return deferredMessages;\n };\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: receiveDeferredMessagesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config);\n }\n\n async deleteMessages(options: DeleteMessagesOptions): Promise<number> {\n this._throwIfReceiverOrConnectionClosed();\n\n const deleteMessagesOperationPromise = (): Promise<number> => {\n return this._context\n .getManagementClient(this.entityPath)\n .deleteMessages(options.maxMessageCount, options?.beforeEnqueueTime, this.sessionId, {\n ...options,\n associatedLinkName: this._messageSession.name,\n requestName: \"deleteMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<number> = {\n operation: deleteMessagesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<number>(config);\n }\n\n async purgeMessages(options?: PurgeMessagesOptions): Promise<number> {\n let deletedCount = await this.deleteMessages({\n maxMessageCount: MaxDeleteMessageCount,\n beforeEnqueueTime: options?.beforeEnqueueTime,\n });\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' deleted ${deletedCount} messages.`,\n );\n if (deletedCount > 0) {\n let batchCount = deletedCount;\n while (batchCount > 0) {\n batchCount = await this.deleteMessages({\n maxMessageCount: MaxDeleteMessageCount,\n beforeEnqueueTime: options?.beforeEnqueueTime,\n });\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' deleted ${batchCount} messages.`,\n );\n deletedCount += batchCount;\n }\n }\n logger.verbose(\n `${this.logPrefix} receiver '${this.identifier}' purged ${deletedCount} messages.`,\n );\n return deletedCount;\n }\n\n async receiveMessages(\n maxMessageCount: number,\n options?: ReceiveMessagesOptions,\n ): Promise<ServiceBusReceivedMessage[]> {\n this._throwIfReceiverOrConnectionClosed();\n this._throwIfAlreadyReceiving();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n );\n throwTypeErrorIfParameterTypeMismatch(\n this._context.connectionId,\n \"maxMessageCount\",\n maxMessageCount,\n \"number\",\n );\n\n if (isNaN(maxMessageCount) || maxMessageCount < 1) {\n throw new TypeError(InvalidMaxMessageCountError);\n }\n\n const receiveBatchOperationPromise = async (): Promise<ServiceBusReceivedMessage[]> => {\n const receivedMessages = await this._messageSession!.receiveMessages(\n maxMessageCount,\n options?.maxWaitTimeInMs ?? Constants.defaultOperationTimeoutInMs,\n defaultMaxTimeAfterFirstMessageForBatchingMs,\n options ?? {},\n );\n\n return receivedMessages;\n };\n const config: RetryConfig<ServiceBusReceivedMessage[]> = {\n operation: receiveBatchOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.receiveMessage,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<ServiceBusReceivedMessage[]>(config).catch((err) => {\n throw translateServiceBusError(err);\n });\n }\n\n subscribe(\n handlers: MessageHandlers,\n options?: SubscribeOptions,\n ): {\n close(): Promise<void>;\n } {\n // TODO - receiverOptions for subscribe??\n assertValidMessageHandlers(handlers);\n\n options = options ?? {};\n\n const processError = wrapProcessErrorHandler(handlers);\n\n this._registerMessageHandler(\n async (message: ServiceBusMessageImpl) => {\n return tracingClient.withSpan(\n \"SessionReceiver.process\",\n options ?? {},\n () => handlers.processMessage(message),\n toProcessingSpanOptions(message, this, this._context.config, \"process\"),\n );\n },\n processError,\n options,\n );\n\n return {\n close: async (): Promise<void> => {\n return this._messageSession?.receiverHelper.suspend();\n },\n };\n }\n\n /**\n * Registers handlers to deal with the incoming stream of messages over an AMQP receiver link\n * from a Queue/Subscription.\n * To stop receiving messages, call `close()` on the SessionReceiver.\n *\n * Throws an error if there is another receive operation in progress on the same receiver. If you\n * are not sure whether there is another receive operation running, check the `isReceivingMessages`\n * property on the receiver.\n *\n * @param onMessage - Handler for processing each incoming message.\n * @param onError - Handler for any error that occurs while receiving or processing messages.\n * @param options - Options to control whether messages should be automatically completed\n * or if the lock on the session should be automatically renewed. You can control the\n * maximum number of messages that should be concurrently processed. You can\n * also provide a timeout in milliseconds to denote the amount of time to wait for a new message\n * before closing the receiver.\n *\n * @throws Error if the underlying connection or receiver is closed.\n * @throws Error if the receiver is already in state of receiving messages.\n * @throws `ServiceBusError` if the service returns an error while receiving messages. These are bubbled up to be handled by user provided `onError` handler.\n */\n private _registerMessageHandler(\n onMessage: OnMessage,\n onError: OnError,\n options: SubscribeOptions,\n ): void {\n this._throwIfReceiverOrConnectionClosed();\n this._throwIfAlreadyReceiving();\n const connId = this._context.connectionId;\n throwTypeErrorIfParameterMissing(connId, \"onMessage\", onMessage);\n throwTypeErrorIfParameterMissing(connId, \"onError\", onError);\n if (typeof onMessage !== \"function\") {\n throw new TypeError(\"The parameter 'onMessage' must be of type 'function'.\");\n }\n if (typeof onError !== \"function\") {\n throw new TypeError(\"The parameter 'onError' must be of type 'function'.\");\n }\n\n try {\n this._messageSession.subscribe(onMessage, onError, options);\n } catch (err: any) {\n onError({\n error: err,\n errorSource: \"receive\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n });\n }\n }\n\n getMessageIterator(\n options?: GetMessageIteratorOptions,\n ): AsyncIterableIterator<ServiceBusReceivedMessage> {\n return getMessageIterator(this, options);\n }\n\n async completeMessage(message: ServiceBusReceivedMessage): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return completeMessage(msgImpl, this._context, this.entityPath, this._retryOptions);\n }\n\n async abandonMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return abandonMessage(\n msgImpl,\n this._context,\n this.entityPath,\n propertiesToModify,\n this._retryOptions,\n );\n }\n\n async deferMessage(\n message: ServiceBusReceivedMessage,\n propertiesToModify?: { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return deferMessage(\n msgImpl,\n this._context,\n this.entityPath,\n propertiesToModify,\n this._retryOptions,\n );\n }\n\n async deadLetterMessage(\n message: ServiceBusReceivedMessage,\n options?: DeadLetterOptions & { [key: string]: number | boolean | string | Date | null },\n ): Promise<void> {\n this._throwIfReceiverOrConnectionClosed();\n throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);\n const msgImpl = message as ServiceBusMessageImpl;\n return deadLetterMessage(msgImpl, this._context, this.entityPath, options, this._retryOptions);\n }\n\n async renewMessageLock(): Promise<Date> {\n throw new Error(\"Renewing message lock is an invalid operation when working with sessions.\");\n }\n\n async close(): Promise<void> {\n try {\n await this._messageSession.close();\n } catch (err: any) {\n logger.logError(\n err,\n \"%s An error occurred while closing the SessionReceiver for session %s\",\n this.logPrefix,\n this.sessionId,\n );\n throw err;\n } finally {\n this._isClosed = true;\n }\n }\n\n /**\n * Indicates whether the receiver is currently receiving messages or not.\n * When this returns true, new `registerMessageHandler()` or `receiveMessages()` calls cannot be made.\n */\n private _isReceivingMessages(): boolean {\n return this._messageSession ? this._messageSession.isReceivingMessages : false;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptionsBase } from \"./modelsToBeSharedWithEventHubs\";\nimport { ConnectionContext } from \"./connectionContext\";\nimport { RetryConfig, RetryOperationType, RetryOptions, retry } from \"@azure/core-amqp\";\nimport { CorrelationRuleFilter } from \"./core/managementClient\";\nimport { ruleManagerLogger as logger } from \"./log\";\nimport {\n isSqlRuleAction,\n RuleProperties,\n SqlRuleAction,\n} from \"./serializers/ruleResourceSerializer\";\nimport { getUniqueName } from \"./util/utils\";\nimport { throwErrorIfConnectionClosed } from \"./util/errors\";\nimport { SqlRuleFilter } from \"./serializers/ruleResourceSerializer\";\nimport { tracingClient } from \"./diagnostics/tracing\";\nimport { getPagedAsyncIterator, PagedAsyncIterableIterator, PagedResult } from \"@azure/core-paging\";\nimport { OperationOptions } from \"@azure/core-client\";\nimport { ListRequestOptions } from \"./serviceBusAtomManagementClient\";\n\n/**\n * Allows rules for a subscription to be managed. This rule manager requires only Listen claims, whereas the\n * {@link ServiceBusAdministrationClient} requires Manage claims.\n */\nexport interface ServiceBusRuleManager {\n /**\n * Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.\n *\n * @param ruleName - the name of the rule\n * @param filter - the filter expression that the rule evaluates.\n * @param options - The options that can be used to abort, trace and control other configurations on the request.\n */\n createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n options?: OperationOptionsBase,\n ): Promise<void>;\n /**\n * Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.\n *\n * @param ruleName - the name of the rule\n * @param filter - the filter expression that the rule evaluates.\n * @param ruleAction - The SQL like expression that can be executed on the message should the associated filter apply.\n * @param options - The options that can be used to abort, trace and control other configurations on the request.\n */\n createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n ruleAction?: SqlRuleAction,\n options?: OperationOptionsBase,\n ): Promise<void>;\n /**\n * Deletes a rule.\n *\n * @param ruleName - the name of the rule\n */\n deleteRule(ruleName: string, options?: OperationOptionsBase): Promise<void>;\n /**\n * Returns an async iterable iterator to list all the rules\n * under the specified subscription.\n *\n * .byPage() returns an async iterable iterator to list the rules in pages.\n *\n * @returns An asyncIterableIterator that supports paging.\n */\n listRules(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: OperationOptions,\n ): PagedAsyncIterableIterator<RuleProperties>;\n}\n\n/**\n * @internal\n */\nexport class ServiceBusRuleManagerImpl implements ServiceBusRuleManager {\n /**\n * Denotes if close() was called on this sender\n */\n private _isClosed: boolean = false;\n private name: string;\n public entityPath: string;\n\n /**\n * @internal\n * @throws Error if the underlying connection is closed.\n */\n constructor(\n private _context: ConnectionContext,\n private _entityPath: string,\n private _retryOptions: RetryOptions = {},\n ) {\n throwErrorIfConnectionClosed(_context);\n this.entityPath = _entityPath;\n this.name = getUniqueName(\"ruleManager\");\n }\n\n public get isClosed(): boolean {\n return this._isClosed || this._context.wasConnectionCloseCalled;\n }\n\n /**\n * Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.\n *\n * @param ruleName - the name of the rule\n * @param filter - the filter expression that the rule evaluates.\n * @param options - The options that can be used to abort, trace and control other configurations on the request.\n */\n createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n options?: OperationOptions,\n ): Promise<void>;\n /**\n * Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.\n *\n * @param ruleName - the name of the rule\n * @param filter - the filter expression that the rule evaluates.\n * @param ruleAction - The SQL like expression that can be executed on the message should the associated filter apply.\n * @param options - The options that can be used to abort, trace and control other configurations on the request.\n */\n createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n ruleAction?: SqlRuleAction,\n options?: OperationOptions,\n ): Promise<void>;\n async createRule(\n ruleName: string,\n filter: SqlRuleFilter | CorrelationRuleFilter,\n ruleActionOrOperationOptions?: SqlRuleAction | OperationOptionsBase,\n options: OperationOptions = {},\n ): Promise<void> {\n let sqlRuleAction: SqlRuleAction | undefined = undefined;\n let operOptions: OperationOptions | undefined;\n if (ruleActionOrOperationOptions) {\n if (isSqlRuleAction(ruleActionOrOperationOptions)) {\n // Overload#2 - where the sqlExpression in the ruleAction is defined\n sqlRuleAction = ruleActionOrOperationOptions;\n operOptions = options;\n } else {\n // Overload#1 - where the sqlExpression in the ruleAction is undefined\n operOptions = { ...ruleActionOrOperationOptions, ...options };\n }\n }\n\n return tracingClient.withSpan(\n \"ServiceBusRuleManager.createRule\",\n operOptions ?? {},\n async (updatedOptions) => {\n const addRuleOperationPromise = async (): Promise<void> => {\n return this._context\n .getManagementClient(this._entityPath)\n .addRule(ruleName, filter, sqlRuleAction?.sqlExpression, {\n ...updatedOptions,\n associatedLinkName: this.name,\n requestName: \"addRule\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<void> = {\n operation: addRuleOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: updatedOptions?.abortSignal,\n };\n return retry<void>(config);\n },\n );\n }\n\n /**\n * Get all rules associated with the subscription.\n */\n private async getRules(\n options?: ListRequestOptions & OperationOptions,\n ): Promise<RuleProperties[]> {\n return tracingClient.withSpan(\n \"ServiceBusRuleManager.getRules\",\n options ?? {},\n async (updatedOptions) => {\n const getRulesOperationPromise = async (): Promise<RuleProperties[]> => {\n return this._context.getManagementClient(this._entityPath).getRules({\n ...updatedOptions,\n associatedLinkName: this.name,\n requestName: \"getRules\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<RuleProperties[]> = {\n operation: getRulesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: updatedOptions?.abortSignal,\n };\n return retry<RuleProperties[]>(config);\n },\n );\n }\n\n /**\n * Returns an async iterable iterator to list all the rules\n * under the specified subscription.\n *\n * .byPage() returns an async iterable iterator to list the rules in pages.\n *\n * @returns An asyncIterableIterator that supports paging.\n */\n public listRules(\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: OperationOptions,\n ): PagedAsyncIterableIterator<RuleProperties, RuleProperties[], { maxPageSize?: number }> {\n logger.verbose(`Performing operation - listRules() with options: %j`, options);\n const pagedResult: PagedResult<RuleProperties[], { maxPageSize?: number }, number> = {\n firstPageLink: 0,\n getPage: async (pageLink, maxPageSize) => {\n const top = maxPageSize ?? 100;\n const rules = await this.getRules({\n skip: pageLink,\n maxCount: top,\n ...options,\n });\n return rules.length\n ? {\n page: rules,\n nextPageLink: rules.length > 0 ? pageLink + rules.length : undefined,\n }\n : undefined;\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n }\n\n /**\n * Deletes a rule.\n */\n async deleteRule(ruleName: string, options: OperationOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"ServiceBusRuleManager.deleteRule\",\n options,\n async (updatedOptions) => {\n const removeRuleOperationPromise = async (): Promise<void> => {\n return this._context.getManagementClient(this._entityPath).removeRule(ruleName, {\n ...updatedOptions,\n associatedLinkName: this.name,\n requestName: \"removeRule\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<void> = {\n operation: removeRuleOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: updatedOptions?.abortSignal,\n };\n return retry<void>(config);\n },\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ServiceBusMessage, toRheaMessage } from \"./serviceBusMessage\";\nimport {\n errorInvalidMessageTypeSingle,\n throwIfNotValidServiceBusMessage,\n throwTypeErrorIfParameterMissing,\n} from \"./util/errors\";\nimport { ConnectionContext } from \"./connectionContext\";\nimport {\n MessageAnnotations,\n messageProperties as RheaMessagePropertiesList,\n message as RheaMessageUtil,\n Message as RheaMessage,\n} from \"rhea-promise\";\nimport { TracingContext } from \"@azure/core-tracing\";\nimport { TryAddOptions } from \"./modelsToBeSharedWithEventHubs\";\nimport { AmqpAnnotatedMessage } from \"@azure/core-amqp\";\nimport { defaultDataTransformer } from \"./dataTransformer\";\nimport { instrumentMessage } from \"./diagnostics/instrumentServiceBusMessage\";\n\n/**\n * @internal\n * The amount of bytes to reserve as overhead for a small message.\n */\nconst smallMessageOverhead = 5;\n/**\n * @internal\n * The amount of bytes to reserve as overhead for a large message.\n */\nconst largeMessageOverhead = 8;\n/**\n * @internal\n * The maximum number of bytes that a message may be to be considered small.\n */\nconst smallMessageMaxBytes = 255;\n\n/**\n * A batch of messages that you can create using the {@link createBatch} method.\n *\n */\nexport interface ServiceBusMessageBatch {\n /**\n * Size of the batch in bytes after the events added to it have been encoded into a single AMQP\n * message.\n * @readonly\n */\n readonly sizeInBytes: number;\n\n /**\n * Number of messages added to the batch.\n * @readonly\n */\n readonly count: number;\n\n /**\n * The maximum size of the batch, in bytes. The `tryAddMessage` function on the batch will return `false`\n * if the message being added causes the size of the batch to exceed this limit. Use the `createMessageBatch()` method on\n * the `Sender` to set the maxSizeInBytes.\n * @readonly\n */\n readonly maxSizeInBytes: number;\n\n /**\n * Adds a message to the batch if permitted by the batch's size limit.\n * **NOTE**: Always remember to check the return value of this method, before calling it again\n * for the next event.\n *\n * @param message - The message to add to the batch.\n * @returns A boolean value indicating if the message has been added to the batch or not.\n */\n tryAddMessage(\n message: ServiceBusMessage | AmqpAnnotatedMessage,\n options?: TryAddOptions,\n ): boolean;\n\n /**\n * The AMQP message containing encoded events that were added to the batch.\n * Used internally by the `sendBatch()` method on the `Sender`.\n * This is not meant for the user to use directly.\n *\n * @readonly\n * @internal\n * @hidden\n */\n _generateMessage(): Buffer;\n\n /**\n * Gets the \"message\" span contexts that were created when adding events to the batch.\n * Used internally by the `sendBatch()` method to set up the right spans in traces if tracing is enabled.\n * @internal\n * @hidden\n */\n readonly _messageSpanContexts: TracingContext[];\n}\n\n/**\n * An internal class representing a batch of messages which can be used to send messages to Service Bus.\n *\n * @internal\n */\nexport class ServiceBusMessageBatchImpl implements ServiceBusMessageBatch {\n /**\n * Current size of the batch in bytes.\n */\n private _sizeInBytes: number;\n /**\n * Encoded amqp messages.\n */\n private _encodedMessages: Buffer[] = [];\n /**\n * List of 'message' span contexts.\n */\n private _spanContexts: TracingContext[] = [];\n /**\n * ServiceBusMessageBatch should not be constructed using `new ServiceBusMessageBatch()`\n * Use the `createBatch()` method on your `Sender` instead.\n * @internal\n * @hidden\n */\n constructor(\n private _context: ConnectionContext,\n private _maxSizeInBytes: number,\n ) {\n this._sizeInBytes = 0;\n this._batchMessageProperties = {};\n }\n\n /**\n * The maximum size of the batch, in bytes.\n * @readonly\n */\n get maxSizeInBytes(): number {\n return this._maxSizeInBytes;\n }\n\n /**\n * Size of the `ServiceBusMessageBatch` instance after the messages added to it have been\n * encoded into a single AMQP message.\n * @readonly\n */\n get sizeInBytes(): number {\n return this._sizeInBytes;\n }\n\n /**\n * Number of messages in the `ServiceBusMessageBatch` instance.\n * @readonly\n */\n get count(): number {\n return this._encodedMessages.length;\n }\n\n /**\n * Gets the \"message\" span contexts that were created when adding messages to the batch.\n * @internal\n * @hidden\n */\n get _messageSpanContexts(): TracingContext[] {\n return this._spanContexts;\n }\n\n /**\n * Generates an AMQP message that contains the provided encoded messages and annotations.\n *\n * @param encodedMessages - The already encoded messages to include in the AMQP batch.\n * @param annotations - The message annotations to set on the batch.\n * @param applicationProperties - The application properties to set on the batch.\n * @param messageProperties - The message properties to set on the batch.\n */\n private _generateBatch(\n encodedMessages: Buffer[],\n annotations?: MessageAnnotations,\n applicationProperties?: { [key: string]: any },\n messageProperties?: { [key: string]: string },\n ): Buffer {\n const batchEnvelope: RheaMessage = {\n body: RheaMessageUtil.data_sections(encodedMessages),\n message_annotations: annotations,\n application_properties: applicationProperties,\n };\n if (messageProperties) {\n for (const prop of RheaMessagePropertiesList) {\n if ((messageProperties as any)[prop]) {\n (batchEnvelope as any)[prop] = (messageProperties as any)[prop];\n }\n }\n }\n return RheaMessageUtil.encode(batchEnvelope);\n }\n\n /**\n * Represents the single AMQP message which is the result of encoding all the events\n * added into the `ServiceBusMessageBatch` instance.\n *\n * This is not meant for the user to use directly.\n *\n * When the `ServiceBusMessageBatch` instance is passed to the `sendBatch()` method on the `Sender`,\n * this single batched AMQP message is what gets sent over the wire to the service.\n * @readonly\n */\n _generateMessage(): Buffer {\n return this._generateBatch(\n this._encodedMessages,\n this._batchAnnotations,\n this._batchApplicationProperties,\n this._batchMessageProperties,\n );\n }\n\n /**\n * The message annotations to apply on the batch envelope.\n * This will reflect the message annotations on the first message\n * that was added to the batch.\n */\n private _batchAnnotations?: MessageAnnotations;\n /**\n * The message properties to apply on the batch envelope.\n * This will reflect the message properties on the first message\n * that was added to the batch.\n */\n private _batchMessageProperties?: { [key: string]: string };\n /**\n * The application properties to apply on the batch envelope.\n * This will reflect the application properties on the first message\n * that was added to the batch.\n */\n private _batchApplicationProperties?: { [key: string]: any };\n\n /**\n * Tries to add a message to the batch if permitted by the batch's size limit.\n * **NOTE**: Always remember to check the return value of this method, before calling it again\n * for the next message.\n *\n * @param originalMessage - An individual service bus message.\n * @returns A boolean value indicating if the message has been added to the batch or not.\n */\n public tryAddMessage(\n originalMessage: ServiceBusMessage | AmqpAnnotatedMessage,\n options: TryAddOptions = {},\n ): boolean {\n throwTypeErrorIfParameterMissing(this._context.connectionId, \"message\", originalMessage);\n throwIfNotValidServiceBusMessage(originalMessage, errorInvalidMessageTypeSingle);\n\n const { message, spanContext } = instrumentMessage(\n originalMessage,\n options,\n this._context.config.entityPath!,\n this._context.config.host,\n \"publish\",\n );\n\n // Convert ServiceBusMessage to AmqpMessage.\n const amqpMessage = toRheaMessage(message, defaultDataTransformer);\n\n const encodedMessage = RheaMessageUtil.encode(amqpMessage);\n let currentSize = this._sizeInBytes;\n\n // The first time an event is added, we need to calculate\n // the overhead of creating an AMQP batch, including the\n // message_annotations, application_properties and message_properties\n // that are taken from the 1st message.\n if (this.count === 0) {\n if (amqpMessage.message_annotations) {\n this._batchAnnotations = amqpMessage.message_annotations;\n }\n if (amqpMessage.application_properties) {\n this._batchApplicationProperties = amqpMessage.application_properties;\n }\n for (const prop of RheaMessagePropertiesList) {\n if ((amqpMessage as any)[prop]) {\n (this._batchMessageProperties as any)[prop] = (amqpMessage as any)[prop];\n }\n }\n // Figure out the overhead of creating a batch by generating an empty batch\n // with the expected batch annotations.\n currentSize += this._generateBatch(\n [],\n this._batchAnnotations,\n this._batchApplicationProperties,\n this._batchMessageProperties,\n ).length;\n }\n\n const messageSize = encodedMessage.length;\n const messageOverhead =\n messageSize <= smallMessageMaxBytes ? smallMessageOverhead : largeMessageOverhead;\n currentSize += messageSize + messageOverhead;\n // Check if the size of the batch exceeds the maximum allowed size\n // once we add the new event to it.\n if (currentSize > this._maxSizeInBytes) {\n return false;\n }\n\n // The message will fit in the batch, so it is now safe to store it.\n this._encodedMessages.push(encodedMessage);\n if (spanContext) {\n this._spanContexts.push(spanContext);\n }\n\n this._sizeInBytes = currentSize;\n return true;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { senderLogger as logger } from \"../log\";\nimport {\n AmqpError,\n AwaitableSender,\n AwaitableSenderOptions,\n EventContext,\n OnAmqpEvent,\n message as RheaMessageUtil,\n} from \"rhea-promise\";\nimport {\n Constants,\n ErrorNameConditionMapper,\n MessagingError,\n RetryConfig,\n RetryOperationType,\n RetryOptions,\n retry,\n AmqpAnnotatedMessage,\n} from \"@azure/core-amqp\";\nimport { ServiceBusMessage, toRheaMessage } from \"../serviceBusMessage\";\nimport { ConnectionContext } from \"../connectionContext\";\nimport { LinkEntity } from \"./linkEntity\";\nimport { getUniqueName, waitForSendable, waitForTimeoutOrAbortOrResolve } from \"../util/utils\";\nimport { throwErrorIfConnectionClosed } from \"../util/errors\";\nimport { ServiceBusMessageBatch, ServiceBusMessageBatchImpl } from \"../serviceBusMessageBatch\";\nimport { CreateMessageBatchOptions } from \"../models\";\nimport { OperationOptionsBase } from \"../modelsToBeSharedWithEventHubs\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { ServiceBusError, translateServiceBusError } from \"../serviceBusError\";\nimport { isDefined } from \"@azure/core-util\";\nimport { defaultDataTransformer } from \"../dataTransformer\";\n\n/**\n * @internal\n * Describes the MessageSender that will send messages to ServiceBus.\n */\nexport class MessageSender extends LinkEntity<AwaitableSender> {\n /**\n * The handler function to handle errors that happen on the\n * underlying sender.\n * @readonly\n */\n private readonly _onAmqpError: OnAmqpEvent;\n /**\n * The handler function to handle \"sender_close\" event\n * that happens on the underlying sender.\n * @readonly\n */\n private readonly _onAmqpClose: OnAmqpEvent;\n /**\n * The message handler that will be set as the handler on\n * the underlying rhea sender's session for the \"session_error\" event.\n */\n private _onSessionError: OnAmqpEvent;\n /**\n * The message handler that will be set as the handler on\n * the underlying rhea sender's session for the \"session_close\" event.\n */\n private _onSessionClose: OnAmqpEvent;\n private _retryOptions: RetryOptions;\n\n constructor(\n private identifier: string,\n connectionContext: ConnectionContext,\n entityPath: string,\n retryOptions: RetryOptions,\n ) {\n super(entityPath, entityPath, connectionContext, \"sender\", logger, {\n address: entityPath,\n audience: `${connectionContext.config.endpoint}${entityPath}`,\n });\n this._retryOptions = retryOptions;\n this._onAmqpError = (context: EventContext) => {\n const senderError = context.sender && context.sender.error;\n logger.logError(\n senderError,\n \"%s 'sender_error' event occurred on the sender '%s' with address '%s'. \" +\n \"The associated error\",\n this.logPrefix,\n this.name,\n this.address,\n );\n // TODO: Consider rejecting promise in trySendBatch() or createBatch()\n };\n\n this._onSessionError = (context: EventContext) => {\n const sessionError = context.session && context.session.error;\n logger.logError(\n sessionError,\n \"%s 'session_error' event occurred on the session of sender '%s' with address '%s'. \" +\n \"The associated error\",\n this.logPrefix,\n this.name,\n this.address,\n );\n // TODO: Consider rejecting promise in trySendBatch() or createBatch()\n };\n\n this._onAmqpClose = async (context: EventContext) => {\n const senderError = context.sender && context.sender.error;\n\n logger.logError(\n senderError,\n `${this.logPrefix} 'sender_close' event occurred. The associated error is`,\n );\n\n await this.onDetached().catch((err) => {\n logger.logError(\n err,\n `${this.logPrefix} error when closing sender after 'sender_close' event`,\n );\n });\n };\n\n this._onSessionClose = async (context: EventContext) => {\n const sessionError = context.session && context.session.error;\n\n logger.logError(\n sessionError,\n `${this.logPrefix} 'session_close' event occurred. The associated error is`,\n );\n\n await this.onDetached().catch((err) => {\n logger.logError(\n err,\n `${this.logPrefix} error when closing sender after 'session_close' event`,\n );\n });\n };\n }\n\n private _createSenderOptions(newName?: boolean): AwaitableSenderOptions {\n if (newName) this.name = getUniqueName(this.baseName);\n const srOptions: AwaitableSenderOptions = {\n name: this.name,\n target: {\n address: this.address,\n },\n source: this.identifier,\n onError: this._onAmqpError,\n onClose: this._onAmqpClose,\n onSessionError: this._onSessionError,\n onSessionClose: this._onSessionClose,\n };\n logger.verbose(`${this.logPrefix} Creating sender with options: %O`, srOptions);\n return srOptions;\n }\n\n /**\n * Tries to send the message to ServiceBus if there is enough credit to send them\n * and the circular buffer has available space to settle the message after sending them.\n *\n * We have implemented a synchronous send over here in the sense that we shall be waiting\n * for the message to be accepted or rejected and accordingly resolve or reject the promise.\n *\n * @param encodedMessage - The encoded message to be sent to ServiceBus.\n * @param sendBatch - Boolean indicating whether the encoded message represents a batch of messages or not\n */\n private _trySend(\n encodedMessage: Buffer,\n sendBatch: boolean,\n options: OperationOptionsBase | undefined,\n ): Promise<void> {\n const abortSignal = options?.abortSignal;\n const timeoutInMs = !isDefined(this._retryOptions.timeoutInMs)\n ? Constants.defaultOperationTimeoutInMs\n : this._retryOptions.timeoutInMs;\n\n const sendEventPromise = async (): Promise<void> => {\n const initStartTime = Date.now();\n if (!this.isOpen()) {\n try {\n await waitForTimeoutOrAbortOrResolve({\n actionFn: () => this.open(undefined, options?.abortSignal),\n abortSignal: options?.abortSignal,\n timeoutMs: timeoutInMs,\n timeoutMessage:\n `[${this._context.connectionId}] Sender \"${this.name}\" ` +\n `with address \"${this.address}\", was not able to send the message right now, due ` +\n `to operation timeout.`,\n });\n } catch (err: any) {\n const translatedError = translateServiceBusError(err);\n logger.logError(\n translatedError,\n \"%s An error occurred while creating the sender\",\n this.logPrefix,\n this.name,\n );\n throw translatedError;\n }\n }\n\n const timeTakenByInit = Date.now() - initStartTime;\n\n logger.verbose(\n \"%s Sender '%s', credit: %d available: %d\",\n this.logPrefix,\n this.name,\n this.link?.credit,\n this.link?.session?.outgoing?.available(),\n );\n\n const waitingTime = await waitForSendable(\n logger,\n this.logPrefix,\n this.name,\n timeoutInMs - timeTakenByInit,\n this.link,\n this.link?.session?.outgoing?.available(),\n );\n\n if (timeoutInMs <= timeTakenByInit + waitingTime) {\n const desc: string =\n `${this.logPrefix} Sender \"${this.name}\" ` +\n `with address \"${this.address}\", was not able to send the message right now, due ` +\n `to operation timeout.`;\n logger.warning(desc);\n const e: AmqpError = {\n condition: ErrorNameConditionMapper.ServiceUnavailableError,\n description: desc,\n };\n throw translateServiceBusError(e);\n }\n\n if (!this.link) {\n const msg = `[${this.logPrefix}] Cannot send the message. Link is not ready.`;\n logger.warning(msg);\n const amqpError: AmqpError = {\n condition: ErrorNameConditionMapper.SenderNotReadyError,\n description: msg,\n };\n throw translateServiceBusError(amqpError);\n }\n try {\n const delivery = await this.link.send(encodedMessage, {\n format: sendBatch ? 0x80013700 : 0,\n timeoutInSeconds: (timeoutInMs - timeTakenByInit - waitingTime) / 1000,\n abortSignal,\n });\n logger.verbose(\n \"%s Sender '%s', sent message with delivery id: %d\",\n this.logPrefix,\n this.name,\n delivery.id,\n );\n } catch (error: any) {\n const translatedError = translateServiceBusError(error.innerError || error);\n logger.logError(\n translatedError,\n `${this.logPrefix} An error occurred while sending the message`,\n );\n throw translatedError;\n }\n };\n const config: RetryConfig<void> = {\n operation: sendEventPromise,\n connectionId: this._context.connectionId!,\n operationType: RetryOperationType.sendMessage,\n retryOptions: this._retryOptions,\n abortSignal: abortSignal,\n };\n\n return retry<void>(config);\n }\n\n protected createRheaLink(options: AwaitableSenderOptions): Promise<AwaitableSender> {\n return this._context.connection.createAwaitableSender(options);\n }\n\n /**\n * Initializes the sender session on the connection.\n */\n public async open(\n options?: AwaitableSenderOptions,\n abortSignal?: AbortSignalLike,\n ): Promise<void> {\n try {\n if (!options) {\n options = this._createSenderOptions();\n }\n await this.initLink(options, abortSignal);\n } catch (err: any) {\n const translatedError = translateServiceBusError(err);\n logger.logError(\n translatedError,\n `${this.logPrefix} An error occurred while creating the sender`,\n );\n // Fix the unhelpful error messages for the OperationTimeoutError that comes from `rhea-promise`.\n if ((translatedError as MessagingError).code === \"OperationTimeoutError\") {\n translatedError.message =\n \"Failed to create a sender within allocated time and retry attempts.\";\n }\n throw translatedError;\n }\n }\n\n /**\n * Closes the rhea link.\n * To be called when connection is disconnected, onAmqpClose and onSessionClose events.\n */\n async onDetached(): Promise<void> {\n // Clears the token renewal timer. Closes the link and its session if they are open.\n // Removes the link and its session if they are present in rhea's cache.\n await this.closeLink();\n }\n\n /**\n * Determines whether the AMQP sender link is open. If open then returns true else returns false.\n */\n isOpen(): boolean {\n const result: boolean = this.link == null ? false : this.link.isOpen();\n logger.verbose(\n \"%s Sender '%s' with address '%s' is open? -> %s\",\n this.logPrefix,\n this.name,\n this.address,\n result,\n );\n return result;\n }\n\n /**\n * Sends the given message, with the given options on this link\n *\n * @param data - Message to send. Will be sent as UTF8-encoded JSON string.\n */\n async send(\n data: ServiceBusMessage | AmqpAnnotatedMessage,\n options?: OperationOptionsBase,\n ): Promise<void> {\n throwErrorIfConnectionClosed(this._context);\n try {\n const amqpMessage = toRheaMessage(data, defaultDataTransformer);\n\n // TODO: this body of logic is really similar to what's in sendMessages. Unify what we can.\n const encodedMessage = RheaMessageUtil.encode(amqpMessage);\n logger.verbose(\"%s Sender '%s', trying to send message: %O\", this.logPrefix, this.name, data);\n return await this._trySend(encodedMessage, false, options);\n } catch (err: any) {\n logger.logError(\n err,\n \"%s An error occurred while sending the message: %O\\nError\",\n this.logPrefix,\n data,\n );\n throw err;\n }\n }\n\n /**\n * Returns maximum message size on the AMQP sender link.\n *\n * Options to configure the `createBatch` method on the `Sender`.\n * - `maxSizeInBytes`: The upper limit for the size of batch.\n *\n * Example usage:\n * ```js\n * {\n * retryOptions: { maxRetries: 5; timeoutInMs: 10 }\n * }\n * ```\n */\n async getMaxMessageSize(\n options: {\n retryOptions?: RetryOptions;\n } & Pick<OperationOptionsBase, \"abortSignal\"> = {},\n ): Promise<number> {\n const retryOptions = options.retryOptions || {};\n if (this.isOpen()) {\n return this.link!.maxMessageSize;\n }\n\n const config: RetryConfig<number> = {\n operation: async () => {\n await this.open(undefined, options?.abortSignal);\n\n if (this.link) {\n return this.link.maxMessageSize;\n }\n\n throw new ServiceBusError(\n \"Link failed to initialize, cannot get max message size.\",\n \"GeneralError\",\n );\n },\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.senderLink,\n retryOptions: retryOptions,\n abortSignal: options?.abortSignal,\n };\n\n return retry(config);\n }\n\n async createBatch(options?: CreateMessageBatchOptions): Promise<ServiceBusMessageBatch> {\n throwErrorIfConnectionClosed(this._context);\n let maxMessageSize = await this.getMaxMessageSize({\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n });\n if (options?.maxSizeInBytes) {\n if (options.maxSizeInBytes > maxMessageSize!) {\n const error = new Error(\n `Max message size (${options.maxSizeInBytes} bytes) is greater than maximum message size (${maxMessageSize} bytes) on the AMQP sender link.`,\n );\n throw error;\n }\n maxMessageSize = options.maxSizeInBytes;\n }\n return new ServiceBusMessageBatchImpl(this._context, maxMessageSize!);\n }\n\n async sendBatch(\n batchMessage: ServiceBusMessageBatch,\n options?: OperationOptionsBase,\n ): Promise<void> {\n throwErrorIfConnectionClosed(this._context);\n try {\n logger.verbose(\n \"%s Sender '%s', sending encoded batch message.\",\n this.logPrefix,\n this.name,\n batchMessage,\n );\n return await this._trySend(batchMessage._generateMessage(), true, options);\n } catch (err: any) {\n logger.logError(\n err,\n \"%s Sender '%s': An error occurred while sending the messages: %O\\nError\",\n this.logPrefix,\n this.name,\n batchMessage,\n );\n throw err;\n }\n }\n\n static create(\n identifier: string,\n context: ConnectionContext,\n entityPath: string,\n retryOptions: RetryOptions,\n ): MessageSender {\n throwErrorIfConnectionClosed(context);\n\n const sbSender = new MessageSender(identifier, context, entityPath, retryOptions);\n context.senders[sbSender.name] = sbSender;\n return sbSender;\n }\n\n protected removeLinkFromContext(): void {\n delete this._context.senders[this.name];\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport Long from \"long\";\nimport { MessageSender } from \"./core/messageSender\";\nimport { ServiceBusMessage } from \"./serviceBusMessage\";\nimport { ConnectionContext } from \"./connectionContext\";\nimport {\n errorInvalidMessageTypeSingleOrArray,\n getSenderClosedErrorMsg,\n throwErrorIfConnectionClosed,\n throwIfNotValidServiceBusMessage,\n throwTypeErrorIfNotInstanceOfParameterType,\n throwTypeErrorIfParameterMissing,\n throwTypeErrorIfParameterNotLong,\n} from \"./util/errors\";\nimport { ServiceBusMessageBatch } from \"./serviceBusMessageBatch\";\nimport { CreateMessageBatchOptions } from \"./models\";\nimport {\n RetryConfig,\n RetryOperationType,\n RetryOptions,\n retry,\n AmqpAnnotatedMessage,\n} from \"@azure/core-amqp\";\nimport { OperationOptionsBase } from \"./modelsToBeSharedWithEventHubs\";\nimport { TracingSpanLink } from \"@azure/core-tracing\";\nimport { senderLogger as logger } from \"./log\";\nimport { toSpanOptions, tracingClient } from \"./diagnostics/tracing\";\nimport { ensureValidIdentifier } from \"./util/utils\";\nimport { ServiceBusError } from \"./serviceBusError\";\nimport { instrumentMessage } from \"./diagnostics/instrumentServiceBusMessage\";\n\n/**\n * A Sender can be used to send messages, schedule messages to be sent at a later time\n * and cancel such scheduled messages.\n * Use the `createSender` function on the ServiceBusClient to instantiate a Sender.\n * The Sender class is an abstraction over the underlying AMQP sender link.\n */\nexport interface ServiceBusSender {\n /**\n * A name used to identify the sender. This can be used to correlate logs and exceptions.\n * If not specified or empty, a random unique one will be generated.\n */\n identifier: string;\n /**\n * Sends the given messages after creating an AMQP Sender link if it doesn't already exist.\n *\n * - To send messages to a `session` and/or `partition` enabled Queue/Topic, set the `sessionId`\n * and/or `partitionKey` properties respectively on the messages.\n * - All messages passed to the same sendMessages() call should have the same `sessionId` (if using\n * sessions) and the same `partitionKey` (if using partitions).\n *\n * **Note:**\n *\n * __If you want to send messages of size greater than 1MB, please send individual messages instead of sending a batched message or an array of messages like below.__\n *\n * `await sender.sendMessages(message);`\n *\n * __This is because the batched messages are not capable of sending the larger messages yet. You'll hit the `force detached` error in this case otherwise. Read [service-bus-premium-messaging#large-messages-support](https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-premium-messaging#large-messages-support). More info at [#23014](https://github.com/Azure/azure-sdk-for-js/pull/23014).__\n *\n * @param messages - A single message or an array of messages or a batch of messages created via the createBatch()\n * method to send.\n * @param options - Options bag to pass an abort signal or tracing options.\n * @throws `ServiceBusError` with the code `MessageSizeExceeded` if the provided messages do not fit in a single `ServiceBusMessageBatch`.\n * @throws Error if the underlying connection, client or sender is closed.\n * @throws `ServiceBusError` if the service returns an error while sending messages to the service.\n */\n sendMessages(\n messages:\n | ServiceBusMessage\n | ServiceBusMessage[]\n | ServiceBusMessageBatch\n | AmqpAnnotatedMessage\n | AmqpAnnotatedMessage[],\n options?: OperationOptionsBase,\n ): Promise<void>;\n\n /**\n * Creates an instance of `ServiceBusMessageBatch` to which one can add messages until the maximum supported size is reached.\n * The batch can be passed to the {@link send} method to send the messages to Azure Service Bus.\n * @param options - Configures the behavior of the batch.\n * - `maxSizeInBytes`: The upper limit for the size of batch. The `tryAdd` function will return `false` after this limit is reached.\n *\n * @throws `ServiceBusError` if an error is encountered while sending a message.\n * @throws Error if the underlying connection or sender has been closed.\n */\n createMessageBatch(options?: CreateMessageBatchOptions): Promise<ServiceBusMessageBatch>;\n\n // TODO: Commented out to come up with an alternative name\n // /**\n // * Opens the AMQP link to Azure Service Bus from the sender.\n // *\n // * It is not necessary to call this method in order to use the sender. It is\n // * recommended to call this before your first sendMessages() call if you\n // * want to front load the work of setting up the AMQP link to the service.\n // *\n // * @param options - Options to configure tracing and the abortSignal.\n // */\n // open(options?: OperationOptionsBase): Promise<void>;\n\n /**\n * Returns `true` if either the sender or the client that created it has been closed.\n * @readonly\n */\n isClosed: boolean;\n\n /**\n * Schedules given messages to appear on Service Bus Queue/Subscription at a later time.\n *\n * @param messages - Message or an array of messages that need to be scheduled.\n * @param scheduledEnqueueTimeUtc - The UTC time at which the messages should be enqueued.\n * @param options - Options bag to pass an abort signal or tracing options.\n * @returns The sequence numbers of messages that were scheduled.\n * You will need the sequence number if you intend to cancel the scheduling of the messages.\n * Save the `Long` type as-is in your application without converting to number. Since JavaScript\n * only supports 53 bit numbers, converting the `Long` to number will cause loss in precision.\n * @throws Error if the underlying connection, client or sender is closed.\n * @throws `ServiceBusError` if the service returns an error while scheduling messages.\n */\n scheduleMessages(\n messages:\n | ServiceBusMessage\n | ServiceBusMessage[]\n | AmqpAnnotatedMessage\n | AmqpAnnotatedMessage[],\n scheduledEnqueueTimeUtc: Date,\n options?: OperationOptionsBase,\n ): Promise<Long[]>;\n\n /**\n * Cancels multiple messages that were scheduled to appear on a ServiceBus Queue/Subscription.\n * @param sequenceNumbers - Sequence number or an array of sequence numbers of the messages to be cancelled.\n * @param options - Options bag to pass an abort signal or tracing options.\n * @throws Error if the underlying connection, client or sender is closed.\n * @throws `ServiceBusError` if the service returns an error while canceling scheduled messages.\n */\n cancelScheduledMessages(\n sequenceNumbers: Long | Long[],\n options?: OperationOptionsBase,\n ): Promise<void>;\n /**\n * Path of the entity for which the sender has been created.\n */\n entityPath: string;\n /**\n * Closes the underlying AMQP sender link.\n * Once closed, the sender cannot be used for any further operations.\n * Use the `createSender` function on the QueueClient or TopicClient to instantiate a new Sender\n *\n */\n close(): Promise<void>;\n}\n\n/**\n * @internal\n */\nexport class ServiceBusSenderImpl implements ServiceBusSender {\n public identifier: string;\n private _retryOptions: RetryOptions;\n /**\n * Denotes if close() was called on this sender\n */\n private _isClosed: boolean = false;\n private _sender: MessageSender;\n public entityPath: string;\n\n private get logPrefix(): string {\n return `[${this._context.connectionId}|sender:${this.entityPath}]`;\n }\n\n /**\n * @internal\n * @throws Error if the underlying connection is closed.\n */\n constructor(\n private _context: ConnectionContext,\n private _entityPath: string,\n retryOptions: RetryOptions = {},\n identifier?: string,\n ) {\n throwErrorIfConnectionClosed(_context);\n this.entityPath = _entityPath;\n this.identifier = ensureValidIdentifier(this.entityPath, identifier);\n this._sender = MessageSender.create(this.identifier, this._context, _entityPath, retryOptions);\n this._retryOptions = retryOptions;\n }\n\n private _throwIfSenderOrConnectionClosed(): void {\n throwErrorIfConnectionClosed(this._context);\n if (this.isClosed) {\n const errorMessage = getSenderClosedErrorMsg(this._entityPath);\n const error = new Error(errorMessage);\n logger.logError(error, `[${this._context.connectionId}] is closed`);\n throw error;\n }\n }\n\n public get isClosed(): boolean {\n return this._isClosed || this._context.wasConnectionCloseCalled;\n }\n\n async sendMessages(\n messages:\n | ServiceBusMessage\n | ServiceBusMessage[]\n | ServiceBusMessageBatch\n | AmqpAnnotatedMessage\n | AmqpAnnotatedMessage[],\n options?: OperationOptionsBase,\n ): Promise<void> {\n this._throwIfSenderOrConnectionClosed();\n throwTypeErrorIfParameterMissing(this._context.connectionId, \"messages\", messages);\n\n if (!isServiceBusMessageBatch(messages) && !Array.isArray(messages)) {\n // Case 1: Single message\n throwIfNotValidServiceBusMessage(messages, errorInvalidMessageTypeSingleOrArray);\n const originalMessage = messages as ServiceBusMessage | AmqpAnnotatedMessage;\n const { message, spanContext } = instrumentMessage(\n originalMessage,\n options ?? {},\n this.entityPath,\n this._context.config.host,\n \"publish\",\n );\n const spanLinks: TracingSpanLink[] = spanContext ? [{ tracingContext: spanContext }] : [];\n return tracingClient.withSpan(\n \"ServiceBusSender.send\",\n options ?? {},\n (updatedOptions) => this._sender.send(message, updatedOptions),\n {\n spanLinks,\n ...toSpanOptions(\n { entityPath: this.entityPath, host: this._context.config.host },\n \"publish\",\n \"client\",\n ),\n },\n );\n }\n\n let batch: ServiceBusMessageBatch;\n if (isServiceBusMessageBatch(messages)) {\n // Case 2: Batch message\n batch = messages;\n } else {\n // Case 3: Array of messages\n batch = await this.createMessageBatch(options);\n for (const message of messages) {\n throwIfNotValidServiceBusMessage(message, errorInvalidMessageTypeSingleOrArray);\n if (!batch.tryAddMessage(message, options)) {\n // this is too big - throw an error\n throw new ServiceBusError(\n \"Messages were too big to fit in a single batch. Remove some messages and try again or create your own batch using createBatch(), which gives more fine-grained control.\",\n \"MessageSizeExceeded\",\n );\n }\n }\n }\n\n const spanLinks: TracingSpanLink[] = batch._messageSpanContexts.map((tracingContext) => {\n return {\n tracingContext,\n };\n });\n\n return tracingClient.withSpan(\n \"ServiceBusSender.send\",\n options ?? {},\n (updatedOptions) => this._sender.sendBatch(batch, updatedOptions),\n {\n spanLinks,\n ...toSpanOptions(\n { entityPath: this.entityPath, host: this._context.config.host },\n \"publish\",\n \"client\",\n ),\n },\n );\n }\n\n async createMessageBatch(options?: CreateMessageBatchOptions): Promise<ServiceBusMessageBatch> {\n this._throwIfSenderOrConnectionClosed();\n return this._sender.createBatch(options);\n }\n\n async scheduleMessages(\n messages:\n | ServiceBusMessage\n | ServiceBusMessage[]\n | AmqpAnnotatedMessage\n | AmqpAnnotatedMessage[],\n scheduledEnqueueTimeUtc: Date,\n options: OperationOptionsBase = {},\n ): Promise<Long[]> {\n this._throwIfSenderOrConnectionClosed();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"scheduledEnqueueTimeUtc\",\n scheduledEnqueueTimeUtc,\n );\n throwTypeErrorIfNotInstanceOfParameterType(\n this._context.connectionId,\n \"scheduledEnqueueTimeUtc\",\n scheduledEnqueueTimeUtc,\n Date,\n );\n throwTypeErrorIfParameterMissing(this._context.connectionId, \"messages\", messages);\n const messagesToSchedule = Array.isArray(messages) ? messages : [messages];\n\n for (const message of messagesToSchedule) {\n throwIfNotValidServiceBusMessage(message, errorInvalidMessageTypeSingleOrArray);\n }\n\n const scheduleMessageOperationPromise = async (): Promise<Long[]> => {\n return this._context\n .getManagementClient(this._entityPath)\n .scheduleMessages(scheduledEnqueueTimeUtc, messagesToSchedule, {\n ...options,\n associatedLinkName: this._sender.name,\n requestName: \"scheduleMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<Long[]> = {\n operation: scheduleMessageOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<Long[]>(config);\n }\n\n async cancelScheduledMessages(\n sequenceNumbers: Long | Long[],\n options: OperationOptionsBase = {},\n ): Promise<void> {\n this._throwIfSenderOrConnectionClosed();\n throwTypeErrorIfParameterMissing(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n throwTypeErrorIfParameterNotLong(\n this._context.connectionId,\n \"sequenceNumbers\",\n sequenceNumbers,\n );\n\n const sequenceNumbersToCancel = Array.isArray(sequenceNumbers)\n ? sequenceNumbers\n : [sequenceNumbers];\n const cancelSchedulesMessagesOperationPromise = async (): Promise<void> => {\n return this._context\n .getManagementClient(this._entityPath)\n .cancelScheduledMessages(sequenceNumbersToCancel, {\n ...options,\n associatedLinkName: this._sender.name,\n requestName: \"cancelScheduledMessages\",\n timeoutInMs: this._retryOptions.timeoutInMs,\n });\n };\n const config: RetryConfig<void> = {\n operation: cancelSchedulesMessagesOperationPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.management,\n retryOptions: this._retryOptions,\n abortSignal: options?.abortSignal,\n };\n return retry<void>(config);\n }\n\n // async open(options?: OperationOptionsBase): Promise<void> {\n // this._throwIfSenderOrConnectionClosed();\n\n // const config: RetryConfig<void> = {\n // // TODO: Pass tracing options too\n // operation: () => this._sender.open(undefined, options?.abortSignal),\n // connectionId: this._context.connectionId,\n // operationType: RetryOperationType.senderLink,\n // retryOptions: this._retryOptions,\n // abortSignal: options?.abortSignal\n // };\n\n // return retry<void>(config);\n // }\n\n async close(): Promise<void> {\n try {\n this._isClosed = true;\n await this._sender.close();\n } catch (err: any) {\n logger.logError(err, `${this.logPrefix} An error occurred while closing the Sender`);\n throw err;\n }\n }\n}\n\n/**\n * @internal\n */\nexport function isServiceBusMessageBatch(\n messageBatchOrAnything: unknown,\n): messageBatchOrAnything is ServiceBusMessageBatch {\n if (messageBatchOrAnything == null) {\n return false;\n }\n\n const possibleBatch = messageBatchOrAnything as ServiceBusMessageBatch;\n\n return (\n typeof possibleBatch.tryAddMessage === \"function\" &&\n typeof possibleBatch.maxSizeInBytes === \"number\" &&\n typeof possibleBatch.sizeInBytes === \"number\"\n );\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n Constants,\n ErrorNameConditionMapper,\n MessagingError,\n RetryOptions,\n StandardAbortMessage,\n} from \"@azure/core-amqp\";\nimport {\n AmqpError,\n EventContext,\n OnAmqpEvent,\n Receiver,\n ReceiverEvents,\n ReceiverOptions,\n} from \"rhea-promise\";\nimport { ConnectionContext } from \"../connectionContext\";\nimport { LinkEntity } from \"../core/linkEntity\";\nimport { DispositionStatusOptions } from \"../core/managementClient\";\nimport { OnAmqpEventAsPromise, OnError, OnMessage } from \"../core/messageReceiver\";\nimport { receiverLogger as logger } from \"../log\";\nimport { DispositionType, ServiceBusMessageImpl } from \"../serviceBusMessage\";\nimport { throwErrorIfConnectionClosed } from \"../util/errors\";\nimport { calculateRenewAfterDuration, convertTicksToDate } from \"../util/utils\";\nimport { BatchingReceiverLite, MinimalReceiver } from \"../core/batchingReceiver\";\nimport { onMessageSettled, DeferredPromiseAndTimer, createReceiverOptions } from \"../core/shared\";\nimport { AbortError, AbortSignalLike } from \"@azure/abort-controller\";\nimport { ReceiverHelper } from \"../core/receiverHelper\";\nimport {\n ServiceBusSessionReceiverOptions,\n ProcessErrorArgs,\n ReceiveMode,\n SubscribeOptions,\n} from \"../models\";\nimport { OperationOptionsBase } from \"../modelsToBeSharedWithEventHubs\";\nimport { ServiceBusError, translateServiceBusError } from \"../serviceBusError\";\nimport { abandonMessage, completeMessage } from \"../receivers/receiverCommon\";\nimport { delay, isDefined } from \"@azure/core-util\";\n\n/**\n * Describes the options that need to be provided while creating a message session receiver link.\n * @internal\n */\nexport interface CreateMessageSessionReceiverLinkOptions {\n onClose: OnAmqpEventAsPromise;\n onSessionClose: OnAmqpEventAsPromise;\n onError: OnAmqpEvent;\n onSessionError: OnAmqpEvent;\n onSettled: OnAmqpEvent;\n sessionId?: string;\n}\n\n/**\n * @internal\n * Describes all the options that can be set while instantiating a MessageSession object.\n */\nexport type MessageSessionOptions = Pick<\n ServiceBusSessionReceiverOptions,\n \"maxAutoLockRenewalDurationInMs\" | \"abortSignal\"\n> & {\n receiveMode?: ReceiveMode;\n retryOptions: RetryOptions | undefined;\n skipParsingBodyAsJson: boolean;\n skipConvertingDate: boolean;\n};\n\n/**\n * @internal\n * Describes the receiver for a Message Session.\n */\nexport class MessageSession extends LinkEntity<Receiver> {\n /**\n * Provides the duration until which the session is locked.\n */\n sessionLockedUntilUtc!: Date;\n /**\n * The sessionId for the message session. Empty string is valid sessionId.\n */\n sessionId!: string;\n /**\n * The maximum number of concurrent sessions that the\n * client should initiate.\n * - **Default**: `1`.\n */\n maxConcurrentSessions?: number;\n /**\n * The maximum number of messages that should be\n * processed concurrently in a session while in streaming mode. Once this limit has been reached,\n * more messages will not be received until the user's message handler has completed processing current message.\n * - **Default**: `1` (message in a session at a time).\n */\n maxConcurrentCalls: number = 1;\n /**\n * The mode in which messages should be received.\n * Default: ReceiveMode.peekLock\n */\n receiveMode: ReceiveMode;\n /**\n * Indicates whether `Message.complete()` should be called\n * automatically after the message processing is complete while receiving messages with handlers.\n * Default: false.\n */\n autoComplete: boolean;\n /**\n * The maximum duration within which the\n * lock will be renewed automatically. This value should be greater than the longest message\n * lock duration; for example, the `lockDuration` property on the received message.\n *\n * Default: `300 * 1000` (5 minutes);\n */\n maxAutoRenewDurationInMs: number;\n /**\n * Should lock renewal happen automatically.\n */\n autoRenewLock: boolean;\n /**\n * Denotes if we are currently receiving messages\n */\n get isReceivingMessages(): boolean {\n return this._batchingReceiverLite.isReceivingMessages || this._isReceivingMessagesForSubscriber;\n }\n\n private _batchingReceiverLite: BatchingReceiverLite;\n private _isReceivingMessagesForSubscriber: boolean;\n\n /**\n * Maintains a map of deliveries that\n * are being actively disposed. It acts as a store for correlating the responses received for\n * active dispositions.\n */\n private _deliveryDispositionMap: Map<number, DeferredPromiseAndTimer> = new Map<\n number,\n DeferredPromiseAndTimer\n >();\n /**\n * The message handler provided by the user that will\n * be wrapped inside _onAmqpMessage.\n */\n private _onMessage!: OnMessage;\n /**\n * The error handler provided by the user that will be wrapped\n * inside _onAmqpError.\n */\n private _onError?: OnError;\n /**\n * If the user provided error handler is present then it will\n * notify the user's error handler about the error.\n */\n private _notifyError: OnError;\n /**\n * The message handler that will be set as the handler on the\n * underlying rhea receiver for the \"receiver_close\" event.\n */\n private _onAmqpClose: OnAmqpEventAsPromise;\n /**\n * The message handler that will be set as the handler on\n * the underlying rhea receiver's session for the \"session_error\" event.\n */\n private _onSessionError: OnAmqpEvent;\n /**\n * The message handler that will be set as the handler on\n * the underlying rhea receiver's session for the \"session_close\" event.\n */\n private _onSessionClose: OnAmqpEventAsPromise;\n /**\n * The message handler that will be set as the handler on the\n * underlying rhea receiver for the \"receiver_error\" event.\n */\n private _onAmqpError: OnAmqpEvent;\n /**\n * The message handler that will be set as the handler on the\n * underlying rhea receiver for the \"settled\" event.\n */\n private _onSettled: OnAmqpEvent;\n /**\n * The session lock renewal timer that keeps\n * track of when the MessageSession is due for session lock renewal.\n */\n private _sessionLockRenewalTimer?: NodeJS.Timeout;\n\n private _totalAutoLockRenewDuration: number;\n\n /**\n * Whether to prevent the client from running JSON.parse() on the message body when receiving the message.\n */\n private skipParsingBodyAsJson: boolean;\n\n /**\n * Whether to skip converting Date type on properties of message annotations\n * or application properties into numbers when receiving the message. By\n * default, properties of Date type is converted into UNIX epoch number for\n * compatibility.\n */\n private skipConvertingDate: boolean;\n\n public get receiverHelper(): ReceiverHelper {\n return this._receiverHelper;\n }\n private _receiverHelper: ReceiverHelper;\n\n /**\n * Ensures that the session lock is renewed before it expires. The lock will not be renewed for\n * more than the configured totalAutoLockRenewDuration.\n */\n private _ensureSessionLockRenewal(): void {\n if (\n this.autoRenewLock &&\n new Date(this._totalAutoLockRenewDuration) > this.sessionLockedUntilUtc! &&\n Date.now() < this._totalAutoLockRenewDuration &&\n this.isOpen()\n ) {\n const nextRenewalTimeout = calculateRenewAfterDuration(this.sessionLockedUntilUtc!);\n this._sessionLockRenewalTimer = setTimeout(async () => {\n try {\n logger.verbose(\n \"%s Attempting to renew the session lock for MessageSession '%s' \" + \"with name '%s'.\",\n this.logPrefix,\n this.sessionId,\n this.name,\n );\n this.sessionLockedUntilUtc = await this._context\n .getManagementClient(this.entityPath)\n .renewSessionLock(this.sessionId, {\n associatedLinkName: this.name,\n timeoutInMs: 10000,\n });\n logger.verbose(\n \"%s Successfully renewed the session lock for MessageSession '%s' \" + \"with name '%s'.\",\n this.logPrefix,\n this.sessionId,\n this.name,\n );\n logger.verbose(\n \"%s Calling _ensureSessionLockRenewal() again for MessageSession '%s'.\",\n this.logPrefix,\n this.sessionId,\n );\n this._ensureSessionLockRenewal();\n } catch (err: any) {\n logger.logError(\n err,\n \"%s An error occurred while renewing the session lock for MessageSession '%s'\",\n this.logPrefix,\n this.sessionId,\n );\n }\n }, nextRenewalTimeout);\n logger.verbose(\n \"%s MessageSession '%s' has next session lock renewal in %d milliseconds @(%s).\",\n this.logPrefix,\n this.sessionId,\n nextRenewalTimeout,\n new Date(Date.now() + nextRenewalTimeout).toString(),\n );\n }\n }\n\n protected async createRheaLink(\n options: ReceiverOptions,\n _abortSignal?: AbortSignalLike,\n ): Promise<Receiver> {\n this._lastSBError = undefined;\n let errorMessage: string = \"\";\n\n const link = await this._context.connection.createReceiver(options);\n\n const receivedSessionId = link.source?.filter?.[Constants.sessionFilterName];\n if (!this._providedSessionId && !receivedSessionId) {\n // When we ask for any sessions (passing option of session-filter: undefined),\n // but don't receive one back, check whether service has sent any error.\n if (\n options.source &&\n typeof options.source !== \"string\" &&\n options.source.filter &&\n Constants.sessionFilterName in options.source.filter &&\n options.source.filter![Constants.sessionFilterName] === undefined\n ) {\n await delay(1); // yield to eventloop\n if (this._lastSBError) {\n throw this._lastSBError;\n }\n }\n // Ideally this code path should never be reached as `MessageSession.createReceiver()` should fail instead\n // TODO: https://github.com/Azure/azure-sdk-for-js/issues/9775 to figure out why this code path indeed gets hit.\n errorMessage = `Failed to create a receiver. No unlocked sessions available.`;\n } else if (this._providedSessionId && receivedSessionId !== this._providedSessionId) {\n // This code path is reached if the session is already locked by another receiver.\n // TODO: Check why the service would not throw an error or just timeout instead of giving a misleading successful receiver\n errorMessage = `Failed to create a receiver for the requested session '${this._providedSessionId}'. It may be locked by another receiver.`;\n }\n\n if (errorMessage) {\n const error = translateServiceBusError({\n description: errorMessage,\n condition: ErrorNameConditionMapper.SessionCannotBeLockedError,\n });\n logger.logError(error, this.logPrefix);\n throw error;\n }\n\n return link;\n }\n\n /**\n * Creates a new AMQP receiver under a new AMQP session.\n */\n private async _init(\n opts: { abortSignal?: AbortSignalLike; timeoutInMs?: number } = {},\n ): Promise<void> {\n try {\n const sessionOptions = this._createMessageSessionOptions(this.identifier, opts.timeoutInMs);\n await this.initLink(sessionOptions, opts.abortSignal);\n\n if (!this.link) {\n throw new Error(\"INTERNAL ERROR: failed to create receiver but without an error.\");\n }\n\n const receivedSessionId = this.link.source?.filter?.[Constants.sessionFilterName];\n\n if (!this._providedSessionId) this.sessionId = receivedSessionId;\n this.sessionLockedUntilUtc = convertTicksToDate(\n this.link.properties[\"com.microsoft:locked-until-utc\"],\n );\n logger.verbose(\n \"%s Session with id '%s' is locked until: '%s'.\",\n this.logPrefix,\n this.sessionId,\n this.sessionLockedUntilUtc.toISOString(),\n );\n logger.verbose(\n \"%s Receiver created with receiver options: %O\",\n this.logPrefix,\n sessionOptions,\n );\n if (!this._context.messageSessions[this.name]) {\n this._context.messageSessions[this.name] = this;\n }\n this._totalAutoLockRenewDuration = Date.now() + this.maxAutoRenewDurationInMs;\n this._ensureSessionLockRenewal();\n } catch (err: any) {\n const errObj = translateServiceBusError(err);\n logger.logError(errObj, \"%s An error occured while creating the receiver\", this.logPrefix);\n\n // Fix the unhelpful error messages for the OperationTimeoutError that comes from `rhea-promise`.\n if ((errObj as MessagingError).code === \"OperationTimeoutError\") {\n if (this._providedSessionId) {\n errObj.message = `Failed to create a receiver for the requested session '${this._providedSessionId}' within allocated time and retry attempts.`;\n } else {\n errObj.message = \"Failed to create a receiver within allocated time and retry attempts.\";\n }\n }\n throw errObj;\n }\n }\n\n /**\n * Creates the options that need to be specified while creating an AMQP receiver link.\n */\n private _createMessageSessionOptions(clientId: string, timeoutInMs?: number): ReceiverOptions {\n const rcvrOptions: ReceiverOptions = createReceiverOptions(\n this.name,\n this.receiveMode,\n {\n address: this.address,\n filter: { [Constants.sessionFilterName]: this.sessionId },\n },\n clientId,\n {\n onClose: (context) =>\n this._onAmqpClose(context).catch(() => {\n /* */\n }),\n onSessionClose: (context) =>\n this._onSessionClose(context).catch(() => {\n /* */\n }),\n onError: this._onAmqpError,\n onSessionError: this._onSessionError,\n onSettled: this._onSettled,\n },\n timeoutInMs,\n );\n\n return rcvrOptions;\n }\n\n private _retryOptions: RetryOptions | undefined;\n private _lastSBError: Error | ServiceBusError | undefined;\n\n /**\n * Constructs a MessageSession instance which lets you receive messages as batches\n * or via callbacks using subscribe.\n *\n * @param _providedSessionId - The sessionId provided by the user. This can be the\n * name of a session ID to open (empty string is also valid) or it can be undefined,\n * to indicate we want the next unlocked non-empty session.\n */\n constructor(\n public identifier: string,\n connectionContext: ConnectionContext,\n entityPath: string,\n private _providedSessionId: string | undefined,\n options: MessageSessionOptions,\n ) {\n super(entityPath, entityPath, connectionContext, \"session\", logger, {\n address: entityPath,\n audience: `${connectionContext.config.endpoint}${entityPath}`,\n });\n this._receiverHelper = new ReceiverHelper(() => ({\n receiver: this.link,\n logPrefix: this.logPrefix,\n }));\n this._retryOptions = options.retryOptions;\n this.autoComplete = false;\n if (isDefined(this._providedSessionId)) this.sessionId = this._providedSessionId;\n this.receiveMode = options.receiveMode || \"peekLock\";\n this.skipParsingBodyAsJson = options.skipParsingBodyAsJson;\n this.skipConvertingDate = options.skipConvertingDate;\n this.maxAutoRenewDurationInMs =\n options.maxAutoLockRenewalDurationInMs != null\n ? options.maxAutoLockRenewalDurationInMs\n : 300 * 1000;\n this._totalAutoLockRenewDuration = Date.now() + this.maxAutoRenewDurationInMs;\n this.autoRenewLock = this.maxAutoRenewDurationInMs > 0 && this.receiveMode === \"peekLock\";\n\n this._isReceivingMessagesForSubscriber = false;\n this._batchingReceiverLite = new BatchingReceiverLite(\n connectionContext,\n entityPath,\n async (_abortSignal?: AbortSignalLike): Promise<MinimalReceiver> => {\n return this.link!;\n },\n this.receiveMode,\n this.skipParsingBodyAsJson,\n this.skipConvertingDate,\n );\n\n // setting all the handlers\n this._onSettled = (context: EventContext) => {\n const delivery = context.delivery;\n\n onMessageSettled(this.logPrefix, delivery, this._deliveryDispositionMap);\n };\n\n this._notifyError = async (args: ProcessErrorArgs) => {\n if (this._onError) {\n this._onError(args);\n logger.verbose(\n \"%s Notified the user's error handler about the error received by the Receiver\",\n this.logPrefix,\n );\n }\n };\n\n this._onAmqpError = (context: EventContext) => {\n const receiverError = context.receiver && context.receiver.error;\n if (receiverError) {\n const sbError = translateServiceBusError(receiverError) as MessagingError;\n if (sbError.code === \"SessionLockLostError\") {\n sbError.message = `The session lock has expired on the session with id ${this.sessionId}.`;\n }\n this._lastSBError = sbError;\n logger.logError(sbError, \"%s An error occurred for Receiver\", this.logPrefix);\n this._notifyError({\n error: sbError,\n errorSource: \"receive\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n });\n }\n };\n\n this._onSessionError = (context: EventContext) => {\n const connectionId = this._context.connectionId;\n const sessionError = context.session && context.session.error;\n if (sessionError) {\n const sbError = translateServiceBusError(sessionError);\n logger.logError(\n sbError,\n \"[%s] An error occurred on the session for Receiver '%s': %O.\",\n connectionId,\n this.name,\n sbError,\n );\n this._notifyError({\n error: sbError,\n errorSource: \"receive\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n });\n }\n };\n\n this._onAmqpClose = async (context: EventContext) => {\n const connectionId = this._context.connectionId;\n const receiverError = context.receiver && context.receiver.error;\n const receiver = this.link || context.receiver!;\n if (receiverError) {\n const sbError = translateServiceBusError(receiverError) as MessagingError;\n logger.logError(\n sbError,\n \"[%s] 'receiver_close' event occurred for receiver '%s' for sessionId '%s'. \" +\n \"The associated error is: %O\",\n connectionId,\n this.name,\n this.sessionId,\n sbError,\n );\n // no need to notify the user's error handler since rhea guarantees that receiver_error\n // will always be emitted before receiver_close.\n }\n if (receiver && !receiver.isItselfClosed()) {\n logger.verbose(\n \"%s 'receiver_close' event occurred on the receiver for sessionId '%s' \" +\n \"and the sdk did not initiate this. Hence, let's gracefully close the receiver.\",\n this.logPrefix,\n this.sessionId,\n );\n try {\n await this.close();\n } catch (err: any) {\n logger.logError(\n err,\n \"%s An error occurred while closing the receiver for sessionId '%s'.\",\n this.logPrefix,\n this.sessionId,\n );\n }\n } else {\n logger.verbose(\n \"%s 'receiver_close' event occurred on the receiver for sessionId '%s' \" +\n \"because the sdk initiated it. Hence no need to gracefully close the receiver\",\n this.logPrefix,\n this.sessionId,\n );\n }\n };\n\n this._onSessionClose = async (context: EventContext) => {\n const receiver = this.link || context.receiver!;\n const sessionError = context.session && context.session.error;\n if (sessionError) {\n const sbError = translateServiceBusError(sessionError);\n logger.logError(\n sbError,\n \"%s 'session_close' event occurred for receiver for sessionId '%s'. \" +\n \"The associated error is\",\n this.logPrefix,\n this.sessionId,\n );\n // no need to notify the user's error handler since rhea guarantees that session_error\n // will always be emitted before session_close.\n }\n\n if (receiver && !receiver.isSessionItselfClosed()) {\n logger.verbose(\n \"%s 'session_close' event occurred on the receiver for sessionId '%s' \" +\n \"and the sdk did not initiate this. Hence, let's gracefully close the receiver.\",\n this.logPrefix,\n this.sessionId,\n );\n try {\n await this.close();\n } catch (err: any) {\n logger.logError(\n err,\n \"%s An error occurred while closing the receiver for sessionId '%s'\",\n this.logPrefix,\n this.sessionId,\n );\n }\n } else {\n logger.verbose(\n \"%s 'session_close' event occurred on the receiver for sessionId'%s' \" +\n \"because the sdk initiated it. Hence no need to gracefully close the receiver\",\n this.logPrefix,\n this.sessionId,\n );\n }\n };\n }\n\n /**\n * Closes the underlying AMQP receiver link.\n */\n async close(error?: Error | AmqpError): Promise<void> {\n try {\n this._isReceivingMessagesForSubscriber = false;\n if (this._sessionLockRenewalTimer) clearTimeout(this._sessionLockRenewalTimer);\n logger.verbose(\n \"%s Cleared the timers for 'no new message received' task and \" +\n \"'session lock renewal' task.\",\n this.logPrefix,\n );\n\n await super.close();\n\n this._batchingReceiverLite.terminate(error);\n } catch (err: any) {\n logger.logError(\n err,\n \"%s An error occurred while closing the message session with id '%s'\",\n this.logPrefix,\n this.sessionId,\n );\n }\n }\n\n /**\n * Determines whether the AMQP receiver link is open. If open then returns true else returns false.\n */\n isOpen(): boolean {\n const result: boolean = this.link! && this.link!.isOpen();\n logger.verbose(\n \"%s Receiver for sessionId '%s' is open? -> %s\",\n this.logPrefix,\n this.sessionId,\n result,\n );\n return result;\n }\n\n /**\n * Registers handlers to deal with the incoming stream of messages over an AMQP receiver link\n * from a Queue/Subscription.\n * To stop receiving messages, call `close()` on the SessionReceiver or set the property\n * `newMessageWaitTimeoutInMs` in the options to provide a timeout.\n *\n * @param onMessage - Handler for processing each incoming message.\n * @param onError - Handler for any error that occurs while receiving or processing messages.\n * @param options - Options to control whether messages should be automatically completed. You can\n * also provide a timeout in milliseconds to denote the amount of time to wait for a new message\n * before closing the receiver.\n */\n public subscribe(onMessage: OnMessage, onError: OnError, options: SubscribeOptions): void {\n this.receiverHelper.resume();\n this._subscribeImpl(onMessage, onError, options);\n }\n\n private _subscribeImpl(onMessage: OnMessage, onError: OnError, options: SubscribeOptions): void {\n if (!options) options = {};\n\n if (options.abortSignal?.aborted) {\n throw new AbortError(StandardAbortMessage);\n }\n\n this._isReceivingMessagesForSubscriber = true;\n if (typeof options.maxConcurrentCalls === \"number\" && options.maxConcurrentCalls > 0) {\n this.maxConcurrentCalls = options.maxConcurrentCalls;\n }\n\n // If explicitly set to false then autoComplete is false else true (default).\n this.autoComplete =\n options.autoCompleteMessages === false ? options.autoCompleteMessages : true;\n this._onMessage = onMessage;\n this._onError = onError;\n\n if (this.link && this.link.isOpen()) {\n const onSessionMessage = async (context: EventContext): Promise<void> => {\n // If the receiver got closed in PeekLock mode, avoid processing the message as we\n // cannot settle the message.\n if (this.receiveMode === \"peekLock\" && (!this.link || !this.link.isOpen())) {\n logger.verbose(\n \"%s Not calling the user's message handler for the current message \" +\n \"as the receiver is closed\",\n this.logPrefix,\n );\n return;\n }\n\n const bMessage = new ServiceBusMessageImpl(\n context.message!,\n context.delivery!,\n true,\n this.receiveMode,\n this.skipParsingBodyAsJson,\n this.skipConvertingDate,\n );\n\n try {\n await this._onMessage(bMessage);\n\n if (\n this.autoComplete &&\n this.receiveMode === \"peekLock\" &&\n !bMessage.delivery.remote_settled\n ) {\n try {\n logger.verbose(\n \"%s Auto completing the message with id '%s' on the receiver.\",\n this.logPrefix,\n bMessage.messageId,\n );\n await completeMessage(bMessage, this._context, this.entityPath, this._retryOptions);\n } catch (completeError: any) {\n const translatedError = translateServiceBusError(completeError);\n logger.logError(\n translatedError,\n \"%s An error occurred while completing the message with id '%s' on the \" +\n \"receiver\",\n this.logPrefix,\n bMessage.messageId,\n );\n await this._notifyError({\n error: translatedError,\n errorSource: \"complete\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n });\n }\n }\n } catch (err: any) {\n logger.logError(\n err,\n \"%s An error occurred while running user's message handler for the message \" +\n \"with id '%s' on the receiver\",\n this.logPrefix,\n bMessage.messageId,\n );\n await this._onError!({\n error: err,\n errorSource: \"processMessageCallback\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n });\n\n const error = translateServiceBusError(err);\n // Nothing much to do if user's message handler throws. Let us try abandoning the message.\n if (\n !bMessage.delivery.remote_settled &&\n this.receiveMode === \"peekLock\" &&\n this.isOpen() // only try to abandon the messages if the connection is still open\n ) {\n try {\n logger.logError(\n error,\n \"%s Abandoning the message with id '%s' on the receiver since an error occured\",\n this.logPrefix,\n bMessage.messageId,\n );\n await abandonMessage(\n bMessage,\n this._context,\n this.entityPath,\n undefined,\n this._retryOptions,\n );\n } catch (abandonError: any) {\n const translatedError = translateServiceBusError(abandonError);\n logger.logError(\n translatedError,\n \"%s An error occurred while abandoning the message with id '%s' on the \" +\n \"receiver\",\n this.logPrefix,\n bMessage.messageId,\n translatedError,\n );\n await this._notifyError({\n error: translatedError,\n errorSource: \"abandon\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n });\n }\n }\n return;\n } finally {\n try {\n this.receiverHelper.addCredit(1);\n } catch (err: any) {\n // this isn't something we expect in normal operation - we'd only get here\n // because of a bug in our code.\n this.processCreditError(err);\n }\n }\n };\n // setting the \"message\" event listener.\n this.link.on(ReceiverEvents.message, onSessionMessage);\n\n try {\n this.receiverHelper.addCredit(this.maxConcurrentCalls);\n } catch (err: any) {\n // this isn't something we expect in normal operation - we'd only get here\n // because of a bug in our code.\n this.processCreditError(err);\n }\n } else {\n this._isReceivingMessagesForSubscriber = false;\n const msg =\n `MessageSession with sessionId '${this.sessionId}' and name '${this.name}' ` +\n `has either not been created or is not open.`;\n logger.verbose(\"[%s] %s\", this._context.connectionId, msg);\n this._notifyError({\n error: new Error(msg),\n // This is _probably_ the right error code since we require that\n // the message session is created before we even give back the receiver. So it not\n // being open at this point is either:\n //\n // 1. we didn't acquire the lock\n // 2. the connection was broken (we don't reconnect)\n //\n // If any of these becomes untrue you'll probably want to re-evaluate this classification.\n errorSource: \"receive\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n });\n }\n }\n\n private async processCreditError(err: any): Promise<void> {\n if (err.name === \"AbortError\") {\n // if we fail to add credits because the user has asked us to stop\n // then this isn't an error - it's normal.\n return;\n }\n\n logger.logError(err, \"Cannot request messages on the receiver\");\n\n const error = new ServiceBusError(\"Cannot request messages on the receiver\", \"SessionLockLost\");\n error.retryable = false;\n\n // from the user's perspective this is a fatal link error and they should retry\n // opening the link.\n await this._onError!({\n error,\n errorSource: \"processMessageCallback\",\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n identifier: this.identifier,\n });\n }\n\n /**\n * Returns a batch of messages based on given count and timeout over an AMQP receiver link\n * from a Queue/Subscription.\n *\n * @param maxMessageCount - The maximum number of messages to receive from Queue/Subscription.\n * @param maxWaitTimeInMs - The total wait time in milliseconds until which the receiver will attempt to receive specified number of messages.\n * If this time elapses before the `maxMessageCount` is reached, then messages collected till then will be returned to the user.\n * @returns A promise that resolves with an array of Message objects.\n */\n async receiveMessages(\n maxMessageCount: number,\n maxWaitTimeInMs: number,\n maxTimeAfterFirstMessageInMs: number,\n options: OperationOptionsBase,\n ): Promise<ServiceBusMessageImpl[]> {\n try {\n return await this._batchingReceiverLite.receiveMessages({\n maxMessageCount,\n maxWaitTimeInMs,\n maxTimeAfterFirstMessageInMs,\n ...options,\n });\n } catch (error: any) {\n logger.logError(error, `${this.logPrefix} Rejecting receiveMessages() with error`);\n throw error;\n }\n }\n\n /**\n * To be called when connection is disconnected to gracefully close ongoing receive request.\n * @param connectionError - The connection error if any.\n */\n async onDetached(connectionError: AmqpError | Error): Promise<void> {\n logger.error(\n translateServiceBusError(connectionError),\n `${this.logPrefix} onDetached: closing link (session receiver will not reconnect)`,\n );\n try {\n // Notifying so that the streaming receiver knows about the error\n await this._notifyError({\n entityPath: this.entityPath,\n fullyQualifiedNamespace: this._context.config.host,\n error: translateServiceBusError(connectionError),\n errorSource: \"receive\",\n identifier: this.identifier,\n });\n } catch (error: any) {\n logger.error(\n translateServiceBusError(error),\n `${\n this.logPrefix\n } onDetached: unexpected error seen when tried calling \"_notifyError\" with ${translateServiceBusError(\n connectionError,\n )}`,\n );\n }\n await this.close(connectionError);\n }\n\n /**\n * Settles the message with the specified disposition.\n * @param message - The ServiceBus Message that needs to be settled.\n * @param operation - The disposition type.\n * @param options - Optional parameters that can be provided while disposing the message.\n */\n async settleMessage(\n message: ServiceBusMessageImpl,\n operation: DispositionType,\n options: DispositionStatusOptions,\n ): Promise<any> {\n return new Promise((resolve, reject) => {\n if (operation.match(/^(complete|abandon|defer|deadletter)$/) == null) {\n return reject(new Error(`operation: '${operation}' is not a valid operation.`));\n }\n const delivery = message.delivery;\n const timer = setTimeout(() => {\n this._deliveryDispositionMap.delete(delivery.id);\n logger.verbose(\n \"[%s] Disposition for delivery id: %d, did not complete in %d milliseconds. \" +\n \"Hence rejecting the promise with timeout error\",\n this._context.connectionId,\n delivery.id,\n Constants.defaultOperationTimeoutInMs,\n );\n\n const e: AmqpError = {\n condition: ErrorNameConditionMapper.ServiceUnavailableError,\n description:\n \"Operation to settle the message has timed out. The disposition of the \" +\n \"message may or may not be successful\",\n };\n return reject(translateServiceBusError(e));\n }, Constants.defaultOperationTimeoutInMs);\n this._deliveryDispositionMap.set(delivery.id, {\n resolve: resolve,\n reject: reject,\n timer: timer,\n });\n if (operation === DispositionType.complete) {\n delivery.accept();\n } else if (operation === DispositionType.abandon) {\n const params: any = {\n undeliverable_here: false,\n };\n if (options.propertiesToModify) params.message_annotations = options.propertiesToModify;\n delivery.modified(params);\n } else if (operation === DispositionType.defer) {\n const params: any = {\n undeliverable_here: true,\n };\n if (options.propertiesToModify) params.message_annotations = options.propertiesToModify;\n delivery.modified(params);\n } else if (operation === DispositionType.deadletter) {\n const error: AmqpError = {\n condition: Constants.deadLetterName,\n info: {\n ...options.propertiesToModify,\n DeadLetterReason: options.deadLetterReason,\n DeadLetterErrorDescription: options.deadLetterDescription,\n },\n };\n delivery.reject(error);\n }\n });\n }\n\n /**\n * Creates a new instance of the MessageSession based on the provided parameters.\n * @param identifier - name to identify the message session\n * @param context - The client entity context\n * @param options - Options that can be provided while creating the MessageSession.\n */\n static async create(\n identifier: string,\n context: ConnectionContext,\n entityPath: string,\n sessionId: string | undefined,\n options: MessageSessionOptions,\n ): Promise<MessageSession> {\n throwErrorIfConnectionClosed(context);\n const messageSession = new MessageSession(identifier, context, entityPath, sessionId, options);\n let timeoutInMs: number | undefined;\n // Only passing client timeout in link properties for accepting next available\n // session as this is the only long-polling scenario.\n if (sessionId === undefined) {\n timeoutInMs = options.retryOptions?.timeoutInMs ?? Constants.defaultOperationTimeoutInMs;\n // The number of milliseconds to use as the basis for calculating a random jitter amount\n // opening receiver links. This is intended to ensure that multiple\n // session operations don't timeout at the same exact moment.\n const openReceiveLinkBaseJitterInMs = 100;\n // The amount of time to subtract from the client timeout when setting the server timeout when attempting to\n // accept the next available session. This will decrease the likelihood that the client times out before receiving a\n // response from the server.\n const openReceiveLinkBufferInMs = 20;\n // The amount minimum threshold for the server timeout for which we will subtract the \"openReceiveLinkBufferInMs\".\n // If the server timeout is less than this, we will not subtract the additional buffer.\n const openReceiveLinkBufferThresholdInMs = 1000;\n // Subtract a random amount up to 100ms from the operation timeout as the jitter when attempting to open next available session link.\n // This prevents excessive resource usage when using high amounts of concurrency and accepting the next available session.\n // Take the min of 1% of the total timeout and the base jitter amount so that we don't end up subtracting more than 1% of the total timeout.\n const jitterBaseInMs = Math.min(timeoutInMs * 0.01, openReceiveLinkBaseJitterInMs);\n // We set the operation timeout on the properties not only to include the jitter, but also because the server will otherwise\n // restrict the maximum timeout to 1 minute and 5 seconds, regardless of the client timeout. We only do this for accepting next available\n // session as this is the only long-polling scenario.\n timeoutInMs = Math.floor(timeoutInMs - jitterBaseInMs * Math.random());\n // Subtract an additional constant buffer to reduce the likelihood that the client times out before the service which leads to unnecessary\n // network traffic. If the timeout is too short, we won't do this.\n if (timeoutInMs >= openReceiveLinkBufferThresholdInMs) {\n timeoutInMs -= openReceiveLinkBufferInMs;\n }\n }\n\n await messageSession._init({\n abortSignal: options?.abortSignal,\n timeoutInMs,\n });\n return messageSession;\n }\n\n protected removeLinkFromContext(): void {\n delete this._context.messageSessions[this.name];\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n isNamedKeyCredential,\n isSASCredential,\n isTokenCredential,\n NamedKeyCredential,\n SASCredential,\n TokenCredential,\n} from \"@azure/core-auth\";\n\n/**\n * Typeguard that checks if the input is a credential type the clients accept.\n * @param thing - Any object.\n * @internal\n */\nexport function isCredential(\n thing: unknown,\n): thing is TokenCredential | NamedKeyCredential | SASCredential {\n return isTokenCredential(thing) || isNamedKeyCredential(thing) || isSASCredential(thing);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ConnectionConfig } from \"@azure/core-amqp\";\nimport { TokenCredential, NamedKeyCredential, SASCredential } from \"@azure/core-auth\";\nimport {\n ServiceBusClientOptions,\n createConnectionContextForConnectionString,\n createConnectionContextForCredential,\n} from \"./constructorHelpers\";\nimport { ConnectionContext } from \"./connectionContext\";\nimport {\n ServiceBusReceiverOptions,\n ServiceBusSessionReceiverOptions,\n ReceiveMode,\n ServiceBusSenderOptions,\n} from \"./models\";\nimport { ServiceBusReceiver, ServiceBusReceiverImpl } from \"./receivers/receiver\";\nimport {\n ServiceBusSessionReceiver,\n ServiceBusSessionReceiverImpl,\n} from \"./receivers/sessionReceiver\";\nimport { ServiceBusRuleManager, ServiceBusRuleManagerImpl } from \"./serviceBusRuleManager\";\nimport { ServiceBusSender, ServiceBusSenderImpl } from \"./sender\";\nimport { entityPathMisMatchError } from \"./util/errors\";\nimport { MessageSession } from \"./session/messageSession\";\nimport { isDefined } from \"@azure/core-util\";\nimport { isCredential } from \"./util/typeGuards\";\nimport { ensureValidIdentifier } from \"./util/utils\";\n\n/**\n * A client that can create Sender instances for sending messages to queues and\n * topics as well as Receiver instances to receive messages from queues and subscriptions.\n */\nexport class ServiceBusClient {\n private _connectionContext: ConnectionContext;\n private _clientOptions: ServiceBusClientOptions;\n /**\n * The fully qualified namespace of the Service Bus instance for which this client is created.\n * This is likely to be similar to <yournamespace>.servicebus.windows.net.\n */\n public fullyQualifiedNamespace: string;\n /**\n * The name used to identify this ServiceBusClient.\n * If not specified or empty, a random unique one will be generated.\n */\n public identifier: string;\n /**\n * Creates an instance of the ServiceBusClient class which can be used to create senders and receivers to\n * the Azure Service Bus namespace provided in the connection string. No connection is made to the service\n * until the senders/receivers created with the client are used to send/receive messages.\n * @param connectionString - A connection string for Azure Service Bus namespace.\n * NOTE: this connection string can contain an EntityPath, which is ignored.\n * @param options - Options for the service bus client.\n */\n constructor(connectionString: string, options?: ServiceBusClientOptions);\n /**\n * Creates an instance of the ServiceBusClient class which can be used to create senders and receivers to\n * the Azure Service Bus namespace provided. No connection is made to the service until\n * the senders/receivers created with the client are used to send/receive messages.\n * @param fullyQualifiedNamespace - The full namespace of your Service Bus instance which is\n * likely to be similar to <yournamespace>.servicebus.windows.net.\n * @param credential - A credential object used by the client to get the token to authenticate the connection\n * with the Azure Service Bus. See @azure/identity for creating the credentials.\n * If you're using an own implementation of the `TokenCredential` interface against AAD, then set the \"scopes\" for service-bus\n * to be `[\"https://servicebus.azure.net//user_impersonation\"]` to get the appropriate token.\n * Use the `AzureNamedKeyCredential` from @azure/core-auth if you want to pass in a `SharedAccessKeyName`\n * and `SharedAccessKey` without using a connection string. These fields map to the `name` and `key` field respectively\n * in `AzureNamedKeyCredential`.\n * Use the `AzureSASCredential` from @azure/core-auth if you want to pass in a `SharedAccessSignature`\n * without using a connection string. This field maps to `signature` in `AzureSASCredential`.\n * @param options - A set of options to apply when configuring the client.\n * - `retryOptions` : Configures the retry policy for all the operations on the client.\n * For example, `{ \"maxRetries\": 4 }` or `{ \"maxRetries\": 4, \"retryDelayInMs\": 30000 }`.\n * - `webSocketOptions`: Configures the channelling of the AMQP connection over Web Sockets.\n */\n constructor(\n fullyQualifiedNamespace: string,\n credential: TokenCredential | NamedKeyCredential | SASCredential,\n options?: ServiceBusClientOptions,\n );\n constructor(\n fullyQualifiedNamespaceOrConnectionString1: string,\n credentialOrOptions2?:\n | TokenCredential\n | NamedKeyCredential\n | SASCredential\n | ServiceBusClientOptions,\n options3?: ServiceBusClientOptions,\n ) {\n if (isCredential(credentialOrOptions2)) {\n const fullyQualifiedNamespace: string = fullyQualifiedNamespaceOrConnectionString1;\n const credential = credentialOrOptions2;\n this._clientOptions = options3 || {};\n\n this._connectionContext = createConnectionContextForCredential(\n credential,\n fullyQualifiedNamespace,\n this._clientOptions,\n );\n } else {\n const connectionString: string = fullyQualifiedNamespaceOrConnectionString1;\n this._clientOptions = credentialOrOptions2 || {};\n\n this._connectionContext = createConnectionContextForConnectionString(\n connectionString,\n this._clientOptions,\n );\n }\n this.fullyQualifiedNamespace = this._connectionContext.config.host;\n this.identifier = ensureValidIdentifier(\n this.fullyQualifiedNamespace,\n this._clientOptions.identifier,\n );\n this._clientOptions.retryOptions = this._clientOptions.retryOptions || {};\n\n const timeoutInMs = this._clientOptions.retryOptions.timeoutInMs;\n if (\n isDefined(timeoutInMs) &&\n (typeof timeoutInMs !== \"number\" || !isFinite(timeoutInMs) || timeoutInMs <= 0)\n ) {\n throw new Error(`${timeoutInMs} is an invalid value for retryOptions.timeoutInMs`);\n }\n }\n\n /**\n * Creates a receiver for an Azure Service Bus queue. No connection is made\n * to the service until one of the methods on the receiver is called.\n *\n * To target sub queues like the dead letter queue or the transfer dead letter queue, provide the\n * `subQueue` in the options. To learn more about dead letter queues, see\n * https://docs.microsoft.com/azure/service-bus-messaging/service-bus-dead-letter-queues\n *\n * You can choose between two receive modes: \"peekLock\" (default) and \"receiveAndDelete\".\n * - In peekLock mode, the receiver has a lock on the message for the duration specified on the\n * queue.\n * - In receiveAndDelete mode, messages are deleted from Service Bus as they are received.\n *\n * Messages that are not settled within the lock duration will be redelivered as many times as\n * the max delivery count set on the queue, after which they get sent to a separate dead letter\n * queue.\n *\n * You can settle a message by calling completeMessage(), abandonMessage(), deferMessage() or\n * deadletterMessage() methods on the receiver.\n *\n * More information about how peekLock and message settlement works here:\n * https://docs.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock\n *\n * @param queueName - The name of the queue to receive from.\n * @param options - Options to pass the receiveMode, defaulted to peekLock.\n * @returns A receiver that can be used to receive, peek and settle messages.\n */\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n createReceiver(queueName: string, options?: ServiceBusReceiverOptions): ServiceBusReceiver;\n /**\n * Creates a receiver for an Azure Service Bus subscription. No connection is made\n * to the service until one of the methods on the receiver is called.\n *\n * To target sub queues like the dead letter queue or the transfer dead letter queue, provide the\n * `subQueue` in the options. To learn more about dead letter queues, see\n * https://docs.microsoft.com/azure/service-bus-messaging/service-bus-dead-letter-queues\n *\n * You can choose between two receive modes: \"peekLock\" (default) and \"receiveAndDelete\".\n * - In peekLock mode, the receiver has a lock on the message for the duration specified on the\n * queue.\n * - In receiveAndDelete mode, messages are deleted from Service Bus as they are received.\n *\n * Messages that are not settled within the lock duration will be redelivered as many times as\n * the max delivery count set on the subscription, after which they get sent to a separate dead letter\n * queue.\n *\n * You can settle a message by calling completeMessage(), abandonMessage(), deferMessage() or\n * deadletterMessage() methods on the receiver.\n *\n * More information about how peekLock and message settlement works here:\n * https://docs.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock\n *\n * @param topicName - Name of the topic for the subscription we want to receive from.\n * @param subscriptionName - Name of the subscription (under the `topic`) that we want to receive from.\n * @param options - Options to pass the receiveMode, defaulted to peekLock.\n * @returns A receiver that can be used to receive, peek and settle messages.\n */\n createReceiver(\n topicName: string,\n subscriptionName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: ServiceBusReceiverOptions,\n ): ServiceBusReceiver;\n createReceiver(\n queueOrTopicName1: string,\n optionsOrSubscriptionName2?: ServiceBusReceiverOptions | string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options3?: ServiceBusReceiverOptions,\n ): ServiceBusReceiver {\n validateEntityPath(this._connectionContext.config, queueOrTopicName1);\n\n // NOTE: we don't currently have any options for this kind of receiver but\n // when we do make sure you pass them in and extract them.\n const { entityPath, receiveMode, options } = extractReceiverArguments(\n queueOrTopicName1,\n optionsOrSubscriptionName2,\n options3,\n );\n\n let entityPathWithSubQueue = entityPath;\n if (options?.subQueueType) {\n switch (options?.subQueueType) {\n case \"deadLetter\":\n entityPathWithSubQueue += \"/$DeadLetterQueue\";\n break;\n case \"transferDeadLetter\":\n entityPathWithSubQueue += \"/$Transfer/$DeadLetterQueue\";\n break;\n default:\n throw new Error(\n `Invalid subQueueType '${options?.subQueueType}' provided. Valid values are 'deadLetter' and 'transferDeadLetter'`,\n );\n }\n }\n\n const maxLockAutoRenewDurationInMs =\n options?.maxAutoLockRenewalDurationInMs != null\n ? options.maxAutoLockRenewalDurationInMs\n : 5 * 60 * 1000;\n\n return new ServiceBusReceiverImpl(\n this._connectionContext,\n entityPathWithSubQueue,\n receiveMode,\n maxLockAutoRenewDurationInMs,\n options?.skipParsingBodyAsJson ?? false,\n options?.skipConvertingDate ?? false,\n this._clientOptions.retryOptions,\n options?.identifier,\n );\n }\n\n /**\n * Creates an instance of {@link ServiceBusRuleManager} that is used to manage\n * the rules for a subscription.\n *\n * @param topicName - the topic to create {@link ServiceBusRuleManager}\n * @param subscriptionName - the subscription specific to the specified topic to create a {@link ServiceBusRuleManager} for.\n * @returns a {@link ServiceBusRuleManager} scoped to the specified subscription and topic.\n */\n createRuleManager(topicName: string, subscriptionName: string): ServiceBusRuleManager {\n validateEntityPath(this._connectionContext.config, topicName);\n\n const { entityPath } = extractReceiverArguments(topicName, subscriptionName);\n return new ServiceBusRuleManagerImpl(\n this._connectionContext,\n entityPath,\n this._clientOptions.retryOptions,\n );\n }\n\n /**\n * Creates a receiver for a session enabled Azure Service Bus queue.\n *\n * You can choose between two receive modes: \"peekLock\" (default) and \"receiveAndDelete\".\n * - In peekLock mode, the receiver has a lock on the message for the duration specified on the\n * queue.\n * - In receiveAndDelete mode, messages are deleted from Service Bus as they are received.\n *\n * You can settle a message by calling completeMessage(), abandonMessage(), deferMessage() or\n * deadletterMessage() methods on the receiver.\n *\n * More information about how peekLock and message settlement works here:\n * https://docs.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock\n *\n * @param queueName - The name of the queue to receive from.\n * @param sessionId - The id of the session from which messages need to be received\n * @param options - Options include receiveMode(defaulted to peekLock), options to create session receiver.\n * @returns A receiver that can be used to receive, peek and settle messages.\n */\n acceptSession(\n queueName: string,\n sessionId: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: ServiceBusSessionReceiverOptions,\n ): Promise<ServiceBusSessionReceiver>;\n /**\n * Creates a receiver for a session enabled Azure Service Bus subscription.\n *\n * You can choose between two receive modes: \"peekLock\" (default) and \"receiveAndDelete\".\n * - In peekLock mode, the receiver has a lock on the message for the duration specified on the\n * queue.\n * - In receiveAndDelete mode, messages are deleted from Service Bus as they are received.\n *\n * You can settle a message by calling completeMessage(), abandonMessage(), deferMessage() or\n * deadletterMessage() methods on the receiver.\n *\n * More information about how peekLock and message settlement works here:\n * https://docs.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock\n *\n * @param topicName - Name of the topic for the subscription we want to receive from.\n * @param subscriptionName - Name of the subscription (under the `topic`) that we want to receive from.\n * @param sessionId - The id of the session from which messages need to be received\n * @param options - Options include receiveMode(defaulted to peekLock), options to create session receiver.\n * @returns A receiver that can be used to receive, peek and settle messages.\n */\n acceptSession(\n topicName: string,\n subscriptionName: string,\n sessionId: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: ServiceBusSessionReceiverOptions,\n ): Promise<ServiceBusSessionReceiver>;\n async acceptSession(\n queueOrTopicName1: string,\n optionsOrSubscriptionNameOrSessionId2?: ServiceBusSessionReceiverOptions | string,\n optionsOrSessionId3?: ServiceBusSessionReceiverOptions | string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options4?: ServiceBusSessionReceiverOptions,\n ): Promise<ServiceBusSessionReceiver> {\n validateEntityPath(this._connectionContext.config, queueOrTopicName1);\n\n let sessionId: string;\n let entityPath: string;\n let receiveMode: \"peekLock\" | \"receiveAndDelete\";\n let options: ServiceBusSessionReceiverOptions | undefined;\n\n if (\n typeof queueOrTopicName1 === \"string\" &&\n typeof optionsOrSubscriptionNameOrSessionId2 === \"string\" &&\n typeof optionsOrSessionId3 === \"string\"\n ) {\n // subscription constructor\n sessionId = optionsOrSessionId3;\n\n ({ entityPath, receiveMode, options } = extractReceiverArguments(\n queueOrTopicName1,\n optionsOrSubscriptionNameOrSessionId2,\n // skip the session ID parameter (3)\n options4,\n ));\n } else if (\n typeof queueOrTopicName1 === \"string\" &&\n typeof optionsOrSubscriptionNameOrSessionId2 === \"string\" &&\n typeof optionsOrSessionId3 !== \"string\"\n ) {\n // queue constructor (but only because we know we're not a subscription constructor)\n sessionId = optionsOrSubscriptionNameOrSessionId2;\n\n ({ entityPath, receiveMode, options } = extractReceiverArguments(\n queueOrTopicName1,\n // skip the session ID parameter (2)\n optionsOrSessionId3,\n undefined,\n ));\n } else {\n throw new Error(\"Unhandled set of parameters\");\n }\n\n const messageSession = await MessageSession.create(\n ensureValidIdentifier(entityPath, options?.identifier),\n this._connectionContext,\n entityPath,\n sessionId,\n {\n maxAutoLockRenewalDurationInMs: options?.maxAutoLockRenewalDurationInMs,\n receiveMode,\n abortSignal: options?.abortSignal,\n retryOptions: this._clientOptions.retryOptions,\n skipParsingBodyAsJson: options?.skipParsingBodyAsJson ?? false,\n skipConvertingDate: options?.skipConvertingDate ?? false,\n },\n );\n\n const sessionReceiver = new ServiceBusSessionReceiverImpl(\n messageSession,\n this._connectionContext,\n entityPath,\n receiveMode,\n options?.skipParsingBodyAsJson ?? false,\n options?.skipConvertingDate ?? false,\n this._clientOptions.retryOptions,\n );\n\n return sessionReceiver;\n }\n\n /**\n * Creates a receiver for the next available session in a session-enabled Azure Service Bus queue.\n *\n * You can choose between two receive modes: \"peekLock\" (default) and \"receiveAndDelete\".\n * - In peekLock mode, the receiver has a lock on the message for the duration specified on the\n * queue.\n * - In receiveAndDelete mode, messages are deleted from Service Bus as they are received.\n *\n * You can settle a message by calling completeMessage(), abandonMessage(), deferMessage() or\n * deadletterMessage() methods on the receiver.\n *\n * More information about how peekLock and message settlement works here:\n * https://docs.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock\n *\n * @param queueName - The name of the queue to receive from.\n * @param options - Options include receiveMode(defaulted to peekLock), options to create session receiver.\n * @returns A receiver that can be used to receive, peek and settle messages.\n */\n acceptNextSession(\n queueName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: ServiceBusSessionReceiverOptions,\n ): Promise<ServiceBusSessionReceiver>;\n /**\n * Creates a receiver for the next available session in a session-enabled Azure Service Bus subscription.\n *\n * You can choose between two receive modes: \"peekLock\" (default) and \"receiveAndDelete\".\n * - In peekLock mode, the receiver has a lock on the message for the duration specified on the\n * queue.\n * - In receiveAndDelete mode, messages are deleted from Service Bus as they are received.\n *\n * You can settle a message by calling completeMessage(), abandonMessage(), deferMessage() or\n * deadletterMessage() methods on the receiver.\n *\n * More information about how peekLock and message settlement works here:\n * https://docs.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock\n *\n * @param topicName - Name of the topic for the subscription we want to receive from.\n * @param subscriptionName - Name of the subscription (under the `topic`) that we want to receive from.\n * @param options - Options include receiveMode(defaulted to peekLock), options to create session receiver.\n * @returns A receiver that can be used to receive, peek and settle messages.\n */\n acceptNextSession(\n topicName: string,\n subscriptionName: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: ServiceBusSessionReceiverOptions,\n ): Promise<ServiceBusSessionReceiver>;\n async acceptNextSession(\n queueOrTopicName1: string,\n optionsOrSubscriptionName2?: ServiceBusSessionReceiverOptions | string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options3?: ServiceBusSessionReceiverOptions,\n ): Promise<ServiceBusSessionReceiver> {\n validateEntityPath(this._connectionContext.config, queueOrTopicName1);\n\n const { entityPath, receiveMode, options } = extractReceiverArguments(\n queueOrTopicName1,\n optionsOrSubscriptionName2,\n options3,\n );\n\n const messageSession = await MessageSession.create(\n ensureValidIdentifier(entityPath, options?.identifier),\n this._connectionContext,\n entityPath,\n undefined,\n {\n maxAutoLockRenewalDurationInMs: options?.maxAutoLockRenewalDurationInMs,\n receiveMode,\n abortSignal: options?.abortSignal,\n retryOptions: this._clientOptions.retryOptions,\n skipParsingBodyAsJson: options?.skipParsingBodyAsJson ?? false,\n skipConvertingDate: options?.skipConvertingDate ?? false,\n },\n );\n\n const sessionReceiver = new ServiceBusSessionReceiverImpl(\n messageSession,\n this._connectionContext,\n entityPath,\n receiveMode,\n options?.skipParsingBodyAsJson ?? false,\n options?.skipConvertingDate ?? false,\n this._clientOptions.retryOptions,\n );\n\n return sessionReceiver;\n }\n\n /**\n * Creates a Sender which can be used to send messages, schedule messages to be\n * sent at a later time and cancel such scheduled messages. No connection is made\n * to the service until one of the methods on the sender is called.\n * @param queueOrTopicName - The name of a queue or topic to send messages to.\n */\n createSender(queueOrTopicName: string, options: ServiceBusSenderOptions = {}): ServiceBusSender {\n validateEntityPath(this._connectionContext.config, queueOrTopicName);\n\n return new ServiceBusSenderImpl(\n this._connectionContext,\n queueOrTopicName,\n this._clientOptions.retryOptions,\n options.identifier,\n );\n }\n\n /**\n * Closes the underlying AMQP connection.\n * NOTE: this will also disconnect any Receiver or Sender instances created from this\n * instance.\n */\n close(): Promise<void> {\n return ConnectionContext.close(this._connectionContext);\n }\n}\n\n/**\n * Helper to validate and extract the common arguments from both the create*Receiver() overloads that\n * have this pattern:\n *\n * queue, options\n * topic, subscription, options\n *\n * @internal\n */\nexport function extractReceiverArguments<OptionsT extends { receiveMode?: ReceiveMode }>(\n queueOrTopicName1: string,\n optionsOrSubscriptionName2: string | OptionsT | undefined,\n definitelyOptions3?: OptionsT,\n): {\n entityPath: string;\n receiveMode: ReceiveMode;\n options?: Omit<OptionsT, \"receiveMode\">;\n} {\n let entityPath: string;\n let options: OptionsT | undefined;\n if (typeof optionsOrSubscriptionName2 === \"string\") {\n const topic = queueOrTopicName1;\n const subscription = optionsOrSubscriptionName2;\n entityPath = `${topic}/Subscriptions/${subscription}`;\n options = definitelyOptions3;\n } else {\n entityPath = queueOrTopicName1;\n options = optionsOrSubscriptionName2;\n }\n let receiveMode: ReceiveMode;\n if (!options || !isDefined(options.receiveMode) || options.receiveMode === \"peekLock\") {\n receiveMode = \"peekLock\";\n } else if (options.receiveMode === \"receiveAndDelete\") {\n receiveMode = \"receiveAndDelete\";\n } else {\n throw new TypeError(\n `Invalid receiveMode '${options?.receiveMode}' provided. Valid values are 'peekLock' and 'receiveAndDelete'`,\n );\n }\n delete options?.receiveMode;\n return {\n entityPath,\n receiveMode,\n options,\n };\n}\n\n/**\n * Validates that the EntityPath in the connection string (if any) matches with the\n * queue or topic name passed to the methods that create senders and receivers.\n *\n * @internal\n */\nfunction validateEntityPath(connectionConfig: ConnectionConfig, queueOrTopicName: string): void {\n if (connectionConfig.entityPath && connectionConfig.entityPath !== queueOrTopicName) {\n throw new Error(entityPathMisMatchError);\n }\n}\n"],"names":["isObjectWithProperties","createClientLogger","URL","HttpHeadersV1","MessagingError","translate","isMessagingError","generate_uuid","Buffer","isDefined","Constants.XML_METADATA_MARKER","AbortError","StandardAbortMessage","OperationTimeoutError","Constants.packageJsonInfo","delay","ErrorNameConditionMapper","stringifyXML","logger","parseXML","RestError","Constants.ATOM_METADATA_MARKER","Constants.HttpResponseCodes","Constants.QUEUE_NAME","Constants.FORWARD_TO","Constants.USER_METADATA","Constants.LOCK_DURATION","Constants.MAX_SIZE_IN_MEGABYTES","Constants.MAX_DELIVERY_COUNT","Constants.ENABLE_PARTITIONING","Constants.REQUIRES_SESSION","Constants.ENABLE_BATCHED_OPERATIONS","Constants.DEFAULT_MESSAGE_TIME_TO_LIVE","Constants.AUTO_DELETE_ON_IDLE","Constants.REQUIRES_DUPLICATE_DETECTION","Constants.DUPLICATE_DETECTION_HISTORY_TIME_WINDOW","Constants.DEAD_LETTERING_ON_MESSAGE_EXPIRATION","Constants.FORWARD_DEADLETTERED_MESSAGES_TO","Constants.AUTHORIZATION_RULES","Constants.STATUS","Constants.ENABLE_EXPRESS","Constants.ENTITY_AVAILABILITY_STATUS","Constants.MAX_MESSAGE_SIZE_IN_KILOBYTES","Constants.COUNT_DETAILS","Constants.SIZE_IN_BYTES","Constants.MESSAGE_COUNT","Constants.CREATED_AT","Constants.UPDATED_AT","Constants.ACCESSED_AT","Constants.XML_VALUE_MARKER","Constants.SUBSCRIPTION_NAME","Constants.TOPIC_NAME","Constants.DEAD_LETTERING_ON_FILTER_EVALUATION_EXCEPTIONS","Constants.SUPPORT_ORDERING","Constants.SUBSCRIPTION_COUNT","createSasTokenProvider","createHttpHeaders","createTracingClient","ServiceClient","isTokenCredential","bearerTokenAuthenticationPolicy","AMQPConstants","isNamedKeyCredential","parseConnectionString","createPipelineFromOptions","Constants.CURRENT_API_VERSION","createPipelineRequest","Constants.API_VERSION_QUERY_KEY","message","AmqpAnnotatedMessage","Constants","uuid_to_string","defaultCancellableLock","isSasTokenProvider","TokenType","AbortController","RequestResponseLink","ReceiverEvents","types","RheaMessageUtil","ConditionErrorNameMapper","string_to_uuid","os","ConnectionContextBase","ConnectionEvents","ConnectionConfig","isSASCredential","retry","RetryOperationType","RetryMode","SessionEvents","getPagedAsyncIterator","RheaMessagePropertiesList"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAMA;;;;AAIG;AACI,MAAM,MAAM,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;AAE5D;;;AAGG;AACI,MAAM,cAAc,GAAG,sBAAsB,CAAC,sBAAsB,CAAC,CAAC;AAE7E;;;AAGG;AACI,MAAM,YAAY,GAAG,sBAAsB,CAAC,oBAAoB,CAAC,CAAC;AAEzE;;;AAGG;AACI,MAAM,iBAAiB,GAAG,sBAAsB,C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