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

hapi-crud-acl

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-crud-acl - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

lib/src/types/CRUDPermissions.d.ts

41

lib/package.json
{
"name": "hapi-crud-acl",
"version": "0.1.0",
"version": "1.0.0",
"description": "Hapi Crud Plugin",

@@ -12,16 +12,17 @@ "engines": {

"@types/hapi__boom": "^9.0.0",
"@types/hapi__hapi": "^19.0.0",
"@types/jest": "^24.9.0",
"@types/lodash": "^4.14.149",
"@types/node": "^13.1.7",
"jest": "^25.1.0",
"prettier": "^1.19.1",
"rimraf": "^3.0.0",
"shx": "^0.3.2",
"ts-jest": "^25.0.0",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"tslint-microsoft-contrib": "^6.2.0",
"tsutils": "^3.17.1",
"typescript": "^3.7.4"
"@types/hapi__hapi": "^20.0.5",
"@types/jest": "^26.0.20",
"@types/lodash": "^4.14.168",
"@types/node": "^14.14.31",
"@typescript-eslint/eslint-plugin": "^4.15.1",
"@typescript-eslint/parser": "^4.15.1",
"eslint": "^7.20.0",
"eslint-config-prettier": "^8.0.0",
"jest": "^26.6.3",
"prettier": "^2.2.1",
"rimraf": "^3.0.2",
"shx": "^0.3.3",
"ts-jest": "^26.5.1",
"tsutils": "^3.20.0",
"typescript": "^4.1.5"
},

@@ -35,3 +36,3 @@ "_files": [

"build:watch": "tsc -w -p tsconfig.release.json",
"lint": "tslint -t stylish --project \"tsconfig.json\"",
"lint": "eslint . && prettier --check .",
"test": "jest --coverage",

@@ -45,7 +46,7 @@ "test:watch": "jest --watch",

"dependencies": {
"@hapi/boom": "^9.0.0",
"@hapi/hapi": "^19.0.4",
"lodash": "^4.17.15",
"tslib": "^1.10.0"
"@hapi/boom": "^9.1.1",
"@hapi/hapi": "^20.1.0",
"lodash": "^4.17.21",
"tslib": "^2.1.0"
}
}

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

export declare class PermissionsFuncMissingError extends Error {
message: string;
}
export declare class MalFormedPermissionsError extends Error {
message: string;
}
declare const _default: any;
export default _default;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MalFormedPermissionsError = exports.PermissionsFuncMissingError = void 0;
const tslib_1 = require("tslib");
const Boom = tslib_1.__importStar(require("@hapi/boom"));
const pkg = tslib_1.__importStar(require("../package.json"));
let internals = {
implementation: null,
permissionsFunc: null,
class PermissionsFuncMissingError extends Error {
constructor() {
super(...arguments);
this.message = 'permissionsFunc is required';
}
}
exports.PermissionsFuncMissingError = PermissionsFuncMissingError;
class MalFormedPermissionsError extends Error {
constructor() {
super(...arguments);
this.message = 'permission must be formatted: [routeName]:[create|read|update|delete]';
}
}
exports.MalFormedPermissionsError = MalFormedPermissionsError;
const internals = {
permissionsFunc: () => ({}),
implementation: () => ({}),
};

@@ -13,3 +28,3 @@ exports.plugin = {

if (!options.permissionsFunc) {
throw Error('permissionsFunc is required');
throw new PermissionsFuncMissingError();
}

@@ -29,2 +44,5 @@ internals.permissionsFunc = options.permissionsFunc;

.every(([name, crud]) => {
if (!crud) {
throw new MalFormedPermissionsError();
}
if (!has[name]) {

@@ -37,8 +55,9 @@ return false;

internals.implementation = (request, h) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
const settings = request.route.settings.plugins[name];
if (!settings) {
const plugins = request.route.settings.plugins;
if (!plugins || !plugins[name]) {
return h.continue;
}
const requiredPermissions = settings.permissions;
if (!requiredPermissions) {
const pluginSettings = plugins[name];
const requiredPermissions = pluginSettings.permissions;
if (!requiredPermissions || requiredPermissions.length === 0) {
return h.continue;

@@ -45,0 +64,0 @@ }

{
"name": "hapi-crud-acl",
"version": "0.1.0",
"version": "1.0.0",
"description": "Hapi Crud Plugin",

@@ -12,16 +12,17 @@ "engines": {

"@types/hapi__boom": "^9.0.0",
"@types/hapi__hapi": "^19.0.0",
"@types/jest": "^24.9.0",
"@types/lodash": "^4.14.149",
"@types/node": "^13.1.7",
"jest": "^25.1.0",
"prettier": "^1.19.1",
"rimraf": "^3.0.0",
"shx": "^0.3.2",
"ts-jest": "^25.0.0",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"tslint-microsoft-contrib": "^6.2.0",
"tsutils": "^3.17.1",
"typescript": "^3.7.4"
"@types/hapi__hapi": "^20.0.5",
"@types/jest": "^26.0.20",
"@types/lodash": "^4.14.168",
"@types/node": "^14.14.31",
"@typescript-eslint/eslint-plugin": "^4.15.1",
"@typescript-eslint/parser": "^4.15.1",
"eslint": "^7.20.0",
"eslint-config-prettier": "^8.0.0",
"jest": "^26.6.3",
"prettier": "^2.2.1",
"rimraf": "^3.0.2",
"shx": "^0.3.3",
"ts-jest": "^26.5.1",
"tsutils": "^3.20.0",
"typescript": "^4.1.5"
},

@@ -35,3 +36,3 @@ "files": [

"build:watch": "tsc -w -p tsconfig.release.json",
"lint": "tslint -t stylish --project \"tsconfig.json\"",
"lint": "eslint . && prettier --check .",
"test": "jest --coverage",

@@ -45,7 +46,7 @@ "test:watch": "jest --watch",

"dependencies": {
"@hapi/boom": "^9.0.0",
"@hapi/hapi": "^19.0.4",
"lodash": "^4.17.15",
"tslib": "^1.10.0"
"@hapi/boom": "^9.1.1",
"@hapi/hapi": "^20.1.0",
"lodash": "^4.17.21",
"tslib": "^2.1.0"
}
}

Sorry, the diff of this file is not supported yet

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