documentdb
Advanced tools
Comparing version 1.12.0 to 1.12.1
@@ -31,5 +31,5 @@ /* | ||
if (documentClient.masterKey) { | ||
return this.getAuthorizationTokenUsingMasterKey(verb, resourceId, resourceType, headers, documentClient.masterKey); | ||
return encodeURIComponent(this.getAuthorizationTokenUsingMasterKey(verb, resourceId, resourceType, headers, documentClient.masterKey)); | ||
} else if (documentClient.resourceTokens) { | ||
return this.getAuthorizationTokenUsingResourceTokens(documentClient.resourceTokens, path, resourceId); | ||
return encodeURIComponent(this.getAuthorizationTokenUsingResourceTokens(documentClient.resourceTokens, path, resourceId)); | ||
} | ||
@@ -42,6 +42,6 @@ }, | ||
var text = (verb || "").toLowerCase() + "\n" + | ||
(resourceType || "").toLowerCase() + "\n" + | ||
(resourceId || "") + "\n" + | ||
(headers["x-ms-date"] || "").toLowerCase() + "\n" + | ||
(headers["date"] || "").toLowerCase() + "\n"; | ||
(resourceType || "").toLowerCase() + "\n" + | ||
(resourceId || "") + "\n" + | ||
(headers["x-ms-date"] || "").toLowerCase() + "\n" + | ||
(headers["date"] || "").toLowerCase() + "\n"; | ||
@@ -66,14 +66,24 @@ var body = new Buffer(text, "utf8"); | ||
} | ||
if (resourceTokens[resourceId]) { | ||
if (resourceId && resourceTokens[resourceId]) { | ||
return resourceTokens[resourceId]; | ||
} else { | ||
var pathParts = path && path.split("/") || []; | ||
var resourceTypes = ["dbs", "colls", "docs", "sprocs", "udfs", "triggers", "users", "permissions", "attachments", "media", "conflicts", "offers"]; | ||
// Get the last resource id from the path and get it's token from resourceTokens | ||
for (var i = pathParts.length - 1; i >= 0; i--) { | ||
if (resourceTypes.indexOf(pathParts[i]) === -1) { | ||
if (resourceTokens[pathParts[i]]) { | ||
return resourceTokens[pathParts[i]]; | ||
} | ||
} | ||
} | ||
//minimum valid path /dbs | ||
if (!path || path.length < 4) { | ||
return null; | ||
} | ||
//remove '/' from left and right of path | ||
path = path[0] == '/' ? path.substring(1) : path; | ||
path = path[path.length - 1] == '/' ? path.substring(0, path.length - 1) : path; | ||
var pathSegments = (path && path.split("/")) || []; | ||
//if it's an incomplete path like /dbs/db1/colls/, start from the paretn resource | ||
var index = pathSegments.length % 2 === 0 ? pathSegments.length - 1 : pathSegments.length - 2; | ||
for (; index > 0; index -= 2) { | ||
var id = decodeURI(pathSegments[index]); | ||
if (resourceTokens[id]) { | ||
return resourceTokens[id]; | ||
} | ||
@@ -84,2 +94,3 @@ } | ||
} | ||
}; | ||
@@ -86,0 +97,0 @@ |
@@ -193,3 +193,11 @@ /* | ||
}, | ||
/** @ignore */ | ||
jsonStringifyAndEscapeNonASCII: function (arg) { | ||
// escapes non-ASCII characters as \uXXXX | ||
return JSON.stringify(arg).replace(/[\u0080-\uFFFF]/g, function(m) { | ||
return "\\u" + ("0000" + m.charCodeAt(0).toString(16)).slice(-4); | ||
}); | ||
}, | ||
getHeaders: function (documentClient, defaultHeaders, verb, path, resourceId, resourceType, options, partitionKeyRangeId) { | ||
@@ -273,4 +281,3 @@ | ||
} | ||
headers[Constants.HttpHeaders.PartitionKey] = JSON.stringify(partitionKey); | ||
headers[Constants.HttpHeaders.PartitionKey] = this.jsonStringifyAndEscapeNonASCII(partitionKey); | ||
} | ||
@@ -284,3 +291,3 @@ } | ||
if (documentClient.masterKey || documentClient.resourceTokens) { | ||
headers[Constants.HttpHeaders.Authorization] = encodeURIComponent(AuthHandler.getAuthorizationHeader(documentClient, verb, path, resourceId, resourceType, headers)); | ||
headers[Constants.HttpHeaders.Authorization] = AuthHandler.getAuthorizationHeader(documentClient, verb, path, resourceId, resourceType, headers); | ||
} | ||
@@ -515,4 +522,4 @@ | ||
if (firstId.length !== 8) return true; | ||
var buffer = new Buffer(firstId, "base64"); | ||
if (buffer.length !== 4) return true; | ||
var decodedDataLength = Platform.getDecodedDataLength(firstId); | ||
if (decodedDataLength !== 4) return true; | ||
return false; | ||
@@ -548,6 +555,2 @@ }, | ||
}, | ||
/** @ignore */ | ||
_getUserAgent: function () { | ||
return Platform.getUserAgent(); | ||
} | ||
}; | ||
@@ -554,0 +557,0 @@ //SCRIPT END |
@@ -182,3 +182,3 @@ /* | ||
SDKName: "documentdb-nodejs-sdk", | ||
SDKVersion: "1.12.0", | ||
SDKVersion: "1.12.1", | ||
@@ -185,0 +185,0 @@ DefaultPrecisions: { |
@@ -29,2 +29,3 @@ /* | ||
//SCRIPT START | ||
var ConsistentHashRing = Base.defineClass( | ||
@@ -31,0 +32,0 @@ /** |
@@ -29,2 +29,3 @@ /* | ||
//SCRIPT START | ||
var HashPartitionResolver = Base.defineClass( | ||
@@ -31,0 +32,0 @@ /** |
@@ -28,2 +28,3 @@ /* | ||
//SCRIPT START | ||
var MurmurHash = Base.defineClass( | ||
@@ -30,0 +31,0 @@ undefined, |
@@ -27,5 +27,8 @@ /* | ||
var Base = require("./base"), | ||
Regexes = require("./constants").RegularExpressions; | ||
Constants = require("./constants"); | ||
var Regexes = Constants.RegularExpressions, | ||
ResourceTypes = Constants.ResourceTypes; | ||
//SCRIPT START | ||
@@ -73,2 +76,18 @@ var Helper = Base.defineClass( | ||
}, | ||
getResourceIdFromPath: function(resourcePath) { | ||
if (!resourcePath || typeof resourcePath !== "string") { | ||
return null; | ||
} | ||
var trimmedPath = this.trimSlashFromLeftAndRight(resourcePath); | ||
var pathSegments = trimmedPath.split('/'); | ||
//number of segments of a path must always be even | ||
if (pathSegments.length % 2 !== 0) { | ||
return null; | ||
} | ||
return pathSegments[pathSegments.length - 1]; | ||
} | ||
@@ -75,0 +94,0 @@ } |
@@ -29,6 +29,16 @@ /* | ||
var util = require("util"); | ||
var semaphore = require("semaphore"); | ||
var Platform = { | ||
/** @ignore */ | ||
getPlatformDefaultHeaders: function () { | ||
var defaultHeaders = {}; | ||
defaultHeaders[Constants.HttpHeaders.UserAgent] = Platform.getUserAgent(); | ||
return defaultHeaders; | ||
}, | ||
/** @ignore */ | ||
getDecodedDataLength: function (encodedData) { | ||
var buffer = new Buffer(encodedData, "base64"); | ||
return buffer.length; | ||
}, | ||
/** @ignore */ | ||
getUserAgent: function () { | ||
@@ -35,0 +45,0 @@ // gets the user agent in the following format |
@@ -28,4 +28,6 @@ /* | ||
, DocumentProducer = require("./documentProducer") | ||
, OrderByDocumentProducerComparator = DocumentProducer.OrderByDocumentProducerComparator; | ||
//SCRIPT START | ||
var AverageAggregator = Base.defineClass( | ||
@@ -116,3 +118,3 @@ | ||
this.value = undefined; | ||
this.comparer = new DocumentProducer.OrderByDocumentProducerComparator("Ascending"); | ||
this.comparer = new OrderByDocumentProducerComparator("Ascending"); | ||
}, | ||
@@ -159,3 +161,3 @@ { | ||
this.value = undefined; | ||
this.comparer = new DocumentProducer.OrderByDocumentProducerComparator("Ascending"); | ||
this.comparer = new OrderByDocumentProducerComparator("Ascending"); | ||
}, | ||
@@ -229,3 +231,3 @@ { | ||
); | ||
//SCRIPT END | ||
//SCRIPT END | ||
@@ -238,2 +240,2 @@ if (typeof exports !== "undefined") { | ||
exports.SumAggregator = SumAggregator; | ||
} | ||
} |
@@ -244,3 +244,3 @@ /* | ||
this.sortOrder = sortOrder; | ||
this.targetPartitionKeyRangeDocProdComparator = new DocumentProducer.createTargetPartitionKeyRangeComparator(); | ||
this.targetPartitionKeyRangeDocProdComparator = DocumentProducer.createTargetPartitionKeyRangeComparator(); | ||
@@ -247,0 +247,0 @@ this._typeOrdComparator = Object.freeze({ |
@@ -29,2 +29,8 @@ /* | ||
var AverageAggregator = aggregators.AverageAggregator | ||
, CountAggregator = aggregators.CountAggregator | ||
, MaxAggregator = aggregators.MaxAggregator | ||
, MinAggregator = aggregators.MinAggregator | ||
, SumAggregator = aggregators.SumAggregator; | ||
//SCRIPT START | ||
@@ -31,0 +37,0 @@ var OrderByEndpointComponent = Base.defineClass( |
@@ -31,15 +31,15 @@ /* | ||
, SmartRoutingMapProvider = require("../routing/smartRoutingMapProvider") | ||
, CollectionRoutingMap = require("../routing/inMemoryCollectionRoutingMap") | ||
, InMemoryCollectionRoutingMap = require("../routing/inMemoryCollectionRoutingMap") | ||
, DocumentProducer = require("./documentProducer") | ||
, QueryExecutionInfoParser = require("./partitionedQueryExecutionContextInfoParser") | ||
, PartitionedQueryExecutionContextInfoParser = require("./partitionedQueryExecutionContextInfoParser") | ||
, bs = require("binary-search-bounds") | ||
, HeaderUtils = require("./headerUtils") | ||
, semaphore = require("semaphore") | ||
, assert = require('assert'); | ||
var QueryRange = CollectionRoutingMap.QueryRange; | ||
var FormatPlaceHolder = "{documentdb-formattableorderbyquery-filter}"; | ||
var QueryRange = InMemoryCollectionRoutingMap.QueryRange; | ||
var _PartitionKeyRange = InMemoryCollectionRoutingMap._PartitionKeyRange; | ||
var PartitionKeyRangeConstants = CollectionRoutingMap._PartitionKeyRange; | ||
//SCRIPT START | ||
//SCRIPT START | ||
var ParallelQueryExecutionContext = Base.defineClass( | ||
@@ -60,3 +60,3 @@ /** | ||
*/ | ||
function (documentclient, collectionLink, query, options, partitionedQueryExecutionInfo) { | ||
function (documentclient, collectionLink, query, options, partitionedQueryExecutionInfo) { | ||
this.documentclient = documentclient; | ||
@@ -70,3 +70,3 @@ this.collectionLink = collectionLink; | ||
this.routingProvider = new SmartRoutingMapProvider(this.documentclient); | ||
this.sortOrders = QueryExecutionInfoParser.parseOrderBy(this.paritionedQueryExecutionInfo); | ||
this.sortOrders = PartitionedQueryExecutionContextInfoParser.parseOrderBy(this.paritionedQueryExecutionInfo); | ||
@@ -89,3 +89,3 @@ if (Array.isArray(this.sortOrders) && this.sortOrders.length > 0) { | ||
this.state = ParallelQueryExecutionContext.STATES.started; | ||
this.sem = require('semaphore')(1); | ||
this.sem = new semaphore(1); | ||
@@ -100,3 +100,2 @@ this.requestContinuation = options ? options.continuation : null; | ||
that._onTargetPartitionRanges(function (err, targetPartitionRanges) { | ||
that.waitingForInternalExcecutionContexts = targetPartitionRanges.length; | ||
if (err) { | ||
@@ -108,2 +107,4 @@ that.err = err; | ||
} | ||
that.waitingForInternalExcecutionContexts = targetPartitionRanges.length; | ||
var maxDegreeOfParallelism = options.maxDegreeOfParallelism || 1; | ||
@@ -116,3 +117,4 @@ | ||
} | ||
var parallelismSem = require('semaphore')(Math.max(maxDegreeOfParallelism, 1)); | ||
var parallelismSem = semaphore(Math.max(maxDegreeOfParallelism, 1)); | ||
@@ -196,8 +198,8 @@ var targetPartitionQueryExecutionContextList = []; | ||
var startRange = {}; | ||
startRange[PartitionKeyRangeConstants.MinInclusive] = suppliedCompositeContinuationToken.range.min; | ||
startRange[PartitionKeyRangeConstants.MaxExclusive] = suppliedCompositeContinuationToken.range.max; | ||
startRange[_PartitionKeyRange.MinInclusive] = suppliedCompositeContinuationToken.range.min; | ||
startRange[_PartitionKeyRange.MaxExclusive] = suppliedCompositeContinuationToken.range.max; | ||
var vbCompareFunction = function (x, y) { | ||
if (x[PartitionKeyRangeConstants.MinInclusive] > y[PartitionKeyRangeConstants.MinInclusive]) return 1; | ||
if (x[PartitionKeyRangeConstants.MinInclusive] < y[PartitionKeyRangeConstants.MinInclusive]) return -1; | ||
if (x[_PartitionKeyRange.MinInclusive] > y[_PartitionKeyRange.MinInclusive]) return 1; | ||
if (x[_PartitionKeyRange.MinInclusive] < y[_PartitionKeyRange.MinInclusive]) return -1; | ||
@@ -349,3 +351,3 @@ return 0; | ||
*/ | ||
current: function (callback) { | ||
current: function (callback) { | ||
if (this.err) { | ||
@@ -378,3 +380,3 @@ return callback(this.err, undefined, that._getAndResetActiveResponseHeaders()); | ||
*/ | ||
hasMoreResults: function () { | ||
hasMoreResults: function () { | ||
return !(this.state === ParallelQueryExecutionContext.STATES.ended || this.err !== undefined); | ||
@@ -464,4 +466,4 @@ }, | ||
var min = documentProducer.targetPartitionKeyRange[PartitionKeyRangeConstants.MinInclusive]; | ||
var max = documentProducer.targetPartitionKeyRange[PartitionKeyRangeConstants.MaxExclusive]; | ||
var min = documentProducer.targetPartitionKeyRange[_PartitionKeyRange.MinInclusive]; | ||
var max = documentProducer.targetPartitionKeyRange[_PartitionKeyRange.MaxExclusive]; | ||
var range = { | ||
@@ -569,3 +571,3 @@ 'min': min, | ||
// creates target partition range Query Execution Context | ||
var rewrittenQuery = QueryExecutionInfoParser.parseRewrittenQuery(this.paritionedQueryExecutionInfo); | ||
var rewrittenQuery = PartitionedQueryExecutionContextInfoParser.parseRewrittenQuery(this.paritionedQueryExecutionInfo); | ||
var query = this.query; | ||
@@ -575,2 +577,4 @@ if (typeof (query) === 'string') { | ||
} | ||
var FormatPlaceHolder = "{documentdb-formattableorderbyquery-filter}"; | ||
if (rewrittenQuery) { | ||
@@ -595,3 +599,3 @@ query = JSON.parse(JSON.stringify(query)); | ||
// invokes the callback when the target partition ranges are ready | ||
var parsedRanges = QueryExecutionInfoParser.parseQueryRanges(this.paritionedQueryExecutionInfo); | ||
var parsedRanges = PartitionedQueryExecutionContextInfoParser.parseQueryRanges(this.paritionedQueryExecutionInfo); | ||
var queryRanges = parsedRanges.map(function (item) { return QueryRange.parseFromDict(item); }); | ||
@@ -607,2 +611,3 @@ return this.routingProvider.getOverlappingRanges(callback, this.collectionLink, queryRanges); | ||
); | ||
//SCRIPT END | ||
@@ -609,0 +614,0 @@ |
@@ -63,3 +63,3 @@ /* | ||
} | ||
assert(Array.isArray(path), | ||
assert.ok(Array.isArray(path), | ||
util.format("%s is expected to be an array", JSON.stringify(path))); | ||
@@ -66,0 +66,0 @@ for (var index = 0; index < path.length; index++) { |
@@ -30,5 +30,10 @@ /* | ||
, assert = require("assert") | ||
, QueryExecutionInfoParser = require("./partitionedQueryExecutionContextInfoParser") | ||
, PartitionedQueryExecutionContextInfoParser = require("./partitionedQueryExecutionContextInfoParser") | ||
, HeaderUtils = require("./headerUtils"); | ||
var AggregateEndpointComponent = endpointComponent.AggregateEndpointComponent | ||
, OrderByEndpointComponent = endpointComponent.OrderByEndpointComponent | ||
, TopEndpointComponent = endpointComponent.TopEndpointComponent; | ||
//SCRIPT START | ||
@@ -53,15 +58,15 @@ var PipelinedQueryExecutionContext = Base.defineClass( | ||
} | ||
var orderBy = QueryExecutionInfoParser.parseOrderBy(partitionedQueryExecutionInfo); | ||
var orderBy = PartitionedQueryExecutionContextInfoParser.parseOrderBy(partitionedQueryExecutionInfo); | ||
if (Array.isArray(orderBy) && orderBy.length > 0) { | ||
this.endpoint = new endpointComponent.OrderByEndpointComponent(this.endpoint); | ||
this.endpoint = new OrderByEndpointComponent(this.endpoint); | ||
} | ||
var aggregates = QueryExecutionInfoParser.parseAggregates(partitionedQueryExecutionInfo); | ||
var aggregates = PartitionedQueryExecutionContextInfoParser.parseAggregates(partitionedQueryExecutionInfo); | ||
if (Array.isArray(aggregates) && aggregates.length > 0) { | ||
this.endpoint = new endpointComponent.AggregateEndpointComponent(this.endpoint, aggregates); | ||
this.endpoint = new AggregateEndpointComponent(this.endpoint, aggregates); | ||
} | ||
var top = QueryExecutionInfoParser.parseTop(partitionedQueryExecutionInfo); | ||
var top = PartitionedQueryExecutionContextInfoParser.parseTop(partitionedQueryExecutionInfo); | ||
if (typeof (top) === 'number') { | ||
this.endpoint = new endpointComponent.TopEndpointComponent(this.endpoint, top); | ||
this.endpoint = new TopEndpointComponent(this.endpoint, top); | ||
} | ||
@@ -68,0 +73,0 @@ }, |
@@ -86,3 +86,3 @@ /* | ||
assert(!Array.isArray(this.resourceLink) || this.resourceLink.length === 1, | ||
assert.ok(!Array.isArray(this.resourceLink) || this.resourceLink.length === 1, | ||
"for top/orderby exactly one collectionLink is required"); | ||
@@ -89,0 +89,0 @@ |
@@ -28,3 +28,3 @@ /* | ||
Constants = require("./constants"), | ||
QueryExecutionContext = require("./queryExecutionContext/proxyQueryExecutionContext"); | ||
ProxyQueryExecutionContext = require("./queryExecutionContext/proxyQueryExecutionContext"); | ||
@@ -51,3 +51,2 @@ //SCRIPT START | ||
this.queryExecutionContext = this._createQueryExecutionContext(); | ||
}, | ||
@@ -68,8 +67,8 @@ { | ||
/** | ||
* Execute a provided function on the next element in the QueryIterator. | ||
* @memberof QueryIterator | ||
* @instance | ||
* @param {callback} callback - Function to execute for each element. the function takes two parameters error, element. | ||
*/ | ||
/** | ||
* Execute a provided function on the next element in the QueryIterator. | ||
* @memberof QueryIterator | ||
* @instance | ||
* @param {callback} callback - Function to execute for each element. the function takes two parameters error, element. | ||
*/ | ||
nextItem: function (callback) { | ||
@@ -121,3 +120,3 @@ this.queryExecutionContext.nextItem(callback); | ||
this.queryExecutionContext.fetchMore(function(err, resources, responseHeaders) { | ||
if(err) { | ||
if (err) { | ||
return callback(err, undefined, responseHeaders); | ||
@@ -140,3 +139,3 @@ } | ||
/** @ignore */ | ||
_toArrayImplementation: function(callback){ | ||
_toArrayImplementation: function(callback) { | ||
var that = this; | ||
@@ -153,9 +152,12 @@ | ||
if (resource === undefined) { | ||
// no more results | ||
return callback(undefined, that.toArrayTempResources, that.toArrayLastResHeaders); | ||
} | ||
} | ||
that.toArrayTempResources = that.toArrayTempResources.concat(resource); | ||
that._toArrayImplementation(callback); | ||
that.toArrayTempResources.push(resource); | ||
setImmediate(function () { | ||
that._toArrayImplementation(callback); | ||
}); | ||
}); | ||
@@ -183,3 +185,5 @@ }, | ||
// recursively call itself to iterate to the remaining elements | ||
that._forEachImplementation(callback); | ||
setImmediate(function () { | ||
that._forEachImplementation(callback); | ||
}); | ||
}); | ||
@@ -190,3 +194,3 @@ }, | ||
_createQueryExecutionContext: function () { | ||
return new QueryExecutionContext(this.documentclient, this.query, this.options, this.fetchFunctions, this.resourceLink); | ||
return new ProxyQueryExecutionContext(this.documentclient, this.query, this.options, this.fetchFunctions, this.resourceLink); | ||
} | ||
@@ -193,0 +197,0 @@ } |
@@ -119,21 +119,2 @@ /* | ||
/** @ignore */ | ||
_toArrayImplementation: function(callback){ | ||
var that = this; | ||
if (this._canFetchMore()) { | ||
this._fetchMore(function(err, resources, headers){ | ||
if(err) { | ||
return callback(err, undefined, headers); | ||
} | ||
that.resHeaders = headers; | ||
that.resources = that.resources.concat(resources); | ||
that._toArrayImplementation(callback); | ||
}); | ||
} else { | ||
this._state = this._states.ended; | ||
callback(undefined, this.resources, this.resHeaders); | ||
} | ||
}, | ||
/** @ignore */ | ||
@@ -140,0 +121,0 @@ _toString: function () { |
@@ -27,9 +27,9 @@ /* | ||
var Documents = require("./documents") | ||
, Constants = require("./constants") | ||
, https = require("https") | ||
, url = require("url") | ||
, querystring = require("querystring") | ||
, RetryUtility = require("./retryUtility") | ||
// Dedicated Agent for socket pooling | ||
, keepAliveAgent = new https.Agent({ keepAlive: true, maxSockets: Infinity }); | ||
, Constants = require("./constants") | ||
, https = require("https") | ||
, url = require("url") | ||
, querystring = require("querystring") | ||
, RetryUtility = require("./retryUtility") | ||
// Dedicated Agent for socket pooling | ||
, keepAliveAgent = new https.Agent({ keepAlive: true, maxSockets: Infinity }); | ||
@@ -40,2 +40,10 @@ //---------------------------------------------------------------------------- | ||
function javaScriptFriendlyJSONStringify(s) { | ||
// two line terminators (Line separator and Paragraph separator) are not needed to be escaped in JSON | ||
// but are needed to be escaped in JavaScript. | ||
return JSON.stringify(s). | ||
replace(/\u2028/g, '\\u2028'). | ||
replace(/\u2029/g, '\\u2029'); | ||
} | ||
function bodyFromData(data) { | ||
@@ -45,3 +53,3 @@ if (data.pipe) return data; | ||
if (typeof data === "string") return data; | ||
if (typeof data === "object") return JSON.stringify(data); | ||
if (typeof data === "object") return javaScriptFriendlyJSONStringify(data); | ||
return undefined; | ||
@@ -57,3 +65,3 @@ } | ||
var isMedia = ( requestOptions.path.indexOf("media") > -1 ); | ||
var isMedia = (requestOptions.path.indexOf("//media") === 0); | ||
@@ -60,0 +68,0 @@ var httpsRequest = https.request(requestOptions, function(response) { |
@@ -149,3 +149,3 @@ /* | ||
// that's an error | ||
assert(index >=0, "error in collection routing map, queried partition key is less than the start range."); | ||
assert.ok(index >= 0, "error in collection routing map, queried partition key is less than the start range."); | ||
@@ -196,6 +196,6 @@ return this._orderedPartitionKeyRanges[index]; | ||
var minIndex = bs.le(sortedLow, { v: queryRange.min, b: !queryRange.isMinInclusive }, this._vbCompareFunction); | ||
assert(minIndex >= 0, "error in collection routing map, queried value is less than the start range."); | ||
assert.ok(minIndex >= 0, "error in collection routing map, queried value is less than the start range."); | ||
var maxIndex = bs.ge(sortedHigh, { v: queryRange.max, b: queryRange.isMaxInclusive }, this._vbCompareFunction); | ||
assert(maxIndex < sortedHigh.length, "error in collection routing map, queried value is greater than the end range."); | ||
assert.ok(maxIndex < sortedHigh.length, "error in collection routing map, queried value is greater than the end range."); | ||
@@ -202,0 +202,0 @@ // the for loop doesn't invoke any async callback |
@@ -27,5 +27,6 @@ /* | ||
var Base = require("../base") | ||
, CollectionRoutingMap = require("./inMemoryCollectionRoutingMap"); | ||
, InMemoryCollectionRoutingMap = require("./inMemoryCollectionRoutingMap") | ||
, semaphore = require("semaphore"); | ||
var CollectionRoutingMapFactory = CollectionRoutingMap.CollectionRoutingMapFactory; | ||
var CollectionRoutingMapFactory = InMemoryCollectionRoutingMap.CollectionRoutingMapFactory; | ||
@@ -45,3 +46,3 @@ //SCRIPT START | ||
this.collectionRoutingMapByCollectionId = {}; | ||
this.sem = require("semaphore")(1); | ||
this.sem = semaphore(1); | ||
}, | ||
@@ -48,0 +49,0 @@ { |
@@ -28,9 +28,9 @@ /* | ||
, assert = require("assert") | ||
, CollectionRoutingMap = require("./inMemoryCollectionRoutingMap") | ||
, InMemoryCollectionRoutingMap = require("./inMemoryCollectionRoutingMap") | ||
, PartitionKeyRangeCache = require("./partitionKeyRangeCache") | ||
, util = require("util"); | ||
var CollectionRoutingMapFactory = CollectionRoutingMap.CollectionRoutingMapFactory; | ||
var QueryRange = CollectionRoutingMap.QueryRange; | ||
var _PartitionKeyRange = CollectionRoutingMap._PartitionKeyRange; | ||
var CollectionRoutingMapFactory = InMemoryCollectionRoutingMap.CollectionRoutingMapFactory; | ||
var QueryRange = InMemoryCollectionRoutingMap.QueryRange; | ||
var _PartitionKeyRange = InMemoryCollectionRoutingMap._PartitionKeyRange; | ||
@@ -145,3 +145,3 @@ //SCRIPT START | ||
var overlappingRanges = collectionRoutingMap.getOverlappingRanges(queryRange); | ||
assert(overlappingRanges.length > 0, util.format("error: returned overlapping ranges for queryRange %s is empty", queryRange)); | ||
assert.ok(overlappingRanges.length > 0, util.format("error: returned overlapping ranges for queryRange %s is empty", queryRange)); | ||
partitionKeyRanges = partitionKeyRanges.concat(overlappingRanges); | ||
@@ -152,3 +152,3 @@ | ||
// the overlapping ranges must contain the requested range | ||
assert(that._stringCompare(currentProvidedRange.max, lastKnownTargetRange.max) <= 0, | ||
assert.ok(that._stringCompare(currentProvidedRange.max, lastKnownTargetRange.max) <= 0, | ||
util.format("error: returned overlapping ranges %s does not contain the requested range %s", overlappingRanges, queryRange)); | ||
@@ -155,0 +155,0 @@ |
@@ -174,3 +174,3 @@ /* | ||
/** | ||
* @summary | ||
* @summary Given a database, collection and conflict id, this creates a conflict link. | ||
* @param {string} databaseId -The database Id | ||
@@ -226,2 +226,2 @@ * @param {string} collectionId -The collection Id | ||
exports.UriFactory = UriFactory; | ||
} | ||
} |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "1.12.0", | ||
"version": "1.12.1", | ||
"author": "Microsoft Corporation", | ||
@@ -20,2 +20,3 @@ "main": "./index.js", | ||
"devDependencies": { | ||
"@types/node": "^8.0.7", | ||
"eslint": "*", | ||
@@ -22,0 +23,0 @@ "grunt": "^0.4.5", |
Sorry, the diff of this file is too big to display
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
812026
17737
8
40