@azure/core-amqp 4.4.0-beta.1 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -3
- package/README.md +3 -5
- package/dist/browser/ConnectionContextBase.js +1 -1
- package/dist/browser/ConnectionContextBase.js.map +1 -1
- package/dist/browser/amqpAnnotatedMessage.d.ts +1 -1
- package/dist/browser/amqpAnnotatedMessage.js +1 -2
- package/dist/browser/amqpAnnotatedMessage.js.map +1 -1
- package/dist/browser/auth/token.js +1 -1
- package/dist/browser/auth/token.js.map +1 -1
- package/dist/browser/auth/tokenProvider.d.ts +1 -1
- package/dist/browser/auth/tokenProvider.js +2 -2
- package/dist/browser/auth/tokenProvider.js.map +1 -1
- package/dist/browser/cbs.d.ts +3 -3
- package/dist/browser/cbs.js +2 -2
- package/dist/browser/cbs.js.map +1 -1
- package/dist/browser/connectionConfig/connectionConfig.d.ts +1 -1
- package/dist/browser/connectionConfig/connectionConfig.js +29 -10
- package/dist/browser/connectionConfig/connectionConfig.js.map +1 -1
- package/dist/browser/errors.d.ts +3 -1
- package/dist/browser/errors.js +3 -1
- package/dist/browser/errors.js.map +1 -1
- package/dist/browser/index.d.ts +0 -1
- package/dist/browser/index.js +1 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/internals.js +1 -1
- package/dist/browser/internals.js.map +1 -1
- package/dist/browser/log.js +1 -1
- package/dist/browser/log.js.map +1 -1
- package/dist/browser/messageHeader.d.ts +1 -1
- package/dist/browser/messageHeader.js +1 -1
- package/dist/browser/messageHeader.js.map +1 -1
- package/dist/browser/messageProperties.d.ts +1 -2
- package/dist/browser/messageProperties.js +1 -1
- package/dist/browser/messageProperties.js.map +1 -1
- package/dist/browser/requestResponseLink.d.ts +2 -2
- package/dist/browser/requestResponseLink.js +3 -3
- package/dist/browser/requestResponseLink.js.map +1 -1
- package/dist/browser/retry.d.ts +1 -1
- package/dist/browser/retry.js +5 -12
- package/dist/browser/retry.js.map +1 -1
- package/dist/browser/util/checkNetworkConnection-browser.mjs.map +1 -1
- package/dist/browser/util/checkNetworkConnection.common.d.ts +6 -0
- package/dist/browser/util/checkNetworkConnection.common.js +10 -0
- package/dist/browser/util/checkNetworkConnection.common.js.map +1 -0
- package/dist/browser/util/checkNetworkConnection.d.ts +1 -5
- package/dist/browser/util/checkNetworkConnection.js +2 -8
- package/dist/browser/util/constants.d.ts +0 -1
- package/dist/browser/util/constants.js +1 -2
- package/dist/browser/util/constants.js.map +1 -1
- package/dist/browser/util/hmacSha256-browser.mjs.map +1 -1
- package/dist/browser/util/hmacSha256.common.d.ts +2 -0
- package/dist/browser/util/hmacSha256.common.js +11 -0
- package/dist/browser/util/hmacSha256.common.js.map +1 -0
- package/dist/browser/util/hmacSha256.d.ts +1 -16
- package/dist/browser/util/hmacSha256.js +2 -9
- package/dist/browser/util/lock.d.ts +1 -1
- package/dist/browser/util/lock.js +1 -1
- package/dist/browser/util/lock.js.map +1 -1
- package/dist/browser/util/runtimeInfo-browser.mjs.map +1 -1
- package/dist/browser/util/runtimeInfo.js +1 -1
- package/dist/browser/util/typeGuards.d.ts +1 -1
- package/dist/browser/util/typeGuards.js +1 -1
- package/dist/browser/util/typeGuards.js.map +1 -1
- package/dist/browser/util/utils.d.ts +3 -3
- package/dist/browser/util/utils.js +1 -1
- package/dist/browser/util/utils.js.map +1 -1
- package/dist/commonjs/ConnectionContextBase.js +1 -1
- package/dist/commonjs/ConnectionContextBase.js.map +1 -1
- package/dist/commonjs/amqpAnnotatedMessage.d.ts +1 -1
- package/dist/commonjs/amqpAnnotatedMessage.js +1 -2
- package/dist/commonjs/amqpAnnotatedMessage.js.map +1 -1
- package/dist/commonjs/auth/token.js +1 -1
- package/dist/commonjs/auth/token.js.map +1 -1
- package/dist/commonjs/auth/tokenProvider.d.ts +1 -1
- package/dist/commonjs/auth/tokenProvider.js +3 -3
- package/dist/commonjs/auth/tokenProvider.js.map +1 -1
- package/dist/commonjs/cbs.d.ts +3 -3
- package/dist/commonjs/cbs.js +1 -1
- package/dist/commonjs/cbs.js.map +1 -1
- package/dist/commonjs/connectionConfig/connectionConfig.d.ts +1 -1
- package/dist/commonjs/connectionConfig/connectionConfig.js +31 -12
- package/dist/commonjs/connectionConfig/connectionConfig.js.map +1 -1
- package/dist/commonjs/errors.d.ts +3 -1
- package/dist/commonjs/errors.js +7 -5
- package/dist/commonjs/errors.js.map +1 -1
- package/dist/commonjs/index.d.ts +0 -1
- package/dist/commonjs/index.js +1 -2
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/internals.js +1 -1
- package/dist/commonjs/internals.js.map +1 -1
- package/dist/commonjs/log.js +3 -3
- package/dist/commonjs/log.js.map +1 -1
- package/dist/commonjs/messageHeader.d.ts +1 -1
- package/dist/commonjs/messageHeader.js +1 -1
- package/dist/commonjs/messageHeader.js.map +1 -1
- package/dist/commonjs/messageProperties.d.ts +1 -2
- package/dist/commonjs/messageProperties.js +1 -1
- package/dist/commonjs/messageProperties.js.map +1 -1
- package/dist/commonjs/requestResponseLink.d.ts +2 -2
- package/dist/commonjs/requestResponseLink.js +4 -4
- package/dist/commonjs/requestResponseLink.js.map +1 -1
- package/dist/commonjs/retry.d.ts +1 -1
- package/dist/commonjs/retry.js +7 -14
- package/dist/commonjs/retry.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/util/checkNetworkConnection.common.d.ts +6 -0
- package/dist/commonjs/util/checkNetworkConnection.common.js +13 -0
- package/dist/commonjs/util/checkNetworkConnection.common.js.map +1 -0
- package/dist/commonjs/util/checkNetworkConnection.js +2 -3
- package/dist/commonjs/util/checkNetworkConnection.js.map +1 -1
- package/dist/commonjs/util/constants.d.ts +0 -1
- package/dist/commonjs/util/constants.js +1 -2
- package/dist/commonjs/util/constants.js.map +1 -1
- package/dist/commonjs/util/hmacSha256.common.d.ts +2 -0
- package/dist/commonjs/util/hmacSha256.common.js +14 -0
- package/dist/commonjs/util/hmacSha256.common.js.map +1 -0
- package/dist/commonjs/util/hmacSha256.js +2 -3
- package/dist/commonjs/util/hmacSha256.js.map +1 -1
- package/dist/commonjs/util/lock.d.ts +1 -1
- package/dist/commonjs/util/lock.js +1 -1
- package/dist/commonjs/util/lock.js.map +1 -1
- package/dist/commonjs/util/runtimeInfo.js +3 -4
- package/dist/commonjs/util/runtimeInfo.js.map +1 -1
- package/dist/commonjs/util/typeGuards.d.ts +1 -1
- package/dist/commonjs/util/typeGuards.js +2 -3
- package/dist/commonjs/util/typeGuards.js.map +1 -1
- package/dist/commonjs/util/utils.d.ts +3 -3
- package/dist/commonjs/util/utils.js +10 -10
- package/dist/commonjs/util/utils.js.map +1 -1
- package/dist/esm/ConnectionContextBase.js +1 -1
- package/dist/esm/ConnectionContextBase.js.map +1 -1
- package/dist/esm/amqpAnnotatedMessage.d.ts +1 -1
- package/dist/esm/amqpAnnotatedMessage.js +1 -2
- package/dist/esm/amqpAnnotatedMessage.js.map +1 -1
- package/dist/esm/auth/token.js +1 -1
- package/dist/esm/auth/token.js.map +1 -1
- package/dist/esm/auth/tokenProvider.d.ts +1 -1
- package/dist/esm/auth/tokenProvider.js +2 -2
- package/dist/esm/auth/tokenProvider.js.map +1 -1
- package/dist/esm/cbs.d.ts +3 -3
- package/dist/esm/cbs.js +2 -2
- package/dist/esm/cbs.js.map +1 -1
- package/dist/esm/connectionConfig/connectionConfig.d.ts +1 -1
- package/dist/esm/connectionConfig/connectionConfig.js +29 -10
- package/dist/esm/connectionConfig/connectionConfig.js.map +1 -1
- package/dist/esm/errors.d.ts +3 -1
- package/dist/esm/errors.js +3 -1
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internals.js +1 -1
- package/dist/esm/internals.js.map +1 -1
- package/dist/esm/log.js +1 -1
- package/dist/esm/log.js.map +1 -1
- package/dist/esm/messageHeader.d.ts +1 -1
- package/dist/esm/messageHeader.js +1 -1
- package/dist/esm/messageHeader.js.map +1 -1
- package/dist/esm/messageProperties.d.ts +1 -2
- package/dist/esm/messageProperties.js +1 -1
- package/dist/esm/messageProperties.js.map +1 -1
- package/dist/esm/requestResponseLink.d.ts +2 -2
- package/dist/esm/requestResponseLink.js +3 -3
- package/dist/esm/requestResponseLink.js.map +1 -1
- package/dist/esm/retry.d.ts +1 -1
- package/dist/esm/retry.js +5 -12
- package/dist/esm/retry.js.map +1 -1
- package/dist/esm/util/checkNetworkConnection.common.d.ts +6 -0
- package/dist/esm/util/checkNetworkConnection.common.js +10 -0
- package/dist/esm/util/checkNetworkConnection.common.js.map +1 -0
- package/dist/esm/util/checkNetworkConnection.js +1 -1
- package/dist/esm/util/checkNetworkConnection.js.map +1 -1
- package/dist/esm/util/constants.d.ts +0 -1
- package/dist/esm/util/constants.js +1 -2
- package/dist/esm/util/constants.js.map +1 -1
- package/dist/esm/util/hmacSha256.common.d.ts +2 -0
- package/dist/esm/util/hmacSha256.common.js +11 -0
- package/dist/esm/util/hmacSha256.common.js.map +1 -0
- package/dist/esm/util/hmacSha256.js +1 -1
- package/dist/esm/util/hmacSha256.js.map +1 -1
- package/dist/esm/util/lock.d.ts +1 -1
- package/dist/esm/util/lock.js +1 -1
- package/dist/esm/util/lock.js.map +1 -1
- package/dist/esm/util/runtimeInfo.js +1 -1
- package/dist/esm/util/runtimeInfo.js.map +1 -1
- package/dist/esm/util/typeGuards.d.ts +1 -1
- package/dist/esm/util/typeGuards.js +1 -1
- package/dist/esm/util/typeGuards.js.map +1 -1
- package/dist/esm/util/utils.d.ts +3 -3
- package/dist/esm/util/utils.js +1 -1
- package/dist/esm/util/utils.js.map +1 -1
- package/dist/react-native/ConnectionContextBase.js +1 -1
- package/dist/react-native/ConnectionContextBase.js.map +1 -1
- package/dist/react-native/amqpAnnotatedMessage.d.ts +1 -1
- package/dist/react-native/amqpAnnotatedMessage.js +1 -2
- package/dist/react-native/amqpAnnotatedMessage.js.map +1 -1
- package/dist/react-native/auth/token.js +1 -1
- package/dist/react-native/auth/token.js.map +1 -1
- package/dist/react-native/auth/tokenProvider.d.ts +1 -1
- package/dist/react-native/auth/tokenProvider.js +2 -2
- package/dist/react-native/auth/tokenProvider.js.map +1 -1
- package/dist/react-native/cbs.d.ts +3 -3
- package/dist/react-native/cbs.js +2 -2
- package/dist/react-native/cbs.js.map +1 -1
- package/dist/react-native/connectionConfig/connectionConfig.d.ts +1 -1
- package/dist/react-native/connectionConfig/connectionConfig.js +29 -10
- package/dist/react-native/connectionConfig/connectionConfig.js.map +1 -1
- package/dist/react-native/errors.d.ts +3 -1
- package/dist/react-native/errors.js +3 -1
- package/dist/react-native/errors.js.map +1 -1
- package/dist/react-native/index.d.ts +0 -1
- package/dist/react-native/index.js +1 -2
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/internals.js +1 -1
- package/dist/react-native/internals.js.map +1 -1
- package/dist/react-native/log.js +1 -1
- package/dist/react-native/log.js.map +1 -1
- package/dist/react-native/messageHeader.d.ts +1 -1
- package/dist/react-native/messageHeader.js +1 -1
- package/dist/react-native/messageHeader.js.map +1 -1
- package/dist/react-native/messageProperties.d.ts +1 -2
- package/dist/react-native/messageProperties.js +1 -1
- package/dist/react-native/messageProperties.js.map +1 -1
- package/dist/react-native/requestResponseLink.d.ts +2 -2
- package/dist/react-native/requestResponseLink.js +3 -3
- package/dist/react-native/requestResponseLink.js.map +1 -1
- package/dist/react-native/retry.d.ts +1 -1
- package/dist/react-native/retry.js +5 -12
- package/dist/react-native/retry.js.map +1 -1
- package/dist/react-native/util/checkNetworkConnection-react-native.mjs.map +1 -0
- package/dist/react-native/util/checkNetworkConnection.common.d.ts +6 -0
- package/dist/react-native/util/checkNetworkConnection.common.js +10 -0
- package/dist/react-native/util/checkNetworkConnection.common.js.map +1 -0
- package/dist/react-native/util/checkNetworkConnection.d.ts +2 -6
- package/dist/react-native/util/checkNetworkConnection.js +3 -27
- package/dist/react-native/util/constants.d.ts +0 -1
- package/dist/react-native/util/constants.js +1 -2
- package/dist/react-native/util/constants.js.map +1 -1
- package/dist/react-native/util/hmacSha256-react-native.mjs.map +1 -0
- package/dist/react-native/util/hmacSha256.common.d.ts +2 -0
- package/dist/react-native/util/hmacSha256.common.js +11 -0
- package/dist/react-native/util/hmacSha256.common.js.map +1 -0
- package/dist/react-native/util/hmacSha256.d.ts +2 -2
- package/dist/react-native/util/hmacSha256.js +3 -7
- package/dist/react-native/util/lock.d.ts +1 -1
- package/dist/react-native/util/lock.js +1 -1
- package/dist/react-native/util/lock.js.map +1 -1
- package/dist/react-native/util/runtimeInfo-react-native.mjs.map +1 -1
- package/dist/react-native/util/runtimeInfo.js +2 -2
- package/dist/react-native/util/typeGuards.d.ts +1 -1
- package/dist/react-native/util/typeGuards.js +1 -1
- package/dist/react-native/util/typeGuards.js.map +1 -1
- package/dist/react-native/util/utils.d.ts +3 -3
- package/dist/react-native/util/utils.js +1 -1
- package/dist/react-native/util/utils.js.map +1 -1
- package/package.json +29 -33
- package/dist/browser/ConnectionContextBase.d.ts.map +0 -1
- package/dist/browser/amqpAnnotatedMessage.d.ts.map +0 -1
- package/dist/browser/auth/token.d.ts.map +0 -1
- package/dist/browser/auth/tokenProvider.d.ts.map +0 -1
- package/dist/browser/cbs.d.ts.map +0 -1
- package/dist/browser/connectionConfig/connectionConfig.d.ts.map +0 -1
- package/dist/browser/errors.d.ts.map +0 -1
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/internals.d.ts.map +0 -1
- package/dist/browser/log.d.ts.map +0 -1
- package/dist/browser/messageHeader.d.ts.map +0 -1
- package/dist/browser/messageProperties.d.ts.map +0 -1
- package/dist/browser/requestResponseLink.d.ts.map +0 -1
- package/dist/browser/retry.d.ts.map +0 -1
- package/dist/browser/util/checkNetworkConnection-browser.d.mts.map +0 -1
- package/dist/browser/util/constants.d.ts.map +0 -1
- package/dist/browser/util/hmacSha256-browser.d.mts.map +0 -1
- package/dist/browser/util/lock.d.ts.map +0 -1
- package/dist/browser/util/runtimeInfo-browser.d.mts.map +0 -1
- package/dist/browser/util/typeGuards.d.ts.map +0 -1
- package/dist/browser/util/utils.d.ts.map +0 -1
- package/dist/commonjs/ConnectionContextBase.d.ts.map +0 -1
- package/dist/commonjs/amqpAnnotatedMessage.d.ts.map +0 -1
- package/dist/commonjs/auth/token.d.ts.map +0 -1
- package/dist/commonjs/auth/tokenProvider.d.ts.map +0 -1
- package/dist/commonjs/cbs.d.ts.map +0 -1
- package/dist/commonjs/connectionConfig/connectionConfig.d.ts.map +0 -1
- package/dist/commonjs/errors.d.ts.map +0 -1
- package/dist/commonjs/index.d.ts.map +0 -1
- package/dist/commonjs/internals.d.ts.map +0 -1
- package/dist/commonjs/log.d.ts.map +0 -1
- package/dist/commonjs/messageHeader.d.ts.map +0 -1
- package/dist/commonjs/messageProperties.d.ts.map +0 -1
- package/dist/commonjs/requestResponseLink.d.ts.map +0 -1
- package/dist/commonjs/retry.d.ts.map +0 -1
- package/dist/commonjs/util/checkNetworkConnection.d.ts.map +0 -1
- package/dist/commonjs/util/constants.d.ts.map +0 -1
- package/dist/commonjs/util/hmacSha256.d.ts.map +0 -1
- package/dist/commonjs/util/lock.d.ts.map +0 -1
- package/dist/commonjs/util/runtimeInfo.d.ts.map +0 -1
- package/dist/commonjs/util/typeGuards.d.ts.map +0 -1
- package/dist/commonjs/util/utils.d.ts.map +0 -1
- package/dist/core-amqp.d.ts +0 -1521
- package/dist/esm/ConnectionContextBase.d.ts.map +0 -1
- package/dist/esm/amqpAnnotatedMessage.d.ts.map +0 -1
- package/dist/esm/auth/token.d.ts.map +0 -1
- package/dist/esm/auth/tokenProvider.d.ts.map +0 -1
- package/dist/esm/cbs.d.ts.map +0 -1
- package/dist/esm/connectionConfig/connectionConfig.d.ts.map +0 -1
- package/dist/esm/errors.d.ts.map +0 -1
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/internals.d.ts.map +0 -1
- package/dist/esm/log.d.ts.map +0 -1
- package/dist/esm/messageHeader.d.ts.map +0 -1
- package/dist/esm/messageProperties.d.ts.map +0 -1
- package/dist/esm/requestResponseLink.d.ts.map +0 -1
- package/dist/esm/retry.d.ts.map +0 -1
- package/dist/esm/util/checkNetworkConnection.d.ts.map +0 -1
- package/dist/esm/util/constants.d.ts.map +0 -1
- package/dist/esm/util/hmacSha256.d.ts.map +0 -1
- package/dist/esm/util/lock.d.ts.map +0 -1
- package/dist/esm/util/runtimeInfo.d.ts.map +0 -1
- package/dist/esm/util/typeGuards.d.ts.map +0 -1
- package/dist/esm/util/utils.d.ts.map +0 -1
- package/dist/react-native/ConnectionContextBase.d.ts.map +0 -1
- package/dist/react-native/amqpAnnotatedMessage.d.ts.map +0 -1
- package/dist/react-native/auth/token.d.ts.map +0 -1
- package/dist/react-native/auth/tokenProvider.d.ts.map +0 -1
- package/dist/react-native/cbs.d.ts.map +0 -1
- package/dist/react-native/connectionConfig/connectionConfig.d.ts.map +0 -1
- package/dist/react-native/errors.d.ts.map +0 -1
- package/dist/react-native/index.d.ts.map +0 -1
- package/dist/react-native/internals.d.ts.map +0 -1
- package/dist/react-native/log.d.ts.map +0 -1
- package/dist/react-native/messageHeader.d.ts.map +0 -1
- package/dist/react-native/messageProperties.d.ts.map +0 -1
- package/dist/react-native/requestResponseLink.d.ts.map +0 -1
- package/dist/react-native/retry.d.ts.map +0 -1
- package/dist/react-native/util/checkNetworkConnection.d.ts.map +0 -1
- package/dist/react-native/util/checkNetworkConnection.js.map +0 -1
- package/dist/react-native/util/constants.d.ts.map +0 -1
- package/dist/react-native/util/hmacSha256.d.ts.map +0 -1
- package/dist/react-native/util/hmacSha256.js.map +0 -1
- package/dist/react-native/util/lock.d.ts.map +0 -1
- package/dist/react-native/util/runtimeInfo-react-native.d.mts.map +0 -1
- package/dist/react-native/util/typeGuards.d.ts.map +0 -1
- package/dist/react-native/util/utils.d.ts.map +0 -1
package/dist/esm/cbs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cbs.js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EAAE,EAAE,WAAW,CAAC,CAAC;QAC7F,OAAO,WAAW,CAAC;IACrB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AbortError, AbortSignalLike } from \"@azure/abort-controller\";\nimport {\n Connection,\n EventContext,\n ReceiverEvents,\n ReceiverOptions,\n Message as RheaMessage,\n SenderEvents,\n SenderOptions,\n generate_uuid,\n} from \"rhea-promise\";\nimport { logErrorStackTrace, logger } from \"./log.js\";\nimport { Constants } from \"./util/constants.js\";\nimport { RequestResponseLink } from \"./requestResponseLink.js\";\nimport { StandardAbortMessage } from \"./util/constants.js\";\nimport { TokenType } from \"./auth/token.js\";\nimport { defaultCancellableLock } from \"./util/utils.js\";\nimport { isError } from \"@azure/core-util\";\nimport { translate } from \"./errors.js\";\n\n/**\n * Describes the CBS Response.\n */\nexport interface CbsResponse {\n correlationId: string;\n statusCode: string;\n statusDescription: string;\n}\n\n/**\n * Describes the EventHub/ServiceBus Cbs client that talks to the $cbs endpoint over AMQP connection.\n */\nexport class CbsClient {\n /**\n * CBS endpoint - \"$cbs\"\n */\n readonly endpoint: string = Constants.cbsEndpoint;\n /**\n * CBS replyTo - The receiver link name that the service should reply to.\n */\n readonly replyTo: string = `${Constants.cbsReplyTo}-${generate_uuid()}`;\n /**\n * The unique lock name per $cbs session per connection that is used to\n * acquire the lock for establishing a cbs session if one does not exist for an amqp connection.\n */\n readonly cbsLock: string = `${Constants.negotiateCbsKey}-${generate_uuid()}`;\n /**\n * The unique lock name per connection that is used to\n * acquire the lock for establishing an amqp connection if one does not exist.\n */\n readonly connectionLock: string;\n /**\n * The AMQP connection.\n */\n connection: Connection;\n\n /**\n * CBS sender, receiver on the same session.\n */\n private _cbsSenderReceiverLink?: RequestResponseLink;\n\n /**\n * @param connection - The AMQP connection.\n * @param connectionLock - A unique string (usually a guid) per connection.\n */\n constructor(connection: Connection, connectionLock: string) {\n this.connection = connection;\n this.connectionLock = connectionLock;\n }\n\n /**\n * Creates a singleton instance of the CBS session if it hasn't been initialized previously on\n * the given connection.\n * @param options - Optional parameters that can be used to affect this method's behavior.\n * For example, `abortSignal` can be passed to allow cancelling an in-progress `init` invocation.\n * @returns Promise<void>.\n */\n async init(options: { abortSignal?: AbortSignalLike; timeoutInMs?: number } = {}): Promise<void> {\n const { abortSignal, timeoutInMs } = options;\n\n try {\n if (abortSignal?.aborted) {\n throw new AbortError(StandardAbortMessage);\n }\n\n // Acquire the lock and establish an amqp connection if it does not exist.\n if (!this.connection.isOpen()) {\n logger.verbose(\"The CBS client is trying to establish an AMQP connection.\");\n await defaultCancellableLock.acquire(\n this.connectionLock,\n () => {\n return this.connection.open({ abortSignal });\n },\n { abortSignal: abortSignal, timeoutInMs: timeoutInMs },\n );\n }\n\n if (!this.isOpen()) {\n const rxOpt: ReceiverOptions = {\n source: {\n address: this.endpoint,\n },\n name: this.replyTo,\n onSessionError: (context: EventContext) => {\n const id = context.connection.options.id;\n const ehError = translate(context.session!.error!);\n logger.verbose(\n \"[%s] An error occurred on the session for request/response links \" + \"for $cbs: %O\",\n id,\n ehError,\n );\n },\n };\n const srOpt: SenderOptions = { target: { address: this.endpoint } };\n logger.verbose(\n \"[%s] Creating sender/receiver links on a session for $cbs endpoint.\",\n this.connection.id,\n );\n this._cbsSenderReceiverLink = await RequestResponseLink.create(\n this.connection,\n srOpt,\n rxOpt,\n { abortSignal },\n );\n this._cbsSenderReceiverLink.sender.on(SenderEvents.senderError, (context: EventContext) => {\n const id = context.connection.options.id;\n const ehError = translate(context.sender!.error!);\n logger.verbose(\"[%s] An error occurred on the cbs sender link.. %O\", id, ehError);\n });\n this._cbsSenderReceiverLink.receiver.on(\n ReceiverEvents.receiverError,\n (context: EventContext) => {\n const id = context.connection.options.id;\n const ehError = translate(context.receiver!.error!);\n logger.verbose(\"[%s] An error occurred on the cbs receiver link.. %O\", id, ehError);\n },\n );\n logger.verbose(\n \"[%s] Successfully created the cbs sender '%s' and receiver '%s' \" +\n \"links over cbs session.\",\n this.connection.id,\n this._cbsSenderReceiverLink.sender.name,\n this._cbsSenderReceiverLink.receiver.name,\n );\n } else {\n logger.verbose(\n \"[%s] CBS session is already present. Reusing the cbs sender '%s' \" +\n \"and receiver '%s' links over cbs session.\",\n this.connection.id,\n this._cbsSenderReceiverLink!.sender.name,\n this._cbsSenderReceiverLink!.receiver.name,\n );\n }\n } catch (err) {\n const translatedError = translate(err);\n logger.warning(\n \"[%s] An error occurred while establishing the cbs links: %s\",\n this.connection.id,\n `${translatedError?.name}: ${translatedError?.message}`,\n );\n logErrorStackTrace(translatedError);\n throw translatedError;\n }\n }\n\n /**\n * Negotiates the CBS claim with the EventHub/ServiceBus Service.\n * @param audience - The entity token audience for which the token is requested in one\n * of the following forms:\n *\n * - **ServiceBus**\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 * - **EventHubs**\n * - **Sender**\n * - `\"sb://<yournamespace>.servicebus.windows.net/<hubName>\"`\n * - `\"sb://<yournamespace>.servicebus.windows.net/<hubName>/Partitions/<partitionId>\"`.\n *\n * - **Receiver**\n * - `\"sb://<your-namespace>.servicebus.windows.net/<event-hub-name>/ConsumerGroups/<consumer-group-name>/Partitions/<partition-id>\"`.\n *\n * - **ManagementClient**\n * - `\"sb://<your-namespace>.servicebus.windows.net/<event-hub-name>/$management\"`.\n * @param token - The token that needs to be sent in the put-token request.\n * @param tokenType - The type of token being used. For example, 'jwt' or 'servicebus.windows.net:sastoken'.\n * @param options - Optional parameters that can be used to affect this method's behavior.\n * For example, `abortSignal` can be passed to allow cancelling an in-progress `negotiateClaim` invocation.\n * @returns A Promise that resolves when $cbs authentication is successful\n * and rejects when an error occurs during $cbs authentication.\n */\n async negotiateClaim(\n audience: string,\n token: string,\n tokenType: TokenType,\n options: { abortSignal?: AbortSignalLike; timeoutInMs?: number } = {},\n ): Promise<CbsResponse> {\n const { abortSignal, timeoutInMs } = options;\n try {\n if (abortSignal?.aborted) {\n throw new AbortError(StandardAbortMessage);\n }\n\n if (!this._cbsSenderReceiverLink) {\n throw new Error(\"Attempted to negotiate a claim but the CBS link does not exist.\");\n }\n\n const request: RheaMessage = {\n body: token,\n message_id: generate_uuid(),\n reply_to: this.replyTo,\n to: this.endpoint,\n application_properties: {\n operation: Constants.operationPutToken,\n name: audience,\n type: tokenType,\n },\n };\n const responseMessage = await this._cbsSenderReceiverLink.sendRequest(request, {\n abortSignal,\n timeoutInMs,\n requestName: \"negotiateClaim\",\n });\n logger.verbose(\"[%s] The CBS response is: %O\", this.connection.id, responseMessage);\n return this._fromRheaMessageResponse(responseMessage);\n } catch (err) {\n logger.warning(\n \"[%s] An error occurred while negotiating the cbs claim: %s\",\n this.connection.id,\n isError(err) ? `${err.name}: ${err.message}` : String(err),\n );\n logErrorStackTrace(err);\n throw err;\n }\n }\n\n /**\n * Closes the AMQP cbs session to the EventHub/ServiceBus for this client,\n * returning a promise that will be resolved when disconnection is completed.\n * @returns\n */\n async close(): Promise<void> {\n try {\n if (this.isOpen()) {\n const cbsLink = this._cbsSenderReceiverLink;\n this._cbsSenderReceiverLink = undefined;\n await cbsLink!.close();\n logger.verbose(\"[%s] Successfully closed the cbs session.\", this.connection.id);\n }\n } catch (err) {\n const msg = `An error occurred while closing the cbs link: ${\n isError(err) && err.stack ? err.stack : JSON.stringify(err)\n }.`;\n logger.verbose(\"[%s] %s\", this.connection.id, msg);\n throw new Error(msg);\n }\n }\n\n /**\n * Removes the AMQP cbs session to the EventHub/ServiceBus for this client,\n * @returns void\n */\n remove(): void {\n try {\n if (this._cbsSenderReceiverLink) {\n const cbsLink = this._cbsSenderReceiverLink;\n this._cbsSenderReceiverLink = undefined;\n cbsLink!.remove();\n logger.verbose(\"[%s] Successfully removed the cbs session.\", this.connection.id);\n }\n } catch (err) {\n const msg = `An error occurred while removing the cbs link: ${\n isError(err) && err.stack ? err.stack : JSON.stringify(err)\n }.`;\n logger.verbose(\"[%s] %s\", this.connection.id, msg);\n throw new Error(msg);\n }\n }\n\n /**\n * Indicates whether the cbs sender receiver link is open or closed.\n * @returns `true` open, `false` closed.\n */\n public isOpen(): boolean {\n return Boolean(this._cbsSenderReceiverLink?.isOpen());\n }\n\n private _fromRheaMessageResponse(msg: RheaMessage): CbsResponse {\n const cbsResponse = {\n correlationId: msg.correlation_id! as string,\n statusCode: msg.application_properties ? msg.application_properties[\"status-code\"] : \"\",\n statusDescription: msg.application_properties\n ? msg.application_properties[\"status-description\"]\n : \"\",\n };\n logger.verbose(\"[%s] The deserialized CBS response is: %o\", this.connection.id, cbsResponse);\n return cbsResponse;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cbs.js","sourceRoot":"","sources":["../../src/cbs.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAQrD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,C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EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,MAAM;;QACX,OAAO,OAAO,CAAC,MAAA,IAAI,CAAC,sBAAsB,0CAAE,MAAM,EAAE,CAAC,CAAC;IACxD,CAAC;IAEO,wBAAwB,CAAC,GAAgB;QAC/C,MAAM,WAAW,GAAG;YAClB,aAAa,EAAE,GAAG,CAAC,cAAyB;YAC5C,UAAU,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC,GAAG,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE;YACvF,iBAAiB,EAAE,GAAG,CAAC,sBAAsB;gBAC3C,CAAC,CAAC,GAAG,CAAC,sBAAsB,CAAC,oBAAoB,CAAC;gBAClD,CAAC,CAAC,EAAE;SACP,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,2CAA2C,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QAC7F,OAAO,WAAW,CAAC;IACrB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport { AbortError } from \"@azure/abort-controller\";\nimport type {\n Connection,\n EventContext,\n ReceiverOptions,\n Message as RheaMessage,\n SenderOptions,\n} from \"rhea-promise\";\nimport { ReceiverEvents, SenderEvents, generate_uuid } from \"rhea-promise\";\nimport { logErrorStackTrace, logger } from \"./log.js\";\nimport { Constants } from \"./util/constants.js\";\nimport { RequestResponseLink } from \"./requestResponseLink.js\";\nimport { StandardAbortMessage } from \"./util/constants.js\";\nimport type { TokenType } from \"./auth/token.js\";\nimport { defaultCancellableLock } from \"./util/utils.js\";\nimport { isError } from \"@azure/core-util\";\nimport { translate } from \"./errors.js\";\n\n/**\n * Describes the CBS Response.\n */\nexport interface CbsResponse {\n correlationId: string;\n statusCode: string;\n statusDescription: string;\n}\n\n/**\n * Describes the EventHub/ServiceBus Cbs client that talks to the $cbs endpoint over AMQP connection.\n */\nexport class CbsClient {\n /**\n * CBS endpoint - \"$cbs\"\n */\n readonly endpoint: string = Constants.cbsEndpoint;\n /**\n * CBS replyTo - The receiver link name that the service should reply to.\n */\n readonly replyTo: string = `${Constants.cbsReplyTo}-${generate_uuid()}`;\n /**\n * The unique lock name per $cbs session per connection that is used to\n * acquire the lock for establishing a cbs session if one does not exist for an amqp connection.\n */\n readonly cbsLock: string = `${Constants.negotiateCbsKey}-${generate_uuid()}`;\n /**\n * The unique lock name per connection that is used to\n * acquire the lock for establishing an amqp connection if one does not exist.\n */\n readonly connectionLock: string;\n /**\n * The AMQP connection.\n */\n connection: Connection;\n\n /**\n * CBS sender, receiver on the same session.\n */\n private _cbsSenderReceiverLink?: RequestResponseLink;\n\n /**\n * @param connection - The AMQP connection.\n * @param connectionLock - A unique string (usually a guid) per connection.\n */\n constructor(connection: Connection, connectionLock: string) {\n this.connection = connection;\n this.connectionLock = connectionLock;\n }\n\n /**\n * Creates a singleton instance of the CBS session if it hasn't been initialized previously on\n * the given connection.\n * @param options - Optional parameters that can be used to affect this method's behavior.\n * For example, `abortSignal` can be passed to allow cancelling an in-progress `init` invocation.\n * @returns Promise<void>.\n */\n async init(options: { abortSignal?: AbortSignalLike; timeoutInMs?: number } = {}): Promise<void> {\n const { abortSignal, timeoutInMs } = options;\n\n try {\n if (abortSignal?.aborted) {\n throw new AbortError(StandardAbortMessage);\n }\n\n // Acquire the lock and establish an amqp connection if it does not exist.\n if (!this.connection.isOpen()) {\n logger.verbose(\"The CBS client is trying to establish an AMQP connection.\");\n await defaultCancellableLock.acquire(\n this.connectionLock,\n () => {\n return this.connection.open({ abortSignal });\n },\n { abortSignal: abortSignal, timeoutInMs: timeoutInMs },\n );\n }\n\n if (!this.isOpen()) {\n const rxOpt: ReceiverOptions = {\n source: {\n address: this.endpoint,\n },\n name: this.replyTo,\n onSessionError: (context: EventContext) => {\n const id = context.connection.options.id;\n const ehError = translate(context.session!.error!);\n logger.verbose(\n \"[%s] An error occurred on the session for request/response links \" + \"for $cbs: %O\",\n id,\n ehError,\n );\n },\n };\n const srOpt: SenderOptions = { target: { address: this.endpoint } };\n logger.verbose(\n \"[%s] Creating sender/receiver links on a session for $cbs endpoint.\",\n this.connection.id,\n );\n this._cbsSenderReceiverLink = await RequestResponseLink.create(\n this.connection,\n srOpt,\n rxOpt,\n { abortSignal },\n );\n this._cbsSenderReceiverLink.sender.on(SenderEvents.senderError, (context: EventContext) => {\n const id = context.connection.options.id;\n const ehError = translate(context.sender!.error!);\n logger.verbose(\"[%s] An error occurred on the cbs sender link.. %O\", id, ehError);\n });\n this._cbsSenderReceiverLink.receiver.on(\n ReceiverEvents.receiverError,\n (context: EventContext) => {\n const id = context.connection.options.id;\n const ehError = translate(context.receiver!.error!);\n logger.verbose(\"[%s] An error occurred on the cbs receiver link.. %O\", id, ehError);\n },\n );\n logger.verbose(\n \"[%s] Successfully created the cbs sender '%s' and receiver '%s' \" +\n \"links over cbs session.\",\n this.connection.id,\n this._cbsSenderReceiverLink.sender.name,\n this._cbsSenderReceiverLink.receiver.name,\n );\n } else {\n logger.verbose(\n \"[%s] CBS session is already present. Reusing the cbs sender '%s' \" +\n \"and receiver '%s' links over cbs session.\",\n this.connection.id,\n this._cbsSenderReceiverLink!.sender.name,\n this._cbsSenderReceiverLink!.receiver.name,\n );\n }\n } catch (err) {\n const translatedError = translate(err);\n logger.warning(\n \"[%s] An error occurred while establishing the cbs links: %s\",\n this.connection.id,\n `${translatedError?.name}: ${translatedError?.message}`,\n );\n logErrorStackTrace(translatedError);\n throw translatedError;\n }\n }\n\n /**\n * Negotiates the CBS claim with the EventHub/ServiceBus Service.\n * @param audience - The entity token audience for which the token is requested in one\n * of the following forms:\n *\n * - **ServiceBus**\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 * - **EventHubs**\n * - **Sender**\n * - `\"sb://<yournamespace>.servicebus.windows.net/<hubName>\"`\n * - `\"sb://<yournamespace>.servicebus.windows.net/<hubName>/Partitions/<partitionId>\"`.\n *\n * - **Receiver**\n * - `\"sb://<your-namespace>.servicebus.windows.net/<event-hub-name>/ConsumerGroups/<consumer-group-name>/Partitions/<partition-id>\"`.\n *\n * - **ManagementClient**\n * - `\"sb://<your-namespace>.servicebus.windows.net/<event-hub-name>/$management\"`.\n * @param token - The token that needs to be sent in the put-token request.\n * @param tokenType - The type of token being used. For example, 'jwt' or 'servicebus.windows.net:sastoken'.\n * @param options - Optional parameters that can be used to affect this method's behavior.\n * For example, `abortSignal` can be passed to allow cancelling an in-progress `negotiateClaim` invocation.\n * @returns A Promise that resolves when $cbs authentication is successful\n * and rejects when an error occurs during $cbs authentication.\n */\n async negotiateClaim(\n audience: string,\n token: string,\n tokenType: TokenType,\n options: { abortSignal?: AbortSignalLike; timeoutInMs?: number } = {},\n ): Promise<CbsResponse> {\n const { abortSignal, timeoutInMs } = options;\n try {\n if (abortSignal?.aborted) {\n throw new AbortError(StandardAbortMessage);\n }\n\n if (!this._cbsSenderReceiverLink) {\n throw new Error(\"Attempted to negotiate a claim but the CBS link does not exist.\");\n }\n\n const request: RheaMessage = {\n body: token,\n message_id: generate_uuid(),\n reply_to: this.replyTo,\n to: this.endpoint,\n application_properties: {\n operation: Constants.operationPutToken,\n name: audience,\n type: tokenType,\n },\n };\n const responseMessage = await this._cbsSenderReceiverLink.sendRequest(request, {\n abortSignal,\n timeoutInMs,\n requestName: \"negotiateClaim\",\n });\n logger.verbose(\"[%s] The CBS response is: %O\", this.connection.id, responseMessage);\n return this._fromRheaMessageResponse(responseMessage);\n } catch (err) {\n logger.warning(\n \"[%s] An error occurred while negotiating the cbs claim: %s\",\n this.connection.id,\n isError(err) ? `${err.name}: ${err.message}` : String(err),\n );\n logErrorStackTrace(err);\n throw err;\n }\n }\n\n /**\n * Closes the AMQP cbs session to the EventHub/ServiceBus for this client,\n * returning a promise that will be resolved when disconnection is completed.\n * @returns\n */\n async close(): Promise<void> {\n try {\n if (this.isOpen()) {\n const cbsLink = this._cbsSenderReceiverLink;\n this._cbsSenderReceiverLink = undefined;\n await cbsLink!.close();\n logger.verbose(\"[%s] Successfully closed the cbs session.\", this.connection.id);\n }\n } catch (err) {\n const msg = `An error occurred while closing the cbs link: ${\n isError(err) && err.stack ? err.stack : JSON.stringify(err)\n }.`;\n logger.verbose(\"[%s] %s\", this.connection.id, msg);\n throw new Error(msg);\n }\n }\n\n /**\n * Removes the AMQP cbs session to the EventHub/ServiceBus for this client,\n * @returns void\n */\n remove(): void {\n try {\n if (this._cbsSenderReceiverLink) {\n const cbsLink = this._cbsSenderReceiverLink;\n this._cbsSenderReceiverLink = undefined;\n cbsLink!.remove();\n logger.verbose(\"[%s] Successfully removed the cbs session.\", this.connection.id);\n }\n } catch (err) {\n const msg = `An error occurred while removing the cbs link: ${\n isError(err) && err.stack ? err.stack : JSON.stringify(err)\n }.`;\n logger.verbose(\"[%s] %s\", this.connection.id, msg);\n throw new Error(msg);\n }\n }\n\n /**\n * Indicates whether the cbs sender receiver link is open or closed.\n * @returns `true` open, `false` closed.\n */\n public isOpen(): boolean {\n return Boolean(this._cbsSenderReceiverLink?.isOpen());\n }\n\n private _fromRheaMessageResponse(msg: RheaMessage): CbsResponse {\n const cbsResponse = {\n correlationId: msg.correlation_id! as string,\n statusCode: msg.application_properties ? msg.application_properties[\"status-code\"] : \"\",\n statusDescription: msg.application_properties\n ? msg.application_properties[\"status-description\"]\n : \"\",\n };\n logger.verbose(\"[%s] The deserialized CBS response is: %o\", this.connection.id, cbsResponse);\n return cbsResponse;\n }\n}\n"]}
|
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
3
|
import { isDefined } from "@azure/core-util";
|
|
4
4
|
import { parseConnectionString } from "../util/utils.js";
|
|
5
|
+
const specialLocalIPs = ["::1", "0:0:0:0:0:0:0:1"];
|
|
5
6
|
function getHost(endpoint) {
|
|
6
|
-
const
|
|
7
|
+
for (const ip of specialLocalIPs) {
|
|
8
|
+
if (endpoint.includes(ip)) {
|
|
9
|
+
return ip;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const matches = /.*:\/\/([^/:]*)/.exec(endpoint);
|
|
7
13
|
const match = matches === null || matches === void 0 ? void 0 : matches[1];
|
|
8
14
|
return !match ? endpoint : match;
|
|
9
15
|
}
|
|
16
|
+
function extractPort(ep) {
|
|
17
|
+
const matches = /.*:(\d*)/.exec(ep);
|
|
18
|
+
const match = matches === null || matches === void 0 ? void 0 : matches[1];
|
|
19
|
+
return match ? parseInt(match, 10) : undefined;
|
|
20
|
+
}
|
|
21
|
+
function getPort(endpoint) {
|
|
22
|
+
for (const ip of specialLocalIPs) {
|
|
23
|
+
if (endpoint.includes(ip)) {
|
|
24
|
+
return extractPort(endpoint.replace(ip, ""));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return extractPort(endpoint);
|
|
28
|
+
}
|
|
10
29
|
/**
|
|
11
30
|
* Describes the ConnectionConfig module
|
|
12
31
|
*/
|
|
@@ -29,14 +48,11 @@ export const ConnectionConfig = {
|
|
|
29
48
|
}
|
|
30
49
|
if (!parsedCS.Endpoint.endsWith("/"))
|
|
31
50
|
parsedCS.Endpoint += "/";
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
sharedAccessKey: parsedCS.SharedAccessKey,
|
|
38
|
-
useDevelopmentEmulator: parsedCS.UseDevelopmentEmulator === "true",
|
|
39
|
-
};
|
|
51
|
+
let port;
|
|
52
|
+
if (parsedCS.Endpoint.includes(":")) {
|
|
53
|
+
port = getPort(parsedCS.Endpoint);
|
|
54
|
+
}
|
|
55
|
+
const result = Object.assign({ connectionString: connectionString, endpoint: parsedCS.Endpoint, host: getHost(parsedCS.Endpoint), sharedAccessKeyName: parsedCS.SharedAccessKeyName, sharedAccessKey: parsedCS.SharedAccessKey, useDevelopmentEmulator: parsedCS.UseDevelopmentEmulator === "true" }, (port !== undefined ? { port } : undefined));
|
|
40
56
|
if (path || parsedCS.EntityPath) {
|
|
41
57
|
result.entityPath = path || parsedCS.EntityPath;
|
|
42
58
|
}
|
|
@@ -61,6 +77,9 @@ export const ConnectionConfig = {
|
|
|
61
77
|
throw new TypeError("Missing 'host' in configuration");
|
|
62
78
|
}
|
|
63
79
|
config.host = String(config.host);
|
|
80
|
+
if (config.port !== undefined && !(config.port >= 0 && config.port <= 65535)) {
|
|
81
|
+
throw new TypeError(`Invalid 'port' of ${config.port} in configuration`);
|
|
82
|
+
}
|
|
64
83
|
if (options.isEntityPathRequired && !config.entityPath) {
|
|
65
84
|
throw new TypeError("Missing 'entityPath' in configuration");
|
|
66
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectionConfig.js","sourceRoot":"","sources":["../../../src/connectionConfig/connectionConfig.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAkFzD,SAAS,OAAO,CAAC,QAAgB;IAC/B,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,KAAK,GAAG,OAAO,aAA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;IAC9D,OAAO,gBAAgB,CAAC,KAAK,CAAC,oDAAoD,CAAC,IAAI,IAAI,CAAC;AAC9F,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { WebSocketImpl } from \"rhea-promise\";\nimport { isDefined } from \"@azure/core-util\";\nimport { parseConnectionString } from \"../util/utils.js\";\n\n/**\n * Describes the options that can be provided while creating a connection config.\n */\nexport interface ConnectionConfigOptions {\n /**\n * Indicates whether the entity path is required in the\n * connection config.\n */\n isEntityPathRequired?: boolean;\n}\n\n/**\n * Describes the connection config object that is created after parsing an EventHub or ServiceBus\n * connection string.\n */\nexport interface ConnectionConfig {\n /**\n * The service bus endpoint\n * \"sb://<yournamespace>.servicebus.windows.net/\".\n */\n endpoint: string;\n /**\n * The DNS hostname or IP address of the service.\n * Typically of the form \"<yournamespace>.servicebus.windows.net\" unless connecting\n * to the service through an intermediary.\n */\n host: string;\n /**\n * The fully qualified name of the host to connect to.\n * This field can be used by AMQP proxies to determine the correct back-end service to\n * connect the client to.\n * Typically of the form \"<yournamespace>.servicebus.windows.net\".\n */\n amqpHostname?: string;\n /**\n * The port number.\n */\n port?: number;\n /**\n * The connection string.\n */\n connectionString: string;\n /**\n * The name/path of the entity (hub/queue/topic name) to which the\n * connection needs to happen.\n */\n entityPath?: string;\n /**\n * The name of the access key.\n */\n sharedAccessKeyName: string;\n /**\n * The secret value of the access key.\n */\n sharedAccessKey: string;\n\n /**\n * The WebSocket constructor used to create an AMQP connection\n * over a WebSocket. In browsers, the built-in WebSocket will be used by default. In Node, a\n * TCP socket will be used if a WebSocket constructor is not provided.\n */\n webSocket?: WebSocketImpl;\n\n /**\n * The path for the endpoint that accepts an AMQP\n * connection over WebSockets.\n */\n webSocketEndpointPath?: string;\n\n /**\n * Options to be passed to the WebSocket constructor\n */\n webSocketConstructorOptions?: any;\n /**\n * This should be true only if the connection string contains the slug \";UseDevelopmentEmulator=true\"\n * and the endpoint is a loopback address.\n */\n useDevelopmentEmulator?: boolean;\n}\n\nfunction getHost(endpoint: string): string {\n const matches = /.*:\\/\\/([^/]*)/.exec(endpoint);\n const match = matches?.[1];\n return !match ? endpoint : match;\n}\n\n/**\n * Describes the ConnectionConfig module\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- renaming constant would be a breaking change.\nexport const ConnectionConfig = {\n /**\n * Creates the connection config.\n * @param connectionString - The connection string for a given service like\n * EventHub/ServiceBus.\n * @param path - The name/path of the entity (hub name) to which the\n * connection needs to happen. This will override the EntityPath in the connectionString\n * if present.\n * @returns ConnectionConfig\n */\n create(connectionString: string, path?: string): ConnectionConfig {\n connectionString = String(connectionString);\n\n const parsedCS = parseConnectionString<{\n Endpoint: string;\n SharedAccessKeyName: string;\n SharedAccessKey: string;\n EntityPath?: string;\n UseDevelopmentEmulator?: string;\n }>(connectionString);\n if (!parsedCS.Endpoint) {\n throw new TypeError(\"Missing Endpoint in Connection String.\");\n }\n\n if (!parsedCS.Endpoint.endsWith(\"/\")) parsedCS.Endpoint += \"/\";\n\n const result: ConnectionConfig = {\n connectionString: connectionString,\n endpoint: parsedCS.Endpoint,\n host: getHost(parsedCS.Endpoint),\n sharedAccessKeyName: parsedCS.SharedAccessKeyName,\n sharedAccessKey: parsedCS.SharedAccessKey,\n useDevelopmentEmulator: parsedCS.UseDevelopmentEmulator === \"true\",\n };\n\n if (path || parsedCS.EntityPath) {\n result.entityPath = path || parsedCS.EntityPath;\n }\n return result;\n },\n\n /**\n * Validates the properties of connection config.\n * @param config - The connection config to be validated.\n * @returns void\n */\n validate(config: ConnectionConfig, options?: ConnectionConfigOptions): void {\n if (!options) options = {};\n\n if (!config) {\n throw new TypeError(\"Missing configuration\");\n }\n\n if (!config.endpoint) {\n throw new TypeError(\"Missing 'endpoint' in configuration\");\n }\n config.endpoint = String(config.endpoint);\n\n if (!config.host) {\n throw new TypeError(\"Missing 'host' in configuration\");\n }\n config.host = String(config.host);\n\n if (options.isEntityPathRequired && !config.entityPath) {\n throw new TypeError(\"Missing 'entityPath' in configuration\");\n }\n if (isDefined(config.entityPath)) {\n config.entityPath = String(config.entityPath);\n }\n\n if (!isSharedAccessSignature(config.connectionString)) {\n if (!config.sharedAccessKeyName) {\n throw new TypeError(\"Missing 'sharedAccessKeyName' in configuration\");\n }\n config.sharedAccessKeyName = String(config.sharedAccessKeyName);\n\n if (!config.sharedAccessKey) {\n throw new TypeError(\"Missing 'sharedAccessKey' in configuration\");\n }\n config.sharedAccessKey = String(config.sharedAccessKey);\n }\n },\n};\n\n/**\n * @internal\n */\nexport function isSharedAccessSignature(connectionString: string): boolean {\n return connectionString.match(/;{0,1}SharedAccessSignature=SharedAccessSignature /) != null;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"connectionConfig.js","sourceRoot":"","sources":["../../../src/connectionConfig/connectionConfig.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAkFzD,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;AAEnD,SAAS,OAAO,CAAC,QAAgB;IAC/B,KAAK,MAAM,EAAE,IAAI,eAAe,EAAE,CAAC;QACjC,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YAC1B,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAG,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,CAAC;IAC3B,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;AACnC,CAAC;AAED,SAAS,WAAW,CAAC,EAAU;IAC7B,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,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SAAS,CAAC,qBAAqB,MAAM,CAAC,IAAI,mBAAmB,CAAC,CAAC;QAC3E,CAAC;QAED,IAAI,OAAO,CAAC,oBAAoB,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YACvD,MAAM,IAAI,SAAS,CAAC,uCAAuC,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;YACjC,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAChD,CAAC;QAED,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACtD,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;gBAChC,MAAM,IAAI,SAAS,CAAC,gDAAgD,CAAC,CAAC;YACxE,CAAC;YACD,MAAM,CAAC,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;YAEhE,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;gBAC5B,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAC;YACpE,CAAC;YACD,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,gBAAwB;IAC9D,OAAO,gBAAgB,CAAC,KAAK,CAAC,oDAAoD,CAAC,IAAI,IAAI,CAAC;AAC9F,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { WebSocketImpl } from \"rhea-promise\";\nimport { isDefined } from \"@azure/core-util\";\nimport { parseConnectionString } from \"../util/utils.js\";\n\n/**\n * Describes the options that can be provided while creating a connection config.\n */\nexport interface ConnectionConfigOptions {\n /**\n * Indicates whether the entity path is required in the\n * connection config.\n */\n isEntityPathRequired?: boolean;\n}\n\n/**\n * Describes the connection config object that is created after parsing an EventHub or ServiceBus\n * connection string.\n */\nexport interface ConnectionConfig {\n /**\n * The service bus endpoint\n * \"sb://<yournamespace>.servicebus.windows.net/\".\n */\n endpoint: string;\n /**\n * The DNS hostname or IP address of the service.\n * Typically of the form \"<yournamespace>.servicebus.windows.net\" unless connecting\n * to the service through an intermediary.\n */\n host: string;\n /**\n * The fully qualified name of the host to connect to.\n * This field can be used by AMQP proxies to determine the correct back-end service to\n * connect the client to.\n * Typically of the form \"<yournamespace>.servicebus.windows.net\".\n */\n amqpHostname?: string;\n /**\n * The port number.\n */\n port?: number;\n /**\n * The connection string.\n */\n connectionString: string;\n /**\n * The name/path of the entity (hub/queue/topic name) to which the\n * connection needs to happen.\n */\n entityPath?: string;\n /**\n * The name of the access key.\n */\n sharedAccessKeyName: string;\n /**\n * The secret value of the access key.\n */\n sharedAccessKey: string;\n\n /**\n * The WebSocket constructor used to create an AMQP connection\n * over a WebSocket. In browsers, the built-in WebSocket will be used by default. In Node, a\n * TCP socket will be used if a WebSocket constructor is not provided.\n */\n webSocket?: WebSocketImpl;\n\n /**\n * The path for the endpoint that accepts an AMQP\n * connection over WebSockets.\n */\n webSocketEndpointPath?: string;\n\n /**\n * Options to be passed to the WebSocket constructor\n */\n webSocketConstructorOptions?: any;\n /**\n * This should be true only if the connection string contains the slug \";UseDevelopmentEmulator=true\"\n * and the endpoint is a loopback address.\n */\n useDevelopmentEmulator?: boolean;\n}\n\nconst specialLocalIPs = [\"::1\", \"0:0:0:0:0:0:0:1\"];\n\nfunction getHost(endpoint: string): string {\n for (const ip of specialLocalIPs) {\n if (endpoint.includes(ip)) {\n return ip;\n }\n }\n\n const matches = /.*:\\/\\/([^/:]*)/.exec(endpoint);\n const match = matches?.[1];\n return !match ? endpoint : match;\n}\n\nfunction extractPort(ep: string): number | undefined {\n const matches = /.*:(\\d*)/.exec(ep);\n const match = matches?.[1];\n return match ? parseInt(match, 10) : undefined;\n}\n\nfunction getPort(endpoint: string): number | undefined {\n for (const ip of specialLocalIPs) {\n if (endpoint.includes(ip)) {\n return extractPort(endpoint.replace(ip, \"\"));\n }\n }\n\n return extractPort(endpoint);\n}\n\n/**\n * Describes the ConnectionConfig module\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- renaming constant would be a breaking change.\nexport const ConnectionConfig = {\n /**\n * Creates the connection config.\n * @param connectionString - The connection string for a given service like\n * EventHub/ServiceBus.\n * @param path - The name/path of the entity (hub name) to which the\n * connection needs to happen. This will override the EntityPath in the connectionString\n * if present.\n * @returns ConnectionConfig\n */\n create(connectionString: string, path?: string): ConnectionConfig {\n connectionString = String(connectionString);\n\n const parsedCS = parseConnectionString<{\n Endpoint: string;\n SharedAccessKeyName: string;\n SharedAccessKey: string;\n EntityPath?: string;\n UseDevelopmentEmulator?: string;\n }>(connectionString);\n if (!parsedCS.Endpoint) {\n throw new TypeError(\"Missing Endpoint in Connection String.\");\n }\n\n if (!parsedCS.Endpoint.endsWith(\"/\")) parsedCS.Endpoint += \"/\";\n\n let port: number | undefined;\n if (parsedCS.Endpoint.includes(\":\")) {\n port = getPort(parsedCS.Endpoint);\n }\n\n const result: ConnectionConfig = {\n connectionString: connectionString,\n endpoint: parsedCS.Endpoint,\n host: getHost(parsedCS.Endpoint),\n sharedAccessKeyName: parsedCS.SharedAccessKeyName,\n sharedAccessKey: parsedCS.SharedAccessKey,\n useDevelopmentEmulator: parsedCS.UseDevelopmentEmulator === \"true\",\n ...(port !== undefined ? { port } : undefined),\n };\n\n if (path || parsedCS.EntityPath) {\n result.entityPath = path || parsedCS.EntityPath;\n }\n return result;\n },\n\n /**\n * Validates the properties of connection config.\n * @param config - The connection config to be validated.\n * @returns void\n */\n validate(config: ConnectionConfig, options?: ConnectionConfigOptions): void {\n if (!options) options = {};\n\n if (!config) {\n throw new TypeError(\"Missing configuration\");\n }\n\n if (!config.endpoint) {\n throw new TypeError(\"Missing 'endpoint' in configuration\");\n }\n config.endpoint = String(config.endpoint);\n\n if (!config.host) {\n throw new TypeError(\"Missing 'host' in configuration\");\n }\n config.host = String(config.host);\n\n if (config.port !== undefined && !(config.port >= 0 && config.port <= 65535)) {\n throw new TypeError(`Invalid 'port' of ${config.port} in configuration`);\n }\n\n if (options.isEntityPathRequired && !config.entityPath) {\n throw new TypeError(\"Missing 'entityPath' in configuration\");\n }\n if (isDefined(config.entityPath)) {\n config.entityPath = String(config.entityPath);\n }\n\n if (!isSharedAccessSignature(config.connectionString)) {\n if (!config.sharedAccessKeyName) {\n throw new TypeError(\"Missing 'sharedAccessKeyName' in configuration\");\n }\n config.sharedAccessKeyName = String(config.sharedAccessKeyName);\n\n if (!config.sharedAccessKey) {\n throw new TypeError(\"Missing 'sharedAccessKey' in configuration\");\n }\n config.sharedAccessKey = String(config.sharedAccessKey);\n }\n },\n};\n\n/**\n * @internal\n */\nexport function isSharedAccessSignature(connectionString: string): boolean {\n return connectionString.match(/;{0,1}SharedAccessSignature=SharedAccessSignature /) != null;\n}\n"]}
|
package/dist/esm/errors.d.ts
CHANGED
|
@@ -522,7 +522,9 @@ export declare enum SystemErrorConditionMapper {
|
|
|
522
522
|
EHOSTDOWN = "com.microsoft:timeout",
|
|
523
523
|
ENETRESET = "com.microsoft:timeout",
|
|
524
524
|
ENETUNREACH = "com.microsoft:timeout",
|
|
525
|
-
ENONET = "com.microsoft:timeout"
|
|
525
|
+
ENONET = "com.microsoft:timeout",
|
|
526
|
+
EADDRNOTAVAIL = "com.microsoft:timeout",
|
|
527
|
+
EAI_AGAIN = "com.microsoft:timeout"
|
|
526
528
|
}
|
|
527
529
|
/**
|
|
528
530
|
* Checks whether the provided error is a node.js SystemError.
|
package/dist/esm/errors.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
3
|
/* eslint-disable eqeqeq */
|
|
4
4
|
import { isAmqpError as rheaIsAmqpError } from "rhea-promise";
|
|
5
5
|
import { isDefined, isError, isNodeLike, isObjectWithProperties } from "@azure/core-util";
|
|
@@ -537,6 +537,8 @@ export var SystemErrorConditionMapper;
|
|
|
537
537
|
SystemErrorConditionMapper["ENETRESET"] = "com.microsoft:timeout";
|
|
538
538
|
SystemErrorConditionMapper["ENETUNREACH"] = "com.microsoft:timeout";
|
|
539
539
|
SystemErrorConditionMapper["ENONET"] = "com.microsoft:timeout";
|
|
540
|
+
SystemErrorConditionMapper["EADDRNOTAVAIL"] = "com.microsoft:timeout";
|
|
541
|
+
SystemErrorConditionMapper["EAI_AGAIN"] = "com.microsoft:timeout";
|
|
540
542
|
/* eslint-enable @typescript-eslint/no-duplicate-enum-values */
|
|
541
543
|
})(SystemErrorConditionMapper || (SystemErrorConditionMapper = {}));
|
|
542
544
|
/**
|
package/dist/esm/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,2BAA2B;AAE3B,OAAO,EAAqC,WAAW,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AACjG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;GAGG;AACH,MAAM,CAAN,IAAY,qBAqBX;AArBD,WAAY,qBAAqB;IAC/B,qGAA+D,CAAA;IAC/D,uFAAkD,CAAA;IAClD,mGAA8D,CAAA;IAC9D,iIAAuE,CAAA;IACvE,yHAA+D,CAAA;IAC/D,yHAA+D,CAAA;IAC/D,uIAAqF,CAAA;IACrF,yHAAoE,CAAA;IACpE,6GAAuE,CAAA;IACvE,mHAAkE,CAAA;IAClE,iIAAyE,CAAA;IACzE,qHAA6D,CAAA;IAC7D,uIAAsE,CAAA;IACtE,6HAAi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AAwC;IACxC,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACrE,MAAM,KAAK,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACzD,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACzB,IAAI,KAAK,CAAC,IAAI,IAAI,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAC7D,YAAY;YACZ,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;QAC1B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,KAAU;IAC7B,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/* eslint-disable eqeqeq */\n\nimport { AmqpError, AmqpResponseStatusCode, isAmqpError as rheaIsAmqpError } from \"rhea-promise\";\nimport { isDefined, isError, isNodeLike, isObjectWithProperties } from \"@azure/core-util\";\nimport { isNumber, isString } from \"./util/utils.js\";\n\n/**\n * Maps the conditions to the numeric AMQP Response status codes.\n * @internal\n */\nexport enum ConditionStatusMapper {\n \"com.microsoft:timeout\" = AmqpResponseStatusCode.RequestTimeout,\n \"amqp:not-found\" = AmqpResponseStatusCode.NotFound,\n \"amqp:not-implemented\" = AmqpResponseStatusCode.NotImplemented,\n \"com.microsoft:entity-already-exists\" = AmqpResponseStatusCode.Conflict,\n \"com.microsoft:message-lock-lost\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:session-lock-lost\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:no-matching-subscription\" = AmqpResponseStatusCode.InternalServerError,\n \"amqp:link:message-size-exceeded\" = AmqpResponseStatusCode.Forbidden,\n \"com.microsoft:server-busy\" = AmqpResponseStatusCode.ServiceUnavailable,\n \"com.microsoft:argument-error\" = AmqpResponseStatusCode.BadRequest,\n \"com.microsoft:argument-out-of-range\" = AmqpResponseStatusCode.BadRequest,\n \"com.microsoft:store-lock-lost\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:session-cannot-be-locked\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:partition-not-owned\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:entity-disabled\" = AmqpResponseStatusCode.BadRequest,\n \"com.microsoft:publisher-revoked\" = AmqpResponseStatusCode.Unauthorized,\n \"amqp:link:stolen\" = AmqpResponseStatusCode.Gone,\n \"amqp:not-allowed\" = AmqpResponseStatusCode.BadRequest,\n \"amqp:unauthorized-access\" = AmqpResponseStatusCode.Unauthorized,\n \"amqp:resource-limit-exceeded\" = AmqpResponseStatusCode.Forbidden,\n}\n\n/**\n * Maps the amqp error conditions to the Error names.\n */\nexport enum ConditionErrorNameMapper {\n /**\n * Error is thrown when the address is already in use.\n */\n \"com.microsoft:address-already-in-use\" = \"AddressAlreadyInUseError\",\n /**\n * Error is thrown when the store lock is lost.\n */\n \"com.microsoft:store-lock-lost\" = \"StoreLockLostError\",\n /**\n * Error is thrown when a matching subscription is not found.\n */\n \"com.microsoft:no-matching-subscription\" = \"NoMatchingSubscriptionError\",\n /**\n * Error is thrown when an attempt is made to access a partition that is not owned by the\n * requesting entity.\n */\n \"com.microsoft:partition-not-owned\" = \"PartitionNotOwnedError\",\n /**\n * Error is thrown when access to publisher has been revoked.\n */\n \"com.microsoft:publisher-revoked\" = \"PublisherRevokedError\",\n /**\n * Error is thrown when an attempt is made to create an entity that already exists.\n */\n \"com.microsoft:entity-already-exists\" = \"MessagingEntityAlreadyExistsError\",\n /**\n * Error is thrown when trying to access/connect to a disabled messaging entity.\n */\n \"com.microsoft:entity-disabled\" = \"MessagingEntityDisabledError\",\n /**\n * Error is thrown when the lock on the message is lost.\n */\n \"com.microsoft:message-lock-lost\" = \"MessageLockLostError\",\n /**\n * Error is thrown when the lock on the Azure ServiceBus session is lost.\n */\n \"com.microsoft:session-lock-lost\" = \"SessionLockLostError\",\n /**\n * Error is thrown when the Azure ServiceBus session cannot be locked.\n */\n \"com.microsoft:session-cannot-be-locked\" = \"SessionCannotBeLockedError\",\n /**\n * Error is thrown when an internal server error occurred. You may have found a bug?\n */\n \"amqp:internal-error\" = \"InternalServerError\", // Retryable\n /**\n * Error for signaling general communication errors related to messaging operations.\n */\n \"amqp:not-found\" = \"ServiceCommunicationError\",\n /**\n * Error is thrown when the message is not found.\n */\n \"com.microsoft:message-not-found\" = \"MessageNotFoundError\",\n /**\n * Error is thrown when relay is not found.\n */\n \"com.microsoft:relay-not-found\" = \"RelayNotFoundError\",\n /**\n * Error is thrown when a feature is not implemented yet but the placeholder is present.\n */\n \"amqp:not-implemented\" = \"NotImplementedError\",\n /**\n * Error is thrown when an operation is attempted but is not allowed.\n */\n \"amqp:not-allowed\" = \"InvalidOperationError\",\n /**\n * Error is thrown the the Azure EventHub/ServiceBus quota has been exceeded.\n * Quotas are reset periodically, this operation will have to wait until then.\n * The messaging entity has reached its maximum allowable size.\n * This can happen if the maximum number of receivers (which is 5) has already\n * been opened on a per-consumer group level.\n */\n \"amqp:resource-limit-exceeded\" = \"QuotaExceededError\",\n /**\n * Error is thrown when the connection parameters are wrong and the server refused the connection.\n */\n \"amqp:unauthorized-access\" = \"UnauthorizedError\",\n /**\n * Error is thrown when the connection parameters are wrong and the server refused the connection.\n */\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n \"com.microsoft:auth-failed\" = \"UnauthorizedError\",\n /**\n * Error is thrown when the service is unavailable. The operation should be retried.\n */\n \"com.microsoft:timeout\" = \"ServiceUnavailableError\", // Retryable\n /**\n * Error is thrown when no new messages are received for the specified time.\n */\n \"com.microsoft:message-wait-timeout\" = \"MessageWaitTimeout\",\n /**\n * Error is thrown when an argument has a value that is out of the admissible range.\n */\n \"com.microsoft:argument-out-of-range\" = \"ArgumentOutOfRangeError\",\n /**\n * Error is thrown when a condition that should have been met in order to execute an operation was not.\n */\n \"amqp:precondition-failed\" = \"PreconditionFailedError\",\n /**\n * Error is thrown when a condition that should have been met in order to execute an operation was not.\n */\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n \"com.microsoft:precondition-failed\" = \"PreconditionFailedError\",\n /**\n * Error is thrown when data could not be decoded.\n */\n \"amqp:decode-error\" = \"DecodeError\",\n /**\n * Error is thrown when an invalid field was passed in a frame body, and the operation could not proceed.\n */\n \"amqp:invalid-field\" = \"InvalidFieldError\",\n /**\n * Error is thrown when the client attempted to work with a server entity to which it\n * has no access because another client is working with it.\n */\n \"amqp:resource-locked\" = \"ResourceLockedError\",\n /**\n * Error is thrown when a server entity the client is working with has been deleted.\n */\n \"amqp:resource-deleted\" = \"ResourceDeletedError\",\n /**\n * Error is thrown when the peer sent a frame that is not permitted in the current state.\n */\n \"amqp:illegal-state\" = \"IllegalStateError\",\n /**\n * Error is thrown when the peer cannot send a frame because the smallest encoding of\n * the performative with the currently valid values would be too large to fit within\n * a frame of the agreed maximum frame size.\n */\n \"amqp:frame-size-too-small\" = \"FrameSizeTooSmallError\",\n /**\n * Error is thrown when an operator intervened to detach for some reason.\n */\n \"amqp:link:detach-forced\" = \"DetachForcedError\", // Retryable\n /**\n * Error is thrown when the peer sent more message transfers than currently allowed on the link.\n */\n \"amqp:link:transfer-limit-exceeded\" = \"TransferLimitExceededError\", // Retryable\n /**\n * Error is thrown when the message sent is too large: the maximum size is 256Kb.\n */\n \"amqp:link:message-size-exceeded\" = \"MessageTooLargeError\",\n /**\n * Error is thrown when the address provided cannot be resolved to a terminus at the current container.\n */\n \"amqp:link:redirect\" = \"LinkRedirectError\",\n /**\n * Error is thrown when two or more instances connect to the same partition\n * with different epoch values.\n */\n \"amqp:link:stolen\" = \"ReceiverDisconnectedError\",\n /**\n * Error is thrown when the peer violated incoming window for the session.\n */\n \"amqp:session:window-violation\" = \"SessionWindowViolationError\",\n /**\n * Error is thrown when input was received for a link that was detached with an error.\n */\n \"amqp:session:errant-link\" = \"ErrantLinkError\",\n /**\n * Error is thrown when an attach was received using a handle that is already in use for an attached link.\n */\n \"amqp:session:handle-in-use\" = \"HandleInUseError\",\n /**\n * Error is thrown when a frame (other than attach) was received referencing a handle which is not\n * currently in use of an attached link.\n */\n \"amqp:session:unattached-handle\" = \"UnattachedHandleError\",\n /**\n * Error is thrown when an operator intervened to close the connection for some reason.\n */\n \"amqp:connection:forced\" = \"ConnectionForcedError\", // Retryable\n /**\n * Error is thrown when a valid frame header cannot be formed from the incoming byte stream.\n */\n \"amqp:connection:framing-error\" = \"FramingError\",\n /**\n * Error is thrown when the container is no longer available on the current connection.\n */\n \"amqp:connection:redirect\" = \"ConnectionRedirectError\",\n /**\n * Error is thrown when the server is busy. Callers should wait a while and retry the operation.\n */\n \"com.microsoft:server-busy\" = \"ServerBusyError\", // Retryable\n /**\n * Error is thrown when an incorrect argument was received.\n */\n \"com.microsoft:argument-error\" = \"ArgumentError\",\n /**\n * Error is thrown when server cancels the operation due to an internal issue.\n */\n \"com.microsoft:operation-cancelled\" = \"OperationCancelledError\", // Retryable\n /**\n * Error is thrown when the client sender does not have enough link credits to send the message.\n */\n \"client.sender:not-enough-link-credit\" = \"SenderBusyError\", // Retryable\n /**\n * Error is thrown when the client sender's link isn't ready\n */\n \"client.sender:link-not-ready\" = \"SenderNotReadyError\", // Retryable\n\n /**\n * Error is thrown when a low level system error is thrown by node.js.\n * {@link https://nodejs.org/dist/latest-v8.x/docs/api/all.html#errors_class_system_error}\n */\n \"system:error\" = \"SystemError\",\n}\n\n/**\n * Maps the Error names to the amqp error conditions.\n */\nexport enum ErrorNameConditionMapper {\n /**\n * Error is thrown when the address is already in use.\n */\n AddressAlreadyInUseError = \"com.microsoft:address-already-in-use\",\n /**\n * Error is thrown when the store lock is lost.\n */\n StoreLockLostError = \"com.microsoft:store-lock-lost\",\n /**\n * Error is thrown when a matching subscription is not found.\n */\n NoMatchingSubscriptionError = \"com.microsoft:no-matching-subscription\",\n /**\n * Error is thrown when an attempt is made to access a partition that is not owned by the\n * requesting entity.\n */\n PartitionNotOwnedError = \"com.microsoft:partition-not-owned\",\n /**\n * Error is thrown when access to publisher has been revoked.\n */\n PublisherRevokedError = \"com.microsoft:publisher-revoked\",\n /**\n * Error is thrown when an attempt is made to create an entity that already exists.\n */\n MessagingEntityAlreadyExistsError = \"com.microsoft:entity-already-exists\",\n /**\n * Error is thrown when trying to access/connect to a disabled messaging entity.\n */\n MessagingEntityDisabledError = \"com.microsoft:entity-disabled\",\n /**\n * Error is thrown when the lock on the message is lost.\n */\n MessageLockLostError = \"com.microsoft:message-lock-lost\",\n /**\n * Error is thrown when the lock on the Azure ServiceBus session is lost.\n */\n SessionLockLostError = \"com.microsoft:session-lock-lost\",\n /**\n * Error is thrown when the Azure ServiceBus session cannot be locked.\n */\n SessionCannotBeLockedError = \"com.microsoft:session-cannot-be-locked\",\n /**\n * Error is thrown when an internal server error occurred. You may have found a bug?\n */\n InternalServerError = \"amqp:internal-error\", // Retryable\n /**\n * Error for signaling general communication errors related to messaging operations.\n */\n ServiceCommunicationError = \"amqp:not-found\",\n /**\n * Error is thrown when message is not found.\n */\n MessageNotFoundError = \"com.microsoft:message-not-found\",\n /**\n * Error is thrown when relay is not found.\n */\n RelayNotFoundError = \"com.microsoft:relay-not-found\",\n /**\n * Error is thrown when a feature is not implemented yet but the placeholder is present.\n */\n NotImplementedError = \"amqp:not-implemented\",\n /**\n * Error is thrown when an operation is attempted but is not allowed.\n */\n InvalidOperationError = \"amqp:not-allowed\",\n /**\n * Error is thrown the the Azure EventHub/ServiceBus quota has been exceeded.\n * Quotas are reset periodically, this operation will have to wait until then.\n * The messaging entity has reached its maximum allowable size.\n * This can happen if the maximum number of receivers (which is 5) has already\n * been opened on a per-consumer group level.\n */\n QuotaExceededError = \"amqp:resource-limit-exceeded\",\n /**\n * Error is thrown when the connection parameters are wrong and the server refused the connection.\n */\n UnauthorizedError = \"amqp:unauthorized-access\",\n /**\n * Error is thrown when the service is unavailable. The operation should be retried.\n */\n ServiceUnavailableError = \"com.microsoft:timeout\", // Retryable\n /**\n * Error is thrown when no new messages are received for the specified time.\n */\n MessageWaitTimeout = \"com.microsoft:message-wait-timeout\",\n /**\n * Error is thrown when an argument has a value that is out of the admissible range.\n */\n ArgumentOutOfRangeError = \"com.microsoft:argument-out-of-range\",\n /**\n * Error is thrown when a condition that should have been met in order to execute an operation was not.\n */\n PreconditionFailedError = \"amqp:precondition-failed\",\n /**\n * Error is thrown when data could not be decoded.\n */\n DecodeError = \"amqp:decode-error\",\n /**\n * Error is thrown when an invalid field was passed in a frame body, and the operation could not proceed.\n */\n InvalidFieldError = \"amqp:invalid-field\",\n /**\n * Error is thrown when the client attempted to work with a server entity to which it\n * has no access because another client is working with it.\n */\n ResourceLockedError = \"amqp:resource-locked\",\n /**\n * Error is thrown when a server entity the client is working with has been deleted.\n */\n ResourceDeletedError = \"amqp:resource-deleted\",\n /**\n * Error is thrown when the peer sent a frame that is not permitted in the current state.\n */\n IllegalStateError = \"amqp:illegal-state\",\n /**\n * Error is thrown when the peer cannot send a frame because the smallest encoding of\n * the performative with the currently valid values would be too large to fit within\n * a frame of the agreed maximum frame size.\n */\n FrameSizeTooSmallError = \"amqp:frame-size-too-small\",\n /**\n * Error is thrown when an operator intervened to detach for some reason.\n */\n DetachForcedError = \"amqp:link:detach-forced\", // Retryable\n /**\n * Error is thrown when the peer sent more message transfers than currently allowed on the link.\n */\n TransferLimitExceededError = \"amqp:link:transfer-limit-exceeded\", // Retryable\n /**\n * Error is thrown when the message sent is too large: the maximum size is 256Kb.\n */\n MessageTooLargeError = \"amqp:link:message-size-exceeded\",\n /**\n * Error is thrown when the address provided cannot be resolved to a terminus at the current container.\n */\n LinkRedirectError = \"amqp:link:redirect\",\n /**\n * Error is thrown when two or more instances connect to the same partition\n * with different epoch values.\n */\n ReceiverDisconnectedError = \"amqp:link:stolen\",\n /**\n * Error is thrown when the peer violated incoming window for the session.\n */\n SessionWindowViolationError = \"amqp:session:window-violation\",\n /**\n * Error is thrown when input was received for a link that was detached with an error.\n */\n ErrantLinkError = \"amqp:session:errant-link\",\n /**\n * Error is thrown when an attach was received using a handle that is already in use for an attached link.\n */\n HandleInUseError = \"amqp:session:handle-in-use\",\n /**\n * Error is thrown when a frame (other than attach) was received referencing a handle which is not\n * currently in use of an attached link.\n */\n UnattachedHandleError = \"amqp:session:unattached-handle\",\n /**\n * Error is thrown when an operator intervened to close the connection for some reason.\n */\n ConnectionForcedError = \"amqp:connection:forced\", // Retryable\n /**\n * Error is thrown when a valid frame header cannot be formed from the incoming byte stream.\n */\n FramingError = \"amqp:connection:framing-error\",\n /**\n * Error is thrown when the container is no longer available on the current connection.\n */\n ConnectionRedirectError = \"amqp:connection:redirect\",\n /**\n * Error is thrown when the server is busy. Callers should wait a while and retry the operation.\n */\n ServerBusyError = \"com.microsoft:server-busy\", // Retryable\n /**\n * Error is thrown when an incorrect argument was received.\n */\n ArgumentError = \"com.microsoft:argument-error\",\n /**\n * Error is thrown when server cancels the operation due to an internal issue.\n */\n OperationCancelledError = \"com.microsoft:operation-cancelled\", // Retryable\n /**\n * Error is thrown when the client sender does not have enough link credits to send the message.\n */\n SenderBusyError = \"client.sender:not-enough-link-credit\", // Retryable\n /**\n * Error is thrown when the client sender's link isn't ready\n */\n SenderNotReadyError = \"client.sender:link-not-ready\", // Retryable\n /**\n * Error is thrown when a low level system error is thrown by node.js.\n * {@link https://nodejs.org/api/errors.html#errors_class_systemerror}\n */\n SystemError = \"system:error\",\n}\n\n/**\n * Describes the fields on a Node.js SystemError.\n * Omits fields that are not related to network calls (e.g. file system calls).\n * See https://nodejs.org/dist/latest-v12.x/docs/api/errors.html#errors_class_systemerror\n */\nexport interface NetworkSystemError {\n address?: string;\n code: string;\n errno: string | number;\n info?: any;\n message: string;\n name: string;\n port?: number;\n stack: string;\n syscall: string;\n}\n\n/**\n * @internal\n */\nconst systemErrorFieldsToCopy: (keyof Omit<NetworkSystemError, \"name\" | \"message\">)[] = [\n \"address\",\n \"code\",\n \"errno\",\n \"info\",\n \"port\",\n \"stack\",\n \"syscall\",\n];\n\n/**\n * Determines if an error is a MessagingError.\n *\n * @param error - An error that can either be an Error or a MessagingError.\n */\nexport function isMessagingError(error: Error | MessagingError): error is MessagingError {\n return error.name === \"MessagingError\";\n}\n\n/**\n * Describes the base class for Messaging Error.\n */\nexport class MessagingError extends Error {\n /**\n * Address to which the network connection failed.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n address?: string;\n /**\n * A string label that identifies the error.\n */\n code?: string;\n /**\n * System-provided error number.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n errno?: number | string;\n /**\n * The error name. Default value: \"MessagingError\".\n */\n name: string = \"MessagingError\";\n /**\n * The unavailable network connection port.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n port?: number;\n /**\n * Name of the system call that triggered the error.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n syscall?: string;\n /**\n *\n * Describes whether the error is retryable. Default: true.\n */\n retryable: boolean = true;\n /**\n * Extra details about the error.\n */\n info?: any;\n /**\n * @param message - The error message that provides more information about the error.\n * @param originalError - An error whose properties will be copied to the MessagingError if the\n * property matches one found on the Node.js `SystemError`.\n */\n constructor(message: string, originalError?: Error) {\n super(message);\n\n if (!originalError) {\n return;\n }\n\n // copy properties from system error\n for (const propName of systemErrorFieldsToCopy) {\n if ((originalError as NetworkSystemError)[propName] != undefined) {\n this[propName] = (originalError as NetworkSystemError)[propName];\n }\n }\n }\n}\n\n/**\n * Provides a list of retryable AMQP errors.\n * \"InternalServerError\", \"ServerBusyError\", \"ServiceUnavailableError\", \"OperationCancelledError\",\n * \"SenderBusyError\", \"SenderNotReadyError\", \"MessagingError\", \"DetachForcedError\", \"ConnectionForcedError\",\n * \"TransferLimitExceededError\"\n */\nexport const retryableErrors: string[] = [\n \"InternalServerError\",\n \"ServerBusyError\",\n \"ServiceUnavailableError\",\n \"OperationCancelledError\",\n\n // The service may throw UnauthorizedError if credentials have been rotated.\n // Attempt to retry in case the user has also rotated their credentials.\n \"UnauthorizedError\",\n\n // OperationTimeoutError occurs when the service fails to respond within a given timeframe.\n // Since reasons for such failures can be transient, this is treated as a retryable error.\n \"OperationTimeoutError\",\n\n \"SenderBusyError\",\n \"SenderNotReadyError\",\n \"MessagingError\",\n \"DetachForcedError\",\n \"ConnectionForcedError\",\n \"TransferLimitExceededError\",\n\n // InsufficientCreditError occurs when the number of credits available on Rhea link is insufficient.\n // Since reasons for such shortage can be transient such as for pending delivery of messages, this is treated as a retryable error.\n \"InsufficientCreditError\",\n];\n\n/**\n * Maps some SystemErrors to amqp error conditions\n */\nexport enum SystemErrorConditionMapper {\n /* eslint-disable @typescript-eslint/no-duplicate-enum-values */\n ENOTFOUND = \"amqp:not-found\",\n EBUSY = \"com.microsoft:server-busy\",\n ECONNREFUSED = \"amqp:connection:forced\",\n ETIMEDOUT = \"com.microsoft:timeout\",\n ECONNRESET = \"com.microsoft:timeout\",\n ENETDOWN = \"com.microsoft:timeout\",\n EHOSTDOWN = \"com.microsoft:timeout\",\n ENETRESET = \"com.microsoft:timeout\",\n ENETUNREACH = \"com.microsoft:timeout\",\n ENONET = \"com.microsoft:timeout\",\n /* eslint-enable @typescript-eslint/no-duplicate-enum-values */\n}\n\n/**\n * Checks whether the provided error is a node.js SystemError.\n * @param err - An object that may contain error information.\n */\nexport function isSystemError(err: unknown): err is NetworkSystemError {\n if (!isObjectWithProperties(err, [\"code\", \"syscall\", \"errno\"])) {\n return false;\n }\n\n if (!isString(err.code) || !isString(err.syscall)) {\n return false;\n }\n\n if (!isString(err.errno) && !isNumber(err.errno)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * @internal\n * Since browser doesn't differentiate between the various kinds of service communication errors,\n * this utility is used to look at the error target to identify such category of errors.\n * For more information refer to - https://html.spec.whatwg.org/multipage/comms.html#feedback-from-the-protocol\n * @param err - object that may contain error information\n */\nfunction isBrowserWebsocketError(err: any): boolean {\n let result: boolean = false;\n if (\n !isNodeLike &&\n self &&\n err.type === \"error\" &&\n err.target instanceof (self as any).WebSocket\n ) {\n result = true;\n }\n return result;\n}\n\n/**\n * @internal\n * Checks whether a object is an ErrorEvent or not. https://html.spec.whatwg.org/multipage/webappapis.html#errorevent\n * @param err - object that may contain error information\n */\nfunction isErrorEvent(err: any): err is { message: string; error: any } {\n return typeof err.error === \"object\" && typeof err.message === \"string\";\n}\n\n/**\n * @internal\n */\nconst rheaPromiseErrors = [\n // OperationTimeoutError occurs when the service fails to respond within a given timeframe.\n \"OperationTimeoutError\",\n\n // InsufficientCreditError occurs when the number of credits available on Rhea link is insufficient.\n \"InsufficientCreditError\",\n\n // Defines the error that occurs when the Sender fails to send a message.\n \"SendOperationFailedError\",\n];\n\n/**\n * Translates the AMQP error received at the protocol layer or a SystemError into a MessagingError.\n * All other errors are returned unaltered.\n *\n * @param err - The amqp error that was received.\n * @returns MessagingError object.\n */\nexport function translate(err: unknown): MessagingError | Error {\n if (!isDefined(err)) {\n return new Error(`Unknown error encountered.`);\n } else if (typeof err !== \"object\") {\n // The error is a scalar type, make it the message of an actual error.\n return new Error(String(err));\n }\n\n const errObj = isErrorEvent(err) ? err.error : err;\n\n // Built-in errors like TypeError and RangeError should not be retryable as these indicate issues\n // with user input and not an issue with the Messaging process.\n if (errObj instanceof TypeError || errObj instanceof RangeError) {\n return errObj;\n }\n\n if (isAmqpError(errObj)) {\n // translate\n const condition = errObj.condition;\n const description = errObj.description!;\n const error = new MessagingError(description);\n if ((errObj as any).stack) error.stack = (errObj as any).stack;\n error.info = errObj.info;\n if (condition) {\n error.code = ConditionErrorNameMapper[condition as keyof typeof ConditionErrorNameMapper];\n }\n if (\n description &&\n (description.includes(\"status-code: 404\") ||\n description.match(/The messaging entity .* could not be found.*/i) !== null)\n ) {\n error.code = \"MessagingEntityNotFoundError\";\n }\n if (error.code && retryableErrors.indexOf(error.code) === -1) {\n // not found\n error.retryable = false;\n }\n return error;\n }\n\n if (errObj instanceof Error && errObj.name === \"MessagingError\") {\n // already translated\n return errObj;\n }\n\n if (isSystemError(errObj)) {\n // translate\n const condition = errObj.code;\n const description = errObj.message;\n const error = new MessagingError(description, errObj);\n let errorType = \"SystemError\";\n if (condition) {\n const amqpErrorCondition =\n SystemErrorConditionMapper[condition as keyof typeof SystemErrorConditionMapper];\n errorType =\n ConditionErrorNameMapper[amqpErrorCondition as keyof typeof ConditionErrorNameMapper];\n }\n if (retryableErrors.indexOf(errorType) === -1) {\n // not found\n error.retryable = false;\n }\n return error;\n }\n\n if (isBrowserWebsocketError(errObj)) {\n // Translate browser communication errors during opening handshake to generic ServiceCommunicationError\n const error = new MessagingError(\"Websocket connection failed.\");\n error.code = ConditionErrorNameMapper[ErrorNameConditionMapper.ServiceCommunicationError];\n error.retryable = false;\n return error;\n }\n\n // Some errors come from rhea-promise and need to be converted to MessagingError.\n // A subset of these are also retryable.\n if (isError(errObj) && rheaPromiseErrors.indexOf(errObj.name) !== -1) {\n const error = new MessagingError(errObj.message, errObj);\n error.code = errObj.name;\n if (error.code && retryableErrors.indexOf(error.code) === -1) {\n // not found\n error.retryable = false;\n }\n return error;\n }\n\n return isError(errObj) ? errObj : new Error(String(errObj));\n}\n\n/**\n * @internal\n */\nfunction isAmqpError(error: any): error is AmqpError {\n return rheaIsAmqpError(error);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,2BAA2B;AAG3B,OAAO,EAA0B,WAAW,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,SA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,CAAC;AAChC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* eslint-disable eqeqeq */\n\nimport type { AmqpError } from \"rhea-promise\";\nimport { AmqpResponseStatusCode, isAmqpError as rheaIsAmqpError } from \"rhea-promise\";\nimport { isDefined, isError, isNodeLike, isObjectWithProperties } from \"@azure/core-util\";\nimport { isNumber, isString } from \"./util/utils.js\";\n\n/**\n * Maps the conditions to the numeric AMQP Response status codes.\n * @internal\n */\nexport enum ConditionStatusMapper {\n \"com.microsoft:timeout\" = AmqpResponseStatusCode.RequestTimeout,\n \"amqp:not-found\" = AmqpResponseStatusCode.NotFound,\n \"amqp:not-implemented\" = AmqpResponseStatusCode.NotImplemented,\n \"com.microsoft:entity-already-exists\" = AmqpResponseStatusCode.Conflict,\n \"com.microsoft:message-lock-lost\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:session-lock-lost\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:no-matching-subscription\" = AmqpResponseStatusCode.InternalServerError,\n \"amqp:link:message-size-exceeded\" = AmqpResponseStatusCode.Forbidden,\n \"com.microsoft:server-busy\" = AmqpResponseStatusCode.ServiceUnavailable,\n \"com.microsoft:argument-error\" = AmqpResponseStatusCode.BadRequest,\n \"com.microsoft:argument-out-of-range\" = AmqpResponseStatusCode.BadRequest,\n \"com.microsoft:store-lock-lost\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:session-cannot-be-locked\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:partition-not-owned\" = AmqpResponseStatusCode.Gone,\n \"com.microsoft:entity-disabled\" = AmqpResponseStatusCode.BadRequest,\n \"com.microsoft:publisher-revoked\" = AmqpResponseStatusCode.Unauthorized,\n \"amqp:link:stolen\" = AmqpResponseStatusCode.Gone,\n \"amqp:not-allowed\" = AmqpResponseStatusCode.BadRequest,\n \"amqp:unauthorized-access\" = AmqpResponseStatusCode.Unauthorized,\n \"amqp:resource-limit-exceeded\" = AmqpResponseStatusCode.Forbidden,\n}\n\n/**\n * Maps the amqp error conditions to the Error names.\n */\nexport enum ConditionErrorNameMapper {\n /**\n * Error is thrown when the address is already in use.\n */\n \"com.microsoft:address-already-in-use\" = \"AddressAlreadyInUseError\",\n /**\n * Error is thrown when the store lock is lost.\n */\n \"com.microsoft:store-lock-lost\" = \"StoreLockLostError\",\n /**\n * Error is thrown when a matching subscription is not found.\n */\n \"com.microsoft:no-matching-subscription\" = \"NoMatchingSubscriptionError\",\n /**\n * Error is thrown when an attempt is made to access a partition that is not owned by the\n * requesting entity.\n */\n \"com.microsoft:partition-not-owned\" = \"PartitionNotOwnedError\",\n /**\n * Error is thrown when access to publisher has been revoked.\n */\n \"com.microsoft:publisher-revoked\" = \"PublisherRevokedError\",\n /**\n * Error is thrown when an attempt is made to create an entity that already exists.\n */\n \"com.microsoft:entity-already-exists\" = \"MessagingEntityAlreadyExistsError\",\n /**\n * Error is thrown when trying to access/connect to a disabled messaging entity.\n */\n \"com.microsoft:entity-disabled\" = \"MessagingEntityDisabledError\",\n /**\n * Error is thrown when the lock on the message is lost.\n */\n \"com.microsoft:message-lock-lost\" = \"MessageLockLostError\",\n /**\n * Error is thrown when the lock on the Azure ServiceBus session is lost.\n */\n \"com.microsoft:session-lock-lost\" = \"SessionLockLostError\",\n /**\n * Error is thrown when the Azure ServiceBus session cannot be locked.\n */\n \"com.microsoft:session-cannot-be-locked\" = \"SessionCannotBeLockedError\",\n /**\n * Error is thrown when an internal server error occurred. You may have found a bug?\n */\n \"amqp:internal-error\" = \"InternalServerError\", // Retryable\n /**\n * Error for signaling general communication errors related to messaging operations.\n */\n \"amqp:not-found\" = \"ServiceCommunicationError\",\n /**\n * Error is thrown when the message is not found.\n */\n \"com.microsoft:message-not-found\" = \"MessageNotFoundError\",\n /**\n * Error is thrown when relay is not found.\n */\n \"com.microsoft:relay-not-found\" = \"RelayNotFoundError\",\n /**\n * Error is thrown when a feature is not implemented yet but the placeholder is present.\n */\n \"amqp:not-implemented\" = \"NotImplementedError\",\n /**\n * Error is thrown when an operation is attempted but is not allowed.\n */\n \"amqp:not-allowed\" = \"InvalidOperationError\",\n /**\n * Error is thrown the the Azure EventHub/ServiceBus quota has been exceeded.\n * Quotas are reset periodically, this operation will have to wait until then.\n * The messaging entity has reached its maximum allowable size.\n * This can happen if the maximum number of receivers (which is 5) has already\n * been opened on a per-consumer group level.\n */\n \"amqp:resource-limit-exceeded\" = \"QuotaExceededError\",\n /**\n * Error is thrown when the connection parameters are wrong and the server refused the connection.\n */\n \"amqp:unauthorized-access\" = \"UnauthorizedError\",\n /**\n * Error is thrown when the connection parameters are wrong and the server refused the connection.\n */\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n \"com.microsoft:auth-failed\" = \"UnauthorizedError\",\n /**\n * Error is thrown when the service is unavailable. The operation should be retried.\n */\n \"com.microsoft:timeout\" = \"ServiceUnavailableError\", // Retryable\n /**\n * Error is thrown when no new messages are received for the specified time.\n */\n \"com.microsoft:message-wait-timeout\" = \"MessageWaitTimeout\",\n /**\n * Error is thrown when an argument has a value that is out of the admissible range.\n */\n \"com.microsoft:argument-out-of-range\" = \"ArgumentOutOfRangeError\",\n /**\n * Error is thrown when a condition that should have been met in order to execute an operation was not.\n */\n \"amqp:precondition-failed\" = \"PreconditionFailedError\",\n /**\n * Error is thrown when a condition that should have been met in order to execute an operation was not.\n */\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n \"com.microsoft:precondition-failed\" = \"PreconditionFailedError\",\n /**\n * Error is thrown when data could not be decoded.\n */\n \"amqp:decode-error\" = \"DecodeError\",\n /**\n * Error is thrown when an invalid field was passed in a frame body, and the operation could not proceed.\n */\n \"amqp:invalid-field\" = \"InvalidFieldError\",\n /**\n * Error is thrown when the client attempted to work with a server entity to which it\n * has no access because another client is working with it.\n */\n \"amqp:resource-locked\" = \"ResourceLockedError\",\n /**\n * Error is thrown when a server entity the client is working with has been deleted.\n */\n \"amqp:resource-deleted\" = \"ResourceDeletedError\",\n /**\n * Error is thrown when the peer sent a frame that is not permitted in the current state.\n */\n \"amqp:illegal-state\" = \"IllegalStateError\",\n /**\n * Error is thrown when the peer cannot send a frame because the smallest encoding of\n * the performative with the currently valid values would be too large to fit within\n * a frame of the agreed maximum frame size.\n */\n \"amqp:frame-size-too-small\" = \"FrameSizeTooSmallError\",\n /**\n * Error is thrown when an operator intervened to detach for some reason.\n */\n \"amqp:link:detach-forced\" = \"DetachForcedError\", // Retryable\n /**\n * Error is thrown when the peer sent more message transfers than currently allowed on the link.\n */\n \"amqp:link:transfer-limit-exceeded\" = \"TransferLimitExceededError\", // Retryable\n /**\n * Error is thrown when the message sent is too large: the maximum size is 256Kb.\n */\n \"amqp:link:message-size-exceeded\" = \"MessageTooLargeError\",\n /**\n * Error is thrown when the address provided cannot be resolved to a terminus at the current container.\n */\n \"amqp:link:redirect\" = \"LinkRedirectError\",\n /**\n * Error is thrown when two or more instances connect to the same partition\n * with different epoch values.\n */\n \"amqp:link:stolen\" = \"ReceiverDisconnectedError\",\n /**\n * Error is thrown when the peer violated incoming window for the session.\n */\n \"amqp:session:window-violation\" = \"SessionWindowViolationError\",\n /**\n * Error is thrown when input was received for a link that was detached with an error.\n */\n \"amqp:session:errant-link\" = \"ErrantLinkError\",\n /**\n * Error is thrown when an attach was received using a handle that is already in use for an attached link.\n */\n \"amqp:session:handle-in-use\" = \"HandleInUseError\",\n /**\n * Error is thrown when a frame (other than attach) was received referencing a handle which is not\n * currently in use of an attached link.\n */\n \"amqp:session:unattached-handle\" = \"UnattachedHandleError\",\n /**\n * Error is thrown when an operator intervened to close the connection for some reason.\n */\n \"amqp:connection:forced\" = \"ConnectionForcedError\", // Retryable\n /**\n * Error is thrown when a valid frame header cannot be formed from the incoming byte stream.\n */\n \"amqp:connection:framing-error\" = \"FramingError\",\n /**\n * Error is thrown when the container is no longer available on the current connection.\n */\n \"amqp:connection:redirect\" = \"ConnectionRedirectError\",\n /**\n * Error is thrown when the server is busy. Callers should wait a while and retry the operation.\n */\n \"com.microsoft:server-busy\" = \"ServerBusyError\", // Retryable\n /**\n * Error is thrown when an incorrect argument was received.\n */\n \"com.microsoft:argument-error\" = \"ArgumentError\",\n /**\n * Error is thrown when server cancels the operation due to an internal issue.\n */\n \"com.microsoft:operation-cancelled\" = \"OperationCancelledError\", // Retryable\n /**\n * Error is thrown when the client sender does not have enough link credits to send the message.\n */\n \"client.sender:not-enough-link-credit\" = \"SenderBusyError\", // Retryable\n /**\n * Error is thrown when the client sender's link isn't ready\n */\n \"client.sender:link-not-ready\" = \"SenderNotReadyError\", // Retryable\n\n /**\n * Error is thrown when a low level system error is thrown by node.js.\n * {@link https://nodejs.org/dist/latest-v8.x/docs/api/all.html#errors_class_system_error}\n */\n \"system:error\" = \"SystemError\",\n}\n\n/**\n * Maps the Error names to the amqp error conditions.\n */\nexport enum ErrorNameConditionMapper {\n /**\n * Error is thrown when the address is already in use.\n */\n AddressAlreadyInUseError = \"com.microsoft:address-already-in-use\",\n /**\n * Error is thrown when the store lock is lost.\n */\n StoreLockLostError = \"com.microsoft:store-lock-lost\",\n /**\n * Error is thrown when a matching subscription is not found.\n */\n NoMatchingSubscriptionError = \"com.microsoft:no-matching-subscription\",\n /**\n * Error is thrown when an attempt is made to access a partition that is not owned by the\n * requesting entity.\n */\n PartitionNotOwnedError = \"com.microsoft:partition-not-owned\",\n /**\n * Error is thrown when access to publisher has been revoked.\n */\n PublisherRevokedError = \"com.microsoft:publisher-revoked\",\n /**\n * Error is thrown when an attempt is made to create an entity that already exists.\n */\n MessagingEntityAlreadyExistsError = \"com.microsoft:entity-already-exists\",\n /**\n * Error is thrown when trying to access/connect to a disabled messaging entity.\n */\n MessagingEntityDisabledError = \"com.microsoft:entity-disabled\",\n /**\n * Error is thrown when the lock on the message is lost.\n */\n MessageLockLostError = \"com.microsoft:message-lock-lost\",\n /**\n * Error is thrown when the lock on the Azure ServiceBus session is lost.\n */\n SessionLockLostError = \"com.microsoft:session-lock-lost\",\n /**\n * Error is thrown when the Azure ServiceBus session cannot be locked.\n */\n SessionCannotBeLockedError = \"com.microsoft:session-cannot-be-locked\",\n /**\n * Error is thrown when an internal server error occurred. You may have found a bug?\n */\n InternalServerError = \"amqp:internal-error\", // Retryable\n /**\n * Error for signaling general communication errors related to messaging operations.\n */\n ServiceCommunicationError = \"amqp:not-found\",\n /**\n * Error is thrown when message is not found.\n */\n MessageNotFoundError = \"com.microsoft:message-not-found\",\n /**\n * Error is thrown when relay is not found.\n */\n RelayNotFoundError = \"com.microsoft:relay-not-found\",\n /**\n * Error is thrown when a feature is not implemented yet but the placeholder is present.\n */\n NotImplementedError = \"amqp:not-implemented\",\n /**\n * Error is thrown when an operation is attempted but is not allowed.\n */\n InvalidOperationError = \"amqp:not-allowed\",\n /**\n * Error is thrown the the Azure EventHub/ServiceBus quota has been exceeded.\n * Quotas are reset periodically, this operation will have to wait until then.\n * The messaging entity has reached its maximum allowable size.\n * This can happen if the maximum number of receivers (which is 5) has already\n * been opened on a per-consumer group level.\n */\n QuotaExceededError = \"amqp:resource-limit-exceeded\",\n /**\n * Error is thrown when the connection parameters are wrong and the server refused the connection.\n */\n UnauthorizedError = \"amqp:unauthorized-access\",\n /**\n * Error is thrown when the service is unavailable. The operation should be retried.\n */\n ServiceUnavailableError = \"com.microsoft:timeout\", // Retryable\n /**\n * Error is thrown when no new messages are received for the specified time.\n */\n MessageWaitTimeout = \"com.microsoft:message-wait-timeout\",\n /**\n * Error is thrown when an argument has a value that is out of the admissible range.\n */\n ArgumentOutOfRangeError = \"com.microsoft:argument-out-of-range\",\n /**\n * Error is thrown when a condition that should have been met in order to execute an operation was not.\n */\n PreconditionFailedError = \"amqp:precondition-failed\",\n /**\n * Error is thrown when data could not be decoded.\n */\n DecodeError = \"amqp:decode-error\",\n /**\n * Error is thrown when an invalid field was passed in a frame body, and the operation could not proceed.\n */\n InvalidFieldError = \"amqp:invalid-field\",\n /**\n * Error is thrown when the client attempted to work with a server entity to which it\n * has no access because another client is working with it.\n */\n ResourceLockedError = \"amqp:resource-locked\",\n /**\n * Error is thrown when a server entity the client is working with has been deleted.\n */\n ResourceDeletedError = \"amqp:resource-deleted\",\n /**\n * Error is thrown when the peer sent a frame that is not permitted in the current state.\n */\n IllegalStateError = \"amqp:illegal-state\",\n /**\n * Error is thrown when the peer cannot send a frame because the smallest encoding of\n * the performative with the currently valid values would be too large to fit within\n * a frame of the agreed maximum frame size.\n */\n FrameSizeTooSmallError = \"amqp:frame-size-too-small\",\n /**\n * Error is thrown when an operator intervened to detach for some reason.\n */\n DetachForcedError = \"amqp:link:detach-forced\", // Retryable\n /**\n * Error is thrown when the peer sent more message transfers than currently allowed on the link.\n */\n TransferLimitExceededError = \"amqp:link:transfer-limit-exceeded\", // Retryable\n /**\n * Error is thrown when the message sent is too large: the maximum size is 256Kb.\n */\n MessageTooLargeError = \"amqp:link:message-size-exceeded\",\n /**\n * Error is thrown when the address provided cannot be resolved to a terminus at the current container.\n */\n LinkRedirectError = \"amqp:link:redirect\",\n /**\n * Error is thrown when two or more instances connect to the same partition\n * with different epoch values.\n */\n ReceiverDisconnectedError = \"amqp:link:stolen\",\n /**\n * Error is thrown when the peer violated incoming window for the session.\n */\n SessionWindowViolationError = \"amqp:session:window-violation\",\n /**\n * Error is thrown when input was received for a link that was detached with an error.\n */\n ErrantLinkError = \"amqp:session:errant-link\",\n /**\n * Error is thrown when an attach was received using a handle that is already in use for an attached link.\n */\n HandleInUseError = \"amqp:session:handle-in-use\",\n /**\n * Error is thrown when a frame (other than attach) was received referencing a handle which is not\n * currently in use of an attached link.\n */\n UnattachedHandleError = \"amqp:session:unattached-handle\",\n /**\n * Error is thrown when an operator intervened to close the connection for some reason.\n */\n ConnectionForcedError = \"amqp:connection:forced\", // Retryable\n /**\n * Error is thrown when a valid frame header cannot be formed from the incoming byte stream.\n */\n FramingError = \"amqp:connection:framing-error\",\n /**\n * Error is thrown when the container is no longer available on the current connection.\n */\n ConnectionRedirectError = \"amqp:connection:redirect\",\n /**\n * Error is thrown when the server is busy. Callers should wait a while and retry the operation.\n */\n ServerBusyError = \"com.microsoft:server-busy\", // Retryable\n /**\n * Error is thrown when an incorrect argument was received.\n */\n ArgumentError = \"com.microsoft:argument-error\",\n /**\n * Error is thrown when server cancels the operation due to an internal issue.\n */\n OperationCancelledError = \"com.microsoft:operation-cancelled\", // Retryable\n /**\n * Error is thrown when the client sender does not have enough link credits to send the message.\n */\n SenderBusyError = \"client.sender:not-enough-link-credit\", // Retryable\n /**\n * Error is thrown when the client sender's link isn't ready\n */\n SenderNotReadyError = \"client.sender:link-not-ready\", // Retryable\n /**\n * Error is thrown when a low level system error is thrown by node.js.\n * {@link https://nodejs.org/api/errors.html#errors_class_systemerror}\n */\n SystemError = \"system:error\",\n}\n\n/**\n * Describes the fields on a Node.js SystemError.\n * Omits fields that are not related to network calls (e.g. file system calls).\n * See https://nodejs.org/dist/latest-v12.x/docs/api/errors.html#errors_class_systemerror\n */\nexport interface NetworkSystemError {\n address?: string;\n code: string;\n errno: string | number;\n info?: any;\n message: string;\n name: string;\n port?: number;\n stack: string;\n syscall: string;\n}\n\n/**\n * @internal\n */\nconst systemErrorFieldsToCopy: (keyof Omit<NetworkSystemError, \"name\" | \"message\">)[] = [\n \"address\",\n \"code\",\n \"errno\",\n \"info\",\n \"port\",\n \"stack\",\n \"syscall\",\n];\n\n/**\n * Determines if an error is a MessagingError.\n *\n * @param error - An error that can either be an Error or a MessagingError.\n */\nexport function isMessagingError(error: Error | MessagingError): error is MessagingError {\n return error.name === \"MessagingError\";\n}\n\n/**\n * Describes the base class for Messaging Error.\n */\nexport class MessagingError extends Error {\n /**\n * Address to which the network connection failed.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n address?: string;\n /**\n * A string label that identifies the error.\n */\n code?: string;\n /**\n * System-provided error number.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n errno?: number | string;\n /**\n * The error name. Default value: \"MessagingError\".\n */\n name: string = \"MessagingError\";\n /**\n * The unavailable network connection port.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n port?: number;\n /**\n * Name of the system call that triggered the error.\n * Only present if the `MessagingError` was instantiated with a Node.js `SystemError`.\n */\n syscall?: string;\n /**\n *\n * Describes whether the error is retryable. Default: true.\n */\n retryable: boolean = true;\n /**\n * Extra details about the error.\n */\n info?: any;\n /**\n * @param message - The error message that provides more information about the error.\n * @param originalError - An error whose properties will be copied to the MessagingError if the\n * property matches one found on the Node.js `SystemError`.\n */\n constructor(message: string, originalError?: Error) {\n super(message);\n\n if (!originalError) {\n return;\n }\n\n // copy properties from system error\n for (const propName of systemErrorFieldsToCopy) {\n if ((originalError as NetworkSystemError)[propName] != undefined) {\n this[propName] = (originalError as NetworkSystemError)[propName];\n }\n }\n }\n}\n\n/**\n * Provides a list of retryable AMQP errors.\n * \"InternalServerError\", \"ServerBusyError\", \"ServiceUnavailableError\", \"OperationCancelledError\",\n * \"SenderBusyError\", \"SenderNotReadyError\", \"MessagingError\", \"DetachForcedError\", \"ConnectionForcedError\",\n * \"TransferLimitExceededError\"\n */\nexport const retryableErrors: string[] = [\n \"InternalServerError\",\n \"ServerBusyError\",\n \"ServiceUnavailableError\",\n \"OperationCancelledError\",\n\n // The service may throw UnauthorizedError if credentials have been rotated.\n // Attempt to retry in case the user has also rotated their credentials.\n \"UnauthorizedError\",\n\n // OperationTimeoutError occurs when the service fails to respond within a given timeframe.\n // Since reasons for such failures can be transient, this is treated as a retryable error.\n \"OperationTimeoutError\",\n\n \"SenderBusyError\",\n \"SenderNotReadyError\",\n \"MessagingError\",\n \"DetachForcedError\",\n \"ConnectionForcedError\",\n \"TransferLimitExceededError\",\n\n // InsufficientCreditError occurs when the number of credits available on Rhea link is insufficient.\n // Since reasons for such shortage can be transient such as for pending delivery of messages, this is treated as a retryable error.\n \"InsufficientCreditError\",\n];\n\n/**\n * Maps some SystemErrors to amqp error conditions\n */\nexport enum SystemErrorConditionMapper {\n /* eslint-disable @typescript-eslint/no-duplicate-enum-values */\n ENOTFOUND = \"amqp:not-found\",\n EBUSY = \"com.microsoft:server-busy\",\n ECONNREFUSED = \"amqp:connection:forced\",\n ETIMEDOUT = \"com.microsoft:timeout\",\n ECONNRESET = \"com.microsoft:timeout\",\n ENETDOWN = \"com.microsoft:timeout\",\n EHOSTDOWN = \"com.microsoft:timeout\",\n ENETRESET = \"com.microsoft:timeout\",\n ENETUNREACH = \"com.microsoft:timeout\",\n ENONET = \"com.microsoft:timeout\",\n EADDRNOTAVAIL = \"com.microsoft:timeout\",\n EAI_AGAIN = \"com.microsoft:timeout\",\n /* eslint-enable @typescript-eslint/no-duplicate-enum-values */\n}\n\n/**\n * Checks whether the provided error is a node.js SystemError.\n * @param err - An object that may contain error information.\n */\nexport function isSystemError(err: unknown): err is NetworkSystemError {\n if (!isObjectWithProperties(err, [\"code\", \"syscall\", \"errno\"])) {\n return false;\n }\n\n if (!isString(err.code) || !isString(err.syscall)) {\n return false;\n }\n\n if (!isString(err.errno) && !isNumber(err.errno)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * @internal\n * Since browser doesn't differentiate between the various kinds of service communication errors,\n * this utility is used to look at the error target to identify such category of errors.\n * For more information refer to - https://html.spec.whatwg.org/multipage/comms.html#feedback-from-the-protocol\n * @param err - object that may contain error information\n */\nfunction isBrowserWebsocketError(err: any): boolean {\n let result: boolean = false;\n if (\n !isNodeLike &&\n self &&\n err.type === \"error\" &&\n err.target instanceof (self as any).WebSocket\n ) {\n result = true;\n }\n return result;\n}\n\n/**\n * @internal\n * Checks whether a object is an ErrorEvent or not. https://html.spec.whatwg.org/multipage/webappapis.html#errorevent\n * @param err - object that may contain error information\n */\nfunction isErrorEvent(err: any): err is { message: string; error: any } {\n return typeof err.error === \"object\" && typeof err.message === \"string\";\n}\n\n/**\n * @internal\n */\nconst rheaPromiseErrors = [\n // OperationTimeoutError occurs when the service fails to respond within a given timeframe.\n \"OperationTimeoutError\",\n\n // InsufficientCreditError occurs when the number of credits available on Rhea link is insufficient.\n \"InsufficientCreditError\",\n\n // Defines the error that occurs when the Sender fails to send a message.\n \"SendOperationFailedError\",\n];\n\n/**\n * Translates the AMQP error received at the protocol layer or a SystemError into a MessagingError.\n * All other errors are returned unaltered.\n *\n * @param err - The amqp error that was received.\n * @returns MessagingError object.\n */\nexport function translate(err: unknown): MessagingError | Error {\n if (!isDefined(err)) {\n return new Error(`Unknown error encountered.`);\n } else if (typeof err !== \"object\") {\n // The error is a scalar type, make it the message of an actual error.\n return new Error(String(err));\n }\n\n const errObj = isErrorEvent(err) ? err.error : err;\n\n // Built-in errors like TypeError and RangeError should not be retryable as these indicate issues\n // with user input and not an issue with the Messaging process.\n if (errObj instanceof TypeError || errObj instanceof RangeError) {\n return errObj;\n }\n\n if (isAmqpError(errObj)) {\n // translate\n const condition = errObj.condition;\n const description = errObj.description!;\n const error = new MessagingError(description);\n if ((errObj as any).stack) error.stack = (errObj as any).stack;\n error.info = errObj.info;\n if (condition) {\n error.code = ConditionErrorNameMapper[condition as keyof typeof ConditionErrorNameMapper];\n }\n if (\n description &&\n (description.includes(\"status-code: 404\") ||\n description.match(/The messaging entity .* could not be found.*/i) !== null)\n ) {\n error.code = \"MessagingEntityNotFoundError\";\n }\n if (error.code && retryableErrors.indexOf(error.code) === -1) {\n // not found\n error.retryable = false;\n }\n return error;\n }\n\n if (errObj instanceof Error && errObj.name === \"MessagingError\") {\n // already translated\n return errObj;\n }\n\n if (isSystemError(errObj)) {\n // translate\n const condition = errObj.code;\n const description = errObj.message;\n const error = new MessagingError(description, errObj);\n let errorType = \"SystemError\";\n if (condition) {\n const amqpErrorCondition =\n SystemErrorConditionMapper[condition as keyof typeof SystemErrorConditionMapper];\n errorType =\n ConditionErrorNameMapper[amqpErrorCondition as keyof typeof ConditionErrorNameMapper];\n }\n if (retryableErrors.indexOf(errorType) === -1) {\n // not found\n error.retryable = false;\n }\n return error;\n }\n\n if (isBrowserWebsocketError(errObj)) {\n // Translate browser communication errors during opening handshake to generic ServiceCommunicationError\n const error = new MessagingError(\"Websocket connection failed.\");\n error.code = ConditionErrorNameMapper[ErrorNameConditionMapper.ServiceCommunicationError];\n error.retryable = false;\n return error;\n }\n\n // Some errors come from rhea-promise and need to be converted to MessagingError.\n // A subset of these are also retryable.\n if (isError(errObj) && rheaPromiseErrors.indexOf(errObj.name) !== -1) {\n const error = new MessagingError(errObj.message, errObj);\n error.code = errObj.name;\n if (error.code && retryableErrors.indexOf(error.code) === -1) {\n // not found\n error.retryable = false;\n }\n return error;\n }\n\n return isError(errObj) ? errObj : new Error(String(errObj));\n}\n\n/**\n * @internal\n */\nfunction isAmqpError(error: any): error is AmqpError {\n return rheaIsAmqpError(error);\n}\n"]}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT
|
|
3
|
-
/// <reference lib="es2020" />
|
|
2
|
+
// Licensed under the MIT License.
|
|
4
3
|
export { RequestResponseLink } from "./requestResponseLink.js";
|
|
5
4
|
export { retry, RetryOperationType, RetryMode } from "./retry.js";
|
|
6
5
|
export { TokenType } from "./auth/token.js";
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,mBAAmB,EAAsB,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,KAAK,EAA6B,kBAAkB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAA2B,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,SAAS,EAAe,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EACL,qBAAqB,GAGtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,SAAS,EACT,eAAe,EACf,aAAa,EACb,0BAA0B,GAE3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,EACL,qBAAqB,EACrB,sBAAsB,GAGvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { RequestResponseLink, SendRequestOptions } from \"./requestResponseLink.js\";\nexport { retry, RetryOptions, RetryConfig, RetryOperationType, RetryMode } from \"./retry.js\";\nexport { TokenType } from \"./auth/token.js\";\nexport { ConnectionConfig, ConnectionConfigOptions } from \"./connectionConfig/connectionConfig.js\";\nexport { CbsClient, CbsResponse } from \"./cbs.js\";\nexport { Constants, StandardAbortMessage } from \"./util/constants.js\";\nexport { AmqpMessageHeader } from \"./messageHeader.js\";\nexport { AmqpMessageProperties } from \"./messageProperties.js\";\nexport {\n ConnectionContextBase,\n ConnectionProperties,\n CreateConnectionContextBaseParameters,\n} from \"./ConnectionContextBase.js\";\nexport {\n MessagingError,\n isMessagingError,\n ErrorNameConditionMapper,\n ConditionErrorNameMapper,\n translate,\n retryableErrors,\n isSystemError,\n SystemErrorConditionMapper,\n NetworkSystemError,\n} from \"./errors.js\";\nexport {\n delay,\n parseConnectionString,\n defaultCancellableLock,\n ParsedOutput,\n WebSocketOptions,\n} from \"./util/utils.js\";\nexport { AmqpAnnotatedMessage } from \"./amqpAnnotatedMessage.js\";\nexport { logger } from \"./log.js\";\nexport * from \"./internals.js\";\nexport { AcquireLockProperties, CancellableAsyncLock } from \"./util/lock.js\";\n"]}
|
package/dist/esm/internals.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
3
|
import { createSasTokenProvider } from "./auth/tokenProvider.js";
|
|
4
4
|
import { isSasTokenProvider } from "./util/typeGuards.js";
|
|
5
5
|
export { createSasTokenProvider, isSasTokenProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internals.js","sourceRoot":"","sources":["../../src/internals.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAoB,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAoB,sBAAsB,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT
|
|
1
|
+
{"version":3,"file":"internals.js","sourceRoot":"","sources":["../../src/internals.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAoB,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAoB,sBAAsB,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { SasTokenProvider, createSasTokenProvider } from \"./auth/tokenProvider.js\";\nimport { isSasTokenProvider } from \"./util/typeGuards.js\";\n\nexport { SasTokenProvider, createSasTokenProvider, isSasTokenProvider };\n"]}
|
package/dist/esm/log.js
CHANGED
package/dist/esm/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAEtD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,sBAAsB,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAEtD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,sBAAsB,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nimport { isObjectWithProperties } from \"@azure/core-util\";\n\n/**\n * The \\@azure/logger configuration for this package.\n * This will output logs using the `azure:event-hubs` namespace prefix.\n */\nexport const logger = createClientLogger(\"core-amqp\");\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(error: unknown): void {\n if (isObjectWithProperties(error, [\"stack\"])) {\n logger.verbose(error.stack);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageHeader.js","sourceRoot":"","sources":["../../src/messageHeader.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,2BAA2B;AAG3B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA+BlC;;GAEG;AACH,4GAA4G;AAC5G,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B;;;;;OAKG;IACH,mBAAmB,CAAC,KAAwB;QAC1C,MAAM,UAAU,GAAsB,EAAE,CAAC;QACzC,IAAI,KAAK,CAAC,aAAa,IAAI,SAAS,EAAE,CAAC;YACrC,UAAU,CAAC,cAAc,GAAG,KAAK,CAAC,aAAa,CAAC;QAClD,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,IAAI,SAAS;YAAE,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QACnE,IAAI,KAAK,CAAC,aAAa,IAAI,SAAS,EAAE,CAAC;YACrC,UAAU,CAAC,cAAc,GAAG,KAAK,CAAC,aAAa,CAAC;QAClD,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,IAAI,SAAS,EAAE,CAAC;YAChC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QACvC,CAAC;QACD,IAAI,KAAK,CAAC,UAAU,IAAI,SAAS,EAAE,CAAC;YAClC,UAAU,CAAC,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC;QACpC,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,0BAA0B,EAAE,UAAU,CAAC,CAAC;QACvD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,qBAAqB,CAAC,KAAwB;QAC5C,MAAM,SAAS,GAAsB,EAAE,CAAC;QACxC,IAAI,KAAK,CAAC,cAAc,IAAI,SAAS,EAAE,CAAC;YACtC,SAAS,CAAC,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC;QACjD,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YAC/B,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QACpC,CAAC;QACD,IAAI,KAAK,CAAC,cAAc,IAAI,SAAS,EAAE,CAAC;YACtC,SAAS,CAAC,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC;QACjD,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,IAAI,SAAS,EAAE,CAAC;YAChC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QACtC,CAAC;QACD,IAAI,KAAK,CAAC,GAAG,IAAI,SAAS,EAAE,CAAC;YAC3B,SAAS,CAAC,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC;QACnC,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;QACxD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT
|
|
1
|
+
{"version":3,"file":"messageHeader.js","sourceRoot":"","sources":["../../src/messageHeader.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,2BAA2B;AAG3B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA+BlC;;GAEG;AACH,4GAA4G;AAC5G,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B;;;;;OAKG;IACH,mBAAmB,CAAC,KAAwB;QAC1C,MAAM,UAAU,GAAsB,EAAE,CAAC;QACzC,IAAI,KAAK,CAAC,aAAa,IAA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,IAAI,SAAS,EAAE,CAAC;YAC3B,SAAS,CAAC,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC;QACnC,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;QACxD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* eslint-disable eqeqeq */\n\nimport type { MessageHeader as RheaMessageHeader } from \"rhea-promise\";\nimport { logger } from \"./log.js\";\n\n/**\n * Describes the defined set of standard header properties of the message.\n */\nexport interface AmqpMessageHeader {\n /**\n * If this value is true, then this message has not been\n * acquired by any other link. If this value is false, then this message MAY have previously\n * been acquired by another link or links.\n */\n firstAcquirer?: boolean;\n /**\n * The number of prior unsuccessful delivery attempts.\n */\n deliveryCount?: number;\n /**\n * time to live in ms.\n */\n timeToLive?: number;\n /**\n * Specifies durability requirements.\n */\n durable?: boolean;\n /**\n * The relative message priority. Higher numbers indicate higher\n * priority messages.\n */\n priority?: number;\n}\n\n/**\n * Describes the operations that can be performed on the message header.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- renaming constant would be a breaking change.\nexport const AmqpMessageHeader = {\n /**\n * Converts MessageHeader to RheaMessageHeader.\n *\n * @param props - Message header.\n * @returns RheaMessageHeader\n */\n toRheaMessageHeader(props: AmqpMessageHeader): RheaMessageHeader {\n const amqpHeader: RheaMessageHeader = {};\n if (props.deliveryCount != undefined) {\n amqpHeader.delivery_count = props.deliveryCount;\n }\n if (props.durable != undefined) amqpHeader.durable = props.durable;\n if (props.firstAcquirer != undefined) {\n amqpHeader.first_acquirer = props.firstAcquirer;\n }\n if (props.priority != undefined) {\n amqpHeader.priority = props.priority;\n }\n if (props.timeToLive != undefined) {\n amqpHeader.ttl = props.timeToLive;\n }\n logger.verbose(\"To RheaMessageHeader: %O\", amqpHeader);\n return amqpHeader;\n },\n\n /**\n * Converts RheaMessageHeader to MessageHeader.\n *\n * @param props - Amqp Message Header\n * @returns MessageHeader.\n */\n fromRheaMessageHeader(props: RheaMessageHeader): AmqpMessageHeader {\n const msgHeader: AmqpMessageHeader = {};\n if (props.delivery_count != undefined) {\n msgHeader.deliveryCount = props.delivery_count;\n }\n if (props.durable != undefined) {\n msgHeader.durable = props.durable;\n }\n if (props.first_acquirer != undefined) {\n msgHeader.firstAcquirer = props.first_acquirer;\n }\n if (props.priority != undefined) {\n msgHeader.priority = props.priority;\n }\n if (props.ttl != undefined) {\n msgHeader.timeToLive = props.ttl;\n }\n logger.verbose(\"From RheaMessageHeader: %O\", msgHeader);\n return msgHeader;\n },\n};\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { MessageProperties as RheaMessageProperties } from "rhea-promise";
|
|
1
|
+
import type { MessageProperties as RheaMessageProperties } from "rhea-promise";
|
|
3
2
|
/**
|
|
4
3
|
* Describes the defined set of standard properties of the message.
|
|
5
4
|
*/
|