Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- 2016-05-31 - v1.10.0
- 2016-05-31 - Export module version so data stores can check for a minimum required version
- 2016-05-27 - v1.9.0
- 2016-05-27 - Make parsed and validated filter available in request for handlers
- 2016-05-24 - v1.8.0
Expand Down
1 change: 1 addition & 0 deletions lib/jsonApi.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow weak */
"use strict";
var jsonApi = module.exports = { };
jsonApi._version = require(require("path").join(__dirname, "../package.json")).version;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

process.env.npm_package_version is a nicer way to get this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would definitely be nicer, but unfortunately I need this the be the required package version when I require it in the data stores. 😞 process.env.npm_package_version would give me the main package's version.

jsonApi._resources = { };
jsonApi._apiConfig = { };

Expand Down
9 changes: 5 additions & 4 deletions lib/postProcessing/include.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ var includePP = module.exports = { };

var jsonApi = require("../jsonApi.js");
var _ = {
unique: require("lodash.uniq")
uniq: require("lodash.uniq"),
uniqBy: require("lodash.uniqby")
};
var rerouter = require("../rerouter.js");
var async = require("async");
Expand All @@ -28,7 +29,7 @@ includePP.action = function(request, response, callback) {

includeTree._dataItems = [ ];
response.included = includePP._getDataItemsFromTree(includeTree);
response.included = _.unique(response.included, false, function(someItem) {
response.included = _.uniqBy(response.included, function(someItem) {
return someItem.type + "~~" + someItem.id;
});

Expand Down Expand Up @@ -153,7 +154,7 @@ includePP._fillIncludeTree = function(includeTree, request, callback) {
var resourcesToFetch = [];

Object.keys(map.primary).forEach(function(relation) {
var ids = _.unique(map.primary[relation]);
var ids = _.uniq(map.primary[relation]);
var parts = relation.split("~~");
var urlJoiner = "&filter[id]=";
ids = urlJoiner + ids.join(urlJoiner);
Expand All @@ -167,7 +168,7 @@ includePP._fillIncludeTree = function(includeTree, request, callback) {
});

Object.keys(map.foreign).forEach(function(relation) {
var ids = _.unique(map.foreign[relation]);
var ids = _.uniq(map.foreign[relation]);
var parts = relation.split("~~");
var urlJoiner = "&filter[" + parts[0] + "]=";
ids = urlJoiner + ids.join(urlJoiner);
Expand Down
39 changes: 20 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsonapi-server",
"version": "1.9.0",
"version": "1.10.0",
"description": "A config driven NodeJS framework implementing json:api",
"keywords": [
"jsonapi",
Expand All @@ -20,33 +20,34 @@
},
"dependencies": {
"async": "1.5.2",
"body-parser": "1.14.2",
"cookie-parser": "1.4.0",
"body-parser": "^1.15.1",
"cookie-parser": "^1.4.3",
"debug": "2.2.0",
"express": "4.13.3",
"express": "^4.13.4",
"joi": "6.10.1",
"lodash.assign": "3.2.0",
"lodash.isequal": "3.0.4",
"lodash.omit": "3.1.0",
"lodash.pick": "3.1.0",
"lodash.uniq": "3.2.2",
"lodash.assign": "^4.0.9",
"lodash.isequal": "^4.2.0",
"lodash.omit": "^4.3.0",
"lodash.pick": "^4.2.1",
"lodash.uniq": "^4.3.0",
"lodash.uniqby": "^4.5.0",
"node-uuid": "1.4.7",
"qs": "^6.2.0",
"request": "2.67.0"
"request": "^2.72.0"
},
"devDependencies": {
"blanket": "1.1.7",
"coveralls": "2.11.2",
"eslint": "0.24.1",
"flow-bin": "^0.23.1",
"blanket": "1.1.9",
"coveralls": "^2.11.9",
"eslint": "^2.11.0",
"flow-bin": "^0.26.0",
"jscpd": "^0.6.1",
"mocha": "2.2.5",
"mocha-lcov-reporter": "0.0.2",
"mocha-performance": "0.1.0",
"node-inspector": "0.12.5",
"mocha": "^2.5.3",
"mocha-lcov-reporter": "^1.2.0",
"mocha-performance": "^0.1.1",
"node-inspector": "^0.12.8",
"plato": "1.5.0",
"swagger-tools": "^0.10.1",
"v8-profiler": "5.5.0"
"v8-profiler": "^5.6.5"
},
"scripts": {
"test": "node ./node_modules/mocha/bin/mocha -S -R spec ./test/*.js",
Expand Down