Skip to content

Commit 756d55c

Browse files
authored
Merge pull request #294 from paparomeo/update-dependencies
Update dependencies
2 parents cbfa8e0 + a9b49fa commit 756d55c

File tree

12 files changed

+32
-30
lines changed

12 files changed

+32
-30
lines changed

example/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ jsonApi.setConfig({
3232

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

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

4040
return callback()
4141
})

lib/MemoryHandler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ MemoryStore.prototype.find = (request, callback) => {
4747

4848
// If the resource doesn't exist, error
4949
if (!theResource) {
50-
return callback({
50+
return callback({ // eslint-disable-line standard/no-callback-literal
5151
status: '404',
5252
code: 'ENOTFOUND',
5353
title: 'Requested resource does not exist',
@@ -66,7 +66,7 @@ MemoryStore.prototype.create = (request, newResource, callback) => {
6666
// Check to see if the ID already exists
6767
const index = MemoryStore._indexOf(resources[request.params.type], newResource)
6868
if (index !== -1) {
69-
return callback({
69+
return callback({ // eslint-disable-line standard/no-callback-literal
7070
status: '403',
7171
code: 'EFORBIDDEN',
7272
title: 'Requested resource already exists',

lib/postProcessing/fields.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fields.action = (request, response, callback) => {
1111

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

2424
for (const j of field) {
2525
if (!jsonApi._resources[resource].attributes[j]) {
26-
return callback({
26+
return callback({ // eslint-disable-line standard/no-callback-literal
2727
status: '403',
2828
code: 'EFORBIDDEN',
2929
title: 'Invalid field selection',

lib/postProcessing/sort.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ sort.action = (request, response, callback) => {
1212
}
1313

1414
if (!request.resourceConfig.attributes[attribute]) {
15-
return callback({
15+
return callback({ // eslint-disable-line standard/no-callback-literal
1616
status: '403',
1717
code: 'EFORBIDDEN',
1818
title: 'Invalid sort',

lib/router.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ router.authenticate = (request, res, callback) => {
133133
detail: err || 'You are not authorised to access this resource.'
134134
}
135135
const payload = responseHelper.generateError(request, errorWrapper)
136-
res.status(401).end(new Buffer(JSON.stringify(payload)))
136+
res.status(401).end(Buffer.from(JSON.stringify(payload)))
137137
})
138138
}
139139

@@ -199,7 +199,7 @@ router._getParams = req => {
199199
router.sendResponse = (res, payload, httpCode) => {
200200
const timeDiff = (new Date()) - res._startDate
201201
metrics.processResponse(res._request, httpCode, payload, timeDiff)
202-
res.status(httpCode).end(new Buffer(JSON.stringify(payload)))
202+
res.status(httpCode).end(Buffer.from(JSON.stringify(payload)))
203203
}
204204

205205
router.getExpressServer = () => {

lib/routes/_foreignKeySearch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ foreignKeySearchRoute.register = () => {
3030
callback => {
3131
const foreignKeySchema = resourceConfig.attributes[foreignKey]
3232
if (!foreignKeySchema || !foreignKeySchema._settings) {
33-
return callback({
33+
return callback({ // eslint-disable-line standard/no-callback-literal
3434
status: '403',
3535
code: 'EFORBIDDEN',
3636
title: 'Invalid foreign key lookup',
3737
detail: `Relation [${foreignKey}] does not exist within ${request.params.type}`
3838
})
3939
}
4040
if (!(foreignKeySchema._settings.__one || foreignKeySchema._settings.__many)) {
41-
return callback({
41+
return callback({ // eslint-disable-line standard/no-callback-literal
4242
status: '403',
4343
code: 'EFORBIDDEN',
4444
title: 'Invalid foreign key lookup',

lib/routes/find.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ findRoute.register = () => {
3535
},
3636
(sanitisedData, callback) => {
3737
if (!sanitisedData) {
38-
return callback({
38+
return callback({ // eslint-disable-line standard/no-callback-literal
3939
status: '404',
4040
code: 'EVERSION',
4141
title: 'Resource is not valid',

lib/routes/helper.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ helper.validate = (someObject, someDefinition, callback) => {
1313
debug.validationInput(JSON.stringify(someObject))
1414
Joi.validate(someObject, someDefinition, { abortEarly: false }, (err, sanitisedObject) => {
1515
if (err) {
16-
return callback({
16+
return callback({ // eslint-disable-line standard/no-callback-literal
1717
status: '403',
1818
code: 'EFORBIDDEN',
1919
title: 'Param validation failed',
@@ -27,7 +27,7 @@ helper.validate = (someObject, someDefinition, callback) => {
2727

2828
helper.checkForBody = (request, callback) => {
2929
if (!request.params.data) {
30-
return callback({
30+
return callback({ // eslint-disable-line standard/no-callback-literal
3131
status: '403',
3232
code: 'EFORBIDDEN',
3333
title: 'Request validation failed',
@@ -36,7 +36,7 @@ helper.checkForBody = (request, callback) => {
3636
}
3737
// data can be {} or [] both of which are typeof === 'object'
3838
if (typeof request.params.data !== 'object') {
39-
return callback({
39+
return callback({ // eslint-disable-line standard/no-callback-literal
4040
status: '403',
4141
code: 'EFORBIDDEN',
4242
title: 'Request validation failed',

lib/routes/related.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ relatedRoute.register = () => {
2525
callback => {
2626
relation = resourceConfig.attributes[request.params.relation]
2727
if (!relation || !relation._settings || !(relation._settings.__one || relation._settings.__many)) {
28-
return callback({
28+
return callback({ // eslint-disable-line standard/no-callback-literal
2929
status: '404',
3030
code: 'ENOTFOUND',
3131
title: 'Resource not found',
3232
detail: 'The requested relation does not exist within the requested type'
3333
})
3434
}
3535
if (relation._settings.__as) {
36-
return callback({
36+
return callback({ // eslint-disable-line standard/no-callback-literal
3737
status: '404',
3838
code: 'EFOREIGN',
3939
title: 'Relation is Foreign',

lib/routes/relationships.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ relationshipsRoute.register = () => {
2222
callback => {
2323
const relation = resourceConfig.attributes[request.params.relation]
2424
if (!relation || !(relation._settings.__one || relation._settings.__many)) {
25-
return callback({
25+
return callback({ // eslint-disable-line standard/no-callback-literal
2626
status: '404',
2727
code: 'ENOTFOUND',
2828
title: 'Resource not found',
@@ -43,7 +43,7 @@ relationshipsRoute.register = () => {
4343
},
4444
(sanitisedData, callback) => {
4545
if (!sanitisedData) {
46-
return callback({
46+
return callback({ // eslint-disable-line standard/no-callback-literal
4747
status: '404',
4848
code: 'EVERSION',
4949
title: 'Resource is not valid',

0 commit comments

Comments
 (0)