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

ghost-gql

Package Overview
Dependencies
Maintainers
6
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ghost-gql - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

.eslintrc.json

12

dist/parser.js

@@ -1,2 +0,2 @@

/* parser generated by jison 0.4.16 */
/* parser generated by jison 0.4.18 */
/*

@@ -169,9 +169,5 @@ Returns a Parser object of the following structure:

} else {
function _parseError (msg, hash) {
this.message = msg;
this.hash = hash;
}
_parseError.prototype = new Error();
throw new _parseError(str, hash);
var error = new Error(str);
error.hash = hash;
throw error;
}

@@ -178,0 +174,0 @@ },

@@ -51,3 +51,3 @@ /**

if (parts.length === 1) {
property = context.name ? context.name + '.' + property : property;
property = context.name + '.' + property;
}

@@ -54,0 +54,0 @@

{
"name": "ghost-gql",
"version": "0.0.6",
"version": "0.0.7",
"description": "Filter query language for Ghost",
"main": "index.js",
"scripts": {
"lint": "jshint lib/*.js test/*.js && jscs lib/*.js test/*.js",
"lint": "eslint lib test/*_spec.js",
"test": "npm run build && npm run lint && mocha",
"build": "jison src/gql.y src/gql.l -o dist/parser.js",
"coverage": "istanbul cover -x src --dir=test/coverage --report=lcov ./node_modules/mocha/bin/_mocha -- test/*_spec.js",
"coverage": "istanbul cover -x src --dir=test/coverage --report=lcov _mocha -- test/*_spec.js",
"release": "npm-release patch"

@@ -29,12 +29,11 @@ },

"devDependencies": {
"istanbul": "0.4.0",
"jison": "0.4.16",
"jscs": "2.8.0",
"jshint": "2.8.0",
"eslint": "4.8.0",
"istanbul": "0.4.5",
"jison": "0.4.18",
"knex": "0.8.6",
"mocha": "2.2.5",
"mocha": "4.0.1",
"npm-release": "1.0.0",
"should": "7.0.1",
"sinon": "1.15.4"
"should": "13.1.0",
"sinon": "4.0.1"
}
}

@@ -1,2 +0,1 @@

/* globals describe, it */
var gql = require('../lib/gql'),

@@ -3,0 +2,0 @@ knex = require('knex')({}),

@@ -1,8 +0,9 @@

/* globals describe, beforeEach, afterEach, it */
var sinon = require('sinon'),
knex = require('knex')({}),
knexify = require('../lib/knexify');
knexify = require('../lib/knexify'),
sandbox = sinon.sandbox.create();
describe('Knexify', function () {
var postKnex, sandbox = sinon.sandbox.create();
var postKnex, testKnex;

@@ -18,2 +19,4 @@ beforeEach(function () {

sandbox.spy(postKnex, 'orWhereNotNull');
testKnex = knex('test');
});

@@ -25,2 +28,10 @@

it('should error for unknown context', function () {
knexify(testKnex, {
statements: []
});
testKnex.toSQL.should.throwError();
});
it('should correctly build an empty query', function () {

@@ -27,0 +38,0 @@ knexify(postKnex, {

@@ -1,2 +0,1 @@

/* globals describe, it */
var gql = require('../lib/gql');

@@ -3,0 +2,0 @@

@@ -1,5 +0,4 @@

/* globals describe, beforeEach, afterEach, it */
var should = require('should'),
sinon = require('sinon'),
_ = require('lodash'),
sinon = require('sinon'),
_ = require('lodash'),

@@ -101,6 +100,8 @@ sandbox = sinon.sandbox.create(),

{op: '!=', value: 'joe', prop: 'author'},
{group: [
{
group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'}
], func: 'and'
}
], single);

@@ -120,9 +121,13 @@

{op: '=', value: 'published', prop: 'status', func: 'and'},
{group: [
{op: '!=', value: 'joe', prop: 'author'},
{group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'}
], func: 'and'}
{
group: [
{op: '!=', value: 'joe', prop: 'author'},
{
group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'
}
], func: 'and'
}
], single);

@@ -141,3 +146,3 @@

group = sandbox.spy(function (statement) {
testFunc(statement.group);
testFunc(statement.group); // eslint-disable-line no-use-before-define
}),

@@ -150,6 +155,8 @@ testFunc = function (stuff) {

{op: '!=', value: 'joe', prop: 'author'},
{group: [
{
group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'}
], func: 'and'
}
]);

@@ -162,6 +169,8 @@

group.callCount.should.eql(1);
group.getCall(0).calledWith({group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'}).should.eql(true);
group.getCall(0).calledWith({
group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'
}).should.eql(true);
});

@@ -172,3 +181,3 @@

group = sandbox.spy(function (statement) {
testFunc(statement.group);
testFunc(statement.group); // eslint-disable-line no-use-before-define
}),

@@ -182,9 +191,13 @@ testFunc = function (stuff) {

{op: '=', value: 'published', prop: 'status', func: 'and'},
{group: [
{op: '!=', value: 'joe', prop: 'author'},
{group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'}
], func: 'and'}
{
group: [
{op: '!=', value: 'joe', prop: 'author'},
{
group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'
}
], func: 'and'
}
]);

@@ -200,16 +213,20 @@

group.callCount.should.eql(2);
group.getCall(0).calledWith({group: [
{op: '!=', value: 'joe', prop: 'author'},
{
group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'
}
], func: 'and'}).should.eql(true);
group.getCall(0).calledWith({
group: [
{op: '!=', value: 'joe', prop: 'author'},
{
group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'
}
], func: 'and'
}).should.eql(true);
group.getCall(1).calledWith({group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'}).should.eql(true);
group.getCall(1).calledWith({
group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'
}).should.eql(true);
});

@@ -279,6 +296,8 @@ });

{op: '!=', value: 'joe', prop: 'author'},
{group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'}
{
group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'
}
];

@@ -326,6 +345,8 @@

{op: '!=', value: 'joe', prop: 'author'},
{group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'}
{
group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'
}
];

@@ -335,5 +356,7 @@

{op: '!=', value: 'joe', prop: 'author'},
{group: [
{op: '=', value: 'photo', prop: 'tag'}
], func: 'and'}
{
group: [
{op: '=', value: 'photo', prop: 'tag'}
], func: 'and'
}
]);

