1
0
Fork 0

Updated aqb to 1.6.0.

This commit is contained in:
Alan Plum 2015-01-13 13:09:40 +01:00
parent 6999a6e3e4
commit b0517096f3
5 changed files with 75 additions and 85 deletions

View File

@ -3,6 +3,13 @@ v2.5.0 (XXXX-XX-XX)
* RequestContext#bodyParam now accepts arbitrary joi schemas and rejects invalid (but well-formed) request bodies.
v2.4.1 (XXXX-XX-XX)
-------------------
* updated AQB module to 1.6.0.
v2.4.0 (XXXX-XX-XX)
-------------------

4
js/node/node_modules/aqb/README.md generated vendored
View File

@ -462,6 +462,10 @@ qb.for('doc').in('my_collection').return('doc._key').toAQL()
`PartialStatement::collect(definitions).into(varname) : Statement`
### COLLECT var1 = expr1, var2 = expr2, …, varn = exprn INTO varname COUNT
`PartialStatement::collect(definitions).into(varname).count() : Statement`
### SORT args…
`PartialStatement::sort(args…) : Statement`

File diff suppressed because one or more lines are too long

135
js/node/node_modules/aqb/types.js generated vendored
View File

@ -240,7 +240,7 @@ Identifier.prototype = new Expression();
Identifier.prototype.constructor = Identifier;
Identifier.prototype.toAQL = function () {
var value = String(this.value);
if (keywords.indexOf(value.toLowerCase()) === -1) {
if (keywords.indexOf(value.toLowerCase()) === -1 && value.indexOf('-') === -1) {
return value;
}
return '`' + value + '`';
@ -506,7 +506,7 @@ function CollectExpression(prev, dfns) {
CollectExpression.prototype = new PartialStatement();
CollectExpression.prototype.constructor = CollectExpression;
CollectExpression.prototype.into = function (varname) {
return new CollectIntoExpression(this.prev, this.dfns, varname);
return new CollectIntoExpression(this, varname);
};
CollectExpression.prototype.toAQL = function () {
return (
@ -514,10 +514,13 @@ CollectExpression.prototype.toAQL = function () {
'COLLECT ' + this.dfns.toAQL()
);
};
CollectExpression.prototype.keep = function () {
var args = Array.prototype.slice.call(arguments);
return new CollectKeepExpression(this, args);
};
function CollectIntoExpression(prev, dfns, varname) {
function CollectIntoExpression(prev, varname) {
this.prev = prev;
this.dfns = new Definitions(dfns);
this.varname = new Identifier(varname);
}
CollectIntoExpression.prototype = new PartialStatement();
@ -525,10 +528,46 @@ CollectIntoExpression.prototype.constructor = CollectIntoExpression;
CollectIntoExpression.prototype.toAQL = function () {
return (
(this.prev ? this.prev.toAQL() + ' ' : '') +
'COLLECT ' + this.dfns.toAQL() +
' INTO ' + this.varname.toAQL()
'INTO ' + this.varname.toAQL()
);
};
CollectIntoExpression.prototype.count = function () {
return new CollectCountExpression(this);
};
CollectIntoExpression.prototype.keep = CollectExpression.prototype.keep;
function CollectCountExpression(prev) {
this.prev = prev;
}
CollectCountExpression.prototype = new PartialStatement();
CollectCountExpression.prototype.constructor = CollectCountExpression;
CollectCountExpression.prototype.toAQL = function () {
return (
(this.prev ? this.prev.toAQL() + ' ' : '') +
'COUNT'
);
};
CollectCountExpression.prototype.keep = CollectExpression.prototype.keep;
function CollectKeepExpression(prev, args) {
if (!args || !Array.isArray(args)) {
throw new AqlError('Expected sort list to be an array: ' + args);
}
if (!args.length) {
throw new AqlError('Expected sort list not to be empty: ' + args);
}
this.prev = prev;
this.args = args.map(autoCastToken);
}
CollectKeepExpression.prototype = new PartialStatement();
CollectKeepExpression.prototype.constructor = CollectKeepExpression;
CollectKeepExpression.prototype.toAQL = function () {
return (
(this.prev ? this.prev.toAQL() + ' ' : '') +
'KEEP ' + this.args.map(wrapAQL).join(', ')
);
};
CollectKeepExpression.prototype.keep = CollectExpression.prototype.keep;
function SortExpression(prev, args) {
if (!args || !Array.isArray(args)) {
@ -623,7 +662,7 @@ function RemoveExpression(prev, expr, collection) {
RemoveExpression.prototype = new Statement();
RemoveExpression.prototype.constructor = RemoveExpression;
RemoveExpression.prototype.options = function (opts) {
return new RemoveExpressionWithOptions(this.prev, this.expr, this.collection, opts);
return new OptionsExpression(this, opts);
};
RemoveExpression.prototype.toAQL = function () {
return (
@ -633,20 +672,16 @@ RemoveExpression.prototype.toAQL = function () {
);
};
function RemoveExpressionWithOptions(prev, expr, collection, opts) {
function OptionsExpression(prev, opts) {
this.prev = prev;
this.expr = autoCastToken(expr);
this.collection = new Identifier(collection);
this.opts = autoCastToken(opts);
}
RemoveExpressionWithOptions.prototype = new Statement();
RemoveExpressionWithOptions.prototype.constructor = RemoveExpressionWithOptions;
RemoveExpressionWithOptions.prototype.toAQL = function () {
OptionsExpression.prototype = new Statement();
OptionsExpression.prototype.constructor = OptionsExpression;
OptionsExpression.prototype.toAQL = function () {
return (
(this.prev ? this.prev.toAQL() + ' ' : '') +
'REMOVE ' + wrapAQL(this.expr) +
' IN ' + wrapAQL(this.collection) +
' OPTIONS ' + wrapAQL(this.opts)
'OPTIONS ' + wrapAQL(this.opts)
);
};
@ -658,7 +693,7 @@ function InsertExpression(prev, expr, collection) {
InsertExpression.prototype = new Statement();
InsertExpression.prototype.constructor = InsertExpression;
InsertExpression.prototype.options = function (opts) {
return new InsertExpressionWithOptions(this.prev, this.expr, this.collection, opts);
return new OptionsExpression(this, opts);
};
InsertExpression.prototype.toAQL = function () {
return (
@ -668,23 +703,6 @@ InsertExpression.prototype.toAQL = function () {
);
};
function InsertExpressionWithOptions(prev, expr, collection, opts) {
this.prev = prev;
this.expr = autoCastToken(expr);
this.collection = new Identifier(collection);
this.opts = autoCastToken(opts);
}
InsertExpressionWithOptions.prototype = new Statement();
InsertExpressionWithOptions.prototype.constructor = InsertExpressionWithOptions;
InsertExpressionWithOptions.prototype.toAQL = function () {
return (
(this.prev ? this.prev.toAQL() + ' ' : '') +
'INSERT ' + wrapAQL(this.expr) +
' INTO ' + wrapAQL(this.collection) +
' OPTIONS ' + wrapAQL(this.opts)
);
};
function UpdateExpression(prev, expr, withExpr, collection) {
this.prev = prev;
this.expr = autoCastToken(expr);
@ -694,7 +712,7 @@ function UpdateExpression(prev, expr, withExpr, collection) {
UpdateExpression.prototype = new Statement();
UpdateExpression.prototype.constructor = UpdateExpression;
UpdateExpression.prototype.options = function (opts) {
return new UpdateExpressionWithOptions(this.prev, this.expr, this.withExpr, this.collection, opts);
return new OptionsExpression(this, opts);
};
UpdateExpression.prototype.toAQL = function () {
return (
@ -705,25 +723,6 @@ UpdateExpression.prototype.toAQL = function () {
);
};
function UpdateExpressionWithOptions(prev, expr, withExpr, collection, opts) {
this.prev = prev;
this.expr = autoCastToken(expr);
this.withExpr = withExpr === undefined ? undefined : autoCastToken(withExpr);
this.collection = new Identifier(collection);
this.opts = autoCastToken(opts);
}
UpdateExpressionWithOptions.prototype = new Statement();
UpdateExpressionWithOptions.prototype.constructor = UpdateExpressionWithOptions;
UpdateExpressionWithOptions.prototype.toAQL = function () {
return (
(this.prev ? this.prev.toAQL() + ' ' : '') +
'UPDATE ' + wrapAQL(this.expr) +
(this.withExpr ? ' WITH ' + wrapAQL(this.withExpr) : '') +
' IN ' + wrapAQL(this.collection) +
' OPTIONS ' + wrapAQL(this.opts)
);
};
function ReplaceExpression(prev, expr, withExpr, collection) {
this.prev = prev;
this.expr = autoCastToken(expr);
@ -733,7 +732,7 @@ function ReplaceExpression(prev, expr, withExpr, collection) {
ReplaceExpression.prototype = new Statement();
ReplaceExpression.prototype.constructor = ReplaceExpression;
ReplaceExpression.prototype.options = function (opts) {
return new ReplaceExpressionWithOptions(this.prev, this.expr, this.withExpr, this.collection, opts);
return new OptionsExpression(this, opts);
};
ReplaceExpression.prototype.toAQL = function () {
return (
@ -744,25 +743,6 @@ ReplaceExpression.prototype.toAQL = function () {
);
};
function ReplaceExpressionWithOptions(prev, expr, withExpr, collection, opts) {
this.prev = prev;
this.expr = autoCastToken(expr);
this.withExpr = withExpr === undefined ? undefined : autoCastToken(withExpr);
this.collection = new Identifier(collection);
this.opts = autoCastToken(opts);
}
ReplaceExpressionWithOptions.prototype = new Statement();
ReplaceExpressionWithOptions.prototype.constructor = ReplaceExpressionWithOptions;
ReplaceExpressionWithOptions.prototype.toAQL = function () {
return (
(this.prev ? this.prev.toAQL() + ' ' : '') +
'REPLACE ' + wrapAQL(this.expr) +
(this.withExpr ? ' WITH ' + wrapAQL(this.withExpr) : '') +
' IN ' + wrapAQL(this.collection) +
' OPTIONS ' + wrapAQL(this.opts)
);
};
exports.autoCastToken = autoCastToken;
exports.RawExpression = RawExpression;
exports.NullLiteral = NullLiteral;
@ -800,7 +780,6 @@ exports._Statement = Statement;
exports._PartialStatement = PartialStatement;
exports._Definitions = Definitions;
exports._CollectIntoExpression = CollectIntoExpression;
exports._RemoveExpressionWithOptions = RemoveExpressionWithOptions;
exports._InsertExpressionWithOptions = InsertExpressionWithOptions;
exports._UpdateExpressionWithOptions = UpdateExpressionWithOptions;
exports._ReplaceExpressionWithOptions = ReplaceExpressionWithOptions;
exports._CollectCountExpression = CollectCountExpression;
exports._CollectKeepExpression = CollectKeepExpression;
exports._OptionsExpression = OptionsExpression;

View File

@ -1,6 +1,6 @@
{
"dependencies": {
"aqb": "1.5.2",
"aqb": "1.6.0",
"buster-format": "0.5.6",
"cheerio": "0.17.0",
"coffee-script": "1.7.1",