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.0
to
3.0.1
+2
-2
package.json
{
"name": "@zenweb/controller",
"version": "3.0.0",
"version": "3.0.1",
"description": "Zenweb Controller module",

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

"scripts": {
"prepublishOnly": "tsc --build --clean && tsc",
"prepublishOnly": "rm -fr dist && tsc",
"dev": "cd example && DEBUG=* ts-node app"

@@ -14,0 +14,0 @@ },

/// <reference types="koa__router" />
import { Router, RouterPath } from "@zenweb/router";
import { Controller, ControllerClass } from "./controller";
export declare class CrudController extends Controller {
/**
* GET 请求 - 获取
*/
get?(): void | Promise<void>;
/**
* POST 请求 - 创建
*/
post?(): void | Promise<void>;
/**
* PATCH 请求 - 更新
*/
patch?(): void | Promise<void>;
/**
* DELETE 请求 - 删除
*/
delete?(): void | Promise<void>;
}
/**
* CRUD 控制器注解
* @param router 路由对象
* @param path 路径
*/
export declare function crudController<C extends CrudController>(router: Router, path: RouterPath, ...middleware: Router.Middleware[]): (controllerClass: ControllerClass<C>) => void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.crudController = exports.CrudController = void 0;
const controller_1 = require("./controller");
class CrudController extends controller_1.Controller {
}
exports.CrudController = CrudController;
/**
* CRUD 控制器注解
* @param router 路由对象
* @param path 路径
*/
function crudController(router, path, ...middleware) {
return function (controllerClass) {
function reg(method) {
router[method](path, ...(middleware || []), async (ctx) => {
const controller = await ctx.injector.getInstance(controllerClass);
await controller[method]();
});
}
for (const method of Object.getOwnPropertyNames(controllerClass.prototype)) {
if (['get', 'post', 'patch', 'delete'].includes(method)) {
reg(method);
}
}
};
}
exports.crudController = crudController;