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

baucis

Package Overview
Dependencies
Maintainers
1
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baucis - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

1

Controller/configure.js

@@ -19,2 +19,3 @@ // __Dependencies__

protect.property('select', '');
protect.property('sort', '');

@@ -21,0 +22,0 @@ protect.property('versions', '*', function (range) {

@@ -53,2 +53,8 @@ // __Dependencies__

});
// Apply controller sort options to the query.
this.query(function (request, response, next) {
var sort = controller.sort();
if (sort) request.baucis.query.sort(sort);
next();
});
// Apply incoming request sort.

@@ -103,3 +109,3 @@ this.query(function (request, response, next) {

if (!allowPopulateSelect) return error = RestError.Forbidden('Selecting fields of populated documents is not permitted');
console.warn('WARNING: Allowing populate with select is experimental and bypasses security.');
console.warn('WARNING: Allowing populate with select is experimental and bypasses security.');
}

@@ -106,0 +112,0 @@

2

package.json

@@ -9,3 +9,3 @@ {

"homepage": "https://github.com/wprl/baucis",
"version": "1.4.0",
"version": "1.5.0",
"main": "index.js",

@@ -12,0 +12,0 @@ "scripts": {

@@ -66,4 +66,5 @@ // __Dependencies__

baucis.rest('fungus').select('-hyphenated-field-name');
baucis.rest('mineral').relations(true);
baucis.rest('mineral').relations(true).sort('color');
baucis.rest('animal').fragment('empty-array').emptyCollection(200);

@@ -70,0 +71,0 @@ baucis.rest('animal').fragment('no-content').emptyCollection(204);

@@ -69,3 +69,3 @@ var expect = require('expect.js');

it('should disallow selecting deselected fields', function (done) {
it('disallows selecting deselected fields', function (done) {
var options = {

@@ -83,3 +83,3 @@ url: 'http://localhost:8012/api/vegetables?select=species+lastModified',

it('should disallow populating deselected fields 1', function (done) {
it('disallows populating deselected fields 1', function (done) {
var options = {

@@ -97,3 +97,3 @@ url: 'http://localhost:8012/api/vegetables?populate=species',

it('should disallow populating deselected fields 2', function (done) {
it('disallows populating deselected fields 2', function (done) {
var options = {

@@ -124,3 +124,3 @@ url: 'http://localhost:8012/api/vegetables?populate={ "path": "species" }',

it('should disallow using +fields with populate', function (done) {
it('disallows using +fields with populate', function (done) {
var options = {

@@ -138,3 +138,3 @@ url: 'http://localhost:8012/api/vegetables?populate={ "select": "%2Bboiler" }',

it('should disallow using +fields with select', function (done) {
it('disallows using +fields with select', function (done) {
var options = {

@@ -152,3 +152,3 @@ url: 'http://localhost:8012/api/vegetables?select=%2Bboiler',

it('should disallow selecting fields when populating', function (done) {
it('disallows selecting fields when populating', function (done) {
var options = {

@@ -179,3 +179,3 @@ url: 'http://localhost:8012/api/vegetables?populate={ "path": "a", "select": "arbitrary" }',

it('should disallow selecting fields when populating', function (done) {
it('disallows selecting fields when populating', function (done) {
var options = {

@@ -193,3 +193,3 @@ url: 'http://localhost:8012/api/vegetables?populate={ "path": "a", "select": "arbitrary" }',

it('should allow populating children', function (done) {
it('allows populating children', function (done) {
var id = vegetables[0]._id;

@@ -210,3 +210,3 @@ var options = {

it('should allow default express query string format', function(done) {
it('allows default express query string format', function(done) {
var options = {

@@ -225,3 +225,3 @@ url: 'http://localhost:8012/api/vegetables?conditions[name]=Radicchio',

it('should allow selecting fields', function (done) {
it('allows selecting fields', function (done) {
var options = {

@@ -241,4 +241,38 @@ url: 'http://localhost:8012/api/vegetables?select=-_id lastModified',

it ('should allow deselecting hyphenated field names', function (done) {
it('allows setting default sort', function (done) {
var options = {
url: 'http://localhost:8012/api/minerals',
json: true
};
request.get(options, function (error, response, body) {
if (error) return done(error);
expect(response.statusCode).to.be(200);
var lastMineral = '';
body.forEach(function (mineral) {
expect(mineral.color).to.be.above(lastMineral);
lastMineral = mineral.color;
});
done();
});
});
it('allows overriding default sort', function (done) {
var options = {
url: 'http://localhost:8012/api/minerals?sort=-color',
json: true
};
request.get(options, function (error, response, body) {
if (error) return done(error);
expect(response.statusCode).to.be(200);
var lastMineral = '';
body.forEach(function (mineral) {
if (lastMineral) expect(mineral.color).to.be.below(lastMineral);
lastMineral = mineral.color;
});
done();
});
});
it('allows deselecting hyphenated field names', function (done) {
var options = {
url: 'http://localhost:8012/api/vegetables?select=-hyphenated-field-name',

@@ -385,3 +419,3 @@ json: true

it('should allow adding paging links', function(done) {
it('allows adding paging links', function(done) {
var options = {

@@ -430,3 +464,3 @@ url: 'http://localhost:8012/api/minerals?limit=2',

it('should allow using relations: true with sorted queries', function (done) {
it('allows using relations: true with sorted queries', function (done) {
var options = {

@@ -521,3 +555,3 @@ url: 'http://localhost:8012/api/minerals?sort=color&limit=2&skip=2&select=-__v -_id -enables',

it('should allow retrieving paging links next', function(done) {
it('allows retrieving paging links next', function(done) {
var options = {

@@ -547,3 +581,3 @@ url: 'http://localhost:8012/api/minerals?limit=2&skip=0',

it('should allow retrieving paging links previous', function(done) {
it('allows retrieving paging links previous', function(done) {
var options = {

@@ -570,3 +604,3 @@ url: 'http://localhost:8012/api/minerals?limit=2&skip=2',

it('should allow retrieving paging links last', function(done) {
it('allows retrieving paging links last', function(done) {
var options = {

@@ -593,3 +627,3 @@ url: 'http://localhost:8012/api/minerals?limit=2&skip=6',

it('should allow retrieving paging links first', function(done) {
it('allows retrieving paging links first', function(done) {
var options = {

@@ -616,3 +650,3 @@ url: 'http://localhost:8012/api/minerals?limit=2&skip=0',

it('should allow retrieving count instead of documents', function (done) {
it('allows retrieving count instead of documents', function (done) {
var options = {

@@ -669,3 +703,3 @@ url: 'http://localhost:8012/api/vegetables?count=true',

it('should allow adding index hint', function (done) {
it('allows adding index hint', function (done) {
var options = {

@@ -682,3 +716,3 @@ url: 'http://localhost:8012/api/vegetables?hint={ "_id": 1 }',

it('should allow adding index hint', function (done) {
it('allows adding index hint', function (done) {
var options = {

@@ -708,3 +742,3 @@ url: 'http://localhost:8012/api/vegetables?hint[_id]=1',

it('should allow adding a query comment', function (done) {
it('allows adding a query comment', function (done) {
var options = {

@@ -747,3 +781,3 @@ url: 'http://localhost:8012/api/vegetables?comment=testing testing 123',

it('should allow querying for distinct values', function (done) {
it('allows querying for distinct values', function (done) {
var options = {

@@ -770,3 +804,3 @@ url: 'http://localhost:8012/api/vegetables?distinct=name',

it('should allow querying for distinct values restricted by conditions', function (done) {
it('allows querying for distinct values restricted by conditions', function (done) {
var options = {

@@ -798,3 +832,3 @@ url: 'http://localhost:8012/api/vegetables?distinct=name&conditions={ "name": "Carrot" }',

it('should allow using query operators with _id', function (done) {
it('allows using query operators with _id', function (done) {
var options = {

@@ -801,0 +835,0 @@ url: 'http://localhost:8012/api/vegetables?conditions={ "_id": { "$gt": "111111111111111111111111" } }',

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