Skip to content

Commit

Permalink
Merge pull request #294 from paparomeo/update-dependencies
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
pmcnr-hx authored Jun 1, 2017
2 parents cbfa8e0 + a9b49fa commit 756d55c
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 30 deletions.
4 changes: 2 additions & 2 deletions example/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jsonApi.setConfig({

jsonApi.authenticate((request, callback) => {
// If a "blockMe" header is provided, block access.
if (request.headers.blockme) return callback('Fail')
if (request.headers.blockme) return callback(new Error('Fail'))

// If a "blockMe" cookie is provided, block access.
if (request.cookies.blockMe) return callback('Fail')
if (request.cookies.blockMe) return callback(new Error('Fail'))

return callback()
})
Expand Down
4 changes: 2 additions & 2 deletions lib/MemoryHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ MemoryStore.prototype.find = (request, callback) => {

// If the resource doesn't exist, error
if (!theResource) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '404',
code: 'ENOTFOUND',
title: 'Requested resource does not exist',
Expand All @@ -66,7 +66,7 @@ MemoryStore.prototype.create = (request, newResource, callback) => {
// Check to see if the ID already exists
const index = MemoryStore._indexOf(resources[request.params.type], newResource)
if (index !== -1) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '403',
code: 'EFORBIDDEN',
title: 'Requested resource already exists',
Expand Down
4 changes: 2 additions & 2 deletions lib/postProcessing/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fields.action = (request, response, callback) => {

for (const resource in resourceList) {
if (!jsonApi._resources[resource]) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '403',
code: 'EFORBIDDEN',
title: 'Invalid field resource',
Expand All @@ -23,7 +23,7 @@ fields.action = (request, response, callback) => {

for (const j of field) {
if (!jsonApi._resources[resource].attributes[j]) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '403',
code: 'EFORBIDDEN',
title: 'Invalid field selection',
Expand Down
2 changes: 1 addition & 1 deletion lib/postProcessing/sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sort.action = (request, response, callback) => {
}

if (!request.resourceConfig.attributes[attribute]) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '403',
code: 'EFORBIDDEN',
title: 'Invalid sort',
Expand Down
4 changes: 2 additions & 2 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ router.authenticate = (request, res, callback) => {
detail: err || 'You are not authorised to access this resource.'
}
const payload = responseHelper.generateError(request, errorWrapper)
res.status(401).end(new Buffer(JSON.stringify(payload)))
res.status(401).end(Buffer.from(JSON.stringify(payload)))
})
}

Expand Down Expand Up @@ -199,7 +199,7 @@ router._getParams = req => {
router.sendResponse = (res, payload, httpCode) => {
const timeDiff = (new Date()) - res._startDate
metrics.processResponse(res._request, httpCode, payload, timeDiff)
res.status(httpCode).end(new Buffer(JSON.stringify(payload)))
res.status(httpCode).end(Buffer.from(JSON.stringify(payload)))
}

router.getExpressServer = () => {
Expand Down
4 changes: 2 additions & 2 deletions lib/routes/_foreignKeySearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ foreignKeySearchRoute.register = () => {
callback => {
const foreignKeySchema = resourceConfig.attributes[foreignKey]
if (!foreignKeySchema || !foreignKeySchema._settings) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '403',
code: 'EFORBIDDEN',
title: 'Invalid foreign key lookup',
detail: `Relation [${foreignKey}] does not exist within ${request.params.type}`
})
}
if (!(foreignKeySchema._settings.__one || foreignKeySchema._settings.__many)) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '403',
code: 'EFORBIDDEN',
title: 'Invalid foreign key lookup',
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ findRoute.register = () => {
},
(sanitisedData, callback) => {
if (!sanitisedData) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '404',
code: 'EVERSION',
title: 'Resource is not valid',
Expand Down
6 changes: 3 additions & 3 deletions lib/routes/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ helper.validate = (someObject, someDefinition, callback) => {
debug.validationInput(JSON.stringify(someObject))
Joi.validate(someObject, someDefinition, { abortEarly: false }, (err, sanitisedObject) => {
if (err) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '403',
code: 'EFORBIDDEN',
title: 'Param validation failed',
Expand All @@ -27,7 +27,7 @@ helper.validate = (someObject, someDefinition, callback) => {

helper.checkForBody = (request, callback) => {
if (!request.params.data) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '403',
code: 'EFORBIDDEN',
title: 'Request validation failed',
Expand All @@ -36,7 +36,7 @@ helper.checkForBody = (request, callback) => {
}
// data can be {} or [] both of which are typeof === 'object'
if (typeof request.params.data !== 'object') {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '403',
code: 'EFORBIDDEN',
title: 'Request validation failed',
Expand Down
4 changes: 2 additions & 2 deletions lib/routes/related.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ relatedRoute.register = () => {
callback => {
relation = resourceConfig.attributes[request.params.relation]
if (!relation || !relation._settings || !(relation._settings.__one || relation._settings.__many)) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '404',
code: 'ENOTFOUND',
title: 'Resource not found',
detail: 'The requested relation does not exist within the requested type'
})
}
if (relation._settings.__as) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '404',
code: 'EFOREIGN',
title: 'Relation is Foreign',
Expand Down
4 changes: 2 additions & 2 deletions lib/routes/relationships.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ relationshipsRoute.register = () => {
callback => {
const relation = resourceConfig.attributes[request.params.relation]
if (!relation || !(relation._settings.__one || relation._settings.__many)) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '404',
code: 'ENOTFOUND',
title: 'Resource not found',
Expand All @@ -43,7 +43,7 @@ relationshipsRoute.register = () => {
},
(sanitisedData, callback) => {
if (!sanitisedData) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '404',
code: 'EVERSION',
title: 'Resource is not valid',
Expand Down
4 changes: 2 additions & 2 deletions lib/routes/removeRelation.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ removeRelationRoute.register = () => {

for (let i = 0; i < theirs.length; i++) {
if (relationType.indexOf(theirs[i].type) === -1) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '403',
code: 'EFORBIDDEN',
title: 'Invalid Request',
Expand All @@ -54,7 +54,7 @@ removeRelationRoute.register = () => {
const someId = theirs[i].id
const indexOfTheirs = keys.indexOf(someId)
if (indexOfTheirs === -1) {
return callback({
return callback({ // eslint-disable-line standard/no-callback-literal
status: '403',
code: 'EFORBIDDEN',
title: 'Invalid Request',
Expand Down
20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsonapi-server",
"version": "2.3.2",
"version": "3.0.0",
"description": "A config driven NodeJS framework implementing json:api",
"keywords": [
"jsonapi",
Expand All @@ -16,17 +16,17 @@
"url": "https://github.com/holidayextras/jsonapi-server"
},
"engines": {
"node": "*"
"node": ">=4.5"
},
"dependencies": {
"express-graphql": "^0.5.4",
"graphql": "^0.7.0",
"async": "2.4.0",
"async": "2.4.1",
"body-parser": "1.17.2",
"cookie-parser": "1.4.3",
"debug": "2.6.8",
"express": "4.15.3",
"joi": "10.5.0",
"express-graphql": "0.5.4",
"graphql": "0.7.2",
"joi": "10.5.2",
"lodash.assign": "4.2.0",
"lodash.isequal": "4.5.0",
"lodash.omit": "4.5.0",
Expand All @@ -40,14 +40,16 @@
},
"devDependencies": {
"eslint": "^3.6.1",
"eslint-config-standard": "^6.1.0",
"eslint-config-standard": "10.2.1",
"eslint-plugin-import": "2.3.0",
"eslint-plugin-node": "4.2.2",
"eslint-plugin-promise": "^3.3.0",
"eslint-plugin-standard": "^2.0.0",
"eslint-plugin-standard": "3.0.1",
"istanbul": "0.4.5",
"jscpd": "0.6.11",
"lokka": "1.7.0",
"lokka-transport-http": "1.6.1",
"mocha": "3.4.1",
"mocha": "3.4.2",
"mocha-performance": "0.1.1",
"node-inspector": "1.1.1",
"plato": "1.7.0",
Expand Down

0 comments on commit 756d55c

Please sign in to comment.