Merge pull request #2838 from overleaf/msm-fix-npm-warnings

Fix npm warnings

GitOrigin-RevId: afc57deb7c4d07d7e86c9c9964fe76ace7b46901
This commit is contained in:
Eric Mc Sween 2020-05-20 10:18:08 -04:00 committed by Copybot
parent 67874f1f53
commit 3d411b98cf
3 changed files with 24 additions and 34 deletions

View file

@ -1,7 +1,25 @@
const { Joi: CelebrateJoi, celebrate, errors } = require('celebrate') const { Joi: CelebrateJoi, celebrate, errors } = require('celebrate')
const JoiObjectId = require('joi-mongodb-objectid') const { ObjectId } = require('./mongojs')
const Joi = CelebrateJoi.extend(JoiObjectId) const objectIdValidator = {
name: 'objectId',
language: {
invalid: 'needs to be a valid ObjectId'
},
pre(value, state, options) {
if (!ObjectId.isValid(value)) {
return this.createError('objectId.invalid', { value }, state, options)
}
if (options.convert) {
return new ObjectId(value)
}
return value
}
}
const Joi = CelebrateJoi.extend(objectIdValidator)
const errorMiddleware = errors() const errorMiddleware = errors()
module.exports = { Joi, validate, errorMiddleware } module.exports = { Joi, validate, errorMiddleware }

View file

@ -6531,6 +6531,7 @@
"version": "7.1.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz", "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==", "integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
"dev": true,
"requires": { "requires": {
"check-error": "^1.0.2" "check-error": "^1.0.2"
} }
@ -6579,7 +6580,8 @@
"check-error": { "check-error": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
"integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==" "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==",
"dev": true
}, },
"cheerio": { "cheerio": {
"version": "1.0.0-rc.3", "version": "1.0.0-rc.3",
@ -13810,34 +13812,6 @@
"resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz",
"integrity": "sha512-+kHj8HXArPfpPEKGLZ+kB5ONRTCiGQXo8RQYL0hH8t6pWXUBBK5KkkQmTNOwKK4LEsd0yTsgtjJVm4UBSZea4w==" "integrity": "sha512-+kHj8HXArPfpPEKGLZ+kB5ONRTCiGQXo8RQYL0hH8t6pWXUBBK5KkkQmTNOwKK4LEsd0yTsgtjJVm4UBSZea4w=="
}, },
"joi-mongodb-objectid": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/joi-mongodb-objectid/-/joi-mongodb-objectid-0.1.0.tgz",
"integrity": "sha512-5N86VRXOd8TZ2nEvlg/EvIeF/StFrB2VAI9iD46di2B2eR7dU2kLhsYTwiAOQMFozIg64qfWs/eEed52w9YpBw==",
"requires": {
"bson": "^4.0.0"
},
"dependencies": {
"bson": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/bson/-/bson-4.0.2.tgz",
"integrity": "sha512-rBdCxMBCg2aR420e1oKUejjcuPZLTibA7zEhWAlliFWEwzuBCC9Dkp5r7VFFIQB2t1WVsvTbohry575mc7Xw5A==",
"requires": {
"buffer": "^5.1.0",
"long": "^4.0.0"
}
},
"buffer": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz",
"integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==",
"requires": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
}
}
}
},
"jquery": { "jquery": {
"version": "2.2.4", "version": "2.2.4",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz",
@ -24581,7 +24555,7 @@
} }
}, },
"translations-sharelatex": { "translations-sharelatex": {
"version": "git+https://github.com/sharelatex/translations-sharelatex.git#beea1036cdf3adf41cd41e73fcfd6a5a70f83763", "version": "git+https://github.com/sharelatex/translations-sharelatex.git#712f3b1b309c2a487d4f84ccbd1ca28fc3fe941f",
"from": "git+https://github.com/sharelatex/translations-sharelatex.git#master", "from": "git+https://github.com/sharelatex/translations-sharelatex.git#master",
"dev": true, "dev": true,
"requires": { "requires": {

View file

@ -48,7 +48,6 @@
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"bufferedstream": "1.6.0", "bufferedstream": "1.6.0",
"celebrate": "^10.0.1", "celebrate": "^10.0.1",
"chai-as-promised": "^7.1.1",
"codemirror": "^5.33.0", "codemirror": "^5.33.0",
"connect-redis": "^3.1.0", "connect-redis": "^3.1.0",
"contentful": "^6.1.1", "contentful": "^6.1.1",
@ -70,7 +69,6 @@
"handlebars": "^4.7.6", "handlebars": "^4.7.6",
"helmet": "^3.22.0", "helmet": "^3.22.0",
"http-proxy": "^1.18.0", "http-proxy": "^1.18.0",
"joi-mongodb-objectid": "^0.1.0",
"jquery": "^2.2.4", "jquery": "^2.2.4",
"json2csv": "^4.3.3", "json2csv": "^4.3.3",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",