From fcd40750fe9fe55412ca82a8abfbe596b4f9ee01 Mon Sep 17 00:00:00 2001 From: vitalii-codefresh Date: Mon, 13 May 2024 13:36:03 +0300 Subject: [PATCH 1/3] updated joi, express --- .gitignore | 1 + .../auxiliary-files/jsons/brokenJson.json | 9 + .../jsons/invalidJsonSchema.json | 9 + .../jsons/validJsonSchema.json | 9 + .../auxiliary-files/yamls/broken.yaml | 24 ++ .../auxiliary-files/yamls/correct.yaml | 9 + infra/__tests__/validate/validate.spec.js | 80 +++++++ infra/express.js | 9 +- .../joi-objectid-extension.js | 27 +++ infra/validation.js | 38 +-- package.json | 16 +- yarn.lock | 220 ++++++++---------- 12 files changed, 295 insertions(+), 156 deletions(-) create mode 100644 infra/__tests__/validate/auxiliary-files/jsons/brokenJson.json create mode 100644 infra/__tests__/validate/auxiliary-files/jsons/invalidJsonSchema.json create mode 100644 infra/__tests__/validate/auxiliary-files/jsons/validJsonSchema.json create mode 100644 infra/__tests__/validate/auxiliary-files/yamls/broken.yaml create mode 100644 infra/__tests__/validate/auxiliary-files/yamls/correct.yaml create mode 100644 infra/__tests__/validate/validate.spec.js create mode 100644 infra/validation-extensions/joi-objectid-extension.js diff --git a/.gitignore b/.gitignore index a325354..e929837 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,4 @@ typings/ # webstorm files .idea/ +globalConfig.json diff --git a/infra/__tests__/validate/auxiliary-files/jsons/brokenJson.json b/infra/__tests__/validate/auxiliary-files/jsons/brokenJson.json new file mode 100644 index 0000000..1e3fe26 --- /dev/null +++ b/infra/__tests__/validate/auxiliary-files/jsons/brokenJson.json @@ -0,0 +1,9 @@ +{ + "type: "object", + "properties": { + "name": { "type": "string" }, + "age": { "type": "number" } + }, + "required": true, + "additionalProperties": false +} diff --git a/infra/__tests__/validate/auxiliary-files/jsons/invalidJsonSchema.json b/infra/__tests__/validate/auxiliary-files/jsons/invalidJsonSchema.json new file mode 100644 index 0000000..ef0336c --- /dev/null +++ b/infra/__tests__/validate/auxiliary-files/jsons/invalidJsonSchema.json @@ -0,0 +1,9 @@ +{ + "type": "object", + "properties": { + "name": { "type": "string" }, + "age": { "type": "number" } + }, + "required": true, + "additionalProperties": false +} diff --git a/infra/__tests__/validate/auxiliary-files/jsons/validJsonSchema.json b/infra/__tests__/validate/auxiliary-files/jsons/validJsonSchema.json new file mode 100644 index 0000000..aee81c1 --- /dev/null +++ b/infra/__tests__/validate/auxiliary-files/jsons/validJsonSchema.json @@ -0,0 +1,9 @@ +{ + "type": "object", + "properties": { + "name": {"type": "string", "nullable": false}, + "age": {"type": "integer"} + }, + "required": ["foo"], + "additionalProperties": false +} diff --git a/infra/__tests__/validate/auxiliary-files/yamls/broken.yaml b/infra/__tests__/validate/auxiliary-files/yamls/broken.yaml new file mode 100644 index 0000000..730a835 --- /dev/null +++ b/infra/__tests__/validate/auxiliary-files/yamls/broken.yaml @@ -0,0 +1,24 @@ +services: + firstService: + image: some-image:master + labels: + - "codefresh" + ports: + - 80:80 + isBroken: true + environment: + NODE_ENV: development + + secondService: + image: some-image2:master + labels: + - "codefresh" + ports: + - 90:90 + environment: + NODE_ENV: production + +brokenPart: + part1: + - hereIsMistake: + mistake diff --git a/infra/__tests__/validate/auxiliary-files/yamls/correct.yaml b/infra/__tests__/validate/auxiliary-files/yamls/correct.yaml new file mode 100644 index 0000000..7e49369 --- /dev/null +++ b/infra/__tests__/validate/auxiliary-files/yamls/correct.yaml @@ -0,0 +1,9 @@ +services: + firstService: + image: first-image:master + labels: + - "codefresh" + ports: + - 80:80 + environment: + NODE_ENV: development diff --git a/infra/__tests__/validate/validate.spec.js b/infra/__tests__/validate/validate.spec.js new file mode 100644 index 0000000..c264c72 --- /dev/null +++ b/infra/__tests__/validate/validate.spec.js @@ -0,0 +1,80 @@ +const { MongoMemoryServer } = require('mongodb-memory-server'); +const mongoClient = require('../../mongo'); +const { Joi, createSchema } = require('../../validation'); +const { ValidationError } = require('joi'); +const { readFileSync } = require('fs'); + +describe('testing validation module', () => { + it('ObjectId', async () => { + const dbName = 'users'; + const mongods = [await MongoMemoryServer.create({ + instance: { + port: 27407, + dbName, + }, + binary: { version: '4.2.0' }, + }), await MongoMemoryServer.create({ + instance: { + port: 27607, + dbName, + }, + binary: { version: '6.0.14' }, + })]; + + // eslint-disable-next-line no-restricted-syntax + for (const mongod of mongods) { + const uri = mongod.getUri(); + // eslint-disable-next-line no-await-in-loop + await mongoClient.init({ + mongo: { + uri, + dbName, + }, + }); + const users = mongoClient.collection('users'); + const mockUser = { name: 'John' }; + // eslint-disable-next-line no-await-in-loop + const id = (await users.insertOne(mockUser)).insertedId.toString(); + expect(() => Joi.assert(id, Joi.objectId())).not.toThrow(); + } + expect(() => Joi.assert('someRandomId', Joi.objectId())).toThrow(ValidationError); + expect(() => Joi.assert(12345678, Joi.objectId())).toThrow(ValidationError); + }); + + it('customYamlSchema', () => { + const correctDoc = readFileSync('infra/__tests__/validate/auxiliary-files/yamls/correct.yaml', { encoding: 'utf8' }); + const brokenDoc = readFileSync('infra/__tests__/validate/auxiliary-files/yamls/broken.yaml', { encoding: 'utf8' }); + expect(() => Joi.assert(correctDoc, Joi.yaml())).not.toThrow(); + expect(() => Joi.assert(brokenDoc, Joi.yaml())).toThrow(ValidationError); + }); + + it('jsonSchemaString', () => { + const validSchema = readFileSync('infra/__tests__/validate/auxiliary-files/jsons/validJsonSchema.json', { encoding: 'utf8' }); + const invalidSchema = readFileSync('infra/__tests__/validate/auxiliary-files/jsons/invalidJsonSchema.json', { encoding: 'utf8' }); + const brokenJson = readFileSync('infra/__tests__/validate/auxiliary-files/jsons/brokenJson.json', { encoding: 'utf8' }); + expect(() => Joi.assert(validSchema, Joi.jsonSchemaString())).not.toThrow(); + expect(() => Joi.assert(invalidSchema, Joi.jsonSchemaString())).toThrow(ValidationError); + expect(() => Joi.assert(brokenJson, Joi.jsonSchemaString())).toThrow(ValidationError); + }); + + it('createSchema', async () => { + const schema = createSchema({ + id: Joi.objectId().required(), + name: Joi.string().required(), + }, 'type', { argo: { spec: Joi.object({ testField: Joi.boolean() }).required() } }); + const invalidValue = { id: '123' }; + const validValue = { id: '663cdd877065d5748d788886', name: 'Somename', type: 'argo', spec: { testField: false } }; + const validateCheck = async (value) => { + const result = await schema.validate(value); + if (result.error) { + throw result.error.details[0].message; + } + return { value }; + }; + await expect(validateCheck(invalidValue)).rejects.toEqual('must be a valid ObjectId'); + + await expect(validateCheck(validValue)).resolves.toEqual({ value: validValue, error: undefined }); + + await expect(schema.validateField('spec', validValue.spec)); + }); +}); diff --git a/infra/express.js b/infra/express.js index 201755a..890d888 100644 --- a/infra/express.js +++ b/infra/express.js @@ -1,15 +1,12 @@ - -const Promise = require('bluebird'); const express = require('express'); const compression = require('compression'); -const bodyParser = require('body-parser'); const methodOverride = require('method-override'); -const cookieParser = require('cookie-parser'); const morgan = require('morgan'); const monitor = require('@codefresh-io/cf-monitor'); const { newDomainMiddleware } = require('@codefresh-io/http-infra'); const { openapi } = require('@codefresh-io/cf-openapi'); const CFError = require('cf-errors'); +const cookieParser = require('cookie-parser'); class Express { constructor() { @@ -59,9 +56,9 @@ class Express { app.use(compression()); openapi.endpoints().registerUtilityMiddleware(app); - app.use(bodyParser.json()); + app.use(express.json()); - app.use(bodyParser.urlencoded({ extended: true })); + app.use(express.urlencoded({ extended: true })); app.use(methodOverride()); if (this.config.httpLogger) { diff --git a/infra/validation-extensions/joi-objectid-extension.js b/infra/validation-extensions/joi-objectid-extension.js new file mode 100644 index 0000000..4433418 --- /dev/null +++ b/infra/validation-extensions/joi-objectid-extension.js @@ -0,0 +1,27 @@ +const { ObjectId } = require('mongodb'); + +const joiObjectId = { + type: 'objectId', + messages: { objectId: 'must be a valid ObjectId' }, + coerce(value) { + if (!value) { + return { value }; + } + + // Convert string to object ID + if (typeof value === 'string' && value.match(/^[0-9a-fA-F]{24}$/)) { + return { value: new ObjectId(value) }; + } + + return { value }; + }, + validate(value, helpers) { + if (!(value instanceof ObjectId)) { + const errors = helpers.error('objectId'); + return { value, errors }; + } + return { value }; + }, +}; + +module.exports = joiObjectId; diff --git a/infra/validation.js b/infra/validation.js index 8fa636c..2e5d5ee 100644 --- a/infra/validation.js +++ b/infra/validation.js @@ -1,38 +1,37 @@ const _ = require('lodash'); -const Promise = require('bluebird'); -const Joi = require('joi').extend(require('@wegolook/joi-objectid')); +const Joi = require('joi'); const YAML = require('js-yaml'); const Ajv = require('ajv'); +Joi.objectId = Joi.extend(require('./validation-extensions/joi-objectid-extension')).objectId; + const customYamlJoi = Joi.extend((joi) => ({ // eslint-disable-line - name: 'yaml', - language: {}, - pre(value, state, options) { + type: 'yaml', + base: Joi.string(), + prepare(value, helpers) { try { YAML.safeLoad(value); - return value; + return { value }; } catch (err) { - return this.createError('yaml', { v: value }, state, options); + return { errors: helpers.error('yaml', { v: value }) }; } }, - rules: [], })); Joi.yaml = customYamlJoi.yaml; const customJsonSchemaStringJoi = Joi.extend((joi) => ({ // eslint-disable-line base: Joi.string(), - name: 'jsonSchemaString', - language: { pre: 'is not a valid JSON Schema: {{err}}' }, - pre(value, state, options) { + type: 'jsonSchemaString', + messages: { pre: 'is not a valid JSON Schema: {{err}}' }, + prepare(value, helpers) { try { - const ajv = new Ajv(); // options can be passed, e.g. {allErrors: true} + const ajv = new Ajv({ validateSchema: true }); // options can be passed, e.g. {allErrors: true} ajv.compile(JSON.parse(value)); - return value; + return { value }; } catch (err) { - return this.createError('jsonSchemaString.pre', { v: value, err: err.toString().replace('Error: schema is invalid: ', '') }, state, options); // eslint-disable-line max-len + return { errors: helpers.error('jsonSchemaString.pre', { v: value, err: err.toString().replace('Error: schema is invalid: ', '') }) }; // eslint-disable-line max-len } }, - rules: [], })); Joi.jsonSchemaString = customJsonSchemaStringJoi.jsonSchemaString; @@ -41,10 +40,12 @@ function validateField(field, val, options = { optional: false }) { if (val === undefined && _.get(options, 'optional')) { return Promise.resolve(); } - - return Joi.reach(this, field).validate(val, { language: { key: `"${field}" ` } }); + const extractedSchema = this.extract(field); + const res = extractedSchema.validate(val, { messages: { key: `"${field}" ` } }); + return res; } + function validateFields(partialObject, options) { return Promise.reduce(Object.keys(partialObject), (ret, field) => this.validateField(field, partialObject[field], options), 0); } @@ -92,8 +93,7 @@ function _createSchema(baseSchema, discriminator, childSchemas) { .when(discriminator, { is: discriminatorVal, then: valueSchema }); }); }); - return Joi.object(baseSchema) - .keys({ [discriminator]: Joi.valid(Object.keys(childSchemas)).required() }) + .keys({ [discriminator]: Joi.valid(...Object.keys(childSchemas)).required() }) .keys(extendedSchema); } diff --git a/package.json b/package.json index a4967b6..d9594dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@codefresh-io/service-base", - "version": "5.0.4", + "version": "6.0.0", "main": "index.js", "description": "", "bin": { @@ -40,15 +40,13 @@ "@codefresh-io/internal-service-config": "^1.0.3", "@wegolook/joi-objectid": "^2.4.0", "ajv": "^6.10.0", - "bluebird": "^3.5.3", - "body-parser": "^1.19.2", "cf-errors": "^0.1.15", "cf-logs": "^1.1.26", "chai": "4.3.10", "compression": "^1.7.4", - "cookie-parser": "^1.4.4", - "express": "^4.17.3", - "joi": "^13.0.2", + "cookie-parser": "^1.4.6", + "express": "^4.19.2", + "joi": "^17.13.0", "js-yaml": "^3.13.1", "lodash": "4.17.21", "method-override": "^3.0.0", @@ -57,9 +55,7 @@ "node-uuid": "^1.4.8", "proxyquire": "^1.8.0", "queue": "^4.2.1", - "redis": "^3.1.0", - "request": "2.88.2", - "request-promise": "4.2.6" + "redis": "^3.1.0" }, "devDependencies": { "@shelf/jest-mongodb": "^4.2.0", @@ -70,6 +66,6 @@ "eslint-plugin-mocha": "^4.12.1", "jest": "^29.7.0", "mocha": "^8.2.1", - "mongodb-memory-server": "^9.1.6" + "mongodb-memory-server": "^9.2.0" } } diff --git a/yarn.lock b/yarn.lock index 63bc45b..b20da44 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1378,6 +1378,18 @@ protobufjs "^7.2.4" yargs "^17.7.2" +"@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0": + version "9.3.0" + resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" + integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ== + +"@hapi/topo@^5.1.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012" + integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg== + dependencies: + "@hapi/hoek" "^9.0.0" + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -1766,6 +1778,23 @@ debug "4.3.4" mongodb-memory-server "9.1.1" +"@sideway/address@^4.1.5": + version "4.1.5" + resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.5.tgz#4bc149a0076623ced99ca8208ba780d65a99b9d5" + integrity sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q== + dependencies: + "@hapi/hoek" "^9.0.0" + +"@sideway/formula@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f" + integrity sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg== + +"@sideway/pinpoint@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" + integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== + "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -3142,7 +3171,7 @@ bitsyntax@~0.1.0: debug "~2.6.9" safe-buffer "~5.1.2" -bluebird@^3.5.0, bluebird@^3.5.3: +bluebird@^3.5.0: version "3.5.3" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" integrity sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw== @@ -3152,25 +3181,7 @@ bluebird@^3.5.4, bluebird@^3.7.2: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -body-parser@1.20.1: - version "1.20.1" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.1.tgz#b1812a8912c195cd371a3ee5e66faa2338a5c668" - integrity sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw== - dependencies: - bytes "3.1.2" - content-type "~1.0.4" - debug "2.6.9" - depd "2.0.0" - destroy "1.2.0" - http-errors "2.0.0" - iconv-lite "0.4.24" - on-finished "2.4.1" - qs "6.11.0" - raw-body "2.5.1" - type-is "~1.6.18" - unpipe "1.0.0" - -body-parser@^1.19.2: +body-parser@1.20.2, body-parser@^1.19.2: version "1.20.2" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.2.tgz#6feb0e21c4724d06de7ff38da36dad4f57a747fd" integrity sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA== @@ -3670,12 +3681,12 @@ convert-source-map@^2.0.0: resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -cookie-parser@^1.4.4: - version "1.4.4" - resolved "https://registry.yarnpkg.com/cookie-parser/-/cookie-parser-1.4.4.tgz#e6363de4ea98c3def9697b93421c09f30cf5d188" - integrity sha512-lo13tqF3JEtFO7FyA49CqbhaFkskRJ0u/UAiINgrIXeRCY41c88/zxtrECl8AKH3B0hj9q10+h3Kt8I7KlW4tw== +cookie-parser@^1.4.6: + version "1.4.6" + resolved "https://registry.yarnpkg.com/cookie-parser/-/cookie-parser-1.4.6.tgz#3ac3a7d35a7a03bbc7e365073a26074824214594" + integrity sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA== dependencies: - cookie "0.3.1" + cookie "0.4.1" cookie-signature "1.0.6" cookie-signature@1.0.6: @@ -3683,15 +3694,15 @@ cookie-signature@1.0.6: resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= -cookie@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" - integrity sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s= +cookie@0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.1.tgz#afd713fe26ebd21ba95ceb61f9a8116e50a537d1" + integrity sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA== -cookie@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" - integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== +cookie@0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" + integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" @@ -4179,17 +4190,17 @@ expect@^29.7.0: jest-message-util "^29.7.0" jest-util "^29.7.0" -express@^4.17.3: - version "4.18.2" - resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59" - integrity sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ== +express@^4.19.2: + version "4.19.2" + resolved "https://registry.yarnpkg.com/express/-/express-4.19.2.tgz#e25437827a3aa7f2a827bc8171bbbb664a356465" + integrity sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q== dependencies: accepts "~1.3.8" array-flatten "1.1.1" - body-parser "1.20.1" + body-parser "1.20.2" content-disposition "0.5.4" content-type "~1.0.4" - cookie "0.5.0" + cookie "0.6.0" cookie-signature "1.0.6" debug "2.6.9" depd "2.0.0" @@ -4446,6 +4457,11 @@ follow-redirects@^1.15.3: resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020" integrity sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw== +follow-redirects@^1.15.6: + version "1.15.6" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b" + integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA== + forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" @@ -4715,16 +4731,6 @@ he@1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -hoek@5.x.x: - version "5.0.4" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-5.0.4.tgz#0f7fa270a1cafeb364a4b2ddfaa33f864e4157da" - integrity sha512-Alr4ZQgoMlnere5FZJsIyfIjORBqZll5POhDsF4q64dPuJR6rNxXdDxtHSQq8OXRurhmx+PWYEE8bXRROY8h0w== - -hoek@6.x.x: - version "6.1.2" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-6.1.2.tgz#99e6d070561839de74ee427b61aa476bd6bddfd6" - integrity sha512-6qhh/wahGYZHFSFw12tBbJw5fsAhhwrrG/y3Cs0YMTv2WzMnL0oLPnQJjv1QJvEfylRSOFuP+xCu+tdx0tD16Q== - hosted-git-info@^2.1.4: version "2.7.1" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" @@ -4793,6 +4799,14 @@ https-proxy-agent@^7.0.1, https-proxy-agent@^7.0.2: agent-base "^7.0.2" debug "4" +https-proxy-agent@^7.0.4: + version "7.0.4" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz#8e97b841a029ad8ddc8731f26595bad868cb4168" + integrity sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg== + dependencies: + agent-base "^7.0.2" + debug "4" + human-signals@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" @@ -5025,13 +5039,6 @@ isarray@^1.0.0, isarray@~1.0.0: resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= -isemail@3.x.x: - version "3.2.0" - resolved "https://registry.yarnpkg.com/isemail/-/isemail-3.2.0.tgz#59310a021931a9fb06bbb51e155ce0b3f236832c" - integrity sha512-zKqkK+O+dGqevc93KNsbZ/TqTUFd46MwWjYOoMrjIMZ51eU7DtQG3Wmd9SQQT7i7RVnuTPEiYEWHU3MSbxC1Tg== - dependencies: - punycode "2.x.x" - isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -5458,14 +5465,16 @@ jest@^29.7.0: import-local "^3.0.2" jest-cli "^29.7.0" -joi@^13.0.2: - version "13.7.0" - resolved "https://registry.yarnpkg.com/joi/-/joi-13.7.0.tgz#cfd85ebfe67e8a1900432400b4d03bbd93fb879f" - integrity sha512-xuY5VkHfeOYK3Hdi91ulocfuFopwgbSORmIwzcwHKESQhC7w1kD5jaVSPnqDxS2I8t3RZ9omCKAxNwXN5zG1/Q== +joi@^17.13.0: + version "17.13.1" + resolved "https://registry.yarnpkg.com/joi/-/joi-17.13.1.tgz#9c7b53dc3b44dd9ae200255cc3b398874918a6ca" + integrity sha512-vaBlIKCyo4FCUtCm7Eu4QZd/q02bWcxfUO6YSXAZOWF6gzcLBeba8kwotUdYJjDLW8Cz8RywsSOqiNJZW0mNvg== dependencies: - hoek "5.x.x" - isemail "3.x.x" - topo "3.x.x" + "@hapi/hoek" "^9.3.0" + "@hapi/topo" "^5.1.0" + "@sideway/address" "^4.1.5" + "@sideway/formula" "^3.0.1" + "@sideway/pinpoint" "^2.0.0" js-tokens@^3.0.2: version "3.0.2" @@ -5965,23 +5974,23 @@ mongodb-memory-server-core@9.1.1: tslib "^2.6.2" yauzl "^2.10.0" -mongodb-memory-server-core@9.1.6: - version "9.1.6" - resolved "https://registry.yarnpkg.com/mongodb-memory-server-core/-/mongodb-memory-server-core-9.1.6.tgz#0dce7831aceb80cca62e242df08cf05b533d0731" - integrity sha512-3H/dq5II+XcSbK80hicMw4zFlDxcpjt4oWJq76RlOVuLoaf3AFqVheR6Vqx9ymlIqER4Jni58FMCIIRbesia1A== +mongodb-memory-server-core@9.2.0: + version "9.2.0" + resolved "https://registry.yarnpkg.com/mongodb-memory-server-core/-/mongodb-memory-server-core-9.2.0.tgz#d83e52633df910d8a48c1ff27de139fd4ab7f2d9" + integrity sha512-9SWZEy+dGj5Fvm5RY/mtqHZKS64o4heDwReD4SsfR7+uNgtYo+JN41kPCcJeIH3aJf04j25i5Dia2s52KmsMPA== dependencies: async-mutex "^0.4.0" camelcase "^6.3.0" debug "^4.3.4" find-cache-dir "^3.3.2" - follow-redirects "^1.15.3" - https-proxy-agent "^7.0.2" + follow-redirects "^1.15.6" + https-proxy-agent "^7.0.4" mongodb "^5.9.1" new-find-package-json "^2.0.0" - semver "^7.5.4" - tar-stream "^3.0.0" + semver "^7.6.0" + tar-stream "^3.1.7" tslib "^2.6.2" - yauzl "^2.10.0" + yauzl "^3.1.3" mongodb-memory-server@9.1.1: version "9.1.1" @@ -5991,12 +6000,12 @@ mongodb-memory-server@9.1.1: mongodb-memory-server-core "9.1.1" tslib "^2.6.2" -mongodb-memory-server@^9.1.6: - version "9.1.6" - resolved "https://registry.yarnpkg.com/mongodb-memory-server/-/mongodb-memory-server-9.1.6.tgz#31b63996b2670e0e4a98d138e6abc7c2fbeca3d3" - integrity sha512-gzcpgGYlPhuKmria37W+bvYy6W+OkX2UVG7MoP41OWFvQv2Hn7A+fLXkV+lsMmhog1lMQprdV6AR+gixgheLaw== +mongodb-memory-server@^9.2.0: + version "9.2.0" + resolved "https://registry.yarnpkg.com/mongodb-memory-server/-/mongodb-memory-server-9.2.0.tgz#9fe8a0128f5b7409041895ce9e56ed28b2cf337d" + integrity sha512-w/usKdYtby5EALERxmA0+et+D0brP0InH3a26shNDgGefXA61hgl6U0P3IfwqZlEGRZdkbZig3n57AHZgDiwvg== dependencies: - mongodb-memory-server-core "9.1.6" + mongodb-memory-server-core "9.2.0" tslib "^2.6.2" mongodb@^4.17.2: @@ -6604,7 +6613,7 @@ psl@^1.1.28: resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.31.tgz#e9aa86d0101b5b105cbe93ac6b784cd547276184" integrity sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw== -punycode@2.x.x, punycode@^2.1.0, punycode@^2.1.1: +punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== @@ -6672,16 +6681,6 @@ range-parser@~1.2.1: resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -raw-body@2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857" - integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== - dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.4.24" - unpipe "1.0.0" - raw-body@2.5.2: version "2.5.2" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" @@ -6817,24 +6816,7 @@ request-ip@^3.3.0: resolved "https://registry.yarnpkg.com/request-ip/-/request-ip-3.3.0.tgz#863451e8fec03847d44f223e30a5d63e369fa611" integrity sha512-cA6Xh6e0fDBBBwH77SLJaJPBmD3nWVAcF9/XAcsrIHdjhFzFiB5aNQFytdjCGPezU3ROwrR11IddKAM08vohxA== -request-promise-core@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.4.tgz#3eedd4223208d419867b78ce815167d10593a22f" - integrity sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw== - dependencies: - lodash "^4.17.19" - -request-promise@4.2.6: - version "4.2.6" - resolved "https://registry.yarnpkg.com/request-promise/-/request-promise-4.2.6.tgz#7e7e5b9578630e6f598e3813c0f8eb342a27f0a2" - integrity sha512-HCHI3DJJUakkOr8fNoCc73E5nU5bqITjOYFMDrKHYOXWXrgD/SBaC7LjwuPymUprRyuF06UK7hd/lMHkmUXglQ== - dependencies: - bluebird "^3.5.0" - request-promise-core "1.1.4" - stealthy-require "^1.1.1" - tough-cookie "^2.3.3" - -request@2.88.2, request@^2.88.2: +request@^2.88.2: version "2.88.2" resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== @@ -7030,7 +7012,7 @@ semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.7, semver@^7.5.3: +semver@^7.3.7, semver@^7.5.3, semver@^7.6.0: version "7.6.0" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== @@ -7255,11 +7237,6 @@ statuses@2.0.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== -stealthy-require@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" - integrity sha512-ZnWpYnYugiOVEY5GkcuJK1io5V8QmNYChG62gSit9pQVGErXtrKuPC55ITaVSukmMta5qpMU7vqLt2Lnni4f/g== - streamroller@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/streamroller/-/streamroller-3.1.5.tgz#1263182329a45def1ffaef58d31b15d13d2ee7ff" @@ -7438,7 +7415,7 @@ table@4.0.2: slice-ansi "1.0.0" string-width "^2.1.1" -tar-stream@^3.0.0: +tar-stream@^3.0.0, tar-stream@^3.1.7: version "3.1.7" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-3.1.7.tgz#24b3fb5eabada19fe7338ed6d26e5f7c482e792b" integrity sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ== @@ -7517,14 +7494,7 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -topo@3.x.x: - version "3.0.3" - resolved "https://registry.yarnpkg.com/topo/-/topo-3.0.3.tgz#d5a67fb2e69307ebeeb08402ec2a2a6f5f7ad95c" - integrity sha512-IgpPtvD4kjrJ7CRA3ov2FhWQADwv+Tdqbsf1ZnPUSAtCJ9e1Z44MmoSGDXGk4IppoZA7jd/QRkNddlLJWlUZsQ== - dependencies: - hoek "6.x.x" - -tough-cookie@^2.3.3, tough-cookie@~2.5.0: +tough-cookie@~2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== @@ -7956,6 +7926,14 @@ yauzl@^2.10.0: buffer-crc32 "~0.2.3" fd-slicer "~1.1.0" +yauzl@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-3.1.3.tgz#f61c17ad1a09403bc7adb01dfb302a9e74bf4a50" + integrity sha512-JCCdmlJJWv7L0q/KylOekyRaUrdEoUxWkWVcgorosTROCFWiS9p2NNPE9Yb91ak7b1N5SxAZEliWpspbZccivw== + dependencies: + buffer-crc32 "~0.2.3" + pend "~1.2.0" + yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" From 26909082de0e4163cd78bc96937aa0d4ece7cdb5 Mon Sep 17 00:00:00 2001 From: vitalii-codefresh Date: Mon, 13 May 2024 18:56:56 +0300 Subject: [PATCH 2/3] added throwing errors while validating according to old joi version --- infra/__tests__/validate/validate.spec.js | 17 +++++++++-------- infra/express.js | 1 + infra/validation.js | 20 +++++++++++++++----- package.json | 2 +- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/infra/__tests__/validate/validate.spec.js b/infra/__tests__/validate/validate.spec.js index c264c72..a9b8e80 100644 --- a/infra/__tests__/validate/validate.spec.js +++ b/infra/__tests__/validate/validate.spec.js @@ -3,6 +3,7 @@ const mongoClient = require('../../mongo'); const { Joi, createSchema } = require('../../validation'); const { ValidationError } = require('joi'); const { readFileSync } = require('fs'); +const { ObjectId } = require('mongodb'); describe('testing validation module', () => { it('ObjectId', async () => { @@ -65,16 +66,16 @@ describe('testing validation module', () => { const invalidValue = { id: '123' }; const validValue = { id: '663cdd877065d5748d788886', name: 'Somename', type: 'argo', spec: { testField: false } }; const validateCheck = async (value) => { - const result = await schema.validate(value); - if (result.error) { - throw result.error.details[0].message; + try { + const res = await schema.validate(value); + return { value: res }; + } catch (error) { + throw error.message; } - return { value }; }; await expect(validateCheck(invalidValue)).rejects.toEqual('must be a valid ObjectId'); - - await expect(validateCheck(validValue)).resolves.toEqual({ value: validValue, error: undefined }); - - await expect(schema.validateField('spec', validValue.spec)); + await expect(validateCheck(validValue)).resolves.toEqual({ value: { ...validValue, id: new ObjectId(validValue.id) } }); + await expect(schema.validateField('id', invalidValue.id)).rejects.toEqual(new Error('must be a valid ObjectId')); + await expect(schema.validateField('id', validValue.id).value).toEqual(new ObjectId(validValue.id)); }); }); diff --git a/infra/express.js b/infra/express.js index 890d888..e1c9134 100644 --- a/infra/express.js +++ b/infra/express.js @@ -1,3 +1,4 @@ +const Promise = require('bluebird'); const express = require('express'); const compression = require('compression'); const methodOverride = require('method-override'); diff --git a/infra/validation.js b/infra/validation.js index 2e5d5ee..5322132 100644 --- a/infra/validation.js +++ b/infra/validation.js @@ -35,14 +35,22 @@ const customJsonSchemaStringJoi = Joi.extend((joi) => ({ // eslint-disable-line })); Joi.jsonSchemaString = customJsonSchemaStringJoi.jsonSchemaString; +const throwValidationError = (error) => { + const validationErrorMessage = _.get(error, 'details[0].message'); + return Promise.reject(validationErrorMessage ? new Error(validationErrorMessage) : error); +}; + function validateField(field, val, options = { optional: false }) { if (val === undefined && _.get(options, 'optional')) { return Promise.resolve(); } const extractedSchema = this.extract(field); - const res = extractedSchema.validate(val, { messages: { key: `"${field}" ` } }); - return res; + const { error, value } = extractedSchema.validate(val, { messages: { key: `"${field}" ` } }); + if (error) { + return throwValidationError(error, field); + } + return { error, value }; } @@ -74,9 +82,11 @@ function _wrapValidate(validate) { return function (schema) { // eslint-disable-line return Promise.resolve() .then(validate.bind(this, schema)) - .catch((err) => { - const validationErrorMessage = _.get(err, 'details[0].message'); - return Promise.reject(validationErrorMessage ? new Error(validationErrorMessage) : err); + .then(({ error, value }) => { + if (error) { + return throwValidationError(error); + } + return Promise.resolve(value); }); }; } diff --git a/package.json b/package.json index d9594dd..d1eee22 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "@codefresh-io/eventbus": "^2.0.0", "@codefresh-io/http-infra": "^1.8.15", "@codefresh-io/internal-service-config": "^1.0.3", - "@wegolook/joi-objectid": "^2.4.0", "ajv": "^6.10.0", + "bluebird": "^3.5.3", "cf-errors": "^0.1.15", "cf-logs": "^1.1.26", "chai": "4.3.10", From 96ac3886ee2741b981b4260952b9a136b594733e Mon Sep 17 00:00:00 2001 From: vitalii-codefresh Date: Mon, 13 May 2024 19:00:49 +0300 Subject: [PATCH 3/3] corrected yarn.lock --- yarn.lock | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/yarn.lock b/yarn.lock index b20da44..e591df6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2802,13 +2802,6 @@ resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== -"@wegolook/joi-objectid@^2.4.0": - version "2.4.0" - resolved "https://registry.yarnpkg.com/@wegolook/joi-objectid/-/joi-objectid-2.4.0.tgz#045cfdbdeb24c075fb43036095e1fcb90ec89fb5" - integrity sha512-jAlXKRxucnQPbTtsKjL7cpv852/dY/zoArOqw+N+Ho5++hes8RT6+JCd5LFKlPeeAaeq7pDx2kXa4+CbozgNqw== - dependencies: - bson "^1.0.5" - accepts@~1.3.5: version "1.3.7" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" @@ -3176,7 +3169,7 @@ bluebird@^3.5.0: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" integrity sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw== -bluebird@^3.5.4, bluebird@^3.7.2: +bluebird@^3.5.3, bluebird@^3.5.4, bluebird@^3.7.2: version "3.7.2" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== @@ -3241,11 +3234,6 @@ bser@2.1.1: dependencies: node-int64 "^0.4.0" -bson@^1.0.5: - version "1.1.1" - resolved "https://registry.yarnpkg.com/bson/-/bson-1.1.1.tgz#4330f5e99104c4e751e7351859e2d408279f2f13" - integrity sha512-jCGVYLoYMHDkOsbwJZBCqwMHyH4c+wzgI9hG7Z6SZJRXWr+x58pdIbm2i9a/jFGCkRJqRUr8eoI7lDWa0hTkxg== - bson@^4.7.2: version "4.7.2" resolved "https://registry.yarnpkg.com/bson/-/bson-4.7.2.tgz#320f4ad0eaf5312dd9b45dc369cc48945e2a5f2e"