New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@zenweb/controller

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zenweb/controller - npm Package Compare versions

Comparing version
3.0.1
to
3.1.0
+3
-1
dist/controller.d.ts

@@ -8,3 +8,4 @@ /// <reference types="koa__router" />

middleware?: Router.Middleware[];
handle: () => Promise<void> | void;
handle: (...args: any[]) => Promise<void> | void;
params: any[];
}

@@ -31,2 +32,3 @@ export declare class Controller {

* 路由映射
* 如果方法中存在参数,则自动注入
* @param method HTTP 方法

@@ -33,0 +35,0 @@ * @param path 路径。如不指定则使用方法名

@@ -44,2 +44,3 @@ "use strict";

* 路由映射
* 如果方法中存在参数,则自动注入
* @param method HTTP 方法

@@ -51,2 +52,3 @@ * @param path 路径。如不指定则使用方法名

return function (target, propertyKey, descriptor) {
const params = Reflect.getMetadata('design:paramtypes', target, propertyKey) || [];
addControllerMapping(target, {

@@ -57,2 +59,3 @@ method,

handle: descriptor.value,
params,
});

@@ -89,3 +92,4 @@ };

const controller = await ctx.injector.getInstance(target);
await item.handle.call(controller);
const args = await Promise.all(item.params.map(i => ctx.injector.getInstance(i)));
await item.handle.apply(controller, args);
});

@@ -92,0 +96,0 @@ }

{
"name": "@zenweb/controller",
"version": "3.0.1",
"version": "3.1.0",
"description": "Zenweb Controller module",

@@ -28,3 +28,3 @@ "exports": "./dist/index.js",

"@zenweb/core": "^2.4.1",
"@zenweb/inject": "^1.0.0",
"@zenweb/inject": "^3.1.0",
"@zenweb/router": "^3.0.0"

@@ -31,0 +31,0 @@ },

@@ -30,4 +30,4 @@ # zenweb controller

@mapping()
simple() {
this.ctx.body = 'simple';
simple(ctx: Context) { // 也可以通过方法的参数自动注入
ctx.body = 'simple';
}

@@ -34,0 +34,0 @@