Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@verdaccio/commons-api

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@verdaccio/commons-api - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

CHANGELOG.md

23

lib/index.d.ts

@@ -1,2 +0,2 @@

import createError from 'http-errors';
import { HttpError } from 'http-errors';
export declare const DEFAULT_MIN_LIMIT_PASSWORD = 3;

@@ -85,10 +85,13 @@ export declare const HTTP_STATUS: {

};
export declare function getConflict(message?: string): createError.HttpError;
export declare function getBadData(customMessage?: string): createError.HttpError;
export declare function getBadRequest(customMessage: string): createError.HttpError;
export declare function getInternalError(customMessage?: string): createError.HttpError;
export declare function getUnauthorized(message?: string): createError.HttpError;
export declare function getForbidden(message?: string): createError.HttpError;
export declare function getServiceUnavailable(message?: string): createError.HttpError;
export declare function getNotFound(customMessage?: string): createError.HttpError;
export declare function getCode(statusCode: number, customMessage: string): createError.HttpError;
export declare type VerdaccioError = HttpError & {
code: number;
};
export declare function getConflict(message?: string): VerdaccioError;
export declare function getBadData(customMessage?: string): VerdaccioError;
export declare function getBadRequest(customMessage: string): VerdaccioError;
export declare function getInternalError(customMessage?: string): VerdaccioError;
export declare function getUnauthorized(message?: string): VerdaccioError;
export declare function getForbidden(message?: string): VerdaccioError;
export declare function getServiceUnavailable(message?: string): VerdaccioError;
export declare function getNotFound(customMessage?: string): VerdaccioError;
export declare function getCode(statusCode: number, customMessage: string): VerdaccioError;

@@ -110,36 +110,43 @@ "use strict";

function getError(code, message) {
const err = Object.assign({}, (0, _httpErrors.default)(code, message), {
code
});
return err;
}
function getConflict(message = API_ERROR.PACKAGE_EXIST) {
return (0, _httpErrors.default)(HTTP_STATUS.CONFLICT, message);
return getError(HTTP_STATUS.CONFLICT, message);
}
function getBadData(customMessage) {
return (0, _httpErrors.default)(HTTP_STATUS.BAD_DATA, customMessage || API_ERROR.BAD_DATA);
return getError(HTTP_STATUS.BAD_DATA, customMessage || API_ERROR.BAD_DATA);
}
function getBadRequest(customMessage) {
return (0, _httpErrors.default)(HTTP_STATUS.BAD_REQUEST, customMessage);
return getError(HTTP_STATUS.BAD_REQUEST, customMessage);
}
function getInternalError(customMessage) {
return customMessage ? (0, _httpErrors.default)(HTTP_STATUS.INTERNAL_ERROR, customMessage) : (0, _httpErrors.default)(HTTP_STATUS.INTERNAL_ERROR);
return customMessage ? getError(HTTP_STATUS.INTERNAL_ERROR, customMessage) : getError(HTTP_STATUS.INTERNAL_ERROR, API_ERROR.UNKNOWN_ERROR);
}
function getUnauthorized(message = 'no credentials provided') {
return (0, _httpErrors.default)(HTTP_STATUS.UNAUTHORIZED, message);
return getError(HTTP_STATUS.UNAUTHORIZED, message);
}
function getForbidden(message = "can't use this filename") {
return (0, _httpErrors.default)(HTTP_STATUS.FORBIDDEN, message);
return getError(HTTP_STATUS.FORBIDDEN, message);
}
function getServiceUnavailable(message = API_ERROR.RESOURCE_UNAVAILABLE) {
return (0, _httpErrors.default)(HTTP_STATUS.SERVICE_UNAVAILABLE, message);
return getError(HTTP_STATUS.SERVICE_UNAVAILABLE, message);
}
function getNotFound(customMessage) {
return (0, _httpErrors.default)(HTTP_STATUS.NOT_FOUND, customMessage || API_ERROR.NO_PACKAGE);
return getError(HTTP_STATUS.NOT_FOUND, customMessage || API_ERROR.NO_PACKAGE);
}
function getCode(statusCode, customMessage) {
return (0, _httpErrors.default)(statusCode, customMessage);
return getError(statusCode, customMessage);
}
{
"name": "@verdaccio/commons-api",
"version": "0.0.1",
"version": "0.1.0",
"description": "commons api utilities for verdaccio",

@@ -21,3 +21,3 @@ "main": "lib/index.js",

"eslint": "5.16.0",
"husky": "2.4.1",
"husky": "2.5.0",
"in-publish": "2.0.0",

@@ -33,3 +33,3 @@ "jest": "24.8.0",

"dependencies": {
"http-errors": "^1.7.2"
"http-errors": "1.7.3"
},

@@ -53,3 +53,3 @@ "lint-staged": {

"build:types": "tsc --emitDeclarationOnly",
"build:js": "babel src/ --out-dir lib --extensions \".ts,.tsx\" --ignore __tests__",
"build:js": "babel src/ --out-dir lib --extensions \".ts,.tsx\"",
"precommit": "lint-staged",

@@ -56,0 +56,0 @@ "prepublish": "in-publish && npm run lint && npm run build || not-in-publish"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc