authorized-rules
Advanced tools
Comparing version 0.4.0 to 0.4.2
@@ -1,11 +0,11 @@ | ||
export declare type JwtToken = { | ||
export type JwtToken = { | ||
iss: string; | ||
sub: string; | ||
}; | ||
export declare type Rule = (token: JwtToken) => Promise<RuleResult>; | ||
export declare type RuleResult = { | ||
export type Rule = (token: JwtToken) => Promise<RuleResult>; | ||
export type RuleResult = { | ||
passed: boolean; | ||
ruleName: string; | ||
}; | ||
export declare type Request = { | ||
export type Request = { | ||
headers: { | ||
@@ -12,0 +12,0 @@ authorization: string; |
@@ -17,3 +17,3 @@ "use strict"; | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
@@ -55,6 +55,6 @@ if (y = 0, t) op = [op[0] & 2, t.value]; | ||
catch (e) { | ||
throw http_errors_1.default(403, 'invalid token: parse failed'); | ||
throw (0, http_errors_1.default)(403, 'invalid token: parse failed'); | ||
} | ||
if (!token.iss) { | ||
throw http_errors_1.default(403, 'invalid token: missing issuer'); | ||
throw (0, http_errors_1.default)(403, 'invalid token: missing issuer'); | ||
} | ||
@@ -65,3 +65,3 @@ return [4 /*yield*/, executionRule(token)]; | ||
if (!ruleResult.passed) { | ||
throw http_errors_1.default(403, 'operation not authorized'); | ||
throw (0, http_errors_1.default)(403, 'operation not authorized'); | ||
} | ||
@@ -122,3 +122,3 @@ return [2 /*return*/]; | ||
exports.or = or; | ||
var parseToken = function (token) { return jwt_decode_1.default(token); }; | ||
var parseToken = function (token) { return (0, jwt_decode_1.default)(token); }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "authorized-rules", | ||
"version": "0.4.0", | ||
"version": "0.4.2", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "rm -rf dist && tsc", | ||
"prepublish": "yarn build", | ||
"build": "tsc", | ||
"prepublish": "npm run build", | ||
"test": "jest --config=tests/jest.config.unit.js" | ||
@@ -13,26 +13,11 @@ }, | ||
"type": "git", | ||
"url": "git+https://github.com/guysegal/authorized-rules.git" | ||
"url": "https://github.com/Soluto/authorized-rules.git" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/guysegal/authorized-rules/issues" | ||
"url": "https://github.com/Soluto/authorized-rules/issues" | ||
}, | ||
"homepage": "https://github.com/guysegal/authorized-rules#readme", | ||
"devDependencies": { | ||
"@types/http-errors": "^1.8.0", | ||
"@types/jest": "^26.0.20", | ||
"@types/jsonwebtoken": "^8.5.0", | ||
"@typescript-eslint/eslint-plugin": "^4.13.0", | ||
"@typescript-eslint/parser": "^4.13.0", | ||
"eslint": "^7.17.0", | ||
"eslint-plugin-simple-import-sort": "^7.0.0", | ||
"husky": "^4.3.7", | ||
"jest": "^26.6.3", | ||
"jsonwebtoken": "^8.5.1", | ||
"lint-staged": "^10.5.3", | ||
"prettier": "^2.2.1", | ||
"ts-jest": "^26.4.4", | ||
"typescript": "^4.1.3" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"dependencies": { | ||
@@ -42,3 +27,16 @@ "@types/jwt-decode": "^3.1.0", | ||
"jwt-decode": "^3.1.2" | ||
}, | ||
"devDependencies": { | ||
"@types/http-errors": "^2.0.1", | ||
"@types/jest": "^29.5.3", | ||
"@types/jsonwebtoken": "^9.0.2", | ||
"@typescript-eslint/eslint-plugin": "^6.4.0", | ||
"@typescript-eslint/parser": "^6.4.0", | ||
"eslint": "^8.47.0", | ||
"eslint-plugin-simple-import-sort": "^10.0.0", | ||
"jest": "^29.6.2", | ||
"jsonwebtoken": "^8.5.1", | ||
"ts-jest": "^29.1.1", | ||
"typescript": "^5.1.6" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
11
0
9834
5
136
2
3