From 00b66aff535d456fe8671a31c79558bff1fa0d17 Mon Sep 17 00:00:00 2001 From: "Juan Picado @jotadeveloper" Date: Fri, 25 Oct 2019 07:21:00 +0200 Subject: [PATCH] feat: add http-status-codes dep (#212) * feat: add http-status-codes dep * chore: pin dep * chore: update lock file --- core/commons-api/package.json | 3 ++- core/commons-api/src/index.ts | 27 ++++++++++++++------------- yarn.lock | 14 +++++++++----- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/core/commons-api/package.json b/core/commons-api/package.json index f529fe20..15c8e6bf 100644 --- a/core/commons-api/package.json +++ b/core/commons-api/package.json @@ -29,7 +29,8 @@ "node": ">=8" }, "dependencies": { - "http-errors": "1.7.3" + "http-errors": "1.7.3", + "http-status-codes": "1.3.2" }, "devDependencies": { "@verdaccio/babel-preset": "^8.2.0", diff --git a/core/commons-api/src/index.ts b/core/commons-api/src/index.ts index 7910d6a2..b1687ec3 100644 --- a/core/commons-api/src/index.ts +++ b/core/commons-api/src/index.ts @@ -1,21 +1,22 @@ import createError, { HttpError } from 'http-errors'; +import httpCodes from 'http-status-codes'; export const DEFAULT_MIN_LIMIT_PASSWORD = 3; export const HTTP_STATUS = { - OK: 200, - CREATED: 201, - MULTIPLE_CHOICES: 300, - NOT_MODIFIED: 304, - BAD_REQUEST: 400, - UNAUTHORIZED: 401, - FORBIDDEN: 403, - NOT_FOUND: 404, - CONFLICT: 409, - UNSUPPORTED_MEDIA: 415, - BAD_DATA: 422, - INTERNAL_ERROR: 500, - SERVICE_UNAVAILABLE: 503, + OK: httpCodes.OK, + CREATED: httpCodes.CREATED, + MULTIPLE_CHOICES: httpCodes.MULTIPLE_CHOICES, + NOT_MODIFIED: httpCodes.NOT_MODIFIED, + BAD_REQUEST: httpCodes.BAD_REQUEST, + UNAUTHORIZED: httpCodes.UNAUTHORIZED, + FORBIDDEN: httpCodes.FORBIDDEN, + NOT_FOUND: httpCodes.NOT_FOUND, + CONFLICT: httpCodes.CONFLICT, + UNSUPPORTED_MEDIA: httpCodes.UNSUPPORTED_MEDIA_TYPE, + BAD_DATA: httpCodes.UNPROCESSABLE_ENTITY, + INTERNAL_ERROR: httpCodes.INTERNAL_SERVER_ERROR, + SERVICE_UNAVAILABLE: httpCodes.SERVICE_UNAVAILABLE, LOOP_DETECTED: 508, }; diff --git a/yarn.lock b/yarn.lock index 869b9fa1..268504fd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4414,10 +4414,10 @@ domexception@^1.0.1: dependencies: webidl-conversions "^4.0.2" -dompurify@2.0.6: - version "2.0.6" - resolved "https://registry.verdaccio.org/dompurify/-/dompurify-2.0.6.tgz#0a4196c211ce00e848240e52b1d49261af12a3be" - integrity sha512-1+AOpCYIKoLER/Ykd/Q/i11slhYy6T29/mmDrTsALH0JcMPB0pt9++8eDTGT70tv6ofmmeptrdqzZpmjMfFLRg== +dompurify@2.0.7: + version "2.0.7" + resolved "https://registry.verdaccio.org/dompurify/-/dompurify-2.0.7.tgz#f8266ad38fe1602fb5b3222f31eedbf5c16c4fd5" + integrity sha512-S3O0lk6rFJtO01ZTzMollCOGg+WAtCwS3U5E2WSDY/x/sy7q70RjEC4Dmrih5/UqzLLB9XoKJ8KqwBxaNvBu4A== dot-prop@^3.0.0: version "3.0.0" @@ -5901,6 +5901,11 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" +http-status-codes@1.3.2: + version "1.3.2" + resolved "https://registry.verdaccio.org/http-status-codes/-/http-status-codes-1.3.2.tgz#181dfa4455ef454e5e4d827718fca3936680d10d" + integrity sha512-nDUtj0ltIt08tGi2VWSpSzNNFye0v3YSe9lX3lIqLTuVvvRiYCvs4QQBSHo0eomFYw1wlUuofurUAlTm+vHnXg== + https-proxy-agent@^2.2.1: version "2.2.2" resolved "https://registry.verdaccio.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz#271ea8e90f836ac9f119daccd39c19ff7dfb0793" @@ -10155,7 +10160,6 @@ snyk@^1.231.0: needle "^2.2.4" opn "^5.5.0" os-name "^3.0.0" - proxy-agent "*" proxy-from-env "^1.0.0" semver "^6.0.0" snyk-config "^2.2.1"