@@ -345,6 +368,8 @@ });

{op: '!=', value: 'joe', prop: 'author'},
{group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'}
{
group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
], func: 'and'
}
];

@@ -372,6 +397,8 @@

{op: '=', value: 'video', prop: 'tag', func: 'or'},
{group: [
{op: '=', value: false, prop: 'page'},
{op: '=', value: 'cameron', prop: 'author', func: 'or'}
], func: 'and'}
{
group: [
{op: '=', value: false, prop: 'page'},
{op: '=', value: 'cameron', prop: 'author', func: 'or'}
], func: 'and'
}
];

@@ -382,5 +409,7 @@

{op: '=', value: 'video', prop: 'tag', func: 'or'},
{group: [
{op: '=', value: 'cameron', prop: 'author'}
], func: 'and'}
{
group: [
{op: '=', value: 'cameron', prop: 'author'}
], func: 'and'
}
]);

@@ -391,17 +420,23 @@ });

var statements = [
{group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
]},
{group: [
{op: '=', value: false, prop: 'page'},
{op: '=', value: 'cameron', prop: 'author', func: 'or'}
], func: 'and'}
{
group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
]
},
{
group: [
{op: '=', value: false, prop: 'page'},
{op: '=', value: 'cameron', prop: 'author', func: 'or'}
], func: 'and'
}
];
rejectStatements(statements, testFunction({prop: 'tag'})).should.eql([
{group: [
{op: '=', value: false, prop: 'page'},
{op: '=', value: 'cameron', prop: 'author', func: 'or'}
]}
{
group: [
{op: '=', value: false, prop: 'page'},
{op: '=', value: 'cameron', prop: 'author', func: 'or'}
]
}
]);

@@ -412,6 +447,8 @@ });

var statements = [
{group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
]},
{
group: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
]
},
{op: '=', value: false, prop: 'page', func: 'and'},

@@ -454,6 +491,8 @@ {op: '=', value: 'cameron', prop: 'author', func: 'or'}

result.should.eql({statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]});
result.should.eql({
statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]
});
});

@@ -467,5 +506,7 @@

result.should.eql({statements: [
{prop: 'status', op: '=', value: 'published'}
]});
result.should.eql({
statements: [
{prop: 'status', op: '=', value: 'published'}
]
});
});

@@ -479,66 +520,86 @@

result.should.eql({statements: [
{prop: 'status', op: '=', value: 'published'}
]});
result.should.eql({
statements: [
{prop: 'status', op: '=', value: 'published'}
]
});
});
it('should merge two statement objects', function () {
var obj1 = {statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]},
obj2 = {statements: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
]},
var obj1 = {
statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]
},
obj2 = {
statements: [
{op: '=', value: 'photo', prop: 'tag'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
]
},
result = mergeStatements(obj1, obj2);
result.should.eql({statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'},
{op: '=', value: 'photo', prop: 'tag', func: 'and'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
]});
result.should.eql({
statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'},
{op: '=', value: 'photo', prop: 'tag', func: 'and'},
{op: '=', value: 'video', prop: 'tag', func: 'or'}
]
});
});
it('should merge two statement objects when one is empty', function () {
var obj1 = {statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]},
var obj1 = {
statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]
},
obj2 = {statements: []},
result = mergeStatements(obj1, obj2);
result.should.eql({statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]});
result.should.eql({
statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]
});
});
it('should merge two statement objects when one is null', function () {
var obj1 = {statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]},
var obj1 = {
statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]
},
obj2 = null,
result = mergeStatements(obj1, obj2);
result.should.eql({statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]});
result.should.eql({
statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]
});
});
it('should merge two statement objects when one is undefined', function () {
var obj1 = {statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]},
var obj1 = {
statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]
},
obj2,
result = mergeStatements(obj1, obj2);
result.should.eql({statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]});
result.should.eql({
statements: [
{prop: 'page', op: '=', value: false},
{prop: 'status', op: '=', value: 'published', func: 'and'}
]
});
});

@@ -545,0 +606,0 @@ });

@@ -1,4 +0,2 @@

/* globals describe, it */
/* jshint unused:false */
var should = require('should'),
var should = require('should'), // eslint-disable-line no-unused-vars
gql = require('../lib/gql');

@@ -5,0 +3,0 @@

Sorry, the diff of this file is not supported yet

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