Skip to content

Commit

Permalink
chore(@nestjs) publish v5.2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Aug 22, 2018
1 parent d5833e3 commit 1f0de49
Show file tree
Hide file tree
Showing 139 changed files with 1,046 additions and 2,681 deletions.
10 changes: 7 additions & 3 deletions bundle/common/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,19 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors

#### Principal Sponsor

<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="300" /></a>
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="320" /></a>

#### Gold Sponsors

<a href="http://xtremis.com/"><img src="https://nestjs.com/img/logo-xtremis.svg" width="220" /></a>

#### Silver Sponsors

<a href="https://neoteric.eu/"><img src="https://nestjs.com/img/neoteric-cut.png" width="130" /></a> &nbsp; <a href="https://www.swingdev.io"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="160" /></a>
<a href="https://neoteric.eu/"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" /></a> &nbsp; <a href="https://www.swingdev.io"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="150" /></a>

#### Sponsors

<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="120" /></a> &nbsp; <a href="http://angularity.io"><img src="http://angularity.io/media/logo.svg" height="32" /></a> &nbsp; <a href="http://gojob.com"><img src="https://gojob.com/w/wp-content/uploads/2017/02/cropped-Logo-web-home.png" height="44" /> &nbsp; <a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="37" /></a> &nbsp; <a href="https://hostpresto.com"><img src="https://nestjs.com/img/hostpresto.png" height="32" /></a>
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="110" /></a> &nbsp; <a href="http://angularity.io"><img src="http://angularity.io/media/logo.svg" height="30" /></a> &nbsp; <a href="http://gojob.com"><img src="https://gojob.com/w/wp-content/uploads/2017/02/cropped-Logo-web-home.png" height="40" /> &nbsp; <a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> &nbsp; <a href="https://hostpresto.com"><img src="https://nestjs.com/img/hostpresto.png" height="30" /></a>

## Backers

