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.0.0-candidate.6 to 1.0.0-candidate.7

5

CHANGES.md
# Baucis Change Log
## v1.0.0-candidate.7
README tweaks. More tests.
## v1.0.0-candidate.6

@@ -4,0 +9,0 @@

12

Controller/request/conditions.js

@@ -0,1 +1,3 @@

var BaucisError = require('baucis-error');
// __Module Definition__

@@ -8,3 +10,11 @@ var decorator = module.exports = function () {

if (typeof conditions === 'string') conditions = JSON.parse(conditions);
if (typeof conditions === 'string') {
try {
conditions = JSON.parse(conditions);
}
catch (exception) {
next(BaucisError.BadRequest('The conditions query string value was not valid JSON: "%s"', exception.message));
return;
}
}
if (request.params.id !== undefined) {

@@ -11,0 +21,0 @@ conditions[controller.findBy()] = request.params.id;

2

package.json

@@ -51,3 +51,3 @@ {

"homepage": "https://github.com/wprl/baucis",
"version": "1.0.0-candidate.6",
"version": "1.0.0-candidate.7",
"main": "index.js",

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

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

# baucis v1.0.0-candidate.6
# baucis v1.0.0-candidate.7

@@ -26,3 +26,3 @@ Baucis enables you to build scalable REST APIs using the open source tools and standards you and your team already know. Like Baucis and Philemon of old, the module provides REST to the weary traveler. [Baucis](https://en.wikipedia.org/wiki/Baucis_and_Philemon) is not the same as [Bacchus](https://en.wikipedia.org/wiki/Dionysus).

* Version your API using semver.
* Over 150 Mocha.js tests.
* Over 140 Mocha.js tests.

@@ -32,4 +32,4 @@

* Real time browser/client subscription with EventSource (server sent events)
* Web hooks
* Real time browser/client [subscription with EventSource](https://github.com/wprl/baucis-subscribe) (server sent events)
* [Web hooks](https://github.com/wprl/baucis-hooks)

@@ -150,3 +150,3 @@ Check the [change log](CHANGES.md) for info on all the latest features.

### controller.select
### controller.select

@@ -164,6 +164,6 @@ Select or deselect fields for all queries.

Set to `true` to enable setting the response Link header with various useful links. Especially useful for paging.
By default the response Link header is set with various useful links based on context. This is especially useful for paging. May be disabled using this method.
``` javascript
controller.relations(true);
controller.relations(false);
```

@@ -220,3 +220,21 @@

### controller.emptyCollection
This can be used to set what status code & body are returned for requests that yield empty query results. The default is status code 200 with a JSON body containing an empty array. Other possible options are 204 No Content and 404 Not Found.
``` javascript
controller.emptyCollection(200);
controller.emptyCollection(204);
controller.emptyCollection(404);
```
### controller.handleErrors
Baucis sets the response status code based on different errors. By default, it also catches and builds responses for certain errors. Set this to false to have the controller only set status codes, and not handle errors further.
``` javascript
controller.emptyCollection(false);
```
### controller.versions

@@ -654,3 +672,3 @@

* Benchmark
* Internal refactoring and simplification
* ~~Internal refactoring and simplification~~ *(completed)*
* v1.0.0

@@ -697,3 +715,3 @@ * Begin a cookbook-style guide with lots of code examples.

*The `baucis-json` and `baucis-error` plugins is bundled with baucis by default. `baucis-json` is a good example for writing your own plugins, and for parsing or formatting custom content types.*
*The `baucis-json` and `baucis-error` plugins are bundled with baucis by default. `baucis-json` is a good example for writing your own plugins for parsing or formatting custom content types.*

@@ -700,0 +718,0 @@

@@ -752,2 +752,29 @@ var expect = require('expect.js');

it('should allow using query operators with _id', function (done) {
var options = {
url: 'http://localhost:8012/api/vegetables?conditions={ "_id": { "$gt": "111111111111111111111111" } }',
json: true
};
request.get(options, function (error, response, body) {
if (error) return done(error);
expect(response.statusCode).to.be(200);
expect(body).to.have.property('length', 8);
expect(body[0]).to.have.property('name', 'Turnip');
done();
});
});
it('should give a 400 if the query stirng is unpar using query operators with _id', function (done) {
var options = {
url: 'http://localhost:8012/api/vegetables?conditions={ \'_id\': { \'$gt\': \'111111111111111111111111\' } }',
json: true
};
request.get(options, function (error, response, body) {
if (error) return done(error);
expect(response.statusCode).to.be(400);
expect(body).to.be('Bad Request: The conditions query string value was not valid JSON: "Unexpected token '" (400).');
done();
});
});
});
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