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

@plumier/generic-controller

Package Overview
Dependencies
Maintainers
1
Versions
204
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@plumier/generic-controller - npm Package Compare versions

Comparing version 1.0.0-canary.kd13oe59.0 to 1.0.0-canary.kd18a18n.0

36

lib/facility.js

@@ -22,11 +22,20 @@ "use strict";

}
function getIgnore(entity, property) {
const meta = tinspector_1.default(entity);
if (property) {
const prop = meta.properties.find(x => x.name === property);
return prop.decorators.find((x) => x.name === "Ignore");
function copyDecorators(decorators) {
const result = [];
for (const decorator of decorators) {
if (decorator.name === "Ignore") {
result.push(decorator);
}
const authDec = decorator;
if (authDec.type === "plumier-meta:authorize" && authDec.access === "all") {
result.push(decorator);
}
}
else
return meta.decorators.find((x) => x.name === "Ignore");
return result;
}
function decorateController(controller, decorators) {
for (const decorator of decorators) {
Reflect.decorate([tinspector_1.decorateClass(decorator)], controller);
}
}
function createController(rootPath, entity, controller, nameConversion) {

@@ -40,6 +49,5 @@ // get type of ID column on entity

const path = core_1.appendRoute(rootPath, name);
// copy @route.ignore() on entity to the controller to control route generation
const ignore = getIgnore(entity);
if (ignore)
Reflect.decorate([core_1.route.ignore(...ignore.methods)], Controller);
// copy @route.ignore() and @authorize on entity to the controller to control route generation
const meta = tinspector_1.default(entity);
decorateController(Controller, copyDecorators(meta.decorators));
Reflect.decorate([core_1.route.root(path)], Controller);

@@ -62,5 +70,5 @@ Reflect.decorate([core_1.api.tag(entity.name)], Controller);

// copy @route.ignore() on entity to the controller to control route generation
const ignore = getIgnore(dec.parentType, dec.propertyName);
if (ignore)
Reflect.decorate([core_1.route.ignore(...ignore.methods)], Controller);
const meta = tinspector_1.default(dec.parentType);
const decorators = meta.properties.find(x => x.name === dec.propertyName).decorators;
decorateController(Controller, copyDecorators(decorators));
Reflect.decorate([

@@ -67,0 +75,0 @@ core_1.route.root(path),

{
"name": "@plumier/generic-controller",
"version": "1.0.0-canary.kd13oe59.0+25feb79",
"version": "1.0.0-canary.kd18a18n.0+10ae92f",
"description": "Plumier generic controller implementation",

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

"dependencies": {
"@plumier/core": "1.0.0-canary.kd13oe59.0+25feb79",
"@plumier/core": "1.0.0-canary.kd18a18n.0+10ae92f",
"@types/pluralize": "^0.0.29",

@@ -33,3 +33,3 @@ "pluralize": "^8.0.0"

},
"gitHead": "25feb797777dbf094590690812eb01976354fefa"
"gitHead": "10ae92fec6d9aca11ad78a96578b7473c8a50af7"
}
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