Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

documentdb

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

documentdb - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

5

changelog.md

@@ -0,1 +1,6 @@

## Changes in 1.2.1 : ##
- Implements ID Based Routing
- Fixes Issue [#49](https://github.com/Azure/azure-documentdb-node/issues/49) - current property conflicts with method current()
## Changes in 1.2.0 : ##

@@ -2,0 +7,0 @@

10

lib/auth.js

@@ -21,9 +21,9 @@ //----------------------------------------------------------------------------

var text = (verb || "") + "\n" +
(resourceType || "") + "\n" +
var text = (verb || "").toLowerCase() + "\n" +
(resourceType || "").toLowerCase() + "\n" +
(resourceId || "") + "\n" +
(headers["x-ms-date"] || "") + "\n" +
(headers["date"] || "") + "\n";
(headers["x-ms-date"] || "").toLowerCase() + "\n" +
(headers["date"] || "").toLowerCase() + "\n";
var body = new Buffer(text.toLowerCase(), "utf8");
var body = new Buffer(text, "utf8");

@@ -30,0 +30,0 @@ var signature = crypto.createHmac("sha256", key).update(body).digest("base64");

@@ -350,2 +350,26 @@ //----------------------------------------------------------------------------

return id;
},
isLinkNameBased: function (link) {
var parts = link.split("/");
var firstId = "";
var count = 0;
// Get the first id from path.
for (var i = 0; i < parts.length; ++i) {
if (count === 0 && parts[i].toLowerCase() !== "dbs") {
return false;
}
if (count === 1) {
firstId = parts[i];
break;
}
if (parts[i]) {
++count;
}
}
if (!firstId) return false;
if (firstId.length !== 8) return true;
var buffer = new Buffer(firstId, "base64");
if (buffer.length !== 4) return true;
return false;
}

@@ -352,0 +376,0 @@ };

@@ -125,3 +125,3 @@ //----------------------------------------------------------------------------

UserAgent: "documentdb-nodejs-sdk-1.2.0",
UserAgent: "documentdb-nodejs-sdk-1.2.1",

@@ -128,0 +128,0 @@ DefaultPrecisions: {

@@ -22,3 +22,3 @@ //----------------------------------------------------------------------------

this.resources = [];
this.current = 0;
this.currentIndex = 0;
this.fetchFunction = fetchFunction;

@@ -53,11 +53,25 @@ this.continuation = null;

*/
nextItem: function(callback) {
nextItem: function (callback) {
var that = this;
if (this.current < this.resources.length) {
return callback(undefined, this.resources[this.current++]);
this.current(function (err, resources, headers) {
++that.currentIndex;
callback(err, resources, headers);
});
},
/**
* Retrieve the current element on the QueryIterator.
* @memberof QueryIterator
* @instance
* @param {callback} callback - Function to execute for each element. the function takes two parameters error, element.
*/
current: function(callback) {
var that = this;
if (this.currentIndex < this.resources.length) {
return callback(undefined, this.resources[this.currentIndex], undefined);
}
if (this._state === this._states.start || (this.continuation && this._state === this._states.inProgress)) {
this._fetchMore(function(err, resources, headers){
if(err) {
this._fetchMore(function (err, resources, headers) {
if (err) {
return callback(err, undefined, headers);

@@ -70,3 +84,3 @@ }

that._state = that._states.ended;
callback(undefined, undefined);
callback(undefined, undefined, headers);
} else {

@@ -78,7 +92,7 @@ that.nextItem(callback);

callback(undefined, that.resources[that.current++]);
callback(undefined, that.resources[that.currentIndex], headers);
});
} else {
this._state = this._states.ended;
callback(undefined, undefined);
callback(undefined, undefined, undefined);
}

@@ -88,12 +102,2 @@ },

/**
* Retrieve the current element on the QueryIterator.
* @memberof QueryIterator
* @instance
* @returns {Object} The current resource in the QueryIterator, undefined if there isn't.
*/
current: function(){
return this.resources[this.current];
},
/**
* Determine if there are still remaining resources to processs based on the value of the continuation token or the elements remaining on the current batch in the QueryIterator.

@@ -105,3 +109,3 @@ * @memberof QueryIterator

hasMoreResults: function() {
return this._state === this._states.start || this.continuation !== undefined || this.current < this.resources.length;
return this._state === this._states.start || this.continuation !== undefined || this.currentIndex < this.resources.length;
},

@@ -145,3 +149,3 @@

reset: function() {
this.current = 0;
this.currentIndex = 0;
this.continuation = null;

@@ -180,5 +184,5 @@ this.resources = [];

that.resources = resources;
while (that.current < that.resources.length) {
while (that.currentIndex < that.resources.length) {
// if the callback explicitly returned false, the loop gets stopped.
if (callback(undefined, that.resources[that.current++]) === false) {
if (callback(undefined, that.resources[that.currentIndex++]) === false) {
return undefined;

@@ -208,3 +212,3 @@ }

that._state = that._states.inProgress;
that.current = 0;
that.currentIndex = 0;
callback(undefined, resources, responseHeaders);

@@ -211,0 +215,0 @@ });

@@ -12,3 +12,3 @@ {

],
"version": "1.2.0",
"version": "1.2.1",
"author": "Microsoft Corporation",

@@ -15,0 +15,0 @@ "main": "./index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc