Comparing version 1.0.0-rc4 to 1.0.0-rc5
@@ -8,1 +8,2 @@ export * from './request-mapping.decorator'; | ||
export { Component as Middleware } from './component.decorator'; | ||
export * from './provide-values.util'; |
@@ -14,1 +14,2 @@ "use strict"; | ||
exports.Middleware = component_decorator_1.Component; | ||
__export(require("./provide-values.util")); |
import 'reflect-metadata'; | ||
import { RequestMappingMetadata } from '../interfaces/request-mapping-metadata.interface'; | ||
export declare const RequestMapping: (metadata?: RequestMappingMetadata) => MethodDecorator; | ||
export declare const Post: (path?: string) => MethodDecorator; | ||
export declare const Get: (path?: string) => MethodDecorator; | ||
export declare const Delete: (path?: string) => MethodDecorator; | ||
export declare const Put: (path?: string) => MethodDecorator; | ||
export declare const All: (path?: string) => MethodDecorator; |
@@ -6,3 +6,6 @@ "use strict"; | ||
const constants_1 = require("../constants"); | ||
const defaultMetadata = { [constants_1.PATH_METADATA]: '/', [constants_1.METHOD_METADATA]: request_method_enum_1.RequestMethod.GET }; | ||
const defaultMetadata = { | ||
[constants_1.PATH_METADATA]: '/', | ||
[constants_1.METHOD_METADATA]: request_method_enum_1.RequestMethod.GET | ||
}; | ||
exports.RequestMapping = (metadata = defaultMetadata) => { | ||
@@ -17,1 +20,12 @@ const path = metadata[constants_1.PATH_METADATA] || '/'; | ||
}; | ||
const createMappingDecorator = (method) => (path) => { | ||
return exports.RequestMapping({ | ||
[constants_1.PATH_METADATA]: path, | ||
[constants_1.METHOD_METADATA]: method | ||
}); | ||
}; | ||
exports.Post = createMappingDecorator(request_method_enum_1.RequestMethod.POST); | ||
exports.Get = createMappingDecorator(request_method_enum_1.RequestMethod.GET); | ||
exports.Delete = createMappingDecorator(request_method_enum_1.RequestMethod.DELETE); | ||
exports.Put = createMappingDecorator(request_method_enum_1.RequestMethod.PUT); | ||
exports.All = createMappingDecorator(request_method_enum_1.RequestMethod.ALL); |
export declare const getModuleInitMessage: (module: string) => string; | ||
export declare const getRouteMappedMessage: (path: string, method: any) => string; | ||
export declare const getControllerMappingMessage: (name: string) => string; | ||
export declare const getMiddlewareInitMessage: (middleware: string, module: string) => string; |
@@ -7,2 +7,1 @@ "use strict"; | ||
exports.getControllerMappingMessage = (name) => `${name}:`; | ||
exports.getMiddlewareInitMessage = (middleware, module) => `${middleware} injected into ${module}`; |
@@ -16,7 +16,8 @@ "use strict"; | ||
addConfig(configList, module) { | ||
const currentMiddlewares = this.getCurrentMiddlewares(module); | ||
const middlewares = this.getCurrentMiddlewares(module); | ||
const currentConfig = this.getCurrentConfig(module); | ||
(configList || []).map((config) => { | ||
[].concat(config.middlewares).map((metatype) => { | ||
currentMiddlewares.set(metatype.name, { | ||
const token = metatype.name; | ||
middlewares.set(token, { | ||
instance: null, | ||
@@ -23,0 +24,0 @@ metatype |
@@ -35,6 +35,6 @@ "use strict"; | ||
instance.configure(middlewaresBuilder); | ||
if (middlewaresBuilder instanceof builder_1.MiddlewareBuilder) { | ||
const config = middlewaresBuilder.build(); | ||
this.container.addConfig(config, module); | ||
} | ||
if (!(middlewaresBuilder instanceof builder_1.MiddlewareBuilder)) | ||
return; | ||
const config = middlewaresBuilder.build(); | ||
this.container.addConfig(config, module); | ||
} | ||
@@ -41,0 +41,0 @@ static setupMiddlewares(app) { |
@@ -5,3 +5,2 @@ import { MiddlewaresContainer } from './container'; | ||
private middlewaresContainer; | ||
private readonly logger; | ||
private readonly instanceLoader; | ||
@@ -8,0 +7,0 @@ constructor(middlewaresContainer: MiddlewaresContainer); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const injector_1 = require("../injector/injector"); | ||
const logger_service_1 = require("../../common/services/logger.service"); | ||
const messages_1 = require("../helpers/messages"); | ||
class MiddlewaresResolver { | ||
constructor(middlewaresContainer) { | ||
this.middlewaresContainer = middlewaresContainer; | ||
this.logger = new logger_service_1.Logger(MiddlewaresResolver.name); | ||
this.instanceLoader = new injector_1.Injector(); | ||
@@ -16,3 +13,2 @@ } | ||
this.resolveMiddlewareInstance(wrapper, middlewares, module); | ||
this.logger.log(messages_1.getMiddlewareInitMessage(wrapper.metatype.name, module.metatype.name)); | ||
}); | ||
@@ -19,0 +15,0 @@ } |
@@ -15,3 +15,3 @@ import { NestModuleMetatype } from './common/interfaces/module-metatype.interface'; | ||
private static createProxy(target); | ||
private static createExceptionMethodProxy(); | ||
private static createExceptionProxy(); | ||
} |
@@ -36,7 +36,7 @@ "use strict"; | ||
return new Proxy(target, { | ||
get: this.createExceptionMethodProxy(), | ||
set: this.createExceptionMethodProxy() | ||
get: this.createExceptionProxy(), | ||
set: this.createExceptionProxy() | ||
}); | ||
} | ||
static createExceptionMethodProxy() { | ||
static createExceptionProxy() { | ||
return (receiver, prop) => { | ||
@@ -43,0 +43,0 @@ if (!(prop in receiver)) { |
{ | ||
"name": "nest.js", | ||
"version": "1.0.0-rc4", | ||
"version": "1.0.0-rc5", | ||
"description": "Modern, fast, powerful node.js web framework", | ||
@@ -5,0 +5,0 @@ "author": "Kamil Mysliwiec", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
180568
260
4054