azure-iot-common
Advanced tools
Comparing version 1.9.9 to 1.10.0
/*! Copyright (c) Microsoft. All rights reserved. | ||
*! Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
*/ | ||
/// <reference types="node" /> | ||
/** | ||
@@ -5,0 +6,0 @@ * Returns the seconds elapsed since 1 January 1970 00:00:00 UTC until one |
@@ -35,3 +35,3 @@ /*! Copyright (c) Microsoft. All rights reserved. | ||
function hmacHash(password, stringToSign) { | ||
var hmac = crypto.createHmac('sha256', new Buffer(password, 'base64')); | ||
var hmac = crypto.createHmac('sha256', Buffer.from(password, 'base64')); | ||
hmac.update(stringToSign); | ||
@@ -38,0 +38,0 @@ return hmac.digest('base64'); |
/*! Copyright (c) Microsoft. All rights reserved. | ||
*! Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
*/ | ||
export declare const apiVersion = "2018-06-30"; | ||
export declare const apiVersion = "2019-03-30"; | ||
export declare function devicePath(deviceId: string): string; | ||
@@ -6,0 +6,0 @@ export declare function deviceEventPath(deviceId: string): string; |
@@ -6,3 +6,3 @@ /*! Copyright (c) Microsoft. All rights reserved. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.apiVersion = '2018-06-30'; | ||
exports.apiVersion = '2019-03-30'; | ||
function devicePath(deviceId) { | ||
@@ -9,0 +9,0 @@ return '/devices/' + deviceId; |
/*! Copyright (c) Microsoft. All rights reserved. | ||
*! Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
*/ | ||
/// <reference types="node" /> | ||
import { Properties } from './properties'; | ||
@@ -5,0 +6,0 @@ /** |
@@ -53,3 +53,3 @@ /*! Copyright (c) Microsoft. All rights reserved. | ||
/*Codes_SRS_NODE_IOTHUB_MESSAGE_07_002: [If the data message is of any other type then the data will be converted to a Buffer object and returned.]*/ | ||
return new Buffer(this.data); | ||
return Buffer.from(this.data); | ||
} | ||
@@ -56,0 +56,0 @@ }; |
@@ -8,4 +8,5 @@ import { RetryPolicy } from './retry_policy'; | ||
private _retryCount; | ||
private _totalRetryTime; | ||
private _maxTimeout; | ||
private _operationStartTime; | ||
private _operationExpiryTime; | ||
/** | ||
@@ -12,0 +13,0 @@ * Creates an instance of {@link azure-iot-common.RetryOperation.} |
@@ -6,2 +6,4 @@ // Copyright (c) Microsoft. All rights reserved. | ||
var errors = require("./errors"); | ||
var dbg = require("debug"); | ||
var debug = dbg('azure-iot-common:RetryOperation'); | ||
/** | ||
@@ -18,3 +20,2 @@ * Implements the necessary logic to retry operations such as connecting, receiving C2D messages, sending telemetry, twin updates, etc. | ||
this._retryCount = 0; | ||
this._totalRetryTime = 0; | ||
this._policy = policy; | ||
@@ -40,8 +41,9 @@ this._maxTimeout = maxTimeout; | ||
var nextRetryTimeout = _this._policy.nextRetryTimeout(_this._retryCount, (err instanceof errors.ThrottlingError)); | ||
_this._totalRetryTime += nextRetryTimeout; | ||
/*Codes_SRS_NODE_COMMON_RETRY_OPERATION_16_006: [The `operation` should not be retried past the `maxTimeout` parameter passed to the constructor.]*/ | ||
if (_this._totalRetryTime > _this._maxTimeout || nextRetryTimeout < 0) { | ||
if (Date.now() >= _this._operationExpiryTime || nextRetryTimeout < 0) { | ||
debug('Past the maximum timeout for the operation. failing with the latest error.'); | ||
finalCallback(err); | ||
} | ||
else { | ||
debug('Will retry after: ' + nextRetryTimeout + ' milliseconds'); | ||
setTimeout(retryOperation, nextRetryTimeout); | ||
@@ -51,2 +53,3 @@ } | ||
else { | ||
debug('Error: ' + err.toString() + ' is not retriable'); | ||
/*Codes_SRS_NODE_COMMON_RETRY_OPERATION_16_004: [If the `operation` fails and should not be retried, the `finalCallback` should be called with the last error as the only parameter. ]*/ | ||
@@ -62,2 +65,5 @@ finalCallback(err); | ||
}; | ||
this._operationStartTime = Date.now(); | ||
this._operationExpiryTime = this._operationStartTime + this._maxTimeout; | ||
debug('Operation start time: ' + this._operationStartTime + ' - Will stop retrying after: ' + this._operationExpiryTime); | ||
retryOperation(); | ||
@@ -64,0 +70,0 @@ }; |
{ | ||
"name": "azure-iot-common", | ||
"version": "1.9.9", | ||
"version": "1.10.0", | ||
"description": "Common components shared by Azure IoT device and service SDKs", | ||
@@ -10,2 +10,3 @@ "author": "Microsoft Corporation", | ||
"dependencies": { | ||
"debug": "^4.1.1", | ||
"getos": "^3.1.0" | ||
@@ -12,0 +13,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
134067
3043
2
+ Addeddebug@^4.1.1
+ Addeddebug@4.3.7(transitive)
+ Addedms@2.1.3(transitive)