@naturalcycles/js-lib
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -0,1 +1,8 @@ | ||
# [4.2.0](https://github.com/NaturalCycles/js-lib/compare/v4.1.0...v4.2.0) (2019-03-15) | ||
### Features | ||
* HttpErrorResponse, Admin401ErrorData, Admin403ErrorData ([d159381](https://github.com/NaturalCycles/js-lib/commit/d159381)) | ||
# [4.1.0](https://github.com/NaturalCycles/js-lib/compare/v4.0.0...v4.1.0) (2019-03-11) | ||
@@ -2,0 +9,0 @@ |
@@ -26,2 +26,11 @@ import { StringMap } from '../types'; | ||
} | ||
export interface Admin401ErrorData extends HttpErrorData { | ||
adminAuthRequired: true; | ||
} | ||
export interface Admin403ErrorData extends HttpErrorData { | ||
/** | ||
* Returns non-empty array. | ||
*/ | ||
adminPermissionsRequired: string[]; | ||
} | ||
/** | ||
@@ -60,5 +69,4 @@ * Portable object that represents Error. | ||
*/ | ||
export interface ErrorResponse<DATA_TYPE extends ErrorData = ErrorData> { | ||
export interface HttpErrorResponse<DATA_TYPE extends HttpErrorData = HttpErrorData> { | ||
error: ErrorObject<DATA_TYPE>; | ||
} | ||
export declare type HttpErrorResponse = ErrorResponse<HttpErrorData>; |
import { memo } from './decorators/memo.decorator'; | ||
import { memoCache } from './decorators/memoCache.decorator'; | ||
import { AppError } from './error/app.error'; | ||
import { ErrorData, ErrorObject, ErrorResponse, HttpErrorData, HttpErrorResponse } from './error/error.model'; | ||
import { Admin401ErrorData, Admin403ErrorData, ErrorData, ErrorObject, HttpErrorData, HttpErrorResponse } from './error/error.model'; | ||
import { anyToErrorMessage, anyToErrorObject, appErrorToErrorObject, appErrorToHttpError, errorObjectToAppError, errorObjectToHttpError, errorToErrorObject } from './error/error.util'; | ||
@@ -13,2 +13,2 @@ import { HttpError } from './error/http.error'; | ||
import { silentConsole } from './util/test.util'; | ||
export { memo, memoCache, ErrorData, ErrorObject, HttpErrorData, ErrorResponse, HttpErrorResponse, AppError, HttpError, silentConsole, randomInt, loadScript, StringMap, PromiseMap, ClassType, capitalizeFirstLetter, lowercaseFirstLetter, removeWhitespace, pick, filterFalsyValues, filterEmptyStringValues, filterUndefinedValues, filterValues, transformValues, objectNullValuesToUndefined, deepEquals, deepCopy, isObject, isEmptyObject, mergeDeep, deepTrim, sortObjectDeep, unsetValue, mask, arrayToHash, classToPlain, getKeyByValue, invertObject, invertMap, by, deepFreeze, anyToErrorMessage, anyToErrorObject, errorToErrorObject, errorObjectToAppError, errorObjectToHttpError, appErrorToErrorObject, appErrorToHttpError, }; | ||
export { memo, memoCache, ErrorData, ErrorObject, HttpErrorData, HttpErrorResponse, AppError, HttpError, Admin401ErrorData, Admin403ErrorData, silentConsole, randomInt, loadScript, StringMap, PromiseMap, ClassType, capitalizeFirstLetter, lowercaseFirstLetter, removeWhitespace, pick, filterFalsyValues, filterEmptyStringValues, filterUndefinedValues, filterValues, transformValues, objectNullValuesToUndefined, deepEquals, deepCopy, isObject, isEmptyObject, mergeDeep, deepTrim, sortObjectDeep, unsetValue, mask, arrayToHash, classToPlain, getKeyByValue, invertObject, invertMap, by, deepFreeze, anyToErrorMessage, anyToErrorObject, errorToErrorObject, errorObjectToAppError, errorObjectToHttpError, appErrorToErrorObject, appErrorToHttpError, }; |
{ | ||
"name": "@naturalcycles/js-lib", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"scripts": { | ||
@@ -19,5 +19,5 @@ "build": "del ./dist && tsc", | ||
"@naturalcycles/semantic-release": "^1.0.0", | ||
"@naturalcycles/shared-module": "^3.0.0", | ||
"@naturalcycles/shared-module": "^4.0.3", | ||
"@types/jest": "^24.0.6", | ||
"@types/node": "^10.0.0", | ||
"@types/node": "^11.11.3", | ||
"jest": "^24.1.0", | ||
@@ -24,0 +24,0 @@ "jest-junit": "^6.2.1", |
@@ -31,2 +31,13 @@ import { StringMap } from '../types' | ||
export interface Admin401ErrorData extends HttpErrorData { | ||
adminAuthRequired: true | ||
} | ||
export interface Admin403ErrorData extends HttpErrorData { | ||
/** | ||
* Returns non-empty array. | ||
*/ | ||
adminPermissionsRequired: string[] | ||
} | ||
/** | ||
@@ -73,6 +84,4 @@ * Portable object that represents Error. | ||
*/ | ||
export interface ErrorResponse<DATA_TYPE extends ErrorData = ErrorData> { | ||
export interface HttpErrorResponse<DATA_TYPE extends HttpErrorData = HttpErrorData> { | ||
error: ErrorObject<DATA_TYPE> | ||
} | ||
export type HttpErrorResponse = ErrorResponse<HttpErrorData> |
@@ -5,5 +5,6 @@ import { memo } from './decorators/memo.decorator' | ||
import { | ||
Admin401ErrorData, | ||
Admin403ErrorData, | ||
ErrorData, | ||
ErrorObject, | ||
ErrorResponse, | ||
HttpErrorData, | ||
@@ -59,6 +60,7 @@ HttpErrorResponse, | ||
HttpErrorData, | ||
ErrorResponse, | ||
HttpErrorResponse, | ||
AppError, | ||
HttpError, | ||
Admin401ErrorData, | ||
Admin403ErrorData, | ||
silentConsole, | ||
@@ -65,0 +67,0 @@ randomInt, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107057
1896