Skip to content

Commit 0c98a65

Browse files
chore(@nestjs) publish 5.2.2 release
1 parent cd30d7a commit 0c98a65

4 files changed

Lines changed: 11 additions & 2 deletions

File tree

bundle/common/decorators/http/create-route-param-metadata.decorator.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export declare type ParamDecoratorEnhancer = ParameterDecorator;
66
* Defines HTTP route param decorator
77
* @param factory
88
*/
9-
export declare function createParamDecorator(factory: CustomParamFactory, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | string)[]) => ParameterDecorator;
9+
export declare function createParamDecorator(factory: CustomParamFactory, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | any)[]) => ParameterDecorator;
1010
/**
1111
* Defines HTTP route param decorator
1212
* @deprecated

bundle/common/decorators/http/create-route-param-metadata.decorator.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ function createParamDecorator(factory, enhancers = []) {
2020
const paramtype = randomString() + randomString();
2121
return (data, ...pipes) => (target, key, index) => {
2222
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
23-
const hasParamData = shared_utils_1.isNil(data) || shared_utils_1.isString(data);
23+
const isPipe = pipe => pipe &&
24+
((shared_utils_1.isFunction(pipe) && pipe.prototype) || shared_utils_1.isFunction(pipe.transform));
25+
const hasParamData = shared_utils_1.isNil(data) || !isPipe(data);
2426
const paramData = hasParamData ? data : undefined;
2527
const paramPipes = hasParamData ? pipes : [data, ...pipes];
2628
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignCustomMetadata(args, paramtype, index, factory, paramData, ...paramPipes), target.constructor, key);

bundle/common/interfaces/external/serve-static-options.interface.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,8 @@ export interface ServeStaticOptions {
5757
* stat the stat object of the file that is being sent
5858
*/
5959
setHeaders?: (res, path: string, stat: any) => any;
60+
/**
61+
* Creates a virtual path prefix
62+
*/
63+
prefix?: string;
6064
}

bundle/core/adapters/express-adapter.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ class ExpressAdapter {
7676
return this.instance.engine(...args);
7777
}
7878
useStaticAssets(path, options) {
79+
if (options && options.prefix) {
80+
return this.use(options.prefix, express.static(path, options));
81+
}
7982
return this.use(express.static(path, options));
8083
}
8184
setBaseViewsDir(path) {

0 commit comments

Comments
 (0)