Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

arangolize

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arangolize - npm Package Compare versions

Comparing version 0.9.7 to 0.9.8

33

dist/index.js

@@ -28,4 +28,3 @@ "use strict";

for instance in @@modelName
filter instance._removed != true
`;
filter instance._removed != true`;
}

@@ -55,3 +54,7 @@

try {
this._query += string;
if (string.indexOf('\n') === 0) {
return this._query += string;
}
this._query += '\n' + string;
} catch (e) {

@@ -76,3 +79,4 @@ console.error(e);

const {
include
include,
attributes
} = this.props;

@@ -85,3 +89,3 @@ const {

if (Array.isArray(include)) {
query('return MERGE(instance, {\n');
query('return MERGE(instance, {');
include.map((inc, index) => {

@@ -98,5 +102,5 @@ const includeAs = `includeAs${index}`;

});
query(`\n })), \n`);
query(`\n })),`);
} else {
query(`\nlet doc = MERGE(instance, { @includeAs: DOCUMENT(instance[@includeAs]) })`);
query(`let doc = MERGE(${attributes ? 'atts' : 'instance'}, { @includeAs: DOCUMENT(instance[@includeAs]) })`);
bindVars({

@@ -120,3 +124,10 @@ 'includeAs': include.as

query(`\n return doc)\n`);
if (include.attributes) {
bindVars({
includeAttributes: include.attributes
});
query(`return MERGE(doc, { @includeAs: KEEP(doc.@includeAs, @includeAttributes )})\n)`);
} else {
query(`return doc)`);
}
}

@@ -161,3 +172,3 @@ }

if (['asc', 'desc'].includes(direction)) {
query`\n sort instance.@sortparam @sortDirection`;
query(`sort instance.@sortparam @sortDirection`);
bindVars({

@@ -175,3 +186,3 @@ sortparam: sortArray[0]

if (attributes && include) {
query`let atts = KEEP(instance, @attributes)`;
query(`let atts = KEEP(instance, @attributes)`);

@@ -184,3 +195,3 @@ _this.handleInclude();

if (!include) {
query(`\nreturn ${attributes && !include ? 'KEEP(instance, @attributes)' : 'instance'}\n)`);
query(`\nreturn ${attributes && !include ? 'KEEP(instance, @attributes)' : 'instance'})`);
}

@@ -187,0 +198,0 @@

@@ -13,4 +13,3 @@ import { autobind } from 'core-decorators'

for instance in @@modelName
filter instance._removed != true
`
filter instance._removed != true`
}

@@ -39,3 +38,7 @@

try {
this._query += string
if (string.indexOf('\n') === 0) {
return this._query += string
}
this._query += '\n' + string
} catch (e) {

@@ -61,7 +64,7 @@ console.error(e)

handleInclude () {
const { include } = this.props
const { include, attributes } = this.props
const { query, bindVars } = this
if (Array.isArray(include)) {
query('return MERGE(instance, {\n')
query('return MERGE(instance, {')

@@ -77,5 +80,5 @@ include.map((inc, index) => {

query(`\n })), \n`)
query(`\n })),`)
} else {
query(`\nlet doc = MERGE(instance, { @includeAs: DOCUMENT(instance[@includeAs]) })`)
query(`let doc = MERGE(${attributes ? 'atts' : 'instance'}, { @includeAs: DOCUMENT(instance[@includeAs]) })`)
bindVars({'includeAs': include.as})

@@ -93,3 +96,8 @@

query(`\n return doc)\n`)
if (include.attributes) {
bindVars({includeAttributes: include.attributes})
query(`return MERGE(doc, { @includeAs: KEEP(doc.@includeAs, @includeAttributes )})\n)`)
} else {
query(`return doc)`)
}
}

@@ -118,3 +126,3 @@ }

if (['asc', 'desc'].includes(direction)) {
query`\n sort instance.@sortparam @sortDirection`
query(`sort instance.@sortparam @sortDirection`)
bindVars({ sortparam: sortArray[0] })

@@ -128,3 +136,3 @@ bindVars({ sortDirection: direction })

if (attributes && include) {
query`let atts = KEEP(instance, @attributes)`
query(`let atts = KEEP(instance, @attributes)`)
this.handleInclude()

@@ -136,3 +144,3 @@ } else if (include) {

if (!include) {
query(`\nreturn ${attributes && !include ? 'KEEP(instance, @attributes)' : 'instance'}\n)`)
query(`\nreturn ${attributes && !include ? 'KEEP(instance, @attributes)' : 'instance'})`)
}

@@ -139,0 +147,0 @@

@@ -48,13 +48,14 @@ import test from 'tape'

const { bindVars, query } = await arangolize({
collection: 'test',
limit: 5,
skip: 0,
sort: 'createdAt DESC',
attributes: ['creator', 'createdAt'],
include: {
as: 'creator',
where: {name: 'noah'}
where: {name: 'noah'},
attributes: ['createdAt', 'name']
}
})
console.log('query', query)
t.ok(bindVars, 'should have bindVars')

@@ -61,0 +62,0 @@ t.ok(query, 'should have query')

{
"name": "arangolize",
"version": "0.9.7",
"version": "0.9.8",
"description": "Sequelize-like query-builder for ArangoDB",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc