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

routing-controllers

Package Overview
Dependencies
Maintainers
2
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

routing-controllers - npm Package Compare versions

Comparing version 0.6.0-alpha.3 to 0.6.0-alpha.4

metadata/args/UseMetadataArgs.d.ts

8

decorator/decorators.d.ts

@@ -7,4 +7,10 @@ import { MiddlewareOptions } from "./options/MiddlewareOptions";

export declare function Middleware(options?: MiddlewareOptions): Function;
export declare function Middleware(name?: string, options?: MiddlewareOptions): Function;
/**
* Annotation must be set to controller action and given to it code will be used as HTTP Status Code in the case
* if response result is success.
*/
export declare function Use(middleware: Function, options?: {
afterAction: boolean;
}): Function;
/**
* Registers a new error handler middleware.

@@ -11,0 +17,0 @@ */

"use strict";
var index_1 = require("../index");
var ResponsePropertyTypes_1 = require("../metadata/types/ResponsePropertyTypes");
function Middleware(nameOrOptions, maybeOptions) {
var name = typeof nameOrOptions === "string" ? nameOrOptions : undefined;
var options = nameOrOptions instanceof Object ? nameOrOptions : maybeOptions;
/**
* Registers a new middleware.
*/
function Middleware(options) {
return function (target) {
var metadata = {
target: target,
name: name,
isGlobal: options && options.global ? true : false,
priority: options && options.priority ? options.priority : undefined,
routes: options && options.routes ? options.routes : undefined,
afterAction: options && options.afterAction ? options.afterAction : false

@@ -19,2 +19,18 @@ };

exports.Middleware = Middleware;
/**
* Annotation must be set to controller action and given to it code will be used as HTTP Status Code in the case
* if response result is success.
*/
function Use(middleware, options) {
return function (objectOrFunction, methodName) {
var metadata = {
middleware: middleware,
target: methodName ? objectOrFunction.constructor : objectOrFunction,
method: methodName,
afterAction: options && options.afterAction ? true : false
};
index_1.defaultMetadataArgsStorage().uses.push(metadata);
};
}
exports.Use = Use;
function ErrorHandler(nameOrOptions, maybeOptions) {

@@ -21,0 +37,0 @@ var name = typeof nameOrOptions === "string" ? nameOrOptions : undefined;

10

decorator/options/MiddlewareOptions.d.ts

@@ -6,2 +6,6 @@ /**

/**
* Indicates if this is a global middleware. Global middleware applies to all routes of the project.
*/
global?: boolean;
/**
* Special priority to be used to define order of middlewares to be executed.

@@ -11,9 +15,5 @@ */

/**
* Defines on which routes this middleware is applied.
*/
routes?: string[];
/**
* Indicates if middleware must be executed after routing action is executed.
*/
afterAction: boolean;
afterAction?: boolean;
}

@@ -39,2 +39,11 @@ import { ParamOptions } from "./options/ParamOptions";

/**
* This decorator allows to inject http header parameter value to the controller action parameter.
* Applied to class method parameters.
*
* @param name Parameter name
* @param options Extra parameter options
*/
export declare function HeaderParam(name: string, options: ParamOptions): Function;
export declare function HeaderParam(name: string, required?: boolean, parseJson?: boolean): Function;
/**
* This decorator allows to inject a request body's value to the controller action parameter.

@@ -41,0 +50,0 @@ * Applied to class method parameters.

@@ -114,2 +114,27 @@ "use strict";

exports.QueryParam = QueryParam;
function HeaderParam(name, requiredOrOptions, parseJson) {
var required = false;
if (typeof requiredOrOptions === "object") {
required = requiredOrOptions.required;
parseJson = requiredOrOptions.parseJson;
}
else {
required = requiredOrOptions;
}
return function (object, methodName, index) {
var format = Reflect.getMetadata("design:paramtypes", object, methodName)[index];
var metadata = {
object: object,
method: methodName,
index: index,
type: ParamTypes_1.ParamTypes.HEADER,
name: name,
format: format,
parseJson: parseJson,
isRequired: required
};
index_1.defaultMetadataArgsStorage().params.push(metadata);
};
}
exports.HeaderParam = HeaderParam;
function BodyParam(name, requiredOrOptions, parseJson) {

@@ -116,0 +141,0 @@ var required = false;

@@ -42,3 +42,3 @@ import { ActionMetadata } from "../metadata/ActionMetadata";

*/
registerAction(action: ActionMetadata, executeCallback: (options: ActionCallbackOptions) => any): void;
registerAction(action: ActionMetadata, middlewares: MiddlewareMetadata[], executeCallback: (options: ActionCallbackOptions) => any): void;
/**

@@ -45,0 +45,0 @@ * Gets param from the request.

@@ -14,6 +14,7 @@ import { Driver } from "./Driver";

registerMiddleware(middleware: MiddlewareMetadata): void;
registerAction(action: ActionMetadata, executeCallback: (options: ActionCallbackOptions) => any): void;
registerAction(action: ActionMetadata, middlewares: MiddlewareMetadata[], executeCallback: (options: ActionCallbackOptions) => any): void;
getParamFromRequest(actionOptions: ActionCallbackOptions, param: any): void;
handleSuccess(result: any, action: ActionMetadata, options: ActionCallbackOptions): void;
handleError(error: any, action: ActionMetadata, options: ActionCallbackOptions): void;
private registerUses(uses, middlewares);
}

@@ -41,7 +41,7 @@ "use strict";

};
ExpressDriver.prototype.registerAction = function (action, executeCallback) {
ExpressDriver.prototype.registerAction = function (action, middlewares, executeCallback) {
var expressAction = action.type.toLowerCase();
if (!this.express[expressAction])
throw new BadHttpActionError_1.BadHttpActionError(action.type);
this.express[expressAction]("" + this.routePrefix + action.fullRoute, function (request, response, next) {
var routeHandler = function (request, response, next) {
var options = {

@@ -53,3 +53,12 @@ request: request,

executeCallback(options);
});
};
var uses = action.controllerMetadata.uses.concat(action.uses);
var fullRoute = "" + this.routePrefix + action.fullRoute;
var preMiddlewareFunctions = this.registerUses(uses.filter(function (use) { return !use.afterAction; }), middlewares);
var postMiddlewareFunctions = this.registerUses(uses.filter(function (use) { return use.afterAction; }), middlewares);
var expressParams = [fullRoute].concat(preMiddlewareFunctions, [routeHandler], postMiddlewareFunctions);
// finally register action
console.log("params: ", expressParams);
(_a = this.express)[expressAction].apply(_a, expressParams);
var _a;
};

@@ -65,2 +74,4 @@ ExpressDriver.prototype.getParamFromRequest = function (actionOptions, param) {

return request.query[param.name];
case ParamTypes_1.ParamTypes.HEADER:
return request.headers[param.name];
case ParamTypes_1.ParamTypes.BODY_PARAM:

@@ -153,2 +164,23 @@ return request.body[param.name];

};
// -------------------------------------------------------------------------
// Private Methods
// -------------------------------------------------------------------------
ExpressDriver.prototype.registerUses = function (uses, middlewares) {
var middlewareFunctions = [];
uses.forEach(function (use) {
if (use.middleware.prototype.use) {
middlewares.forEach(function (middleware) {
if (middleware.expressInstance instanceof use.middleware) {
middlewareFunctions.push(function (request, response, next) {
middleware.expressInstance.use(request, response, next);
});
}
});
}
else {
middlewareFunctions.push(use.middleware);
}
});
return middlewareFunctions;
};
return ExpressDriver;

@@ -155,0 +187,0 @@ }(BaseDriver_1.BaseDriver));

@@ -15,3 +15,3 @@ import { Driver } from "./Driver";

registerMiddleware(middleware: MiddlewareMetadata): void;
registerAction(action: ActionMetadata, executeCallback: (options: ActionCallbackOptions) => any): void;
registerAction(action: ActionMetadata, middlewares: MiddlewareMetadata[], executeCallback: (options: ActionCallbackOptions) => any): void;
getParamFromRequest(actionOptions: ActionCallbackOptions, param: any): void;

@@ -18,0 +18,0 @@ handleSuccess(result: any, action: ActionMetadata, options: ActionCallbackOptions): void;

@@ -35,3 +35,3 @@ "use strict";

};
KoaDriver.prototype.registerAction = function (action, executeCallback) {
KoaDriver.prototype.registerAction = function (action, middlewares, executeCallback) {
var _this = this;

@@ -70,2 +70,4 @@ var koaAction = action.type.toLowerCase();

return context.query[param.name];
case ParamTypes_1.ParamTypes.HEADER:
return context.headers[param.name];
case ParamTypes_1.ParamTypes.BODY_PARAM:

@@ -72,0 +74,0 @@ return request.body[param.name];

@@ -7,2 +7,3 @@ import { ControllerMetadataArgs } from "../metadata/args/ControllerMetadataArgs";

import { ErrorHandlerMetadataArgs } from "../metadata/args/ErrorHandlerMetadataArgs";
import { UseMetadataArgs } from "../metadata/args/UseMetadataArgs";
/**

@@ -14,2 +15,3 @@ * Storage all metadatas read from decorators.

middlewares: MiddlewareMetadataArgs[];
uses: UseMetadataArgs[];
errorHandlers: ErrorHandlerMetadataArgs[];

@@ -23,4 +25,5 @@ actions: ActionMetadataArgs[];

findActionsWithTarget(target: Function): ActionMetadataArgs[];
findUsesWithTargetAndMethod(target: Function, methodName: string): UseMetadataArgs[];
findParamsWithTargetAndMethod(target: Function, methodName: string): ParamMetadataArgs[];
findResponseHandlersWithTargetAndMethod(target: Function, methodName: string): ResponseHandlerMetadataArgs[];
}

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

this.middlewares = [];
this.uses = [];
this.errorHandlers = [];

@@ -39,5 +40,10 @@ this.actions = [];

};
MetadataArgsStorage.prototype.findUsesWithTargetAndMethod = function (target, methodName) {
return this.uses.filter(function (use) {
return use.target === target && use.method === methodName;
});
};
MetadataArgsStorage.prototype.findParamsWithTargetAndMethod = function (target, methodName) {
return this.params.filter(function (param) {
return param.object.constructor === target && param.method === methodName;
return param.target === target && param.method === methodName;
});

@@ -44,0 +50,0 @@ };

@@ -17,2 +17,4 @@ import { ControllerMetadata } from "../metadata/ControllerMetadata";

private createResponseHandlers(action);
private createActionUses(action);
private createControllerUses(controller);
}

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

var ErrorHandlerMetadata_1 = require("../metadata/ErrorHandlerMetadata");
var UseMetadata_1 = require("../metadata/UseMetadata");
/**

@@ -17,5 +18,2 @@ * Builds metadata from the given metadata arguments.

// -------------------------------------------------------------------------
// Properties
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
// Public Methods

@@ -38,5 +36,3 @@ // -------------------------------------------------------------------------

var errorHandlers = !classes ? storage.errorHandlers : storage.findErrorHandlerMetadatasForClasses(classes);
return errorHandlers.map(function (errorHandlerArgs) {
return new ErrorHandlerMetadata_1.ErrorHandlerMetadata(errorHandlerArgs);
});
return errorHandlers.map(function (errorHandlerArgs) { return new ErrorHandlerMetadata_1.ErrorHandlerMetadata(errorHandlerArgs); });
};

@@ -46,5 +42,3 @@ MetadataBuilder.prototype.createMiddlewares = function (classes) {

var middlewares = !classes ? storage.middlewares : storage.findMiddlewareMetadatasForClasses(classes);
return middlewares.map(function (middlewareArgs) {
return new MiddlewareMetadata_1.MiddlewareMetadata(middlewareArgs);
});
return middlewares.map(function (middlewareArgs) { return new MiddlewareMetadata_1.MiddlewareMetadata(middlewareArgs); });
};

@@ -58,2 +52,4 @@ MetadataBuilder.prototype.createControllers = function (classes) {

controller.actions = _this.createActions(controller);
controller.uses = _this.createControllerUses(controller);
console.log("controller.uses: ", controller.uses);
return controller;

@@ -70,2 +66,3 @@ });

action.responseHandlers = _this.createResponseHandlers(action);
action.uses = _this.createActionUses(action);
return action;

@@ -77,3 +74,3 @@ });

.findParamsWithTargetAndMethod(action.target, action.method)
.map(function (actionArgs) { return new ParamMetadata_1.ParamMetadata(action, actionArgs); });
.map(function (paramArgs) { return new ParamMetadata_1.ParamMetadata(action, paramArgs); });
};

@@ -83,4 +80,16 @@ MetadataBuilder.prototype.createResponseHandlers = function (action) {

.findResponseHandlersWithTargetAndMethod(action.target, action.method)
.map(function (actionArgs) { return new ResponseHandleMetadata_1.ResponseHandlerMetadata(action, actionArgs); });
.map(function (handlerArgs) { return new ResponseHandleMetadata_1.ResponseHandlerMetadata(action, handlerArgs); });
};
MetadataBuilder.prototype.createActionUses = function (action) {
return index_1.defaultMetadataArgsStorage()
.findUsesWithTargetAndMethod(action.target, action.method)
.map(function (useArgs) { return new UseMetadata_1.UseMetadata(useArgs); });
};
MetadataBuilder.prototype.createControllerUses = function (controller) {
console.log("target: ", controller.target);
console.log(index_1.defaultMetadataArgsStorage().uses.filter(function (use) { return use.target === controller.target; }));
return index_1.defaultMetadataArgsStorage()
.findUsesWithTargetAndMethod(controller.target, undefined)
.map(function (useArgs) { return new UseMetadata_1.UseMetadata(useArgs); });
};
return MetadataBuilder;

@@ -87,0 +96,0 @@ }());

@@ -6,2 +6,3 @@ import { ParamMetadata } from "./ParamMetadata";

import { ResponseHandlerMetadata } from "./ResponseHandleMetadata";
import { UseMetadata } from "./UseMetadata";
export declare class ActionMetadata {

@@ -17,2 +18,6 @@ /**

/**
* Action's use metadatas.
*/
uses: UseMetadata[];
/**
* Action's response handlers.

@@ -19,0 +24,0 @@ */

@@ -10,5 +10,5 @@ /**

/**
* Middleware name.
* Indicates if this middleware is global, thous applied to all routes.
*/
name: string;
isGlobal: boolean;
/**

@@ -19,6 +19,2 @@ * Execution priority of the middleware.

/**
* List of routes to which this middleware is applied.
*/
routes: string[];
/**
* Indicates if middleware must be executed after routing action is executed.

@@ -25,0 +21,0 @@ */

import { ActionMetadata } from "./ActionMetadata";
import { ControllerMetadataArgs } from "./args/ControllerMetadataArgs";
import { UseMetadata } from "./UseMetadata";
export declare class ControllerMetadata {

@@ -20,2 +21,6 @@ /**

type: "default" | "json";
/**
* Middleware "use"-s applied to a whole controller.
*/
uses: UseMetadata[];
constructor(args: ControllerMetadataArgs);

@@ -22,0 +27,0 @@ isJsonTyped: boolean;

@@ -7,2 +7,6 @@ import { MiddlewareMetadataArgs } from "./args/MiddlewareMetadataArgs";

/**
* Indicates if this middleware is global, thous applied to all routes.
*/
isGlobal: boolean;
/**
* Object class of the middleware class.

@@ -12,6 +16,2 @@ */

/**
* Middleware name.
*/
name: string;
/**
* Execution priority of the middleware.

@@ -21,6 +21,2 @@ */

/**
* List of routes to which this middleware is applied.
*/
routes: string[];
/**
* Indicates if middleware must be executed after routing action is executed.

@@ -33,3 +29,2 @@ */

koaInstance: KoaMiddlewareInterface;
hasRoutes: boolean;
}

@@ -8,12 +8,6 @@ "use strict";

function MiddlewareMetadata(args) {
if (args.target)
this.target = args.target;
if (args.name)
this.name = args.name;
if (args.priority)
this.priority = args.priority;
if (args.routes)
this.routes = args.routes;
if (args.afterAction)
this.afterAction = args.afterAction;
this.isGlobal = args.isGlobal;
this.target = args.target;
this.priority = args.priority;
this.afterAction = args.afterAction;
}

@@ -44,9 +38,2 @@ Object.defineProperty(MiddlewareMetadata.prototype, "expressInstance", {

});
Object.defineProperty(MiddlewareMetadata.prototype, "hasRoutes", {
get: function () {
return this.routes && this.routes.length > 0;
},
enumerable: true,
configurable: true
});
return MiddlewareMetadata;

@@ -53,0 +40,0 @@ }());

/**
* Controller action's parameter type.
*/
export declare type ParamType = "body" | "query" | "body_param" | "param" | "cookie" | "request" | "response" | "custom_converter";
export declare type ParamType = "body" | "query" | "header" | "body_param" | "param" | "cookie" | "request" | "response" | "custom_converter";
/**

@@ -11,2 +11,3 @@ * Controller action's parameter type.

static QUERY: ParamType;
static HEADER: ParamType;
static BODY_PARAM: ParamType;

@@ -13,0 +14,0 @@ static PARAM: ParamType;

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

ParamTypes.QUERY = "query";
ParamTypes.HEADER = "header";
ParamTypes.BODY_PARAM = "body_param";

@@ -12,0 +13,0 @@ ParamTypes.PARAM = "param";

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

import { ServerResponse, ServerRequest } from "http";
import { ServerResponse, IncomingMessage } from "http";
/**

@@ -9,3 +9,3 @@ * Classes that intercepts response result must implement this interface.

*/
use(request: ServerRequest, response: ServerResponse, next: Function): void;
use(request: IncomingMessage, response: ServerResponse, next: Function): void;
}
{
"name": "routing-controllers",
"private": false,
"version": "0.6.0-alpha.3",
"version": "0.6.0-alpha.4",
"description": "Allows to use class-based controllers with express.js in Typescript",

@@ -31,2 +31,3 @@ "license": "Apache-2.0",

"glob": "^7.0.3",
"reflect-metadata": "^0.1.3",
"require-all": "^2.0.0"

@@ -33,0 +34,0 @@ },

