documentdb
Advanced tools
Comparing version 1.14.5 to 1.15.0
@@ -193,3 +193,3 @@ /* | ||
SDKName: "documentdb-nodejs-sdk", | ||
SDKVersion: "1.14.5", | ||
SDKVersion: "1.15.0", | ||
@@ -196,0 +196,0 @@ DefaultPrecisions: { |
@@ -27,3 +27,4 @@ /* | ||
var Base = require("../base") | ||
, aggregators = require('./aggregators'); | ||
, aggregators = require('./aggregators') | ||
, HeaderUtils = require("./headerUtils"); | ||
@@ -191,2 +192,3 @@ var AverageAggregator = aggregators.AverageAggregator | ||
this.toArrayTempResources = []; | ||
this.aggregatedHeaders = HeaderUtils.getInitialHeader(); | ||
this.aggregateValues = []; | ||
@@ -196,5 +198,5 @@ this.aggregateValuesIndex = -1; | ||
this._getQueryResults(function (err, resources) { | ||
this._getQueryResults(function (err, resources, headers) { | ||
if (err) { | ||
return callback(err, undefined); | ||
return callback(err, undefined, headers); | ||
} | ||
@@ -218,3 +220,3 @@ | ||
return callback(undefined, that.aggregateValues); | ||
return callback(undefined, that.aggregateValues, headers); | ||
}); | ||
@@ -230,5 +232,5 @@ }, | ||
this.executionContext.nextItem(function (err, item) { | ||
this.executionContext.nextItem(function (err, item, headers) { | ||
if (err) { | ||
return callback(err, undefined); | ||
return callback(err, undefined, headers); | ||
} | ||
@@ -238,6 +240,7 @@ | ||
// no more results | ||
return callback(undefined, that.toArrayTempResources); | ||
return callback(undefined, that.toArrayTempResources, that.aggregatedHeaders); | ||
} | ||
that.toArrayTempResources = that.toArrayTempResources.concat(item); | ||
HeaderUtils.mergeHeaders(that.aggregatedHeaders, headers); | ||
return that._getQueryResults(callback); | ||
@@ -256,5 +259,5 @@ }); | ||
var that = this; | ||
var _nextItem = function (err, resources) { | ||
var _nextItem = function (err, resources, headers) { | ||
if (err || that.aggregateValues.length <= 0) { | ||
return callback(undefined, undefined); | ||
return callback(undefined, undefined, headers); | ||
} | ||
@@ -266,8 +269,8 @@ | ||
return callback(undefined, resource); | ||
return callback(undefined, resource, headers); | ||
}; | ||
if (that.aggregateValues == undefined) { | ||
that._getAggregateResult(function (err, resources) { | ||
return _nextItem(err, resources); | ||
that._getAggregateResult(function (err, resources, headers) { | ||
return _nextItem(err, resources, headers); | ||
}); | ||
@@ -289,8 +292,8 @@ } | ||
if (that.aggregateValues == undefined) { | ||
that._getAggregateResult(function (err, resources) { | ||
return callback(undefined, that.aggregateValues[that.aggregateValuesIndex]); | ||
that._getAggregateResult(function (err, resources, headers) { | ||
return callback(undefined, that.aggregateValues[that.aggregateValuesIndex], headers); | ||
}); | ||
} | ||
else { | ||
return callback(undefined, that.aggregateValues[that.aggregateValuesIndex]); | ||
return callback(undefined, that.aggregateValues[that.aggregateValuesIndex], that.aggregatedHeaders); | ||
} | ||
@@ -297,0 +300,0 @@ }, |
@@ -38,3 +38,4 @@ /* | ||
, SubStatusCodes = require("../statusCodes").SubStatusCodes | ||
, assert = require('assert'); | ||
, assert = require('assert') | ||
, log = require("../log")("query"); | ||
@@ -96,4 +97,6 @@ var QueryRange = InMemoryCollectionRoutingMap.QueryRange; | ||
if (err) { | ||
log.error("[_onTargetPartitionRanges] Error: %o", err); | ||
that.err = err; | ||
// release the lock | ||
log.debug("[_onTargetPartitionRanges] semaphore released. Count before release: %d", sem.queue.length); | ||
that.sem.leave(); | ||
@@ -136,3 +139,5 @@ return; | ||
} catch (e) { | ||
log.error("[_onTargetPartitionRanges] Error filtering partition key ranges: %o", e); | ||
that.err = e; | ||
log.debug("[_onTargetPartitionRanges] semaphore released. Count before release: %d", that.sem.queue.length); | ||
that.sem.leave(); | ||
@@ -150,3 +155,3 @@ } | ||
that._createTargetPartitionQueryExecutionContext(partitionTargetRange) | ||
); | ||
); | ||
} | ||
@@ -179,2 +184,3 @@ ); | ||
} finally { | ||
log.debug("[createDocumentProducersAndFillUpPriorityQueueFunc] parallelism semaphore released. Count before release: %d", parallelismSem.queue.length); | ||
parallelismSem.leave(); | ||
@@ -185,2 +191,3 @@ that._decrementInitiationLock(); | ||
} | ||
log.debug("[createDocumentProducersAndFillUpPriorityQueueFunc] parallelism semaphore taken. Count before taking: %d", parallelismSem.queue.length); | ||
parallelismSem.take(throttledFunc); | ||
@@ -191,2 +198,3 @@ } | ||
}; | ||
log.debug("[createDocumentProducersAndFillUpPriorityQueueFunc] semaphore taken. Count before taking: %d", this.sem.queue.length); | ||
this.sem.take(createDocumentProducersAndFillUpPriorityQueueFunc); | ||
@@ -225,2 +233,3 @@ }, | ||
if (this.waitingForInternalExecutionContexts === 0) { | ||
log.debug("[createDocumentProducersAndFillUpPriorityQueueFunc] semaphore released. Count before release: %d", this.sem.queue.length); | ||
this.sem.leave(); | ||
@@ -280,3 +289,4 @@ if (this.orderByPQ.size() === 0) { | ||
that.err = err; | ||
return; | ||
log.error("[_repairExecutionContext] Error: %o", that.err); | ||
return originFunction(); | ||
} | ||
@@ -298,3 +308,4 @@ var replacementDocumentProducers = []; | ||
that.err = err; | ||
return; | ||
log.error("[_repairExecutionContext] Error: %o", that.err); | ||
return originFunction(); | ||
} else if (afterItem === undefined) { | ||
@@ -347,2 +358,3 @@ // no more results left in this document producer, so we don't enqueue it | ||
if (that._needPartitionKeyRangeCacheRefresh(err)) { | ||
log.info("[_repairExecutionContextIfNeeded] Split occurred. Attempting to repair.") | ||
// Split has happened so we need to repair execution context before continueing | ||
@@ -353,3 +365,4 @@ return that._repairExecutionContext(ifCallback); | ||
that.err = err; | ||
return; | ||
log.error("[_repairExecutionContextIfNeeded] Error: %o", that.err); | ||
return ifCallback(); | ||
} | ||
@@ -376,2 +389,3 @@ } else { | ||
var that = this; | ||
log.debug("[nextItem] semaphore taken. Count before taking: %d", this.sem.queue.length); | ||
this.sem.take(function () { | ||
@@ -381,2 +395,3 @@ // NOTE: lock must be released before invoking quitting | ||
// release the lock before invoking callback | ||
log.debug("[nextItem] Error occurred. Semaphore released. Count before release: %d", that.sem.queue.length); | ||
that.sem.leave(); | ||
@@ -391,2 +406,3 @@ // if there is a prior error return error | ||
// release the lock before invoking callback | ||
log.debug("[nextItem] Queue is empty. Semaphore released. Count before release: %d", that.sem.queue.length); | ||
that.sem.leave(); | ||
@@ -398,2 +414,3 @@ return callback(undefined, undefined, that._getAndResetActiveResponseHeaders()); | ||
// Release the semaphore to avoid deadlock | ||
log.debug("[nextItem] IfCallback called. Semaphore released. Count before release: %d", that.sem.queue.length); | ||
that.sem.leave(); | ||
@@ -411,2 +428,3 @@ // Reexcute the function | ||
// release the lock before invoking callback | ||
log.debug("[nextItem] Error occurred in elseCallback. Semaphore released. Count before release: %d", that.sem.queue.length); | ||
that.sem.leave(); | ||
@@ -428,3 +446,5 @@ return callback(that.err, undefined, that._getAndResetActiveResponseHeaders()); | ||
// release the lock before invoking callback | ||
log.debug("[nextItem] Error occurred fetching next item. Semaphore released. Count before release: %d", that.sem.queue.length); | ||
that.sem.leave(); | ||
log.error("[nextItem] Error occurred fetching next item. Error: %o", that.err); | ||
return callback(that.err, undefined, that._getAndResetActiveResponseHeaders()); | ||
@@ -442,3 +462,5 @@ } | ||
// release the lock before invoking callback | ||
log.debug("[nextItem] Error occurred. Item was undefined. Semaphore released. Count before release: %d", that.sem.queue.length); | ||
that.sem.leave(); | ||
log.error("[nextItem] Error occurred. Item was undefined. Error: %o: ", that.err); | ||
return callback(that.err, undefined, that._getAndResetActiveResponseHeaders()); | ||
@@ -480,2 +502,3 @@ } | ||
// release the lock before returning | ||
log.debug("[nextItem] Completed current. Semaphore released. Count before release: %d", that.sem.queue.length); | ||
that.sem.leave(); | ||
@@ -505,2 +528,3 @@ } | ||
var that = this; | ||
log.debug("[current] Semaphore taken. Count before being taken: %d", this.sem.queue.length); | ||
this.sem.take(function () { | ||
@@ -528,2 +552,3 @@ try { | ||
} finally { | ||
log.debug("[current] Semaphore released. Count before release: %d", that.sem.queue.length); | ||
that.sem.leave(); | ||
@@ -530,0 +555,0 @@ } |
@@ -30,3 +30,4 @@ /* | ||
, PartitionedQueryExecutionContextInfoParser = require("./partitionedQueryExecutionContextInfoParser") | ||
, HeaderUtils = require("./headerUtils"); | ||
, HeaderUtils = require("./headerUtils") | ||
, log = require("../log")("query"); | ||
@@ -69,2 +70,3 @@ var ParallelQueryExecutionContext = require("./parallelQueryExecutionContext") | ||
// Need to wrap orderby execution context in endpoint component, since the data is nested as a "payload" property. | ||
log.info("[PipelinedQueryExecutionContext] Using order by component and execution context"); | ||
this.endpoint = new OrderByEndpointComponent( | ||
@@ -78,2 +80,3 @@ new OrderByQueryExecutionContext( | ||
} else { | ||
log.info("[PipelinedQueryExecutionContext] Using parallel execution context"); | ||
this.endpoint = new ParallelQueryExecutionContext( | ||
@@ -90,2 +93,3 @@ this.documentclient, | ||
if (Array.isArray(aggregates) && aggregates.length > 0) { | ||
log.info("[PipelinedQueryExecutionContext] Using aggregate component: %o", aggregates); | ||
this.endpoint = new AggregateEndpointComponent(this.endpoint, aggregates); | ||
@@ -97,2 +101,3 @@ } | ||
if (typeof (top) === 'number') { | ||
log.info("[PipelinedQueryExecutionContext] Using top component: %d", top); | ||
this.endpoint = new TopEndpointComponent(this.endpoint, top); | ||
@@ -99,0 +104,0 @@ } |
@@ -32,2 +32,3 @@ /* | ||
, assert = require("assert") | ||
, log = require("../log")("query") | ||
@@ -70,4 +71,6 @@ //SCRIPT START | ||
that.queryExecutionContext = that._createPipelinedExecutionContext(partitionedExecutionInfo); | ||
log.info("[nextItem] Received query plan back on response. Creating pipelinedExecutionContext. Query Info: %o", partitionedExecutionInfo); | ||
return that.nextItem(callback); | ||
} else { | ||
log.error("[nextItem] Error: %o", err); | ||
return callback(err, undefined, headers); | ||
@@ -74,0 +77,0 @@ } |
@@ -31,3 +31,4 @@ /* | ||
, querystring = require("querystring") | ||
, RetryUtility = require("./retryUtility"); | ||
, RetryUtility = require("./retryUtility") | ||
, log = require("./log")("request"); | ||
@@ -58,2 +59,3 @@ //---------------------------------------------------------------------------- | ||
function onTimeout() { | ||
log.error("[onTimeout] Timeout occurred") | ||
httpsRequest.abort(); | ||
@@ -60,0 +62,0 @@ } |
@@ -33,3 +33,4 @@ /* | ||
StatusCodes = require("./statusCodes").StatusCodes, | ||
SubStatusCodes = require("./statusCodes").SubStatusCodes; | ||
SubStatusCodes = require("./statusCodes").SubStatusCodes, | ||
log = require("./log")("request"); | ||
@@ -72,2 +73,3 @@ //SCRIPT START | ||
var that = this; | ||
log.debug("[apply] Request Options: %o", requestOptions); | ||
var httpsRequest = createRequestObjectFunc(connectionPolicy, requestOptions, function (err, response, headers) { | ||
@@ -93,2 +95,3 @@ if (err) { | ||
headers[Constants.ThrottleRetryWaitTimeInMs] = resourceThrottleRetryPolicy.cummulativeWaitTimeinMilliseconds; | ||
log.error("[apply] Cannot retry, %o", err); | ||
return callback(err, response, headers); | ||
@@ -95,0 +98,0 @@ } else { |
@@ -14,3 +14,3 @@ { | ||
], | ||
"version": "1.14.5", | ||
"version": "1.15.0", | ||
"author": "Microsoft Corporation", | ||
@@ -38,8 +38,9 @@ "main": "./index.js", | ||
"big-integer": "^1.6.25", | ||
"binary-search-bounds": "2.0.3", | ||
"debug": "^4.1.0", | ||
"int64-buffer": "^0.1.9", | ||
"binary-search-bounds": "2.0.3", | ||
"priorityqueuejs": "1.0.0", | ||
"semaphore": "1.0.5", | ||
"underscore": "1.8.3", | ||
"tunnel": "0.0.5" | ||
"tunnel": "0.0.5", | ||
"underscore": "1.8.3" | ||
}, | ||
@@ -46,0 +47,0 @@ "repository": { |
@@ -54,2 +54,12 @@ # Microsoft Azure Cosmos DB Node.js SDK | ||
## Traces | ||
The `documentdb` module support tracing via the [`debug`](https://www.npmjs.com/package/debug) module. Traces will go to stderr by default. To enable tracing, you can set the `DEBUG` environment variable in a variety of ways. | ||
- `documentdb:*` will output all logs. This can be verbose, so it's helpful to filter on log level. | ||
- `documentdb:<log level>:*` will output all traces for a given `<log level>` value. The valid levels are `error`, `warn`, `info`, and `debug`. | ||
- `documentdb:<log level>:<component>` will output all traces for a given `<log level>` and `<component>`. The valid components are `request` and `query`. | ||
You can combine filters via `,`. So if you wanted to have error info for all components, but only debug info for `query`, then you'd use `documentdb:error:*,documentdb:debug:query`. | ||
## Tests | ||
@@ -56,0 +66,0 @@ |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1592398
95
30692
155
8
10
6
+ Addeddebug@^4.1.0
+ Addeddebug@4.3.4(transitive)
+ Addedms@2.1.2(transitive)