arangolize
Advanced tools
Comparing version 0.9.8 to 0.10.1
@@ -26,5 +26,3 @@ "use strict"; | ||
}; | ||
this._query = `let data = ( | ||
for instance in @@modelName | ||
filter instance._removed != true`; | ||
this._query = ``; | ||
} | ||
@@ -135,2 +133,3 @@ | ||
return _asyncToGenerator(function* () { | ||
const args = _this.props; | ||
let { | ||
@@ -140,4 +139,5 @@ where, | ||
sort, | ||
include | ||
} = _this.props; | ||
include, | ||
$with | ||
} = args; | ||
const { | ||
@@ -148,2 +148,13 @@ query, | ||
if ($with) { | ||
bindVars({ | ||
with: $with | ||
}); | ||
query(`WITH @@with\n`); | ||
} | ||
query(`let data = ( | ||
for instance in @@modelName | ||
filter instance._removed != true`); | ||
if (include && !Array.isArray(include)) { | ||
@@ -150,0 +161,0 @@ bindVars({ |
16
index.js
@@ -11,5 +11,3 @@ import { autobind } from 'core-decorators' | ||
} | ||
this._query = `let data = ( | ||
for instance in @@modelName | ||
filter instance._removed != true` | ||
this._query = `` | ||
} | ||
@@ -103,5 +101,15 @@ | ||
async build () { | ||
let { where, attributes, sort, include} = this.props | ||
const args = this.props | ||
let { where, attributes, sort, include, $with } = args | ||
const { query, bindVars } = this | ||
if ($with) { | ||
bindVars({ with: $with }) | ||
query(`WITH @@with\n`) | ||
} | ||
query(`let data = ( | ||
for instance in @@modelName | ||
filter instance._removed != true`) | ||
if (include && !Array.isArray(include)) { | ||
@@ -108,0 +116,0 @@ bindVars({ includeAs: include.as }) |
@@ -64,1 +64,20 @@ import test from 'tape' | ||
}) | ||
test('query with $with', async (t) => { | ||
const { bindVars, query } = await arangolize({ | ||
$with: 'User', | ||
limit: 5, | ||
skip: 0, | ||
sort: 'createdAt DESC', | ||
attributes: ['creator', 'createdAt'], | ||
include: { | ||
as: 'creator', | ||
where: { name: 'noah' }, | ||
attributes: ['createdAt', 'name'] | ||
} | ||
}) | ||
t.ok(query, 'should have query') | ||
t.ok(bindVars, 'should have bindVars') | ||
t.end() | ||
}) |
{ | ||
"name": "arangolize", | ||
"version": "0.9.8", | ||
"version": "0.10.1", | ||
"description": "Sequelize-like query-builder for ArangoDB", | ||
@@ -26,3 +26,4 @@ "main": "dist/index.js", | ||
"core-decorators": "^0.20.0" | ||
} | ||
}, | ||
"gitHead": "99e4e04767bef8812c4dcb85dcbca0dc8c84a810" | ||
} |
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
411
15087
6