@@ -14,13 +14,20 @@ # routing-controllers

2. Use [typings](https://github.com/typings/typings) to install all required definition dependencies.
2. `reflect-metadata` shim is required, so make sure to import it before you use the library,
in a global place, like app.ts:
`typings install`
```javascript
import "reflect-metadata";
```
3. ES6 features are used, so you may want to install [es6-shim](https://github.com/paulmillr/es6-shim) too:
3. ES6 features are used, so you are using old versions of node.js you may need to install a
[es6-shim](https://github.com/paulmillr/es6-shim) too:
`npm install es6-shim --save`
if you are building nodejs app, you may want to `require("es6-shim");` in your app.
or if you are building web app, you man want to add `<script src="path-to-shim/es6-shim.js">` on your page.
and import it in a global place like app.ts:
```javascript
import "es6-shim";
```
## Simple usage

@@ -102,2 +109,3 @@

```javascript
import "reflect-metadata";
import * as express from "express";

@@ -122,2 +130,3 @@ import {useExpressServer} from "routing-controllers";

```javascript
import "reflect-metadata";
import * as express from "express";

@@ -277,11 +286,12 @@ import {useExpressServer} from "routing-controllers";

| Signature | Example | Description | express.js analogue |
|-----------------------------------------------------|--------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| `Req()` | `getAll(@Req() request: Request)` | Injects a Request object to a controller action parameter value | `function (request, response)` |
| `Res()` | `getAll(@Res() response: Response)` | Injects a Reponse object to a controller action parameter value | `function (request, response)` |
| `Body(options: ParamOptions)` | `save(@Body() body: any)` | Injects a body to a controller action parameter value. In options you can specify if body should be parsed into a json object or not. Also you can specify there if body is required and action cannot work without body being specified. | `request.body` |
| `Param(name: string, options?: ParamOptions)` | `get(@Param("id") id: number)` | Injects a parameter to a controller action parameter value. In options you can specify if parameter should be parsed into a json object or not. Also you can specify there if parameter is required and action cannot work with empty parameter. | `request.params.id` |
| `QueryParam(name: string, options?: ParamOptions)` | `get(@QueryParam("id") id: number)` | Injects a query string parameter to a controller action parameter value. In options you can specify if parameter should be parsed into a json object or not. Also you can specify there if query parameter is required and action cannot work with empty parameter. | `request.query.id` |
| `BodyParam(name: string, options?: ParamOptions)` | `post(@BodyParam("name") name: string)` | Injects a body parameter to a controller action parameter value. In options you can specify if parameter should be parsed into a json object or not. Also you can specify there if body parameter is required and action cannot work with empty parameter. | `request.body.name` |
| `CookieParam(name: string, options?: ParamOptions)` | `get(@CookieParam("username") username: string)` | Injects a cookie parameter to a controller action parameter value. In options you can specify if parameter should be parsed into a json object or not. Also you can specify there if cookie parameter is required and action cannot work with empty parameter. | `request.cookie("username")` |
| Signature | Example | Description | express.js analogue |
|-----------------------------------------------------|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| `Req()` | `getAll(@Req() request: Request)` | Injects a Request object to a controller action parameter value | `function (request, response)` |
| `Res()` | `getAll(@Res() response: Response)` | Injects a Reponse object to a controller action parameter value | `function (request, response)` |
| `Body(options: ParamOptions)` | `save(@Body() body: any)` | Injects a body to a controller action parameter value. In options you can specify if body should be parsed into a json object or not. Also you can specify there if body is required and action cannot work without body being specified. | `request.body` |
| `Param(name: string, options?: ParamOptions)` | `get(@Param("id") id: number)` | Injects a parameter to a controller action parameter value. In options you can specify if parameter should be parsed into a json object or not. Also you can specify there if parameter is required and action cannot work with empty parameter. | `request.params.id` |
| `QueryParam(name: string, options?: ParamOptions)` | `get(@QueryParam("id") id: number)` | Injects a query string parameter to a controller action parameter value. In options you can specify if parameter should be parsed into a json object or not. Also you can specify there if query parameter is required and action cannot work with empty parameter. | `request.query.id` |
| `HeaderParam(name: string, options?: ParamOptions)` | `get(@HeaderParam("token") token: string)` | Injects a parameter from response headers to a controller action parameter value. In options you can specify if parameter should be parsed into a json object or not. Also you can specify there if query parameter is required and action cannot work with empty parameter. | `request.headers.token` |
| `BodyParam(name: string, options?: ParamOptions)` | `post(@BodyParam("name") name: string)` | Injects a body parameter to a controller action parameter value. In options you can specify if parameter should be parsed into a json object or not. Also you can specify there if body parameter is required and action cannot work with empty parameter. | `request.body.name` |
| `CookieParam(name: string, options?: ParamOptions)` | `get(@CookieParam("username") username: string)` | Injects a cookie parameter to a controller action parameter value. In options you can specify if parameter should be parsed into a json object or not. Also you can specify there if cookie parameter is required and action cannot work with empty parameter. | `request.cookie("username")` |

@@ -288,0 +298,0 @@ ## Samples

@@ -25,6 +25,7 @@ "use strict";

var _this = this;
var middlewares = this.metadataBuilder.buildMiddlewareMetadata(classes);
var controllers = this.metadataBuilder.buildControllerMetadata(classes);
controllers.forEach(function (controller) {
controller.actions.forEach(function (action) {
_this.driver.registerAction(action, function (options) {
_this.driver.registerAction(action, middlewares, function (options) {
_this.handleAction(action, options);

@@ -43,3 +44,3 @@ });

.buildMiddlewareMetadata(classes)
.filter(function (middleware) { return !middleware.hasRoutes && !middleware.name && !!middleware.expressErrorHandlerInstance.error; })
.filter(function (middleware) { return middleware.isGlobal && !!middleware.expressErrorHandlerInstance.error; })
.sort(function (middleware1, middleware2) { return middleware1.priority - middleware2.priority; })

@@ -61,3 +62,3 @@ .forEach(function (middleware) { return _this.driver.registerErrorHandler(middleware); });

.buildMiddlewareMetadata(classes)
.filter(function (middleware) { return !middleware.hasRoutes && !middleware.name && !middleware.afterAction; })
.filter(function (middleware) { return middleware.isGlobal && !middleware.afterAction; })
.sort(function (middleware1, middleware2) { return middleware1.priority - middleware2.priority; })

@@ -74,3 +75,3 @@ .forEach(function (middleware) { return _this.driver.registerMiddleware(middleware); });

.buildMiddlewareMetadata(classes)
.filter(function (middleware) { return !middleware.hasRoutes && !middleware.name && middleware.afterAction; })
.filter(function (middleware) { return middleware.isGlobal && middleware.afterAction; })
.sort(function (middleware1, middleware2) { return middleware1.priority - middleware2.priority; })

@@ -77,0 +78,0 @@ .reverse()

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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