Expand Down
1 change: 1 addition & 0 deletions bundle/common/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export declare const GLOBAL_MODULE_METADATA = "__globalModule__";
export declare const PATH_METADATA = "path";
export declare const PARAMTYPES_METADATA = "design:paramtypes";
export declare const SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
export declare const OPTIONAL_DEPS_METADATA = "optional:paramtypes";
export declare const METHOD_METADATA = "method";
export declare const ROUTE_ARGS_METADATA = "__routeArguments__";
export declare const CUSTOM_ROUTE_AGRS_METADATA = "__customRouteArgs__";
Expand Down
1 change: 1 addition & 0 deletions bundle/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ exports.GLOBAL_MODULE_METADATA = '__globalModule__';
exports.PATH_METADATA = 'path';
exports.PARAMTYPES_METADATA = 'design:paramtypes';
exports.SELF_DECLARED_DEPS_METADATA = 'self:paramtypes';
exports.OPTIONAL_DEPS_METADATA = 'optional:paramtypes';
exports.METHOD_METADATA = 'method';
exports.ROUTE_ARGS_METADATA = '__routeArguments__';
exports.CUSTOM_ROUTE_AGRS_METADATA = '__customRouteArgs__';
Expand Down
3 changes: 2 additions & 1 deletion bundle/common/decorators/core/catch.decorator.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'reflect-metadata';
import { Type } from '../../interfaces';
/**
* Defines the Exceptions Filter. Takes set of exception types as an argument which has to be caught by this Filter.
* The class should implement the `ExceptionFilter` interface.
*/
export declare function Catch(...exceptions: any[]): ClassDecorator;
export declare function Catch(...exceptions: Type<any>[]): ClassDecorator;
4 changes: 2 additions & 2 deletions bundle/common/decorators/core/component.decorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ function Interceptor() {
return (target) => { };
}
exports.Interceptor = Interceptor;
let offset = Math.random() * 100;
function mixin(mixinClass) {
this.offset = this.offset ? ++this.offset : Math.random() * 100;
Object.defineProperty(mixinClass, 'name', {
value: JSON.stringify(this.offset),
value: JSON.stringify(offset++),
});
Injectable()(mixinClass);
return mixinClass;
Expand Down
13 changes: 7 additions & 6 deletions bundle/common/decorators/core/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
export * from './controller.decorator';
export * from './bind.decorator';
export * from './catch.decorator';
export * from './component.decorator';
export * from './controller.decorator';
export * from './dependencies.decorator';
export * from './inject.decorator';
export * from './catch.decorator';
export * from './exception-filters.decorator';
export * from './use-pipes.decorator';
export * from './use-guards.decorator';
export * from './inject.decorator';
export * from './optional.decorator';
export * from './reflect-metadata.decorator';
export * from './use-guards.decorator';
export * from './use-interceptors.decorator';
export * from './bind.decorator';
export * from './use-pipes.decorator';
13 changes: 7 additions & 6 deletions bundle/common/decorators/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./controller.decorator"));
__export(require("./bind.decorator"));
__export(require("./catch.decorator"));
__export(require("./component.decorator"));
__export(require("./controller.decorator"));
__export(require("./dependencies.decorator"));
__export(require("./inject.decorator"));
__export(require("./catch.decorator"));
__export(require("./exception-filters.decorator"));
__export(require("./use-pipes.decorator"));
__export(require("./use-guards.decorator"));
__export(require("./inject.decorator"));
__export(require("./optional.decorator"));
__export(require("./reflect-metadata.decorator"));
__export(require("./use-guards.decorator"));
__export(require("./use-interceptors.decorator"));
__export(require("./bind.decorator"));
__export(require("./use-pipes.decorator"));
2 changes: 1 addition & 1 deletion bundle/common/decorators/core/inject.decorator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import 'reflect-metadata';
* Injects provider which has to be available in the current injector (module) scope.
* Providers are recognized by types or tokens.
*/
export declare function Inject(token: any): ParameterDecorator;
export declare function Inject<T = any>(token: T): ParameterDecorator;
5 changes: 5 additions & 0 deletions bundle/common/decorators/core/optional.decorator.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'reflect-metadata';
/**
* Sets dependency as an optional one.
*/
export declare function Optional(): ParameterDecorator;
14 changes: 14 additions & 0 deletions bundle/common/decorators/core/optional.decorator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("reflect-metadata");
const constants_1 = require("../../constants");
/**
* Sets dependency as an optional one.
*/
function Optional() {
return (target, key, index) => {
const args = Reflect.getMetadata(constants_1.OPTIONAL_DEPS_METADATA, target) || [];
Reflect.defineMetadata(constants_1.OPTIONAL_DEPS_METADATA, [...args, index], target);
};
}
exports.Optional = Optional;
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
* Assigns the metadata to the class/function under specified `key`.
* This metadata can be reflected using `Reflector` class.
*/
export declare const ReflectMetadata: (metadataKey: any, metadataValue: any) => (target: object, key?: any, descriptor?: any) => any;
export declare const ReflectMetadata: <K = any, V = any>(metadataKey: K, metadataValue: V) => (target: object, key?: any, descriptor?: any) => any;
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { PipeTransform } from '../../index';
import { Type } from '../../interfaces';
import { CustomParamFactory } from '../../interfaces/features/custom-route-param-factory.interface';
export declare type ParamDecoratorEnhancer = ParameterDecorator;
/**
* Defines HTTP route param decorator
* @param factory
*/
export declare function createParamDecorator(factory: CustomParamFactory): (data?: any, ...pipes: (Type<PipeTransform> | PipeTransform)[]) => ParameterDecorator;
export declare function createParamDecorator(factory: CustomParamFactory, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | string)[]) => ParameterDecorator;
/**
* Defines HTTP route param decorator
* @deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const deprecate = require("deprecate");
const constants_1 = require("../../constants");
const shared_utils_1 = require("../../utils/shared.utils");
const assignCustomMetadata = (args, paramtype, index, factory, data, ...pipes) => (Object.assign({}, args, { [`${paramtype}${constants_1.CUSTOM_ROUTE_AGRS_METADATA}:${index}`]: {
index,
factory,
Expand All @@ -15,11 +16,15 @@ const randomString = () => Math.random()
* Defines HTTP route param decorator
* @param factory
*/
function createParamDecorator(factory) {
function createParamDecorator(factory, enhancers = []) {
const paramtype = randomString() + randomString();
return (data, ...pipes) => (target, key, index) => {
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignCustomMetadata(args, paramtype, index, factory, data, ...pipes), target.constructor, key);
const hasParamData = shared_utils_1.isNil(data) || shared_utils_1.isString(data);
const paramData = hasParamData ? data : undefined;
const paramPipes = hasParamData ? pipes : [data, ...pipes];
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignCustomMetadata(args, paramtype, index, factory, paramData, ...paramPipes), target.constructor, key);
enhancers.forEach(fn => fn(target, key, index));
};
}
exports.createParamDecorator = createParamDecorator;
Expand Down
1 change: 1 addition & 0 deletions bundle/common/http/http.constants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare const AXIOS_INSTANCE_TOKEN = "AXIOS_INSTANCE_TOKEN";
3 changes: 3 additions & 0 deletions bundle/common/http/http.constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AXIOS_INSTANCE_TOKEN = 'AXIOS_INSTANCE_TOKEN';
3 changes: 3 additions & 0 deletions bundle/common/http/http.module.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
import { AxiosRequestConfig } from 'axios';
import { DynamicModule } from '../interfaces';
export declare class HttpModule {
static register(config: AxiosRequestConfig): DynamicModule;
}
21 changes: 18 additions & 3 deletions bundle/common/http/http.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,29 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = require("axios");
const module_decorator_1 = require("../decorators/modules/module.decorator");
const http_constants_1 = require("./http.constants");
const http_service_1 = require("./http.service");
let HttpModule = class HttpModule {
let HttpModule = HttpModule_1 = class HttpModule {
static register(config) {
return {
module: HttpModule_1,
providers: [{
provide: http_constants_1.AXIOS_INSTANCE_TOKEN,
useValue: axios_1.default.create(config),
}],
};
}
};
HttpModule = __decorate([
HttpModule = HttpModule_1 = __decorate([
module_decorator_1.Module({
providers: [http_service_1.HttpService],
providers: [http_service_1.HttpService, {
provide: http_constants_1.AXIOS_INSTANCE_TOKEN,
useValue: axios_1.default,
}],
exports: [http_service_1.HttpService],
})
], HttpModule);
exports.HttpModule = HttpModule;
var HttpModule_1;
6 changes: 4 additions & 2 deletions bundle/common/http/http.service.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { AxiosRequestConfig, AxiosResponse } from 'axios';
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import { Observable } from 'rxjs';
export declare class HttpService {
private readonly instance;
constructor(instance?: AxiosInstance);
request<T = any>(config: AxiosRequestConfig): Observable<AxiosResponse<T>>;
get<T = any>(url: string, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>;
delete<T = any>(url: string, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>;
head<T = any>(url: string, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>;
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>;
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>;
patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>;
readonly axiosRef: any;
readonly axiosRef: AxiosInstance;
}
41 changes: 31 additions & 10 deletions bundle/common/http/http.service.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,52 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = require("axios");
const rxjs_1 = require("rxjs");
class HttpService {
const decorators_1 = require("../decorators");
const http_constants_1 = require("./http.constants");
let HttpService = class HttpService {
constructor(instance = axios_1.default) {
this.instance = instance;
}
request(config) {
return rxjs_1.from(axios_1.default.request(config));
return rxjs_1.defer(() => this.instance.request(config));
}
get(url, config) {
return rxjs_1.from(axios_1.default.get(url, config));
return rxjs_1.defer(() => this.instance.get(url, config));
}
delete(url, config) {
return rxjs_1.from(axios_1.default.delete(url, config));
return rxjs_1.defer(() => this.instance.delete(url, config));
}
head(url, config) {
return rxjs_1.from(axios_1.default.head(url, config));
return rxjs_1.defer(() => this.instance.head(url, config));
}
post(url, data, config) {
return rxjs_1.from(axios_1.default.post(url, data, config));
return rxjs_1.defer(() => this.instance.post(url, data, config));
}
put(url, data, config) {
return rxjs_1.from(axios_1.default.put(url, data, config));
return rxjs_1.defer(() => this.instance.put(url, data, config));
}
patch(url, data, config) {
return rxjs_1.from(axios_1.default.patch(url, data, config));
return rxjs_1.defer(() => this.instance.patch(url, data, config));
}
get axiosRef() {
return axios_1.default;
return this.instance;
}
}
};
HttpService = __decorate([
__param(0, decorators_1.Inject(http_constants_1.AXIOS_INSTANCE_TOKEN)),
__metadata("design:paramtypes", [Object])
], HttpService);
exports.HttpService = HttpService;
8 changes: 4 additions & 4 deletions bundle/common/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export * from './decorators';
export * from './enums';
export { NestModule, INestApplication, INestMicroservice, NestMiddleware, MiddlewareFunction, MiddlewareConsumer, OnModuleInit, ExceptionFilter, WebSocketAdapter, PipeTransform, Paramtype, ArgumentMetadata, OnModuleDestroy, ExecutionContext, CanActivate, RpcExceptionFilter, WsExceptionFilter, NestInterceptor, DynamicModule, INestApplicationContext, HttpServer, Provider, Type, HttpServerFactory, ArgumentsHost, INestExpressApplication, INestFastifyApplication, ForwardReference } from './interfaces';
export * from './exceptions';
export * from './http';
export * from './interceptors';
export * from './services/logger.service';
export { ArgumentMetadata, ArgumentsHost, CanActivate, DynamicModule, ExceptionFilter, ExecutionContext, ForwardReference, HttpServer, HttpServerFactory, INestApplication, INestApplicationContext, INestExpressApplication, INestFastifyApplication, INestMicroservice, MiddlewareConsumer, MiddlewareFunction, NestInterceptor, NestMiddleware, NestModule, OnModuleDestroy, OnModuleInit, Paramtype, PipeTransform, Provider, RpcExceptionFilter, Type, WebSocketAdapter, WsExceptionFilter } from './interfaces';
export * from './pipes';
export * from './services/logger.service';
export * from './utils';
export * from './exceptions';
export * from './http';
6 changes: 3 additions & 3 deletions bundle/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ function __export(m) {
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./decorators"));
__export(require("./enums"));
__export(require("./exceptions"));
__export(require("./http"));
__export(require("./interceptors"));
__export(require("./services/logger.service"));
__export(require("./pipes"));
__export(require("./services/logger.service"));
__export(require("./utils"));
__export(require("./exceptions"));
__export(require("./http"));
9 changes: 1 addition & 8 deletions bundle/common/interceptors/file-fields.interceptor.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
import { Observable } from 'rxjs';
import { ExecutionContext } from '../interfaces';
import { MulterField, MulterOptions } from '../interfaces/external/multer-options.interface';
export declare function FileFieldsInterceptor(uploadFields: MulterField[], options?: MulterOptions): {
new (): {
readonly upload: any;
intercept(context: ExecutionContext, call$: Observable<any>): Promise<Observable<any>>;
};
};
export declare function FileFieldsInterceptor(uploadFields: MulterField[], options?: MulterOptions): any;
5 changes: 3 additions & 2 deletions bundle/common/interceptors/file-fields.interceptor.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const multer = require("multer");
const component_decorator_1 = require("../decorators/core/component.decorator");
const multer_utils_1 = require("./multer/multer.utils");
function FileFieldsInterceptor(uploadFields, options) {
const Interceptor = class {
const Interceptor = component_decorator_1.mixin(class {
constructor() {
this.upload = multer(options);
}
Expand All @@ -18,7 +19,7 @@ function FileFieldsInterceptor(uploadFields, options) {
}));
return call$;
}
};
});
return Interceptor;
}
exports.FileFieldsInterceptor = FileFieldsInterceptor;
9 changes: 1 addition & 8 deletions bundle/common/interceptors/files.interceptor.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
import { Observable } from 'rxjs';
import { MulterOptions } from '../interfaces/external/multer-options.interface';
import { ExecutionContext } from '../interfaces';
export declare function FilesInterceptor(fieldName: string, maxCount?: number, options?: MulterOptions): {
new (): {
readonly upload: any;
intercept(context: ExecutionContext, call$: Observable<any>): Promise<Observable<any>>;
};
};
export declare function FilesInterceptor(fieldName: string, maxCount?: number, options?: MulterOptions): any;
5 changes: 3 additions & 2 deletions bundle/common/interceptors/files.interceptor.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const multer = require("multer");
const component_decorator_1 = require("../decorators/core/component.decorator");
const multer_utils_1 = require("./multer/multer.utils");
function FilesInterceptor(fieldName, maxCount, options) {
const Interceptor = class {
const Interceptor = component_decorator_1.mixin(class {
constructor() {
this.upload = multer(options);
}
Expand All @@ -18,7 +19,7 @@ function FilesInterceptor(fieldName, maxCount, options) {
}));
return call$;
}
};
});
return Interceptor;
}
exports.FilesInterceptor = FilesInterceptor;
Loading

0 comments on commit 1f0de49

Please sign in to comment.