Comparing version 1.4.2 to 1.5.0
@@ -1,3 +0,2 @@ | ||
/* jshint globalstrict: true, es3: true */ | ||
/* globals require: false, exports: false */ | ||
/*jshint browserify: true */ | ||
'use strict'; | ||
@@ -4,0 +3,0 @@ exports.keywords = [ |
@@ -1,3 +0,2 @@ | ||
/* jshint globalstrict: true, es3: true */ | ||
/* globals require: false, exports: false */ | ||
/*jshint browserify: true */ | ||
'use strict'; | ||
@@ -4,0 +3,0 @@ function AqlError(message) { |
24
index.js
@@ -1,3 +0,3 @@ | ||
/* jshint globalstrict: true, es3: true */ | ||
/* globals require: false, module: false, console: false */ | ||
/*jshint browserify: true */ | ||
/*globals console: false */ | ||
'use strict'; | ||
@@ -45,3 +45,3 @@ var AqlError = require('./errors').AqlError, | ||
QB.num = function (value) {return new types.NumberLiteral(value);}; | ||
QB.int_ = function (value) {return new types.IntegerLiteral(value);}; | ||
QB.int_ = QB.int = function (value) {return new types.IntegerLiteral(value);}; | ||
QB.str = function (value) {return new types.StringLiteral(value);}; | ||
@@ -62,5 +62,5 @@ QB.list = function (arr) {return new types.ListLiteral(arr);}; | ||
QB.or = function (/* x, y... */) {return new types.NAryOperation('||', toArray(arguments));}; | ||
QB.add = function (/* x, y... */) {return new types.NAryOperation('+', toArray(arguments));}; | ||
QB.sub = function (/* x, y... */) {return new types.NAryOperation('-', toArray(arguments));}; | ||
QB.mul = function (/* x, y... */) {return new types.NAryOperation('*', toArray(arguments));}; | ||
QB.plus = QB.add = function (/* x, y... */) {return new types.NAryOperation('+', toArray(arguments));}; | ||
QB.minus = QB.sub = function (/* x, y... */) {return new types.NAryOperation('-', toArray(arguments));}; | ||
QB.times = QB.mul = function (/* x, y... */) {return new types.NAryOperation('*', toArray(arguments));}; | ||
QB.div = function (/* x, y... */) {return new types.NAryOperation('/', toArray(arguments));}; | ||
@@ -76,13 +76,5 @@ QB.mod = function (/* x, y... */) {return new types.NAryOperation('%', toArray(arguments));}; | ||
QB.neg = function (x) {return new types.UnaryOperation('-', x);}; | ||
QB.in_ = function (x, y) {return new types.BinaryOperation('in', x, y);}; | ||
QB.if_ = function (x, y, z) {return new types.TernaryOperation('?', ':', x, y, z);}; | ||
QB.in_ = QB.in = function (x, y) {return new types.BinaryOperation('in', x, y);}; | ||
QB.if_ = QB.if = function (x, y, z) {return new types.TernaryOperation('?', ':', x, y, z);}; | ||
QB.plus = QB.add; | ||
QB.minus = QB.sub; | ||
QB.times = QB.mul; | ||
QB['int'] = QB.int_; | ||
QB['in'] = QB.in_; | ||
QB['if'] = QB.if_; | ||
QB.fn = function (functionName, arity) { | ||
@@ -89,0 +81,0 @@ if (typeof arity === 'number') { |
{ | ||
"name": "aqb", | ||
"license": "APACHE2_0", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"description": "ArangoDB AQL query builder.", | ||
"main": "index.js", | ||
"keywords": [ | ||
@@ -12,24 +12,40 @@ "arangodb", | ||
], | ||
"author": { | ||
"name": "Alan Plum", | ||
"email": "me@pluma.io", | ||
"web": "https://www.arangodb.org" | ||
"files": [ | ||
"*.js", | ||
"package.json", | ||
"README.md", | ||
"LICENSE" | ||
], | ||
"scripts": { | ||
"test": "npm run lint && npm run test-only", | ||
"test-only": "mocha -t 30000 --growl -R spec test test/**", | ||
"cover": "npm run lint && istanbul cover --report lcov _mocha -- -t 30000 -R spec", | ||
"coveralls": "npm run cover && cat ./coverage/lcov.info | coveralls ; rm -rf ./coverage", | ||
"dist": "npm run bundle && npm run minify", | ||
"bundle": "browserify -t dekeywordify -u console -s aqb ./index.js > dist/aqb.js", | ||
"minify": "uglifyjs dist/aqb.js > dist/aqb.min.js", | ||
"lint": "jshint index.js *.js test test/**", | ||
"prepublish": "npm run lint" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"expect.js": "^0.3.1", | ||
"mocha": "^1.21.4" | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/arangodb/aqbjs.git" | ||
}, | ||
"engine": "node >= 0.8.0", | ||
"author": "Alan Plum <me@pluma.io>", | ||
"license": "APACHE-2.0", | ||
"bugs": { | ||
"url": "https://github.com/arangodb/aqbjs/issues" | ||
}, | ||
"scripts": { | ||
"test": "./node_modules/.bin/mocha --growl -R spec test test/**" | ||
"homepage": "https://github.com/arangodb/aqbjs", | ||
"devDependencies": { | ||
"browserify": "^7.0.2", | ||
"coveralls": "^2.11.2", | ||
"dekeywordify": "^0.2.1", | ||
"expect.js": "^0.3.1", | ||
"istanbul": "^0.3.5", | ||
"jshint": "^2.5.11", | ||
"mocha": "^2.1.0", | ||
"uglify-js": "^2.4.15" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/arangodb/aqbjs.git" | ||
}, | ||
"main": "index.js" | ||
"dependencies": {} | ||
} |
161
README.md
@@ -5,3 +5,52 @@ # ArangoDB Query Builder | ||
[![license - APACHE-2.0](https://img.shields.io/npm/l/aqb.svg)](http://opensource.org/licenses/APACHE-2.0) [![Dependencies](https://img.shields.io/david/arangodb/aqbjs.svg)](https://david-dm.org/arangodb/aqbjs) | ||
![NPM status](https://nodei.co/npm/aqb.png?downloads=true&stars=true) | ||
[![Build status](https://img.shields.io/travis/arangodb/aqbjs.svg)](https://travis-ci.org/arangodb/aqbjs) [![Coverage Status](https://img.shields.io/coveralls/arangodb/aqbjs.svg)](https://coveralls.io/r/arangodb/aqbjs?branch=master) [![Codacy rating](https://img.shields.io/codacy/1d5a1be201024e0caaf0aa6bc990231e.svg)](https://www.codacy.com/public/me_4/aqbjs) | ||
# Install | ||
## With NPM | ||
```sh | ||
npm install aqb | ||
``` | ||
## With Bower | ||
```sh | ||
bower install aqb | ||
``` | ||
## ArangoDB | ||
As of ArangoDB 1.3, a version of `aqb` comes pre-installed with ArangoDB. | ||
```js | ||
var qb = require('aqb'); | ||
``` | ||
If you want to use a more recent version of `aqb` in a Foxx app, you can add it to your NPM dependencies as usual. | ||
## Browser | ||
This CommonJS module is compatible with [browserify](http://browserify.org). | ||
If you don't want to use browserify, you can simply use the AMD-compatible [browserify bundle](https://raw.githubusercontent.com/arangodb/aqbjs/master/dist/aqb.min.js) (~30 kB minified, ~6 kB gzipped). | ||
If you want to use this module in non-ES5 browsers like Microsoft Internet Explorer 8 and earlier, you may need to include [es5-shim](https://www.npmjs.com/package/es5-shim) or a similar ES5 polyfill. | ||
## From source | ||
```sh | ||
git clone https://github.com/arangodb/aqbjs.git | ||
cd aqbjs | ||
npm install | ||
npm run dist | ||
``` | ||
# Example | ||
```js | ||
// in arangosh | ||
@@ -13,5 +62,5 @@ var db = require('org/arangodb').db; | ||
## API | ||
# API | ||
### AQL Types | ||
## AQL Types | ||
@@ -22,3 +71,3 @@ If raw JavaScript values are passed to AQL statements, they will be wrapped in a matching AQL type automatically. | ||
#### Boolean | ||
### Boolean | ||
@@ -33,3 +82,3 @@ Wraps the given value as an AQL Boolean literal. | ||
#### Number | ||
### Number | ||
@@ -46,3 +95,3 @@ Wraps the given value as an AQL Number literal. | ||
#### Integer | ||
### Integer | ||
@@ -61,3 +110,3 @@ Wraps the given value as an AQL Integer literal. | ||
#### String | ||
### String | ||
@@ -74,3 +123,3 @@ Wraps the given value as an AQL String literal. | ||
#### List | ||
### List | ||
@@ -87,3 +136,3 @@ Wraps the given value as an AQL List (Array) literal. | ||
#### Object | ||
### Object | ||
@@ -100,3 +149,3 @@ Wraps the given value as an AQL Object literal. | ||
#### Simple Reference | ||
### Simple Reference | ||
@@ -139,5 +188,5 @@ Wraps a given value in an AQL Simple Reference. | ||
### AQL Expressions | ||
## AQL Expressions | ||
#### Range | ||
### Range | ||
@@ -150,3 +199,3 @@ Creates a range expression from the given values. | ||
#### Property Access | ||
### Property Access | ||
@@ -159,3 +208,3 @@ Creates a property access expression from the given values. | ||
#### Raw Expression | ||
### Raw Expression | ||
@@ -170,5 +219,5 @@ Wraps a given value in a raw AQL expression. | ||
### AQL Operations | ||
## AQL Operations | ||
#### Boolean And | ||
### Boolean And | ||
@@ -187,3 +236,3 @@ Creates an "and" operation from the given values. | ||
#### Boolean Or | ||
### Boolean Or | ||
@@ -202,3 +251,3 @@ Creates an "or" operation from the given values. | ||
#### Addition | ||
### Addition | ||
@@ -219,3 +268,3 @@ Creates an addition operation from the given values. | ||
#### Subtraction | ||
### Subtraction | ||
@@ -236,3 +285,3 @@ Creates a subtraction operation from the given values. | ||
#### Multiplication | ||
### Multiplication | ||
@@ -253,3 +302,3 @@ Creates a multiplication operation from the given values. | ||
#### Division | ||
### Division | ||
@@ -268,3 +317,3 @@ Creates a division operation from the given values. | ||
#### Modulus | ||
### Modulus | ||
@@ -283,3 +332,3 @@ Creates a modulus operation from the given values. | ||
#### Equality | ||
### Equality | ||
@@ -292,3 +341,3 @@ Creates an equality comparison from the given values. | ||
#### Inequality | ||
### Inequality | ||
@@ -301,3 +350,3 @@ Creates an inequality comparison from the given values. | ||
#### Greater Than | ||
### Greater Than | ||
@@ -310,3 +359,3 @@ Creates a greater-than comparison from the given values. | ||
#### Greater Than Or Equal To | ||
### Greater Than Or Equal To | ||
@@ -319,3 +368,3 @@ Creates a greater-than-or-equal-to comparison from the given values. | ||
#### Less Than | ||
### Less Than | ||
@@ -328,3 +377,3 @@ Creates a less-than comparison from the given values. | ||
#### Less Than Or Equal To | ||
### Less Than Or Equal To | ||
@@ -337,3 +386,3 @@ Creates a less-than-or-equal-to comparison from the given values. | ||
#### Contains | ||
### Contains | ||
@@ -348,3 +397,3 @@ Creates an "in" comparison from the given values. | ||
#### Negation | ||
### Negation | ||
@@ -357,3 +406,3 @@ Creates a negation from the given value. | ||
#### Negative Value | ||
### Negative Value | ||
@@ -366,3 +415,3 @@ Creates a negative value expression from the given value. | ||
#### Ternary (if / else) | ||
### Ternary (if / else) | ||
@@ -377,3 +426,3 @@ Creates a ternary expression from the given values. | ||
#### Function Call | ||
### Function Call | ||
@@ -395,3 +444,3 @@ Creates a function call for the given name and arguments. | ||
### AQL Statements | ||
## AQL Statements | ||
@@ -409,3 +458,3 @@ In addition to the methods documented above, the query builder provides all methods of *PartialStatement* objects. | ||
#### FOR expression IN collection | ||
### FOR expression IN collection | ||
@@ -416,3 +465,3 @@ `PartialStatement::for(expression).in(collection) : Statement` | ||
#### LET varname = expression | ||
### LET varname = expression | ||
@@ -423,3 +472,3 @@ `PartialStatement::let(varname, expression) : Statement` | ||
#### LET var1 = expr1, var2 = expr2, …, varn = exprn | ||
### LET var1 = expr1, var2 = expr2, …, varn = exprn | ||
@@ -430,31 +479,31 @@ `PartialStatement::let(definitions) : Statement` | ||
#### FILTER expression | ||
### FILTER expression | ||
`PartialStatement::filter(expression) : Statement` | ||
#### COLLECT varname = expression | ||
### COLLECT varname = expression | ||
`PartialStatement::collect(varname, expression) : Statement` | ||
#### COLLECT varname1 = expression INTO varname2 | ||
### COLLECT varname1 = expression INTO varname2 | ||
`PartialStatement::collect(varname1, expression).into(varname2) : Statement` | ||
#### COLLECT var1 = expr1, var2 = expr2, …, varn = exprn | ||
### COLLECT var1 = expr1, var2 = expr2, …, varn = exprn | ||
`PartialStatement::collect(definitions) : Statement` | ||
#### COLLECT var1 = expr1, var2 = expr2, …, varn = exprn INTO varname | ||
### COLLECT var1 = expr1, var2 = expr2, …, varn = exprn INTO varname | ||
`PartialStatement::collect(definitions).into(varname) : Statement` | ||
#### SORT args… | ||
### SORT args… | ||
`PartialStatement::sort(args…) : Statement` | ||
#### LIMIT offset, count | ||
### LIMIT offset, count | ||
`PartialStatement::limit([offset,] count) : Statement` | ||
#### RETURN expression | ||
### RETURN expression | ||
@@ -465,3 +514,3 @@ `PartialStatement::return(expression) : Statement` | ||
#### REMOVE expression IN collection | ||
### REMOVE expression IN collection | ||
@@ -475,7 +524,7 @@ `PartialStatement::remove(expression).in(collection) : RemoveExpression` | ||
#### REMOVE … OPTIONS options | ||
### REMOVE … OPTIONS options | ||
`RemoveExpression::options(options) : Statement` | ||
#### INSERT expression INTO collection | ||
### INSERT expression INTO collection | ||
@@ -489,7 +538,7 @@ `PartialStatement::insert(expression).into(collection) : InsertExpression` | ||
#### INSERT … OPTIONS options | ||
### INSERT … OPTIONS options | ||
`InsertExpression::options(options) : Statement` | ||
#### UPDATE expression1 WITH expression2 IN collection | ||
### UPDATE expression1 WITH expression2 IN collection | ||
@@ -506,3 +555,3 @@ `PartialStatement::update(expression1).with(expression2).in(collection) : UpdateExpression` | ||
#### UPDATE expression IN collection | ||
### UPDATE expression IN collection | ||
@@ -516,7 +565,7 @@ `PartialStatement::update(expression).in(collection) : UpdateExpression` | ||
#### UPDATE … OPTIONS options | ||
### UPDATE … OPTIONS options | ||
`UpdateExpression::options(options) : Statement` | ||
#### REPLACE expression1 WITH expression2 IN collection | ||
### REPLACE expression1 WITH expression2 IN collection | ||
@@ -533,3 +582,3 @@ `PartialStatement::replace(expression1).with(expression2).in(collection) : ReplaceExpression` | ||
#### REPLACE expression IN collection | ||
### REPLACE expression IN collection | ||
@@ -543,4 +592,8 @@ `PartialStatement::replace(expression).in(collection) : ReplaceExpression` | ||
#### REPLACE … OPTIONS options | ||
### REPLACE … OPTIONS options | ||
`ReplaceExpression::options(options) : Statement` | ||
# License | ||
The Apache License, Version 2.0. For more information, see the accompanying LICENSE file. |
15
types.js
@@ -1,3 +0,2 @@ | ||
/* jshint globalstrict: true, es3: true */ | ||
/* globals require: false, exports: false */ | ||
/*jshint browserify: true */ | ||
'use strict'; | ||
@@ -365,3 +364,3 @@ var AqlError = require('./errors').AqlError, | ||
function PartialStatement() {} | ||
PartialStatement.prototype.for_ = function (varname) { | ||
PartialStatement.prototype.for = function (varname) { | ||
var self = this, inFn; | ||
@@ -375,3 +374,3 @@ inFn = function (expr) { | ||
PartialStatement.prototype.filter = function (expr) {return new FilterExpression(this, expr);}; | ||
PartialStatement.prototype.let_ = function (varname, expr) { | ||
PartialStatement.prototype.let = function (varname, expr) { | ||
if (expr === undefined) { | ||
@@ -393,3 +392,3 @@ return new LetExpression(this, varname); | ||
PartialStatement.prototype.limit = function (x, y) {return new LimitExpression(this, x, y);}; | ||
PartialStatement.prototype.return_ = function (x) {return new ReturnExpression(this, x);}; | ||
PartialStatement.prototype.return = function (x) {return new ReturnExpression(this, x);}; | ||
PartialStatement.prototype.remove = function (expr) { | ||
@@ -436,5 +435,5 @@ var self = this, inFn; | ||
PartialStatement.prototype['for'] = PartialStatement.prototype.for_; | ||
PartialStatement.prototype['let'] = PartialStatement.prototype.let_; | ||
PartialStatement.prototype['return'] = PartialStatement.prototype.return_; | ||
PartialStatement.prototype.for_ = PartialStatement.prototype.for; | ||
PartialStatement.prototype.let_ = PartialStatement.prototype.let; | ||
PartialStatement.prototype.return_ = PartialStatement.prototype.return; | ||
@@ -441,0 +440,0 @@ function Definitions(dfns) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
62692
0
0
558
8
7
981