@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/commonjs/index.d.ts
CHANGED
package/dist/commonjs/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.logger = exports.AmqpAnnotatedMessage = exports.defaultCancellableLock = exports.parseConnectionString = exports.delay = exports.SystemErrorConditionMapper = exports.isSystemError = exports.retryableErrors = exports.translate = exports.ConditionErrorNameMapper = exports.ErrorNameConditionMapper = exports.isMessagingError = exports.MessagingError = exports.ConnectionContextBase = exports.AmqpMessageProperties = exports.AmqpMessageHeader = exports.StandardAbortMessage = exports.Constants = exports.CbsClient = exports.ConnectionConfig = exports.TokenType = exports.RetryMode = exports.RetryOperationType = exports.retry = exports.RequestResponseLink = void 0;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
|
-
/// <reference lib="es2020" />
|
|
8
7
|
var requestResponseLink_js_1 = require("./requestResponseLink.js");
|
|
9
8
|
Object.defineProperty(exports, "RequestResponseLink", { enumerable: true, get: function () { return requestResponseLink_js_1.RequestResponseLink; } });
|
|
10
9
|
var retry_js_1 = require("./retry.js");
|
|
@@ -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,mEAAmF;AAA1E,6HAAA,mBAAmB,OAAA;AAC5B,uCAA6F;AAApF,iGAAA,KAAK,OAAA;AAA6B,8GAAA,kBAAkB,OAAA;AAAE,qGAAA,SAAS,OAAA;AACxE,4CAA4C;AAAnC,qGAAA,SAAS,OAAA;AAClB,8EAAmG;AAA1F,uHAAA,gBAAgB,OAAA;AACzB,mCAAkD;AAAzC,mGAAA,SAAS,OAAA;AAClB,oDAAsE;AAA7D,yGAAA,SAAS,OAAA;AAAE,oHAAA,oBAAoB,OAAA;AACxC,uDAAuD;AAA9C,qHAAA,iBAAiB,OAAA;AAC1B,+DAA+D;AAAtD,6HAAA,qBAAqB,OAAA;AAC9B,uEAIoC;AAHlC,iIAAA,qBAAqB,OAAA;AAIvB,yCAUqB;AATnB,2GAAA,cAAc,OAAA;AACd,6GAAA,gBAAgB,OAAA;AAChB,qHAAA,wBAAwB,OAAA;AACxB,qHAAA,wBAAwB,OAAA;AACxB,sGAAA,SAAS,OAAA;AACT,4GAAA,eAAe,OAAA;AACf,0GAAA,aAAa,OAAA;AACb,uHAAA,0BAA0B,OAAA;AAG5B,4CAMyB;AALvB,iGAAA,KAAK,OAAA;AACL,iHAAA,qBAAqB,OAAA;AACrB,kHAAA,sBAAsB,OAAA;AAIxB,qEAAiE;AAAxD,+HAAA,oBAAoB,OAAA;AAC7B,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,yDAA+B","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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.isSasTokenProvider = exports.createSasTokenProvider = void 0;
|
|
6
6
|
const tokenProvider_js_1 = require("./auth/tokenProvider.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internals.js","sourceRoot":"","sources":["../../src/internals.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,8DAAmF;AAGxD,uGAHA,yCAAsB,OAGA;AAFjD,wDAA0D;AAEP,mGAF1C,kCAAkB,OAE0C","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,8DAAmF;AAGxD,uGAHA,yCAAsB,OAGA;AAFjD,wDAA0D;AAEP,mGAF1C,kCAAkB,OAE0C","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/commonjs/log.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.logger = void 0;
|
|
6
|
+
exports.logErrorStackTrace = logErrorStackTrace;
|
|
6
7
|
const logger_1 = require("@azure/logger");
|
|
7
8
|
const core_util_1 = require("@azure/core-util");
|
|
8
9
|
/**
|
|
@@ -20,5 +21,4 @@ function logErrorStackTrace(error) {
|
|
|
20
21
|
exports.logger.verbose(error.stack);
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
|
-
exports.logErrorStackTrace = logErrorStackTrace;
|
|
24
24
|
//# sourceMappingURL=log.js.map
|
package/dist/commonjs/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAgBlC,gDAIC;AAlBD,0CAAmD;AACnD,gDAA0D;AAE1D;;;GAGG;AACU,QAAA,MAAM,GAAG,IAAA,2BAAkB,EAAC,WAAW,CAAC,CAAC;AAEtD;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,KAAc;IAC/C,IAAI,IAAA,kCAAsB,EAAC,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QAC7C,cAAM,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,qCAAkC;AA+BlC;;GAEG;AACH,4GAA4G;AAC/F,QAAA,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,eAAM,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,eAAM,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,qCAAkC;AA+BlC;;GAEG;AACH,4GAA4G;AAC/F,QAAA,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,CAA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cesContent":["// 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageProperties.js","sourceRoot":"","sources":["../../src/messageProperties.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAClC,2BAA2B;;;AAG3B,qCAAkC;AA+DlC;;GAEG;AACH,4GAA4G;AAC/F,QAAA,qBAAqB,GAAG;IACnC;;;;OAIG;IACH,uBAAuB,CAAC,KAA4B;QAClD,MAAM,cAAc,GAA0B,EAAE,CAAC;QACjD,IAAI,KAAK,CAAC,kBAAkB,IAAI,SAAS,EAAE,CAAC;YAC1C,cAAc,CAAC,oBAAoB,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAC3E,CAAC;QACD,IAAI,KAAK,CAAC,eAAe,IAAI,SAAS,EAAE,CAAC;YACvC,cAAc,CAAC,gBAAgB,GAAG,KAAK,CAAC,eAAe,CAAC;QAC1D,CAAC;QACD,IAAI,KAAK,CAAC,WAAW,IAAI,SAAS,EAAE,CAAC;YACnC,cAAc,CAAC,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC;QAClD,CAAC;QACD,IAAI,KAAK,CAAC,aAAa,IAAI,SAAS,EAAE,CAAC;YACrC,cAAc,CAAC,cAAc,GAAG,KAAK,CAAC,aAAa,CAAC;QACtD,CAAC;QACD,IAAI,KAAK,CAAC,YAAY,IAAI,SAAS,EAAE,CAAC;YACpC,cAAc,CAAC,aAAa,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC9D,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YAC/B,cAAc,CAAC,QA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C,EAAE,CAAC;QAC9B,CAAC;QACD,oCAAoC;QACpC,0CAA0C;QAC1C,IAAI;QAEJ,eAAM,CAAC,OAAO,CAAC,gCAAgC,EAAE,aAAa,CAAC,CAAC;QAChE,OAAO,aAAa,CAAC;IACvB,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT
|
|
1
|
+
{"version":3,"file":"messageProperties.js","sourceRoot":"","sources":["../../src/messageProperties.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAClC,2BAA2B;;;AAG3B,qCAAkC;AA+DlC;;GAEG;AACH,4GAA4G;AAC/F,QAAA,qBAAqB,GAAG;IACnC;;;;OAIG;IACH,uBAAuB,CAAC,KAA4B;QAClD,MAAM,cAAc,GAA0B,EAAE,CAAC;QACjD,IAAI,KAAK,CAAC,kBAAkB,IAAI,SAAS,EAAE,CAAC;YAC1C,cAAc,CAAC,oBAAoB,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAC3E,CAAC;QACD,IAAI,KAAK,CAAC,eAAe,IAAI,SAAS,EAAE,CAAC;YACvC,cAAc,CAAC,gBAAgB,GAAG,KAAK,CAAC,eAAe,CAAC;QAC1D,CAAC;QACD,IAAI,KAAK,CAAC,WAAW,IAAI,SAAS,EAAE,CAAC;YACnC,cAAc,CAAC,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC;QAClD,CAAC;QACD,IAAI,KAAK,CAAC,aAAa,IAAI,SAAS,EAAE,CAAC;YACrC,cAAc,CAAC,cAAc,GAAG,KAAK,CAAC,aAAa,CAAC;QACtD,CAAC;QACD,IAAI,KAAK,CAAC,YAAY,IAAI,SAAS,EAAE,CAAC;YACpC,cAAc,CAAC,aAAa,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC9D,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YAC/B,cAAc,CAA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,CAAC,EAAE,CAAC;QAC9B,CAAC;QACD,oCAAoC;QACpC,0CAA0C;QAC1C,IAAI;QAEJ,eAAM,CAAC,OAAO,CAAC,gCAAgC,EAAE,aAAa,CAAC,CAAC;QAChE,OAAO,aAAa,CAAC;IACvB,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* eslint-disable eqeqeq */\n\nimport type { MessageProperties as RheaMessageProperties } from \"rhea-promise\";\nimport { logger } from \"./log.js\";\n\n/**\n * Describes the defined set of standard properties of the message.\n */\nexport interface AmqpMessageProperties {\n /**\n * The application message identifier that uniquely identifies a message.\n * The user is responsible for making sure that this is unique in the given context. Guids usually make a good fit.\n */\n messageId?: string | number | Buffer;\n /**\n * The address of the node to send replies to.\n */\n replyTo?: string;\n /**\n * The address of the node the message is destined for.\n */\n to?: string;\n /**\n * The id that can be used to mark or identify messages between clients.\n */\n correlationId?: string | number | Buffer;\n /**\n * MIME type for the message.\n */\n contentType?: string;\n /**\n * The content-encoding property is used as a modifier to the content-type.\n * When present, its value indicates what additional content encodings have been applied to the application-data.\n */\n contentEncoding?: string;\n /**\n * The time when this message is considered expired.\n */\n absoluteExpiryTime?: number;\n /**\n * The time this message was created.\n */\n creationTime?: number;\n /**\n * The group this message belongs to.\n */\n groupId?: string;\n /**\n * The sequence number of this message with its group.\n */\n groupSequence?: number;\n /**\n * The group the reply message belongs to.\n */\n replyToGroupId?: string;\n /**\n * A common field for summary information about the message\n * content and purpose.\n */\n subject?: string;\n // /**\n // * The identity of the user responsible for producing the message.\n // */\n // userId?: string;\n}\n\n/**\n * Describes the operations that can be performed on the amqp message properties.\n */\n// eslint-disable-next-line @typescript-eslint/no-redeclare -- renaming constant would be a breaking change.\nexport const AmqpMessageProperties = {\n /**\n * Converts MessageProperties to RheaMessageProperties.\n * @param props - Message properties.\n * @returns RheaMessageProperties.\n */\n toRheaMessageProperties(props: AmqpMessageProperties): RheaMessageProperties {\n const amqpProperties: RheaMessageProperties = {};\n if (props.absoluteExpiryTime != undefined) {\n amqpProperties.absolute_expiry_time = new Date(props.absoluteExpiryTime);\n }\n if (props.contentEncoding != undefined) {\n amqpProperties.content_encoding = props.contentEncoding;\n }\n if (props.contentType != undefined) {\n amqpProperties.content_type = props.contentType;\n }\n if (props.correlationId != undefined) {\n amqpProperties.correlation_id = props.correlationId;\n }\n if (props.creationTime != undefined) {\n amqpProperties.creation_time = new Date(props.creationTime);\n }\n if (props.groupId != undefined) {\n amqpProperties.group_id = props.groupId;\n }\n if (props.groupSequence != undefined) {\n amqpProperties.group_sequence = props.groupSequence;\n }\n if (props.messageId != undefined) {\n amqpProperties.message_id = props.messageId;\n }\n if (props.replyTo != undefined) {\n amqpProperties.reply_to = props.replyTo;\n }\n if (props.replyToGroupId != undefined) {\n amqpProperties.reply_to_group_id = props.replyToGroupId;\n }\n if (props.subject != undefined) {\n amqpProperties.subject = props.subject;\n }\n if (props.to != undefined) {\n amqpProperties.to = props.to;\n }\n // if (props.userId != undefined) {\n // amqpProperties.user_id = props.userId;\n // }\n\n logger.verbose(\"To RheaMessageProperties: %O\", amqpProperties);\n return amqpProperties;\n },\n\n /**\n * Converts RheaMessageProperties to MessageProperties.\n * @param props - Amqp message properties.\n * @returns MessageProperties.\n */\n fromRheaMessageProperties(props: RheaMessageProperties): AmqpMessageProperties {\n const msgProperties: AmqpMessageProperties = {};\n if (props.absolute_expiry_time != undefined) {\n msgProperties.absoluteExpiryTime = props.absolute_expiry_time.getTime();\n }\n if (props.content_encoding != undefined) {\n msgProperties.contentEncoding = props.content_encoding;\n }\n if (props.content_type != undefined) {\n msgProperties.contentType = props.content_type;\n }\n if (props.correlation_id != undefined) {\n msgProperties.correlationId = props.correlation_id;\n }\n if (props.creation_time != undefined) {\n msgProperties.creationTime = props.creation_time.getTime();\n }\n if (props.group_id != undefined) {\n msgProperties.groupId = props.group_id;\n }\n if (props.group_sequence != undefined) {\n msgProperties.groupSequence = props.group_sequence;\n }\n if (props.message_id != undefined) {\n msgProperties.messageId = props.message_id;\n }\n if (props.reply_to != undefined) {\n msgProperties.replyTo = props.reply_to;\n }\n if (props.reply_to_group_id != undefined) {\n msgProperties.replyToGroupId = props.reply_to_group_id;\n }\n if (props.subject != undefined) {\n msgProperties.subject = props.subject;\n }\n if (props.to != undefined) {\n msgProperties.to = props.to;\n }\n // if (props.user_id != undefined) {\n // msgProperties.userId = props.user_id;\n // }\n\n logger.verbose(\"From RheaMessageProperties: %O\", msgProperties);\n return msgProperties;\n },\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AbortSignalLike } from "@azure/abort-controller";
|
|
2
|
-
import { Connection, EventContext, Receiver, ReceiverOptions, ReqResLink, Message as RheaMessage, Sender, SenderOptions, Session } from "rhea-promise";
|
|
1
|
+
import type { AbortSignalLike } from "@azure/abort-controller";
|
|
2
|
+
import type { Connection, EventContext, Receiver, ReceiverOptions, ReqResLink, Message as RheaMessage, Sender, SenderOptions, Session } from "rhea-promise";
|
|
3
3
|
/**
|
|
4
4
|
* Describes the options that can be specified while sending a request.
|
|
5
5
|
*/
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.getCodeDescriptionAndError = exports.RequestResponseLink = void 0;
|
|
6
|
+
exports.onMessageReceived = onMessageReceived;
|
|
6
7
|
const abort_controller_1 = require("@azure/abort-controller");
|
|
7
8
|
const errors_js_1 = require("./errors.js");
|
|
8
9
|
const rhea_promise_1 = require("rhea-promise");
|
|
@@ -123,7 +124,7 @@ class RequestResponseLink {
|
|
|
123
124
|
}
|
|
124
125
|
},
|
|
125
126
|
});
|
|
126
|
-
log_js_1.logger.verbose("[%s] %s request sent: %O", this.connection.id, request.to || "$management"
|
|
127
|
+
log_js_1.logger.verbose("[%s] %s request sent: %O", this.connection.id, request.to || "$management");
|
|
127
128
|
this.sender.send(request);
|
|
128
129
|
});
|
|
129
130
|
}
|
|
@@ -232,7 +233,6 @@ function onMessageReceived(context, connectionId, responsesMap) {
|
|
|
232
233
|
(0, log_js_1.logErrorStackTrace)(error);
|
|
233
234
|
return promise.reject(error);
|
|
234
235
|
}
|
|
235
|
-
exports.onMessageReceived = onMessageReceived;
|
|
236
236
|
function onSenderError(context, connectionId, responsesMap) {
|
|
237
237
|
if (context.sender) {
|
|
238
238
|
for (const [key, promise] of responsesMap.entries()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestResponseLink.js","sourceRoot":"","sources":["../../src/requestResponseLink.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,8DAAsE;AACtE,2CAA+D;AAC/D,+CAasB;AACtB,sDAAsE;AACtE,qCAAsD;AACtD,gDAA6C;AAiC7C;;GAEG;AACH,MAAa,mBAAmB;IAC9B;;;;OAIG;IACH,YACS,OAAgB,EAChB,MAAc,EACd,QAAkB;QAFlB,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAU;QAa3B;;;;WAIG;QACK,kBAAa,GAA6C,IAAI,GAAG,EAGtE,CAAC;QAnBF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,6BAAc,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE;YACnD,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,2BA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ACH,eAAM,CAAC,OAAO,CAAC,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,KAAK,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,IAAA,2BAAkB,EAAC,KAAK,CAAC,CAAC;IAC1B,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AA1DD,8CA0DC;AAED,SAAS,aAAa,CACpB,OAAqC,EACrC,YAAoB,EACpB,YAAsD;IAEtD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC;YACpD,eAAM,CAAC,OAAO,CACZ,IAAI,YAAY,sEAAsE,GAAG,GAAG,CAC7F,CAAC;YACF,OAAO,CAAC,4BAA4B,EAAE,CAAC;YACvC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;QACD,YAAY,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AbortError, AbortSignalLike } from \"@azure/abort-controller\";\nimport { ConditionStatusMapper, translate } from \"./errors.js\";\nimport {\n Connection,\n EventContext,\n Receiver,\n ReceiverEvents,\n ReceiverOptions,\n ReqResLink,\n Message as RheaMessage,\n Sender,\n SenderEvents,\n SenderOptions,\n Session,\n generate_uuid,\n} from \"rhea-promise\";\nimport { Constants, StandardAbortMessage } from \"./util/constants.js\";\nimport { logErrorStackTrace, logger } from \"./log.js\";\nimport { isDefined } from \"@azure/core-util\";\n\n/**\n * Describes the options that can be specified while sending a request.\n */\nexport interface SendRequestOptions {\n /**\n * Cancels the operation.\n */\n abortSignal?: AbortSignalLike;\n /**\n * Max time to wait for the operation to complete.\n * Default: `60000 milliseconds`.\n */\n timeoutInMs?: number;\n /**\n * Name of the request being performed.\n */\n requestName?: string;\n}\n\n/**\n * @internal\n */\nexport interface DeferredPromiseWithCallback {\n resolve: (value?: any) => void;\n reject: (reason?: any) => void;\n /**\n * To be called before resolving or rejecting the deferred promise\n */\n cleanupBeforeResolveOrReject: () => void;\n}\n\n/**\n * Describes an amqp request(sender)-response(receiver) link that is created over an amqp session.\n */\nexport class RequestResponseLink implements ReqResLink {\n /**\n * @param session - The amqp session.\n * @param sender - The amqp sender link.\n * @param receiver - The amqp receiver link.\n */\n constructor(\n public session: Session,\n public sender: Sender,\n public receiver: Receiver,\n ) {\n this.session = session;\n this.sender = sender;\n this.receiver = receiver;\n this.receiver.on(ReceiverEvents.message, (context) => {\n onMessageReceived(context, this.connection.id, this._responsesMap);\n });\n this.sender.on(SenderEvents.senderError, (context) => {\n onSenderError(context, this.connection.id, this._responsesMap);\n });\n }\n\n /**\n * Maintains a map of responses that\n * are being actively returned. It acts as a store for correlating the responses received for\n * the send requests.\n */\n private _responsesMap: Map<string, DeferredPromiseWithCallback> = new Map<\n string,\n DeferredPromiseWithCallback\n >();\n\n /**\n * Provides the underlying amqp connection object.\n * @returns Connection.\n */\n get connection(): Connection {\n return this.session.connection;\n }\n\n /**\n * Indicates whether the session and the sender and receiver links are all open or closed.\n * @returns boolean - `true` - `open`, `false` - `closed`.\n */\n isOpen(): boolean {\n return this.session.isOpen() && this.sender.isOpen() && this.receiver.isOpen();\n }\n\n /**\n * Sends the given request message and returns the received response. If the operation is not\n * completed in the provided timeout in milliseconds `default: 60000`, then `OperationTimeoutError` is thrown.\n *\n * @param request - The AMQP (request) message.\n * @param options - Options that can be provided while sending a request.\n * @returns Promise<Message> The AMQP (response) message.\n */\n sendRequest(request: RheaMessage, options: SendRequestOptions = {}): Promise<RheaMessage> {\n const timeoutInMs = options.timeoutInMs || Constants.defaultOperationTimeoutInMs;\n\n const aborter: AbortSignalLike | undefined = options.abortSignal;\n\n // If message_id is not already set on the request, set it to a unique value\n // This helps in determining the right response for current request among multiple incoming messages\n if (!request.message_id) {\n request.message_id = generate_uuid();\n }\n\n return new Promise<RheaMessage>((resolve: any, reject: any) => {\n let timer: ReturnType<typeof setTimeout> | undefined = undefined;\n\n const rejectOnAbort = (): void => {\n this._responsesMap.delete(request.message_id as string);\n const address = this.receiver.address || \"address\";\n const requestName = options.requestName;\n const desc: string =\n `[${this.connection.id}] The request \"${requestName}\" ` +\n `to \"${address}\" has been cancelled by the user.`;\n // Cancellation is a user-intended action, so log to info instead of warning.\n logger.info(desc);\n const error = new AbortError(StandardAbortMessage);\n\n reject(error);\n };\n\n const onAbort = (): void => {\n // safe to clear the timeout if it hasn't already occurred.\n if (isDefined(timer)) {\n clearTimeout(timer);\n }\n aborter!.removeEventListener(\"abort\", onAbort);\n\n rejectOnAbort();\n };\n\n if (aborter) {\n // the aborter may have been triggered between request attempts\n // so check if it was triggered and reject if needed.\n if (aborter.aborted) {\n return rejectOnAbort();\n }\n aborter.addEventListener(\"abort\", onAbort);\n }\n\n timer = setTimeout(() => {\n this._responsesMap.delete(request.message_id as string);\n if (aborter) {\n aborter.removeEventListener(\"abort\", onAbort);\n }\n const address = this.receiver?.address || \"address\";\n const desc: string =\n `The request with message_id \"${request.message_id}\" to \"${address}\" ` +\n `endpoint timed out. Please try again later.`;\n const e: Error = {\n name: \"OperationTimeoutError\",\n message: desc,\n };\n return reject(translate(e));\n }, timeoutInMs);\n\n this._responsesMap.set(request.message_id as string, {\n resolve: resolve,\n reject: reject,\n cleanupBeforeResolveOrReject: () => {\n if (aborter) aborter.removeEventListener(\"abort\", onAbort);\n if (isDefined(timer)) {\n clearTimeout(timer);\n }\n },\n });\n\n logger.verbose(\n \"[%s] %s request sent: %O\",\n this.connection.id,\n request.to || \"$management\",\n request,\n );\n this.sender.send(request);\n });\n }\n\n /**\n * Closes the sender, receiver link and the underlying session.\n * @returns Promise<void>\n */\n async close(): Promise<void> {\n await this.sender.close({ closeSession: false });\n await this.receiver.close({ closeSession: false });\n await this.session.close();\n }\n\n /**\n * Removes the sender, receiver link and it's underlying session.\n * @returns void\n */\n remove(): void {\n this.sender.remove();\n this.receiver.remove();\n this.session.remove();\n }\n\n /**\n * Creates an amqp request/response link.\n *\n * @param connection - The amqp connection.\n * @param senderOptions - Options that must be provided to create the sender link.\n * @param receiverOptions - Options that must be provided to create the receiver link.\n * @param createOptions - 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 `create` invocation.\n * @returns Promise<RequestResponseLink>\n */\n static async create(\n connection: Connection,\n senderOptions: SenderOptions,\n receiverOptions: ReceiverOptions,\n createOptions: { abortSignal?: AbortSignalLike } = {},\n ): Promise<RequestResponseLink> {\n const { abortSignal } = createOptions;\n const session = await connection.createSession({ abortSignal });\n const sender = await session.createSender({ ...senderOptions, abortSignal });\n const receiver = await session.createReceiver({ ...receiverOptions, abortSignal });\n logger.verbose(\n \"[%s] Successfully created the sender and receiver links on the same session.\",\n connection.id,\n );\n return new RequestResponseLink(session, sender, receiver);\n }\n}\n/**\n * @internal\n *\n * Type used in getCodeDescriptionAndError to get the normalized info from the responses emitted by EventHubs and ServiceBus.\n */\ntype NormalizedInfo = {\n statusCode: number;\n statusDescription: string;\n errorCondition: string;\n};\n\n/**\n * @internal\n *\n * Handle different variations of property names in responses emitted by EventHubs and ServiceBus.\n */\nexport const getCodeDescriptionAndError = (\n props: { [key: string]: string | number | undefined } = {},\n): NormalizedInfo => {\n return {\n statusCode: (props[Constants.statusCode] || props.statusCode) as number,\n statusDescription: (props[Constants.statusDescription] || props.statusDescription) as string,\n errorCondition: (props[Constants.errorCondition] || props.errorCondition) as string,\n };\n};\n\n/**\n * This is used as the onMessage handler for the \"message\" event on the receiver.\n *\n * (This is inspired from the message settlement sequence in service-bus SDK which\n * relies on a single listener for settled event for all the messages.)\n * The sequence is as follows:\n * 1. User calls `await RequestResponseLink.sendRequest()`\n * 2. This creates a `Promise` that gets stored in the _responsesMap\n * 3. When the service acknowledges the response, this method gets called for that request.\n * 4. We resolve() the promise from the _responsesMap with the message.\n * 5. User's code after the sendRequest continues.\n *\n * @internal\n */\nexport function onMessageReceived(\n context: Pick<EventContext, \"message\">,\n connectionId: string,\n responsesMap: Map<string, DeferredPromiseWithCallback>,\n): void {\n const message = context.message;\n if (!message) {\n logger.verbose(\n `[${connectionId}] \"message\" property on the EventContext is \"undefined\" which is unexpected, ` +\n `returning from the \"onMessageReceived\" handler without resolving or rejecting the promise ` +\n `upon encountering the message event.`,\n );\n return;\n }\n\n const responseCorrelationId = message.correlation_id;\n if (!responsesMap.has(responseCorrelationId as string)) {\n logger.verbose(\n `[${connectionId}] correlationId \"${responseCorrelationId}\" property on the response does not match with ` +\n `any of the \"request-id\"s in the map, returning from the \"onMessageReceived\" handler without resolving ` +\n `or rejecting the promise upon encountering the message event.`,\n );\n return;\n }\n\n const promise = responsesMap.get(responseCorrelationId as string) as DeferredPromiseWithCallback;\n promise.cleanupBeforeResolveOrReject();\n\n const deleteResult = responsesMap.delete(responseCorrelationId as string);\n logger.verbose(\n `[${connectionId}] Successfully deleted the response with id ${responseCorrelationId} from the map. ` +\n `Delete result - ${deleteResult}`,\n );\n\n const info = getCodeDescriptionAndError(message.application_properties);\n let error;\n if (!info.statusCode) {\n error = new Error(\n `[${connectionId}] No statusCode in the \"application_properties\" in the returned response with correlation-id: ${responseCorrelationId}`,\n );\n }\n if (info.statusCode > 199 && info.statusCode < 300) {\n logger.verbose(\n `[${connectionId}] Resolving the response with correlation-id: ${responseCorrelationId}`,\n );\n return promise.resolve(message);\n }\n if (!error) {\n const condition =\n info.errorCondition || ConditionStatusMapper[info.statusCode] || \"amqp:internal-error\";\n error = translate({\n condition: condition,\n description: info.statusDescription,\n });\n logger.warning(`${error?.name}: ${error?.message}`);\n }\n logErrorStackTrace(error);\n return promise.reject(error);\n}\n\nfunction onSenderError(\n context: Pick<EventContext, \"sender\">,\n connectionId: string,\n responsesMap: Map<string, DeferredPromiseWithCallback>,\n): void {\n if (context.sender) {\n for (const [key, promise] of responsesMap.entries()) {\n logger.verbose(\n `[${connectionId}] Sender closed due to error when sending request with message_id \"${key}\"`,\n );\n promise.cleanupBeforeResolveOrReject();\n promise.reject(context.sender.error);\n }\n responsesMap.clear();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"requestResponseLink.js","sourceRoot":"","sources":["../../src/requestResponseLink.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAqRlC,8CA0DC;AA5UD,8DAAqD;AACrD,2CAA+D;AAY/D,+CAA2E;AAC3E,sDAAsE;AACtE,qCAAsD;AACtD,gDAA6C;AAiC7C;;GAEG;AACH,MAAa,mBAAmB;IAC9B;;;;OAIG;IACH,YACS,OAAgB,EAChB,MAAc,EACd,QAAkB;QAFlB,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAU;QAa3B;;;;WAIG;QACK,kBAAa,GAA6C,IAAI,GAAG,EAGtE,CAAC;QAnBF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,6BAAc,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE;YACnD,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,2BAAY,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE;YACnD,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACL,CAAC;IAYD;;;OAGG;IACH,IAAI,UA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O,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,aAAa,CACpB,OAAqC,EACrC,YAAoB,EACpB,YAAsD;IAEtD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC;YACpD,eAAM,CAAC,OAAO,CACZ,IAAI,YAAY,sEAAsE,GAAG,GAAG,CAC7F,CAAC;YACF,OAAO,CAAC,4BAA4B,EAAE,CAAC;YACvC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;QACD,YAAY,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;AACH,CAAC","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 { ConditionStatusMapper, translate } from \"./errors.js\";\nimport type {\n Connection,\n EventContext,\n Receiver,\n ReceiverOptions,\n ReqResLink,\n Message as RheaMessage,\n Sender,\n SenderOptions,\n Session,\n} from \"rhea-promise\";\nimport { ReceiverEvents, SenderEvents, generate_uuid } from \"rhea-promise\";\nimport { Constants, StandardAbortMessage } from \"./util/constants.js\";\nimport { logErrorStackTrace, logger } from \"./log.js\";\nimport { isDefined } from \"@azure/core-util\";\n\n/**\n * Describes the options that can be specified while sending a request.\n */\nexport interface SendRequestOptions {\n /**\n * Cancels the operation.\n */\n abortSignal?: AbortSignalLike;\n /**\n * Max time to wait for the operation to complete.\n * Default: `60000 milliseconds`.\n */\n timeoutInMs?: number;\n /**\n * Name of the request being performed.\n */\n requestName?: string;\n}\n\n/**\n * @internal\n */\nexport interface DeferredPromiseWithCallback {\n resolve: (value?: any) => void;\n reject: (reason?: any) => void;\n /**\n * To be called before resolving or rejecting the deferred promise\n */\n cleanupBeforeResolveOrReject: () => void;\n}\n\n/**\n * Describes an amqp request(sender)-response(receiver) link that is created over an amqp session.\n */\nexport class RequestResponseLink implements ReqResLink {\n /**\n * @param session - The amqp session.\n * @param sender - The amqp sender link.\n * @param receiver - The amqp receiver link.\n */\n constructor(\n public session: Session,\n public sender: Sender,\n public receiver: Receiver,\n ) {\n this.session = session;\n this.sender = sender;\n this.receiver = receiver;\n this.receiver.on(ReceiverEvents.message, (context) => {\n onMessageReceived(context, this.connection.id, this._responsesMap);\n });\n this.sender.on(SenderEvents.senderError, (context) => {\n onSenderError(context, this.connection.id, this._responsesMap);\n });\n }\n\n /**\n * Maintains a map of responses that\n * are being actively returned. It acts as a store for correlating the responses received for\n * the send requests.\n */\n private _responsesMap: Map<string, DeferredPromiseWithCallback> = new Map<\n string,\n DeferredPromiseWithCallback\n >();\n\n /**\n * Provides the underlying amqp connection object.\n * @returns Connection.\n */\n get connection(): Connection {\n return this.session.connection;\n }\n\n /**\n * Indicates whether the session and the sender and receiver links are all open or closed.\n * @returns boolean - `true` - `open`, `false` - `closed`.\n */\n isOpen(): boolean {\n return this.session.isOpen() && this.sender.isOpen() && this.receiver.isOpen();\n }\n\n /**\n * Sends the given request message and returns the received response. If the operation is not\n * completed in the provided timeout in milliseconds `default: 60000`, then `OperationTimeoutError` is thrown.\n *\n * @param request - The AMQP (request) message.\n * @param options - Options that can be provided while sending a request.\n * @returns Promise<Message> The AMQP (response) message.\n */\n sendRequest(request: RheaMessage, options: SendRequestOptions = {}): Promise<RheaMessage> {\n const timeoutInMs = options.timeoutInMs || Constants.defaultOperationTimeoutInMs;\n\n const aborter: AbortSignalLike | undefined = options.abortSignal;\n\n // If message_id is not already set on the request, set it to a unique value\n // This helps in determining the right response for current request among multiple incoming messages\n if (!request.message_id) {\n request.message_id = generate_uuid();\n }\n\n return new Promise<RheaMessage>((resolve: any, reject: any) => {\n let timer: ReturnType<typeof setTimeout> | undefined = undefined;\n\n const rejectOnAbort = (): void => {\n this._responsesMap.delete(request.message_id as string);\n const address = this.receiver.address || \"address\";\n const requestName = options.requestName;\n const desc: string =\n `[${this.connection.id}] The request \"${requestName}\" ` +\n `to \"${address}\" has been cancelled by the user.`;\n // Cancellation is a user-intended action, so log to info instead of warning.\n logger.info(desc);\n const error = new AbortError(StandardAbortMessage);\n\n reject(error);\n };\n\n const onAbort = (): void => {\n // safe to clear the timeout if it hasn't already occurred.\n if (isDefined(timer)) {\n clearTimeout(timer);\n }\n aborter!.removeEventListener(\"abort\", onAbort);\n\n rejectOnAbort();\n };\n\n if (aborter) {\n // the aborter may have been triggered between request attempts\n // so check if it was triggered and reject if needed.\n if (aborter.aborted) {\n return rejectOnAbort();\n }\n aborter.addEventListener(\"abort\", onAbort);\n }\n\n timer = setTimeout(() => {\n this._responsesMap.delete(request.message_id as string);\n if (aborter) {\n aborter.removeEventListener(\"abort\", onAbort);\n }\n const address = this.receiver?.address || \"address\";\n const desc: string =\n `The request with message_id \"${request.message_id}\" to \"${address}\" ` +\n `endpoint timed out. Please try again later.`;\n const e: Error = {\n name: \"OperationTimeoutError\",\n message: desc,\n };\n return reject(translate(e));\n }, timeoutInMs);\n\n this._responsesMap.set(request.message_id as string, {\n resolve: resolve,\n reject: reject,\n cleanupBeforeResolveOrReject: () => {\n if (aborter) aborter.removeEventListener(\"abort\", onAbort);\n if (isDefined(timer)) {\n clearTimeout(timer);\n }\n },\n });\n\n logger.verbose(\"[%s] %s request sent: %O\", this.connection.id, request.to || \"$management\");\n this.sender.send(request);\n });\n }\n\n /**\n * Closes the sender, receiver link and the underlying session.\n * @returns Promise<void>\n */\n async close(): Promise<void> {\n await this.sender.close({ closeSession: false });\n await this.receiver.close({ closeSession: false });\n await this.session.close();\n }\n\n /**\n * Removes the sender, receiver link and it's underlying session.\n * @returns void\n */\n remove(): void {\n this.sender.remove();\n this.receiver.remove();\n this.session.remove();\n }\n\n /**\n * Creates an amqp request/response link.\n *\n * @param connection - The amqp connection.\n * @param senderOptions - Options that must be provided to create the sender link.\n * @param receiverOptions - Options that must be provided to create the receiver link.\n * @param createOptions - 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 `create` invocation.\n * @returns Promise<RequestResponseLink>\n */\n static async create(\n connection: Connection,\n senderOptions: SenderOptions,\n receiverOptions: ReceiverOptions,\n createOptions: { abortSignal?: AbortSignalLike } = {},\n ): Promise<RequestResponseLink> {\n const { abortSignal } = createOptions;\n const session = await connection.createSession({ abortSignal });\n const sender = await session.createSender({ ...senderOptions, abortSignal });\n const receiver = await session.createReceiver({ ...receiverOptions, abortSignal });\n logger.verbose(\n \"[%s] Successfully created the sender and receiver links on the same session.\",\n connection.id,\n );\n return new RequestResponseLink(session, sender, receiver);\n }\n}\n/**\n * @internal\n *\n * Type used in getCodeDescriptionAndError to get the normalized info from the responses emitted by EventHubs and ServiceBus.\n */\ntype NormalizedInfo = {\n statusCode: number;\n statusDescription: string;\n errorCondition: string;\n};\n\n/**\n * @internal\n *\n * Handle different variations of property names in responses emitted by EventHubs and ServiceBus.\n */\nexport const getCodeDescriptionAndError = (\n props: { [key: string]: string | number | undefined } = {},\n): NormalizedInfo => {\n return {\n statusCode: (props[Constants.statusCode] || props.statusCode) as number,\n statusDescription: (props[Constants.statusDescription] || props.statusDescription) as string,\n errorCondition: (props[Constants.errorCondition] || props.errorCondition) as string,\n };\n};\n\n/**\n * This is used as the onMessage handler for the \"message\" event on the receiver.\n *\n * (This is inspired from the message settlement sequence in service-bus SDK which\n * relies on a single listener for settled event for all the messages.)\n * The sequence is as follows:\n * 1. User calls `await RequestResponseLink.sendRequest()`\n * 2. This creates a `Promise` that gets stored in the _responsesMap\n * 3. When the service acknowledges the response, this method gets called for that request.\n * 4. We resolve() the promise from the _responsesMap with the message.\n * 5. User's code after the sendRequest continues.\n *\n * @internal\n */\nexport function onMessageReceived(\n context: Pick<EventContext, \"message\">,\n connectionId: string,\n responsesMap: Map<string, DeferredPromiseWithCallback>,\n): void {\n const message = context.message;\n if (!message) {\n logger.verbose(\n `[${connectionId}] \"message\" property on the EventContext is \"undefined\" which is unexpected, ` +\n `returning from the \"onMessageReceived\" handler without resolving or rejecting the promise ` +\n `upon encountering the message event.`,\n );\n return;\n }\n\n const responseCorrelationId = message.correlation_id;\n if (!responsesMap.has(responseCorrelationId as string)) {\n logger.verbose(\n `[${connectionId}] correlationId \"${responseCorrelationId}\" property on the response does not match with ` +\n `any of the \"request-id\"s in the map, returning from the \"onMessageReceived\" handler without resolving ` +\n `or rejecting the promise upon encountering the message event.`,\n );\n return;\n }\n\n const promise = responsesMap.get(responseCorrelationId as string) as DeferredPromiseWithCallback;\n promise.cleanupBeforeResolveOrReject();\n\n const deleteResult = responsesMap.delete(responseCorrelationId as string);\n logger.verbose(\n `[${connectionId}] Successfully deleted the response with id ${responseCorrelationId} from the map. ` +\n `Delete result - ${deleteResult}`,\n );\n\n const info = getCodeDescriptionAndError(message.application_properties);\n let error;\n if (!info.statusCode) {\n error = new Error(\n `[${connectionId}] No statusCode in the \"application_properties\" in the returned response with correlation-id: ${responseCorrelationId}`,\n );\n }\n if (info.statusCode > 199 && info.statusCode < 300) {\n logger.verbose(\n `[${connectionId}] Resolving the response with correlation-id: ${responseCorrelationId}`,\n );\n return promise.resolve(message);\n }\n if (!error) {\n const condition =\n info.errorCondition || ConditionStatusMapper[info.statusCode] || \"amqp:internal-error\";\n error = translate({\n condition: condition,\n description: info.statusDescription,\n });\n logger.warning(`${error?.name}: ${error?.message}`);\n }\n logErrorStackTrace(error);\n return promise.reject(error);\n}\n\nfunction onSenderError(\n context: Pick<EventContext, \"sender\">,\n connectionId: string,\n responsesMap: Map<string, DeferredPromiseWithCallback>,\n): void {\n if (context.sender) {\n for (const [key, promise] of responsesMap.entries()) {\n logger.verbose(\n `[${connectionId}] Sender closed due to error when sending request with message_id \"${key}\"`,\n );\n promise.cleanupBeforeResolveOrReject();\n promise.reject(context.sender.error);\n }\n responsesMap.clear();\n }\n}\n"]}
|
package/dist/commonjs/retry.d.ts
CHANGED
package/dist/commonjs/retry.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
4
|
/* eslint-disable eqeqeq */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.RetryOperationType = exports.RetryMode = void 0;
|
|
7
|
+
exports.retry = retry;
|
|
7
8
|
const errors_js_1 = require("./errors.js");
|
|
8
9
|
const constants_js_1 = require("./util/constants.js");
|
|
9
10
|
const checkNetworkConnection_js_1 = require("./util/checkNetworkConnection.js");
|
|
@@ -157,18 +158,10 @@ async function retry(config) {
|
|
|
157
158
|
return result;
|
|
158
159
|
}
|
|
159
160
|
else {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function compileErrors(errors) {
|
|
165
|
-
if (!errors.length) {
|
|
166
|
-
throw new RangeError("Error array is empty");
|
|
161
|
+
if (errors.length === 1) {
|
|
162
|
+
throw errors[0];
|
|
163
|
+
}
|
|
164
|
+
throw new AggregateError(errors);
|
|
167
165
|
}
|
|
168
|
-
let i = 0;
|
|
169
|
-
const str = errors.map((error) => `Error ${i++}: ${error}`).join("\n\n");
|
|
170
|
-
const lastError = errors[errors.length - 1];
|
|
171
|
-
lastError.message = str;
|
|
172
|
-
return lastError;
|
|
173
166
|
}
|
|
174
167
|
//# sourceMappingURL=retry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/retry.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAClC,2BAA2B;;;AAE3B,2CAAwD;AAExD,sDAAgD;AAChD,gFAA0E;AAC1E,gDAAyC;AACzC,qCAAkC;AAElC;;;GAGG;AACH,SAAS,UAAU,CAAC,GAAQ;IAC1B,IAAI,MAAM,GAAY,KAAK,CA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CAAC;IAC/C,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzE,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC5C,SAAS,CAAC,OAAO,GAAG,GAAG,CAAC;IACxB,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/* eslint-disable eqeqeq */\n\nimport { MessagingError, translate } from \"./errors.js\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport { Constants } from \"./util/constants.js\";\nimport { checkNetworkConnection } from \"./util/checkNetworkConnection.js\";\nimport { delay } from \"@azure/core-util\";\nimport { logger } from \"./log.js\";\n\n/**\n * Determines whether the object is a Delivery object.\n * @internal\n */\nfunction isDelivery(obj: any): boolean {\n let result: boolean = false;\n if (\n obj &&\n typeof obj.id === \"number\" &&\n typeof obj.settled === \"boolean\" &&\n typeof obj.remote_settled === \"boolean\" &&\n typeof obj.format === \"number\"\n ) {\n result = true;\n }\n return result;\n}\n\n/**\n * Describes the Retry Mode type\n */\nexport enum RetryMode {\n Exponential,\n Fixed,\n}\n\n/**\n * Describes the retry operation type.\n */\nexport enum RetryOperationType {\n cbsAuth = \"cbsAuth\",\n connection = \"connection\",\n management = \"management\",\n receiverLink = \"receiverLink\",\n senderLink = \"senderLink\",\n sendMessage = \"sendMessage\",\n receiveMessage = \"receiveMessage\",\n session = \"session\",\n messageSettlement = \"settlement\",\n}\n\n/**\n * Retry policy options that determine the mode, number of retries, retry interval etc.\n */\nexport interface RetryOptions {\n /**\n * Number of times the operation needs to be retried in case\n * of retryable error. Default: 3.\n */\n maxRetries?: number;\n /**\n * Amount of time to wait in milliseconds before making the\n * next attempt. Default: `30000 milliseconds`.\n * When `mode` option is set to `Exponential`,\n * this is used to compute the exponentially increasing delays between retries.\n */\n retryDelayInMs?: number;\n /**\n * Number of milliseconds to wait before declaring that current attempt has timed out which will trigger a retry\n * A minimum value of `60000` milliseconds will be used if a value not greater than this is provided.\n */\n timeoutInMs?: number;\n /**\n * Denotes which retry mode to apply. If undefined, defaults to `Fixed`\n */\n mode?: RetryMode;\n /**\n * Denotes the maximum delay between retries\n * that the retry attempts will be capped at. Applicable only when performing exponential retry.\n */\n maxRetryDelayInMs?: number;\n}\n\n/**\n * Describes the parameters that need to be configured for the retry operation.\n */\nexport interface RetryConfig<T> {\n /**\n * The operation that needs to be retried.\n */\n operation: () => Promise<T>;\n /**\n * The connection identifier. Used in logging information.\n * Extremely useful when multiple connections are logged in the same file.\n */\n connectionId: string;\n /**\n * The name/type of operation to be performed.\n * Extremely useful in providing better debug logs.\n */\n operationType: RetryOperationType;\n /**\n * The host \"<yournamespace>.servicebus.windows.net\".\n * Used to check network connectivity.\n */\n connectionHost?: string;\n /**\n * The retry related options associated with given operation execution.\n */\n retryOptions?: RetryOptions;\n /**\n * The `AbortSignal` associated with the operation being retried on.\n * If this signal is fired during the wait time between retries, then the `retry()` method will ensure that the wait is abandoned and the retry process gets cancelled. If this signal is fired when the operation is in progress, then the operation is expected to react to it.\n */\n abortSignal?: AbortSignalLike;\n}\n\n/**\n * Validates the retry config.\n * @internal\n */\nfunction validateRetryConfig<T>(config: RetryConfig<T>): void {\n if (!config.operation) {\n throw new TypeError(\"Missing 'operation' in retry configuration\");\n }\n\n if (!config.connectionId) {\n throw new TypeError(\"Missing 'connectionId' in retry configuration\");\n }\n\n if (!config.operationType) {\n throw new TypeError(\"Missing 'operationType' in retry configuration\");\n }\n}\n\n/**\n * Calculates delay between retries, in milliseconds.\n * @internal\n */\nfunction calculateDelay(\n attemptCount: number,\n retryDelayInMs: number,\n maxRetryDelayInMs: number,\n mode: RetryMode,\n): number {\n if (mode === RetryMode.Exponential) {\n const boundedRandDelta =\n retryDelayInMs * 0.8 +\n Math.floor(Math.random() * (retryDelayInMs * 1.2 - retryDelayInMs * 0.8));\n\n const incrementDelta = boundedRandDelta * (Math.pow(2, attemptCount) - 1);\n return Math.min(incrementDelta, maxRetryDelayInMs);\n }\n\n return retryDelayInMs;\n}\n\n/**\n * Every operation is attempted at least once. Additional attempts are made if the previous attempt failed\n * with a retryable error. The number of additional attempts is governed by the `maxRetries` property provided\n * on the `RetryConfig` argument.\n *\n * If `mode` option is set to `Fixed`, then the retries are made on the\n * given operation for a specified number of times, with a fixed delay in between each retry each time.\n *\n * If `mode` option is set to `Exponential`, then the delay between retries is adjusted to increase\n * exponentially with each attempt using back-off factor of power 2.\n *\n * @param config - Parameters to configure retry operation\n *\n * @returns Promise<T>.\n */\nexport async function retry<T>(config: RetryConfig<T>): Promise<T> {\n validateRetryConfig(config);\n const updatedConfig = { ...config };\n if (!updatedConfig.retryOptions) {\n updatedConfig.retryOptions = {};\n }\n if (\n updatedConfig.retryOptions.maxRetries == undefined ||\n updatedConfig.retryOptions.maxRetries < 0\n ) {\n updatedConfig.retryOptions.maxRetries = Constants.defaultMaxRetries;\n }\n if (\n updatedConfig.retryOptions.retryDelayInMs == undefined ||\n updatedConfig.retryOptions.retryDelayInMs < 0\n ) {\n updatedConfig.retryOptions.retryDelayInMs = Constants.defaultDelayBetweenOperationRetriesInMs;\n }\n if (\n updatedConfig.retryOptions.maxRetryDelayInMs == undefined ||\n updatedConfig.retryOptions.maxRetryDelayInMs < 0\n ) {\n updatedConfig.retryOptions.maxRetryDelayInMs = Constants.defaultMaxDelayForExponentialRetryInMs;\n }\n if (updatedConfig.retryOptions.mode == undefined) {\n updatedConfig.retryOptions.mode = RetryMode.Fixed;\n }\n const errors: (MessagingError | Error)[] = [];\n let result: any;\n let success = false;\n const totalNumberOfAttempts = updatedConfig.retryOptions.maxRetries + 1;\n for (let i = 1; i <= totalNumberOfAttempts; i++) {\n logger.verbose(\n \"[%s] Attempt number for '%s': %d.\",\n updatedConfig.connectionId,\n updatedConfig.operationType,\n i,\n );\n try {\n result = await updatedConfig.operation();\n success = true;\n logger.verbose(\n \"[%s] Success for '%s', after attempt number: %d.\",\n updatedConfig.connectionId,\n updatedConfig.operationType,\n i,\n );\n if (result && !isDelivery(result)) {\n logger.verbose(\n \"[%s] Success result for '%s': %O\",\n updatedConfig.connectionId,\n updatedConfig.operationType,\n result,\n );\n }\n break;\n } catch (_err) {\n const err = translate(_err);\n\n if (\n !(err as any).retryable &&\n err.name === \"ServiceCommunicationError\" &&\n updatedConfig.connectionHost\n ) {\n const isConnected = await checkNetworkConnection(updatedConfig.connectionHost);\n if (!isConnected) {\n err.name = \"ConnectionLostError\";\n (err as any).retryable = true;\n }\n }\n logger.verbose(\n \"[%s] Error occurred for '%s' in attempt number %d: %O\",\n updatedConfig.connectionId,\n updatedConfig.operationType,\n i,\n err,\n );\n\n errors.push(err);\n if ((errors[errors?.length - 1] as MessagingError).retryable && totalNumberOfAttempts > i) {\n const targetDelayInMs = calculateDelay(\n i,\n updatedConfig.retryOptions.retryDelayInMs,\n updatedConfig.retryOptions.maxRetryDelayInMs,\n updatedConfig.retryOptions.mode,\n );\n logger.verbose(\n \"[%s] Sleeping for %d milliseconds for '%s'.\",\n updatedConfig.connectionId,\n targetDelayInMs,\n updatedConfig.operationType,\n );\n await delay(targetDelayInMs, {\n abortSignal: updatedConfig.abortSignal,\n abortErrorMsg: `The retry operation has been cancelled by the user.`,\n });\n\n continue;\n } else {\n break;\n }\n }\n }\n if (success) {\n return result;\n } else {\n throw compileErrors(errors);\n }\n}\n\nfunction compileErrors(errors: (MessagingError | Error)[]): MessagingError | Error {\n if (!errors.length) {\n throw new RangeError(\"Error array is empty\");\n }\n let i = 0;\n const str = errors.map((error) => `Error ${i++}: ${error}`).join(\"\\n\\n\");\n const lastError = errors[errors.length - 1];\n lastError.message = str;\n return lastError;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"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,OAAO,MAAM,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* eslint-disable eqeqeq */\n\nimport type { MessagingError } from \"./errors.js\";\nimport { translate } from \"./errors.js\";\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport { Constants } from \"./util/constants.js\";\nimport { checkNetworkConnection } from \"./util/checkNetworkConnection.js\";\nimport { delay } from \"@azure/core-util\";\nimport { logger } from \"./log.js\";\n\n/**\n * Determines whether the object is a Delivery object.\n * @internal\n */\nfunction isDelivery(obj: any): boolean {\n let result: boolean = false;\n if (\n obj &&\n typeof obj.id === \"number\" &&\n typeof obj.settled === \"boolean\" &&\n typeof obj.remote_settled === \"boolean\" &&\n typeof obj.format === \"number\"\n ) {\n result = true;\n }\n return result;\n}\n\n/**\n * Describes the Retry Mode type\n */\nexport enum RetryMode {\n Exponential,\n Fixed,\n}\n\n/**\n * Describes the retry operation type.\n */\nexport enum RetryOperationType {\n cbsAuth = \"cbsAuth\",\n connection = \"connection\",\n management = \"management\",\n receiverLink = \"receiverLink\",\n senderLink = \"senderLink\",\n sendMessage = \"sendMessage\",\n receiveMessage = \"receiveMessage\",\n session = \"session\",\n messageSettlement = \"settlement\",\n}\n\n/**\n * Retry policy options that determine the mode, number of retries, retry interval etc.\n */\nexport interface RetryOptions {\n /**\n * Number of times the operation needs to be retried in case\n * of retryable error. Default: 3.\n */\n maxRetries?: number;\n /**\n * Amount of time to wait in milliseconds before making the\n * next attempt. Default: `30000 milliseconds`.\n * When `mode` option is set to `Exponential`,\n * this is used to compute the exponentially increasing delays between retries.\n */\n retryDelayInMs?: number;\n /**\n * Number of milliseconds to wait before declaring that current attempt has timed out which will trigger a retry\n * A minimum value of `60000` milliseconds will be used if a value not greater than this is provided.\n */\n timeoutInMs?: number;\n /**\n * Denotes which retry mode to apply. If undefined, defaults to `Fixed`\n */\n mode?: RetryMode;\n /**\n * Denotes the maximum delay between retries\n * that the retry attempts will be capped at. Applicable only when performing exponential retry.\n */\n maxRetryDelayInMs?: number;\n}\n\n/**\n * Describes the parameters that need to be configured for the retry operation.\n */\nexport interface RetryConfig<T> {\n /**\n * The operation that needs to be retried.\n */\n operation: () => Promise<T>;\n /**\n * The connection identifier. Used in logging information.\n * Extremely useful when multiple connections are logged in the same file.\n */\n connectionId: string;\n /**\n * The name/type of operation to be performed.\n * Extremely useful in providing better debug logs.\n */\n operationType: RetryOperationType;\n /**\n * The host \"<yournamespace>.servicebus.windows.net\".\n * Used to check network connectivity.\n */\n connectionHost?: string;\n /**\n * The retry related options associated with given operation execution.\n */\n retryOptions?: RetryOptions;\n /**\n * The `AbortSignal` associated with the operation being retried on.\n * If this signal is fired during the wait time between retries, then the `retry()` method will ensure that the wait is abandoned and the retry process gets cancelled. If this signal is fired when the operation is in progress, then the operation is expected to react to it.\n */\n abortSignal?: AbortSignalLike;\n}\n\n/**\n * Validates the retry config.\n * @internal\n */\nfunction validateRetryConfig<T>(config: RetryConfig<T>): void {\n if (!config.operation) {\n throw new TypeError(\"Missing 'operation' in retry configuration\");\n }\n\n if (!config.connectionId) {\n throw new TypeError(\"Missing 'connectionId' in retry configuration\");\n }\n\n if (!config.operationType) {\n throw new TypeError(\"Missing 'operationType' in retry configuration\");\n }\n}\n\n/**\n * Calculates delay between retries, in milliseconds.\n * @internal\n */\nfunction calculateDelay(\n attemptCount: number,\n retryDelayInMs: number,\n maxRetryDelayInMs: number,\n mode: RetryMode,\n): number {\n if (mode === RetryMode.Exponential) {\n const boundedRandDelta =\n retryDelayInMs * 0.8 +\n Math.floor(Math.random() * (retryDelayInMs * 1.2 - retryDelayInMs * 0.8));\n\n const incrementDelta = boundedRandDelta * (Math.pow(2, attemptCount) - 1);\n return Math.min(incrementDelta, maxRetryDelayInMs);\n }\n\n return retryDelayInMs;\n}\n\n/**\n * Every operation is attempted at least once. Additional attempts are made if the previous attempt failed\n * with a retryable error. The number of additional attempts is governed by the `maxRetries` property provided\n * on the `RetryConfig` argument.\n *\n * If `mode` option is set to `Fixed`, then the retries are made on the\n * given operation for a specified number of times, with a fixed delay in between each retry each time.\n *\n * If `mode` option is set to `Exponential`, then the delay between retries is adjusted to increase\n * exponentially with each attempt using back-off factor of power 2.\n *\n * @param config - Parameters to configure retry operation\n *\n * @returns Promise<T>.\n */\nexport async function retry<T>(config: RetryConfig<T>): Promise<T> {\n validateRetryConfig(config);\n const updatedConfig = { ...config };\n if (!updatedConfig.retryOptions) {\n updatedConfig.retryOptions = {};\n }\n if (\n updatedConfig.retryOptions.maxRetries == undefined ||\n updatedConfig.retryOptions.maxRetries < 0\n ) {\n updatedConfig.retryOptions.maxRetries = Constants.defaultMaxRetries;\n }\n if (\n updatedConfig.retryOptions.retryDelayInMs == undefined ||\n updatedConfig.retryOptions.retryDelayInMs < 0\n ) {\n updatedConfig.retryOptions.retryDelayInMs = Constants.defaultDelayBetweenOperationRetriesInMs;\n }\n if (\n updatedConfig.retryOptions.maxRetryDelayInMs == undefined ||\n updatedConfig.retryOptions.maxRetryDelayInMs < 0\n ) {\n updatedConfig.retryOptions.maxRetryDelayInMs = Constants.defaultMaxDelayForExponentialRetryInMs;\n }\n if (updatedConfig.retryOptions.mode == undefined) {\n updatedConfig.retryOptions.mode = RetryMode.Fixed;\n }\n const errors: (MessagingError | Error)[] = [];\n let result: any;\n let success = false;\n const totalNumberOfAttempts = updatedConfig.retryOptions.maxRetries + 1;\n for (let i = 1; i <= totalNumberOfAttempts; i++) {\n logger.verbose(\n \"[%s] Attempt number for '%s': %d.\",\n updatedConfig.connectionId,\n updatedConfig.operationType,\n i,\n );\n try {\n result = await updatedConfig.operation();\n success = true;\n logger.verbose(\n \"[%s] Success for '%s', after attempt number: %d.\",\n updatedConfig.connectionId,\n updatedConfig.operationType,\n i,\n );\n if (result && !isDelivery(result)) {\n logger.verbose(\n \"[%s] Success result for '%s': %O\",\n updatedConfig.connectionId,\n updatedConfig.operationType,\n result,\n );\n }\n break;\n } catch (_err) {\n const err = translate(_err);\n\n if (\n !(err as any).retryable &&\n err.name === \"ServiceCommunicationError\" &&\n updatedConfig.connectionHost\n ) {\n const isConnected = await checkNetworkConnection(updatedConfig.connectionHost);\n if (!isConnected) {\n err.name = \"ConnectionLostError\";\n (err as any).retryable = true;\n }\n }\n logger.verbose(\n \"[%s] Error occurred for '%s' in attempt number %d: %O\",\n updatedConfig.connectionId,\n updatedConfig.operationType,\n i,\n err,\n );\n\n errors.push(err);\n if ((errors[errors?.length - 1] as MessagingError).retryable && totalNumberOfAttempts > i) {\n const targetDelayInMs = calculateDelay(\n i,\n updatedConfig.retryOptions.retryDelayInMs,\n updatedConfig.retryOptions.maxRetryDelayInMs,\n updatedConfig.retryOptions.mode,\n );\n logger.verbose(\n \"[%s] Sleeping for %d milliseconds for '%s'.\",\n updatedConfig.connectionId,\n targetDelayInMs,\n updatedConfig.operationType,\n );\n await delay(targetDelayInMs, {\n abortSignal: updatedConfig.abortSignal,\n abortErrorMsg: `The retry operation has been cancelled by the user.`,\n });\n\n continue;\n } else {\n break;\n }\n }\n }\n if (success) {\n return result;\n } else {\n if (errors.length === 1) {\n throw errors[0];\n }\n throw new AggregateError(errors);\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.checkNetworkConnection = checkNetworkConnection;
|
|
6
|
+
/**
|
|
7
|
+
* Checks whether a network connection is detected.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
function checkNetworkConnection() {
|
|
11
|
+
return Promise.resolve(self.navigator.onLine);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=checkNetworkConnection.common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkNetworkConnection.common.js","sourceRoot":"","sources":["../../../src/util/checkNetworkConnection.common.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAMlC,wDAEC;AAND;;;GAGG;AACH,SAAgB,sBAAsB;IACpC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Checks whether a network connection is detected.\n * @internal\n */\nexport function checkNetworkConnection(): Promise<boolean> {\n return Promise.resolve(self.navigator.onLine);\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.checkNetworkConnection =
|
|
5
|
+
exports.checkNetworkConnection = checkNetworkConnection;
|
|
6
6
|
const node_dns_1 = require("node:dns");
|
|
7
7
|
const log_js_1 = require("../log.js");
|
|
8
8
|
/**
|
|
@@ -28,5 +28,4 @@ function checkNetworkConnection(host) {
|
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
exports.checkNetworkConnection = checkNetworkConnection;
|
|
32
31
|
//# sourceMappingURL=checkNetworkConnection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkNetworkConnection.js","sourceRoot":"","sources":["../../../src/util/checkNetworkConnection.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"checkNetworkConnection.js","sourceRoot":"","sources":["../../../src/util/checkNetworkConnection.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AASlC,wDAsBC;AA7BD,uCAAuE;AACvE,sCAAmC;AAEnC;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,IAAY;IACjD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,eAAM,CAAC,OAAO,CAAC,6DAA6D,CAAC,CAAC;QAC9E,IAAA,kBAAU,EAAC,IAAI,EAAE,UAAU,GAAQ;YACjC,IAAI,GAAG,EAAE,CAAC;gBACR,eAAM,CAAC,OAAO,CACZ,qEAAqE,EACrE,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,EACpB,GAAG,CACJ,CAAC;gBACF,2GAA2G;gBAC3G,8GAA8G;gBAC9G,IAAI,GAAG,CAAC,IAAI,KAAK,sBAAW,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAO,EAAE,CAAC;oBACrD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,eAAM,CAAC,OAAO,CAAC,yEAAyE,CAAC,CAAC;YAC5F,CAAC;YAED,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CONNREFUSED, TIMEOUT, resolve as dnsResolve } from \"node:dns\";\nimport { logger } from \"../log.js\";\n\n/**\n * Checks whether a network connection is detected.\n * @internal\n */\nexport function checkNetworkConnection(host: string): Promise<boolean> {\n return new Promise((resolve) => {\n logger.verbose(\"Calling dns.resolve to determine network connection status.\");\n dnsResolve(host, function (err: any): void {\n if (err) {\n logger.verbose(\n \"Error thrown from dns.resolve in network connection check: '%s', %O\",\n err.code || err.name,\n err,\n );\n // List of possible DNS error codes: https://nodejs.org/dist/latest-v12.x/docs/api/dns.html#dns_error_codes\n // We only resolve with `false` when dnsResolve fails with an error we expect to see when the network is down.\n if (err.code === CONNREFUSED || err.code === TIMEOUT) {\n return resolve(false);\n }\n } else {\n logger.verbose(\"Successfully resolved host via dns.resolve in network connection check.\");\n }\n\n return resolve(true);\n });\n });\n}\n"]}
|
|
@@ -42,7 +42,6 @@ export declare const Constants: {
|
|
|
42
42
|
readonly attachEpoch: "com.microsoft:epoch";
|
|
43
43
|
readonly receiverIdentifierName: "com.microsoft:receiver-name";
|
|
44
44
|
readonly enableReceiverRuntimeMetricName: "com.microsoft:enable-receiver-runtime-metric";
|
|
45
|
-
readonly geoReplication: "com.microsoft:georeplication";
|
|
46
45
|
readonly timespan: "com.microsoft:timespan";
|
|
47
46
|
readonly uri: "com.microsoft:uri";
|
|
48
47
|
readonly dateTimeOffset: "com.microsoft:datetime-offset";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.StandardAbortMessage = exports.Constants = void 0;
|
|
6
6
|
exports.Constants = {
|
|
@@ -47,7 +47,6 @@ exports.Constants = {
|
|
|
47
47
|
attachEpoch: `com.microsoft:epoch`,
|
|
48
48
|
receiverIdentifierName: `com.microsoft:receiver-name`,
|
|
49
49
|
enableReceiverRuntimeMetricName: `com.microsoft:enable-receiver-runtime-metric`,
|
|
50
|
-
geoReplication: `com.microsoft:georeplication`,
|
|
51
50
|
timespan: `com.microsoft:timespan`,
|
|
52
51
|
uri: `com.microsoft:uri`,
|
|
53
52
|
dateTimeOffset: `com.microsoft:datetime-offset`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/util/constants.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAErB,QAAA,SAAS,GAAG;IACvB,kBAAkB,EAAE,sBAAsB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,EAAE,kBAAkB;IACnC,gBAAgB,EAAE,mBAAmB;IACrC,qBAAqB,EAAE,wBAAwB;IAC/C,kBAAkB,EAAE,sBAAsB;IAC1C,cAAc,EAAE,2BAA2B;IAC3C,UAAU,EAAE,2BAA2B;IACvC,aAAa,EAAE,8BAA8B;IAC7C,UAAU,EAAE;QACV,QAAQ,EAAE,WAAW;QACrB,IAAI,EAAE,MAAM;QACZ,sBAAsB,EAAE,wCAAwC;QAChE,eAAe,EAAE,gCAAgC;QACjD,SAAS,EAAE,0BAA0B;QACrC,WAAW,EAAE,4BAA4B;QACzC,uBAAuB,EAAE,0CAA0C;QACnE,cAAc,EAAE,qCAAqC;QACrD,iBAAiB,EAAE,kCAAkC;QACrD,gBAAgB,EAAE,kCAAkC;QACpD,eAAe,EAAE,iCAAiC;QAClD,eAAe,EAAE,iCAAiC;QAClD,iBAAiB,EAAE,oCAAoC;QACvD,OAAO,EAAE,wBAAwB;QACjC,UAAU,EAAE,2BAA2B;QACvC,cAAc,EAAE,+BAA+B;KAChD;IACD,eAAe,EAAE;QACf,mBAAmB,EAAE,aAAa;QAClC,aAAa,EAAE,WAAW;QAC1B,qBAAqB,EAAE,WAAW;QAClC,iBAAiB,EAAE,aAAa;QAChC,cAAc,EAAE,WAAW;QAC3B,eAAe,EAAE,WAAW;KAC7B;CACO,CAAC;AAEX;;;GAGG;AACU,QAAA,oBAAoB,GAAG,4BAA4B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const Constants = {\n associatedLinkName: \"associated-link-name\",\n partitionKey: \"x-opt-partition-key\",\n sequenceNumber: \"x-opt-sequence-number\",\n enqueueSequenceNumber: \"x-opt-enqueue-sequence-number\",\n enqueuedTime: \"x-opt-enqueued-time\",\n scheduledEnqueueTime: \"x-opt-scheduled-enqueue-time\",\n offset: \"x-opt-offset\",\n lockedUntil: \"x-opt-locked-until\",\n partitionIdName: \"x-opt-partition-id\",\n publisher: \"x-opt-publisher-name\",\n viaPartitionKey: \"x-opt-via-partition-key\",\n deadLetterSource: \"x-opt-deadletter-source\",\n messageState: \"x-opt-message-state\",\n enqueuedTimeAnnotation: `amqp.annotation.x-opt-enqueued-time`,\n offsetAnnotation: `amqp.annotation.x-opt-offset`,\n sequenceNumberAnnotation: `amqp.annotation.x-opt-sequence-number`,\n guidSize: 16,\n message: \"message\",\n error: \"error\",\n statusCode: \"status-code\",\n statusDescription: \"status-description\",\n errorCondition: \"error-condition\",\n management: \"$management\",\n partition: \"partition\",\n partitionId: \"partitionId\",\n readOperation: \"READ\",\n TLS: \"tls\",\n TCP: \"tcp\",\n establishConnection: \"establishConnection\",\n defaultConsumerGroup: \"$default\",\n eventHub: \"eventhub\",\n cbsEndpoint: \"$cbs\",\n cbsReplyTo: \"cbs\",\n operationPutToken: \"put-token\",\n aadEventHubsAudience: \"https://eventhubs.azure.net/\",\n aadEventHubsScope: \"https://eventhubs.azure.net//.default\",\n aadServiceBusAudience: \"https://servicebus.azure.net/\",\n aadServiceBusScope: \"https://servicebus.azure.net//.default\",\n maxUserAgentLength: 512,\n vendorString: \"com.microsoft\",\n attachEpoch: `com.microsoft:epoch`,\n receiverIdentifierName: `com.microsoft:receiver-name`,\n enableReceiverRuntimeMetricName: `com.microsoft:enable-receiver-runtime-metric`,\n timespan: `com.microsoft:timespan`,\n uri: `com.microsoft:uri`,\n dateTimeOffset: `com.microsoft:datetime-offset`,\n sessionFilterName: `com.microsoft:session-filter`,\n receiverError: \"receiver_error\",\n senderError: \"sender_error\",\n sessionError: \"session_error\",\n connectionError: \"connection_error\",\n defaultOperationTimeoutInMs: 60000,\n defaultConnectionIdleTimeoutInMs: 60000,\n managementRequestKey: \"managementRequest\",\n negotiateCbsKey: \"negotiateCbs\",\n negotiateClaim: \"negotiateClaim\",\n ensureContainerAndBlob: \"ensureContainerAndBlob\",\n defaultPrefetchCount: 1000,\n reconnectLimit: 100,\n maxMessageIdLength: 128,\n maxPartitionKeyLength: 128,\n maxSessionIdLength: 128,\n pathDelimiter: \"/\",\n ruleNameMaximumLength: 50,\n maximumSqlFilterStatementLength: 1024,\n maximumSqlRuleActionStatementLength: 1024,\n maxDeadLetterReasonLength: 4096,\n // https://stackoverflow.com/questions/11526504/minimum-and-maximum-date for js\n // However we are setting this to the TimeSpan.MaxValue of C#.\n maxDurationValue: 922337203685477,\n minDurationValue: -922337203685477,\n // https://github.com/Azure/azure-amqp/blob/master/Microsoft.Azure.Amqp/Amqp/AmqpConstants.cs#L47\n maxAbsoluteExpiryTime: new Date(\"9999-12-31T07:59:59.000Z\").getTime(),\n maxUint32Value: 4294967295,\n aadTokenValidityMarginInMs: 5000,\n connectionReconnectDelay: 300,\n defaultMaxRetries: 3,\n defaultMaxRetriesForConnection: 150,\n defaultDelayBetweenOperationRetriesInMs: 30000,\n defaultMaxDelayForExponentialRetryInMs: 90000,\n receiverSettleMode: \"receiver-settle-mode\",\n dispositionStatus: \"disposition-status\",\n fromSequenceNumber: \"from-sequence-number\",\n messageCount: \"message-count\",\n enqueuedTimeUtc: \"enqueued-time-utc\",\n lockTokens: \"lock-tokens\",\n messageIdMapKey: \"message-id\",\n sequenceNumberMapKey: \"sequence-number\",\n lockTokenMapKey: \"lock-token\",\n sessionIdMapKey: \"session-id\",\n sequenceNumbers: \"sequence-numbers\",\n deadLetterReason: \"deadletter-reason\",\n deadLetterDescription: \"deadletter-description\",\n propertiesToModify: \"properties-to-modify\",\n deadLetterName: \"com.microsoft:dead-letter\",\n trackingId: \"com.microsoft:tracking-id\",\n serverTimeout: \"com.microsoft:server-timeout\",\n operations: {\n putToken: \"put-token\",\n read: \"READ\",\n cancelScheduledMessage: \"com.microsoft:cancel-scheduled-message\",\n scheduleMessage: \"com.microsoft:schedule-message\",\n renewLock: \"com.microsoft:renew-lock\",\n peekMessage: \"com.microsoft:peek-message\",\n receiveBySequenceNumber: \"com.microsoft:receive-by-sequence-number\",\n deleteMessages: \"com.microsoft:batch-delete-messages\",\n updateDisposition: \"com.microsoft:update-disposition\",\n renewSessionLock: \"com.microsoft:renew-session-lock\",\n setSessionState: \"com.microsoft:set-session-state\",\n getSessionState: \"com.microsoft:get-session-state\",\n enumerateSessions: \"com.microsoft:get-message-sessions\",\n addRule: \"com.microsoft:add-rule\",\n removeRule: \"com.microsoft:remove-rule\",\n enumerateRules: \"com.microsoft:enumerate-rules\",\n },\n descriptorCodes: {\n ruleDescriptionList: 1335734829060,\n sqlFilterList: 83483426822,\n correlationFilterList: 83483426825,\n sqlRuleActionList: 1335734829062,\n trueFilterList: 83483426823,\n falseFilterList: 83483426824,\n },\n} as const;\n\n/**\n * The standard error message accompanying an AbortError.\n * @hidden\n */\nexport const StandardAbortMessage = \"The operation was aborted.\";\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.signString = signString;
|
|
6
|
+
async function signString(key, toSign) {
|
|
7
|
+
const enc = new TextEncoder();
|
|
8
|
+
const algorithm = { name: "HMAC", hash: { name: "SHA-256" } };
|
|
9
|
+
const extractedKey = await globalThis.crypto.subtle.importKey("raw", enc.encode(key), algorithm, false, ["sign", "verify"]);
|
|
10
|
+
const signature = await globalThis.crypto.subtle.sign(algorithm, extractedKey, enc.encode(toSign));
|
|
11
|
+
const digest = btoa(String.fromCharCode(...new Uint8Array(signature)));
|
|
12
|
+
return encodeURIComponent(digest);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=hmacSha256.common.js.map
|