You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/03/21 22:20:44 UTC
[1/8] git commit: return the statusCode with the error
Repository: incubator-usergrid
Updated Branches:
refs/heads/node-sdk-enhancements [created] be803f759
refs/pull/80/head [created] be803f759
refs/pull/80/merge [created] 02b81a3d4
return the statusCode with the error
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/47665154
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/47665154
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/47665154
Branch: refs/heads/node-sdk-enhancements
Commit: 47665154294599855a3bec4dd009a0a1b1d06079
Parents: 3f93ca7
Author: Scott Ganyo <sc...@ganyo.com>
Authored: Fri Mar 21 13:49:40 2014 -0700
Committer: Scott Ganyo <sc...@ganyo.com>
Committed: Fri Mar 21 13:49:40 2014 -0700
----------------------------------------------------------------------
sdks/nodejs/lib/usergrid.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/47665154/sdks/nodejs/lib/usergrid.js
----------------------------------------------------------------------
diff --git a/sdks/nodejs/lib/usergrid.js b/sdks/nodejs/lib/usergrid.js
index 59cb843..edc6714 100755
--- a/sdks/nodejs/lib/usergrid.js
+++ b/sdks/nodejs/lib/usergrid.js
@@ -73,7 +73,7 @@ var AUTH_NONE = 'NONE';
* @param {function} callback
* @return {callback} callback(err, data)
*/
- Usergrid.Client.prototype.request = function (options, callback) {
+ Usergrid.client.prototype.request = function (options, callback) {
var self = this;
var method = options.method || 'GET';
var endpoint = options.endpoint;
@@ -87,10 +87,11 @@ var AUTH_NONE = 'NONE';
return this.logoutCallback(true, 'no_org_or_app_name_specified');
}
}
+ var uri;
if (mQuery) {
- var uri = this.URI + '/' + endpoint;
+ uri = this.URI + '/' + endpoint;
} else {
- var uri = this.URI + '/' + orgName + '/' + appName + '/' + endpoint;
+ uri = this.URI + '/' + orgName + '/' + appName + '/' + endpoint;
}
if (this.authType === AUTH_CLIENT_ID) {
@@ -123,6 +124,7 @@ var AUTH_NONE = 'NONE';
callback(err, data);
} else {
err = true;
+ data.statusCode = r.statusCode;
if ((r.error === 'auth_expired_session_token') ||
(r.error === 'auth_missing_credentials') ||
(r.error == 'auth_unverified_oath') ||
@@ -153,7 +155,7 @@ var AUTH_NONE = 'NONE';
}
}
});
- }
+ };
/*
* function for building asset urls
*
[8/8] git commit: Merge be803f759594133f90de6892ce7fb354307853a0 into
3f93ca70776988a4da4f276fc796431960677432
Posted by sn...@apache.org.
Merge be803f759594133f90de6892ce7fb354307853a0 into 3f93ca70776988a4da4f276fc796431960677432
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/02b81a3d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/02b81a3d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/02b81a3d
Branch: refs/pull/80/merge
Commit: 02b81a3d4ec942f312272ab4ab5d5168bbfafce1
Parents: 3f93ca7 be803f7
Author: Scott Ganyo <sc...@ganyo.com>
Authored: Fri Mar 21 21:15:34 2014 +0000
Committer: Scott Ganyo <sc...@ganyo.com>
Committed: Fri Mar 21 21:15:34 2014 +0000
----------------------------------------------------------------------
sdks/nodejs/lib/usergrid.js | 76 +++++++++++++++++++++++++++-------------
sdks/nodejs/package.json | 3 +-
2 files changed, 53 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
[5/8] git commit: accept options for query
Posted by sn...@apache.org.
accept options for query
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/293cbc5d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/293cbc5d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/293cbc5d
Branch: refs/heads/node-sdk-enhancements
Commit: 293cbc5da18f97dca2614434f590b140efe639c8
Parents: 18944ce
Author: Scott Ganyo <sc...@ganyo.com>
Authored: Fri Mar 21 14:01:57 2014 -0700
Committer: Scott Ganyo <sc...@ganyo.com>
Committed: Fri Mar 21 14:01:57 2014 -0700
----------------------------------------------------------------------
sdks/nodejs/lib/usergrid.js | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/293cbc5d/sdks/nodejs/lib/usergrid.js
----------------------------------------------------------------------
diff --git a/sdks/nodejs/lib/usergrid.js b/sdks/nodejs/lib/usergrid.js
index 144eb5b..b9e31fe 100755
--- a/sdks/nodejs/lib/usergrid.js
+++ b/sdks/nodejs/lib/usergrid.js
@@ -1171,12 +1171,14 @@ var AUTH_NONE = 'NONE';
* @method getConnections
* @public
* @param {string} connection
- * @param {object} entity
+ * @param {opts} options (actually, just options.qs for now)
* @param {function} callback
* @return {callback} callback(err, data, connections)
*
*/
- Usergrid.Entity.prototype.getConnections = function (connection, callback) {
+ Usergrid.Entity.prototype.getConnections = function (connection, opts, callback) {
+
+ if (_.isFunction(opts)) { callback = opts; opts = undefined; }
var self = this;
@@ -1199,9 +1201,10 @@ var AUTH_NONE = 'NONE';
method:'GET',
endpoint:endpoint
};
+ if (opts && opts.qs) { options.qs = opts.qs; }
this._client.request(options, function (err, data) {
if (err && self._client.logging) {
- console.log('entity could not be connected');
+ console.log('entity connections could not be retrieved');
}
self[connection] = {};
@@ -1212,7 +1215,7 @@ var AUTH_NONE = 'NONE';
if (data.entities[i].type === 'user'){
self[connection][data.entities[i].username] = data.entities[i];
} else {
- self[connection][data.entities[i].name] = data.entities[i]
+ self[connection][data.entities[i].name] = data.entities[i];
}
}
[7/8] git commit: add "delete by query" functionality
Posted by sn...@apache.org.
add "delete by query" functionality
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/be803f75
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/be803f75
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/be803f75
Branch: refs/heads/node-sdk-enhancements
Commit: be803f759594133f90de6892ce7fb354307853a0
Parents: 0fc9cd6
Author: Scott Ganyo <sc...@ganyo.com>
Authored: Fri Mar 21 14:11:11 2014 -0700
Committer: Scott Ganyo <sc...@ganyo.com>
Committed: Fri Mar 21 14:11:11 2014 -0700
----------------------------------------------------------------------
sdks/nodejs/lib/usergrid.js | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/be803f75/sdks/nodejs/lib/usergrid.js
----------------------------------------------------------------------
diff --git a/sdks/nodejs/lib/usergrid.js b/sdks/nodejs/lib/usergrid.js
index 55908ef..837a6d0 100755
--- a/sdks/nodejs/lib/usergrid.js
+++ b/sdks/nodejs/lib/usergrid.js
@@ -1472,6 +1472,36 @@ var AUTH_NONE = 'NONE';
});
}
+/*
+ * calls delete on the database w/ the passed query
+ *
+ * @method delete
+ * @param {opts} options containing query (include options.qs)
+ * @param {function} callback
+ * @return {callback} callback(err, data)
+ *
+ */
+Usergrid.client.prototype.delete = function(opts, callback) {
+ if (_.isFunction(opts)) { callback = opts; opts = undefined; }
+
+ if (!opts.qs.q) { opts.qs.q = '*'; }
+
+ var options = {
+ method: 'DELETE',
+ endpoint: opts.type,
+ qs: opts.qs
+ };
+ var self = this;
+ this.request(options, function (err, data) {
+ if (err && self.logging) {
+ console.log('entities could not be deleted');
+ }
+ if (typeof(callback) === 'function') {
+ callback(err, data);
+ }
+ });
+};
+
/*
* The Collection class models Usergrid Collections. It essentially
* acts as a container for holding Entity objects, while providing
[3/8] git commit: allow non-uuid identifiers
Posted by sn...@apache.org.
allow non-uuid identifiers
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/454ab6ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/454ab6ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/454ab6ee
Branch: refs/heads/node-sdk-enhancements
Commit: 454ab6ee74a9d112a5a7890fec174e2ab9d2592c
Parents: 70c4f01
Author: Scott Ganyo <sc...@ganyo.com>
Authored: Fri Mar 21 13:57:20 2014 -0700
Committer: Scott Ganyo <sc...@ganyo.com>
Committed: Fri Mar 21 13:57:20 2014 -0700
----------------------------------------------------------------------
sdks/nodejs/lib/usergrid.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/454ab6ee/sdks/nodejs/lib/usergrid.js
----------------------------------------------------------------------
diff --git a/sdks/nodejs/lib/usergrid.js b/sdks/nodejs/lib/usergrid.js
index 9140f14..95beb6a 100755
--- a/sdks/nodejs/lib/usergrid.js
+++ b/sdks/nodejs/lib/usergrid.js
@@ -1066,17 +1066,17 @@ var AUTH_NONE = 'NONE';
Usergrid.Entity.prototype.destroy = function (callback) {
var self = this;
var type = this.get('type');
- if (isUUID(this.get('uuid'))) {
- type += '/' + this.get('uuid');
- } else {
+ var id = this.getEntityId(this);
+ if (!id) {
if (typeof(callback) === 'function') {
- var error = 'Error trying to delete object - no uuid specified.';
+ var error = 'Error trying to delete object - no uuid or name specified.';
if (self._client.logging) {
console.log(error);
}
callback(true, error);
}
}
+ type += '/' + this.get('uuid');
var options = {
method:'DELETE',
endpoint:type
[4/8] git commit: fixed a bug where the callback could be called twice
Posted by sn...@apache.org.
fixed a bug where the callback could be called twice
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/18944ce4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/18944ce4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/18944ce4
Branch: refs/heads/node-sdk-enhancements
Commit: 18944ce465dda966fbeb34fe4f2906421ba3ba92
Parents: 454ab6e
Author: Scott Ganyo <sc...@ganyo.com>
Authored: Fri Mar 21 13:57:35 2014 -0700
Committer: Scott Ganyo <sc...@ganyo.com>
Committed: Fri Mar 21 13:57:35 2014 -0700
----------------------------------------------------------------------
sdks/nodejs/lib/usergrid.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/18944ce4/sdks/nodejs/lib/usergrid.js
----------------------------------------------------------------------
diff --git a/sdks/nodejs/lib/usergrid.js b/sdks/nodejs/lib/usergrid.js
index 95beb6a..144eb5b 100755
--- a/sdks/nodejs/lib/usergrid.js
+++ b/sdks/nodejs/lib/usergrid.js
@@ -1073,7 +1073,7 @@ var AUTH_NONE = 'NONE';
if (self._client.logging) {
console.log(error);
}
- callback(true, error);
+ return callback(true, error);
}
}
type += '/' + this.get('uuid');
[6/8] git commit: type should be plural
Posted by sn...@apache.org.
type should be plural
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/0fc9cd6b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/0fc9cd6b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/0fc9cd6b
Branch: refs/heads/node-sdk-enhancements
Commit: 0fc9cd6b1d9c9f9aaa783954063dc72cfd3b5d84
Parents: 293cbc5
Author: Scott Ganyo <sc...@ganyo.com>
Authored: Fri Mar 21 14:04:09 2014 -0700
Committer: Scott Ganyo <sc...@ganyo.com>
Committed: Fri Mar 21 14:04:09 2014 -0700
----------------------------------------------------------------------
sdks/nodejs/lib/usergrid.js | 3 ++-
sdks/nodejs/package.json | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0fc9cd6b/sdks/nodejs/lib/usergrid.js
----------------------------------------------------------------------
diff --git a/sdks/nodejs/lib/usergrid.js b/sdks/nodejs/lib/usergrid.js
index b9e31fe..55908ef 100755
--- a/sdks/nodejs/lib/usergrid.js
+++ b/sdks/nodejs/lib/usergrid.js
@@ -20,6 +20,7 @@
* @author rod simpson (rod@apigee.com)
*/
+var inflection = require('inflection');
var request = require('request');
var Usergrid = {};
Usergrid.USERGRID_SDK_VERSION = '0.10.07';
@@ -1183,7 +1184,7 @@ var AUTH_NONE = 'NONE';
var self = this;
//connector info
- var connectorType = this.get('type');
+ var connectorType = inflection.pluralize(this.get('type'));
var connector = this.getEntityId(this);
if (!connector) {
if (typeof(callback) === 'function') {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0fc9cd6b/sdks/nodejs/package.json
----------------------------------------------------------------------
diff --git a/sdks/nodejs/package.json b/sdks/nodejs/package.json
index 418d16b..fff1b39 100644
--- a/sdks/nodejs/package.json
+++ b/sdks/nodejs/package.json
@@ -4,7 +4,8 @@
"description": "A Node.js module for making API calls to App Services (Usergrid) from within Node.js",
"main": "./lib/usergrid.js",
"dependencies": {
- "request": "2.12.x"
+ "request": "2.12.x",
+ "inflection": "1.3.x"
},
"devDependencies": {
"mocha": "1.7.x",
[2/8] git commit: fix and simplify getEntityId()
Posted by sn...@apache.org.
fix and simplify getEntityId()
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/70c4f01f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/70c4f01f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/70c4f01f
Branch: refs/heads/node-sdk-enhancements
Commit: 70c4f01f5a82e29a3ca8d055901315674b033a26
Parents: 4766515
Author: Scott Ganyo <sc...@ganyo.com>
Authored: Fri Mar 21 13:52:24 2014 -0700
Committer: Scott Ganyo <sc...@ganyo.com>
Committed: Fri Mar 21 13:52:24 2014 -0700
----------------------------------------------------------------------
sdks/nodejs/lib/usergrid.js | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/70c4f01f/sdks/nodejs/lib/usergrid.js
----------------------------------------------------------------------
diff --git a/sdks/nodejs/lib/usergrid.js b/sdks/nodejs/lib/usergrid.js
index edc6714..9140f14 100755
--- a/sdks/nodejs/lib/usergrid.js
+++ b/sdks/nodejs/lib/usergrid.js
@@ -1162,17 +1162,7 @@ var AUTH_NONE = 'NONE';
*
*/
Usergrid.Entity.prototype.getEntityId = function (entity) {
- var id = false;
- if (isUUID(entity.get('uuid'))) {
- id = entity.get('uuid');
- } else {
- if (type === 'users') {
- id = entity.get('username');
- } else if (entity.get('name')) {
- id = entity.get('name');
- }
- }
- return id;
+ return entity.get('uuid') || entity.get('username') || entity.get('name') || false;
}
/*