From c34ff6130b41e62b76b10c441cfaff773887b390 Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Sun, 14 Sep 2014 16:38:55 +0200 Subject: [PATCH] Updated AQB. --- js/node/node_modules/aqb/README.md | 9 +++++++++ js/node/node_modules/aqb/package.json | 16 ++++++++-------- js/node/node_modules/aqb/types.js | 3 +++ js/node/package.json | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/js/node/node_modules/aqb/README.md b/js/node/node_modules/aqb/README.md index cb18bfd634..b21f54fd48 100644 --- a/js/node/node_modules/aqb/README.md +++ b/js/node/node_modules/aqb/README.md @@ -97,6 +97,8 @@ Wraps a given value in an AQL Simple Reference. If the value is not a JavaScript string or not a well-formed simple reference, an *AQLError* will be thrown. +If the value is an *ArangoCollection*, its *name* property will be used instead. + If the value is already an AQL Simple Reference, its value is wrapped instead. *Examples* @@ -118,6 +120,13 @@ Invalid values: * `foo-bar` * `foo[bar]` +ArangoDB collection objects can be passed directly: + +```js +var myUserCollection = applicationContext.collection('users'); +var users = db._query(qb.for('u').in(myUserCollection).return('u')).toArray(); +``` + ### AQL Expressions #### Range diff --git a/js/node/node_modules/aqb/package.json b/js/node/node_modules/aqb/package.json index 9c30135e79..0bc783d9fa 100644 --- a/js/node/node_modules/aqb/package.json +++ b/js/node/node_modules/aqb/package.json @@ -1,7 +1,7 @@ { "name": "aqb", "license": "APACHE2_0", - "version": "1.2.0", + "version": "1.3.0", "description": "ArangoDB AQL query builder.", "keywords": [ "arangodb", @@ -31,11 +31,11 @@ "url": "git://github.com/arangodb/aqbjs.git" }, "main": "index.js", - "gitHead": "da036ea91d1148021686be9db77c87fbc87f807d", + "gitHead": "71e4855a5ddd8d4800c2fd85dc75f0c8c3d3e967", "homepage": "https://github.com/arangodb/aqbjs", - "_id": "aqb@1.2.0", - "_shasum": "79e6873cf802b15b43d9bcc4e9091d3a2c42ee59", - "_from": "aqb@1.2.0", + "_id": "aqb@1.3.0", + "_shasum": "948129b0a52046d6e3853c9e2d106b625f6a07a6", + "_from": "aqb@1.3.0", "_npmVersion": "1.4.24", "_npmUser": { "name": "pluma", @@ -48,9 +48,9 @@ } ], "dist": { - "shasum": "79e6873cf802b15b43d9bcc4e9091d3a2c42ee59", - "tarball": "http://registry.npmjs.org/aqb/-/aqb-1.2.0.tgz" + "shasum": "948129b0a52046d6e3853c9e2d106b625f6a07a6", + "tarball": "http://registry.npmjs.org/aqb/-/aqb-1.3.0.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/aqb/-/aqb-1.2.0.tgz" + "_resolved": "https://registry.npmjs.org/aqb/-/aqb-1.3.0.tgz" } diff --git a/js/node/node_modules/aqb/types.js b/js/node/node_modules/aqb/types.js index fe207bd96e..821f7c1ff0 100644 --- a/js/node/node_modules/aqb/types.js +++ b/js/node/node_modules/aqb/types.js @@ -49,6 +49,9 @@ function autoCastToken(token) { return new SimpleReference(token); } if (typeof token === 'object') { + if (Object.prototype.toStrint.call(token) === '[object ArangoCollection]') { + return new Identifier(token.name); + } if (Object.prototype.toString.call(token) === '[object Array]') { return new ListLiteral(token); } diff --git a/js/node/package.json b/js/node/package.json index aa645e4343..ec7e92d7cc 100644 --- a/js/node/package.json +++ b/js/node/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "aqb": "1.2.0", + "aqb": "1.3.0", "buster-format": "0.5.6", "cheerio": "0.17.0", "coffee-script": "1.7.1",