@men-mvc/foundation
Advanced tools
Comparing version 0.120.0 to 0.121.0
@@ -8,3 +8,3 @@ "use strict"; | ||
const events_1 = __importDefault(require("events")); | ||
const applicationNotInitialisedError_1 = require("./applicationNotInitialisedError"); | ||
const applicationNotInitialisedError_1 = require("./errors/applicationNotInitialisedError"); | ||
class BaseApplication { | ||
@@ -11,0 +11,0 @@ constructor(app) { |
export * from './deepPartial'; | ||
export * from './errorCodes'; | ||
export * from './errors/errorCodes'; | ||
export * from './baseApplication'; | ||
export * from './uploadedFile'; | ||
export * from './readableString'; | ||
export * from './uploadMaxFileSizeError'; | ||
export * from './validationError'; | ||
export * from './errors/uploadMaxFileSizeError'; | ||
export * from './errors/validationError'; | ||
export * from './errorResponse'; | ||
export * from './errorResponseData'; | ||
export * from './insufficientPermissionError'; | ||
export * from './errors/insufficientPermissionError'; | ||
export * from './readableString'; | ||
@@ -16,3 +16,3 @@ export * from './statusCodes'; | ||
export * from './requestValidator'; | ||
export * from './applicationNotInitialisedError'; | ||
export * from './fileNotPublicError'; | ||
export * from './errors/applicationNotInitialisedError'; | ||
export * from './errors/fileNotPublicError'; |
@@ -18,11 +18,11 @@ "use strict"; | ||
__exportStar(require("./deepPartial"), exports); | ||
__exportStar(require("./errorCodes"), exports); | ||
__exportStar(require("./errors/errorCodes"), exports); | ||
__exportStar(require("./baseApplication"), exports); | ||
__exportStar(require("./uploadedFile"), exports); | ||
__exportStar(require("./readableString"), exports); | ||
__exportStar(require("./uploadMaxFileSizeError"), exports); | ||
__exportStar(require("./validationError"), exports); | ||
__exportStar(require("./errors/uploadMaxFileSizeError"), exports); | ||
__exportStar(require("./errors/validationError"), exports); | ||
__exportStar(require("./errorResponse"), exports); | ||
__exportStar(require("./errorResponseData"), exports); | ||
__exportStar(require("./insufficientPermissionError"), exports); | ||
__exportStar(require("./errors/insufficientPermissionError"), exports); | ||
__exportStar(require("./readableString"), exports); | ||
@@ -33,3 +33,3 @@ __exportStar(require("./statusCodes"), exports); | ||
__exportStar(require("./requestValidator"), exports); | ||
__exportStar(require("./applicationNotInitialisedError"), exports); | ||
__exportStar(require("./fileNotPublicError"), exports); | ||
__exportStar(require("./errors/applicationNotInitialisedError"), exports); | ||
__exportStar(require("./errors/fileNotPublicError"), exports); |
@@ -1,2 +0,2 @@ | ||
import { ValidationError } from './validationError'; | ||
import { ValidationError } from './errors/validationError'; | ||
import { ErrorResponse } from './errorResponse'; | ||
@@ -3,0 +3,0 @@ export declare class ValidationErrorResponse extends ErrorResponse<{ |
export declare const hashPassword: (plainTextPassword: string) => Promise<string>; | ||
export declare const validatePassword: (plainText: string, hash: string) => Promise<boolean>; | ||
export declare const generateVerificationToken: () => string; | ||
export declare const authorizeSync: (authFunc: () => boolean, error?: string) => void; | ||
export declare const authorizeAsync: (authFunc: () => Promise<boolean>, error?: string) => Promise<void>; |
@@ -6,6 +6,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateVerificationToken = exports.validatePassword = exports.hashPassword = void 0; | ||
exports.authorizeAsync = exports.authorizeSync = exports.generateVerificationToken = exports.validatePassword = exports.hashPassword = void 0; | ||
const bcryptjs_1 = __importDefault(require("bcryptjs")); | ||
const crypto_1 = __importDefault(require("crypto")); | ||
const str_1 = require("./str"); | ||
const types_1 = require("../types"); | ||
const hashPassword = async (plainTextPassword) => { | ||
@@ -20,1 +21,13 @@ const salt = await bcryptjs_1.default.genSalt(10); | ||
exports.generateVerificationToken = generateVerificationToken; | ||
const authorizeSync = (authFunc, error) => { | ||
if (!authFunc()) { | ||
throw new types_1.InsufficientPermissionError(error); | ||
} | ||
}; | ||
exports.authorizeSync = authorizeSync; | ||
const authorizeAsync = async (authFunc, error) => { | ||
if (!(await authFunc())) { | ||
throw new types_1.InsufficientPermissionError(error); | ||
} | ||
}; | ||
exports.authorizeAsync = authorizeAsync; |
@@ -27,3 +27,2 @@ "use strict"; | ||
}; | ||
// TODO: unit test even thought this is already tested in the tests for other components | ||
const readReadableAsString = async (readable) => { | ||
@@ -30,0 +29,0 @@ try { |
{ | ||
"name": "@men-mvc/foundation", | ||
"version": "0.120.0", | ||
"version": "0.121.0", | ||
"description": "Package that includes shared variables, types and utility functions for MEN MVC framework.", | ||
@@ -30,3 +30,3 @@ "private": false, | ||
"dependencies": { | ||
"@men-mvc/config": "^0.120.0", | ||
"@men-mvc/config": "^0.121.0", | ||
"express": "^4.18.2", | ||
@@ -55,3 +55,3 @@ "joi": "^17.9.1", | ||
"license": "MIT", | ||
"gitHead": "c01b0438b3775f18f0db96f1780dcec3440043d1" | ||
"gitHead": "919c95ddc80a3c4c2c17d45fb2eab975515467e3" | ||
} |
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
80682
1641
+ Added@men-mvc/config@0.121.0(transitive)
- Removed@men-mvc/config@0.120.0(transitive)
Updated@men-mvc/config@^0.121.0