documentdb
Advanced tools
Comparing version 1.14.4 to 1.14.5
@@ -193,3 +193,3 @@ /* | ||
SDKName: "documentdb-nodejs-sdk", | ||
SDKVersion: "1.14.4", | ||
SDKVersion: "1.14.5", | ||
@@ -196,0 +196,0 @@ DefaultPrecisions: { |
@@ -1,2 +0,2 @@ | ||
/* | ||
/* | ||
The MIT License (MIT) | ||
@@ -26,3 +26,4 @@ Copyright (c) 2017 Microsoft Corporation | ||
var Base = require("./base"); | ||
var Base = require("./base"), | ||
StatusCodes = require("./statusCodes").StatusCodes; | ||
@@ -63,3 +64,3 @@ //SCRIPT START | ||
//Linux Error Codes | ||
this.LinuxConnectionReset = "ECONNRESET"; | ||
this.LinuxConnectionReset = StatusCodes.ConnectionReset; | ||
@@ -115,2 +116,2 @@ this.CONNECTION_ERROR_CODES = [ | ||
module.exports = DefaultRetryPolicy; | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
/* | ||
/* | ||
The MIT License (MIT) | ||
@@ -26,3 +26,4 @@ Copyright (c) 2017 Microsoft Corporation | ||
var Base = require("./base"); | ||
var Base = require("./base"), | ||
StatusCodes = require("./statusCodes").StatusCodes; | ||
@@ -58,3 +59,7 @@ //SCRIPT START | ||
this.currentRetryAttemptCount++; | ||
console.log("Write region was changed, refreshing the regions list from database account and will retry the request."); | ||
if (err.code === StatusCodes.Forbidden) { | ||
console.log("Write region was changed, refreshing the regions list from database account and will retry the request."); | ||
} else if (err.code === StatusCodes.ConnectionRefused) { | ||
console.log("Error trying to connect, refreshing the regions list from database account and will retry the request."); | ||
} | ||
var that = this; | ||
@@ -81,2 +86,2 @@ this.globalEndpointManager.refreshEndpointList(function (writeEndpoint, readEndpoint) { | ||
module.exports = EndpointDiscoveryRetryPolicy; | ||
} | ||
} |
@@ -204,4 +204,3 @@ /* | ||
if (resource && Object.keys(resource).length > 0) { | ||
var key = Object.keys(resource)[0]; | ||
itemValue = resource[key]; | ||
itemValue = resource['item']; | ||
} | ||
@@ -208,0 +207,0 @@ aggregator.aggregate(itemValue); |
@@ -1,2 +0,2 @@ | ||
/* | ||
/* | ||
The MIT License (MIT) | ||
@@ -75,3 +75,6 @@ Copyright (c) 2017 Microsoft Corporation | ||
headers = headers || {}; | ||
if (err.code === StatusCodes.Forbidden && err.substatus === SubStatusCodes.WriteForbidden) { | ||
// Forbidden errors mean that we might be connecting to the wrong endpoint (failover/etc.), so refresh the endpoints | ||
// System errors mean that we can't reach the endpoint, so refresh the endpoints (unless the failure happened while refreshing the endpoints) | ||
if ((err.code === StatusCodes.Forbidden && err.substatus === SubStatusCodes.WriteForbidden) | ||
|| (requestOptions.path !== "" && typeof err.code === "string" && (err.code === StatusCodes.ConnectionRefused))) { | ||
retryPolicy = endpointDiscoveryRetryPolicy; | ||
@@ -131,2 +134,2 @@ } else if (err.code === StatusCodes.TooManyRequests) { | ||
module.exports = RetryUtility; | ||
} | ||
} |
@@ -71,4 +71,6 @@ /* | ||
var ranges = that._discardGoneRanges(resources); | ||
collectionRoutingMap = CollectionRoutingMapFactory.createCompleteRoutingMap( | ||
resources.map(function (r) { return [r, true]; }), | ||
ranges.map(function (r) { return [r, true]; }), | ||
collectionId); | ||
@@ -96,2 +98,16 @@ | ||
_discardGoneRanges: function (ranges) { | ||
// A split may complete between the readPartitionKeyRanges query page responses. | ||
// We need to discard the old parent ranges which are replaced with new children | ||
// ranges in the later pages. | ||
var parentIds = {}; | ||
ranges.forEach(range => { | ||
if (range.Parents !== undefined && range.Parents != null && Array.isArray(range.Parents)) { | ||
range.Parents.forEach(parentId => { parentIds[parentId] = true; }); | ||
} | ||
}); | ||
var filteredRanges = ranges.filter(range => { return !(range.Id in parentIds); }); | ||
return filteredRanges; | ||
}, | ||
/** | ||
@@ -98,0 +114,0 @@ * Given the query ranges and a collection, invokes the callback on the list of overlapping partition key ranges |
@@ -1,2 +0,2 @@ | ||
/* | ||
/* | ||
The MIT License (MIT) | ||
@@ -53,3 +53,7 @@ Copyright (c) 2017 Microsoft Corporation | ||
"OperationPaused": 1200, | ||
"OperationCancelled": 1201 | ||
"OperationCancelled": 1201, | ||
// Node System Error Codes | ||
"ConnectionRefused": "ECONNREFUSED", | ||
"ConnectionReset": "ECONNRESET" | ||
}; | ||
@@ -56,0 +60,0 @@ |
@@ -14,3 +14,3 @@ { | ||
], | ||
"version": "1.14.4", | ||
"version": "1.14.5", | ||
"author": "Microsoft Corporation", | ||
@@ -17,0 +17,0 @@ "main": "./index.js", |
Sorry, the diff of this file is too big to display
20525
947059
59