Skip to content

Commit

Permalink
merge: resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Sep 21, 2018
2 parents 005d16f + cdccb8e commit 0368d52
Show file tree
Hide file tree
Showing 39 changed files with 127 additions and 127 deletions.
2 changes: 1 addition & 1 deletion integration/hello-world/src/hello/hello.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HelloService } from './hello.service';
import { Controller, Get, Post, Body, Header, Param } from '@nestjs/common';
import { Controller, Get, Header, Param } from '@nestjs/common';
import { Observable, of } from 'rxjs';
import { UserByIdPipe } from './users/user-by-id.pipe';

Expand Down
5 changes: 2 additions & 3 deletions integration/microservices/src/app.controller.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Controller, Get, Post, Body, Query, HttpCode } from '@nestjs/common';
import { Controller, Post, Body, Query, HttpCode } from '@nestjs/common';
import {
Client,
MessagePattern,
ClientProxy,
Transport,
ClientProxyFactory,
} from '@nestjs/microservices';
import { Observable, of, from } from 'rxjs';
import { scan, tap } from 'rxjs/operators';
import { scan } from 'rxjs/operators';

@Controller()
export class AppController {
Expand Down
2 changes: 1 addition & 1 deletion integration/microservices/src/redis/redis.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller, Get, Post, Body, Query, HttpCode } from '@nestjs/common';
import { Controller, Post, Body, Query, HttpCode } from '@nestjs/common';
import {
Client,
MessagePattern,
Expand Down
2 changes: 1 addition & 1 deletion integration/websockets/src/app.gateway.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WebSocketGateway, SubscribeMessage, WsResponse } from '@nestjs/websockets';
import { WebSocketGateway, SubscribeMessage } from '@nestjs/websockets';

@WebSocketGateway(8080)
export class ApplicationGateway {
Expand Down
2 changes: 1 addition & 1 deletion integration/websockets/src/namespace.gateway.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WebSocketGateway, SubscribeMessage, WsResponse } from '@nestjs/websockets';
import { WebSocketGateway, SubscribeMessage } from '@nestjs/websockets';

@WebSocketGateway(8080, {
namespace: 'test'
Expand Down
2 changes: 1 addition & 1 deletion integration/websockets/src/server.gateway.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WebSocketGateway, SubscribeMessage, WsResponse } from '@nestjs/websockets';
import { WebSocketGateway, SubscribeMessage } from '@nestjs/websockets';

@WebSocketGateway()
export class ServerGateway {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/cache/interfaces/cache-module.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface CacheModuleAsyncOptions
useExisting?: Type<CacheOptionsFactory>;
useClass?: Type<CacheOptionsFactory>;
useFactory?: (
...args: any[]
...args: any[],
) => Promise<CacheModuleOptions> | CacheModuleOptions;
inject?: any[];
}
3 changes: 1 addition & 2 deletions packages/common/decorators/core/controller.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'reflect-metadata';
import { ControllerMetadata } from '../../interfaces/controllers/controller-metadata.interface';
import { isUndefined, isObject } from '../../utils/shared.utils';
import { isUndefined } from '../../utils/shared.utils';
import { PATH_METADATA } from '../../constants';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'reflect-metadata';
import { EXCEPTION_FILTERS_METADATA } from '../../constants';
import { Logger } from '@nestjs/common';
import { ExceptionFilter } from '../../index';
import { extendArrayMetadata } from '../../utils/extend-metadata.util';
import { isFunction } from '../../utils/shared.utils';
Expand Down
6 changes: 1 addition & 5 deletions packages/common/decorators/modules/global.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import 'reflect-metadata';
import {
PATH_METADATA,
SHARED_MODULE_METADATA,
GLOBAL_MODULE_METADATA,
} from '../../constants';
import { GLOBAL_MODULE_METADATA } from '../../constants';
/**
* Makes the module global-scoped.
* Once imported will be available for all existing modules.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'reflect-metadata';
import { PATH_METADATA, SHARED_MODULE_METADATA } from '../../constants';
import { SHARED_MODULE_METADATA } from '../../constants';
/**
* Makes the module single-scoped (not singleton).
* In this case, Nest will always create a new instance of this particular module when it's imported by another one.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Transport } from '../../enums/transport.enum';
import {
TcpOptions,
RedisOptions,
NatsOptions,
MqttOptions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { HttpsOptions } from './external/https-options.interface';
import { LoggerService } from '../services/logger.service';
import { NestApplicationContextOptions } from './nest-application-context-options.interface';
import { CorsOptions } from './external/cors-options.interface';

Expand Down
4 changes: 2 additions & 2 deletions packages/common/utils/validate-each.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export function validateEach(
if (!context || !context.name) {
return true;
}
const errors = arr.filter(str => !predicate(str));
if (errors.length > 0) {
const errors = arr.some(str => !predicate(str));
if (errors) {
throw new InvalidDecoratorItemException(decorator, item, context.name);
}
return true;
Expand Down
14 changes: 3 additions & 11 deletions packages/core/guards/guards-consumer.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import iterate from 'iterare';
import { GUARDS_METADATA } from '@nestjs/common/constants';
import {
isUndefined,
isFunction,
isNil,
isEmpty,
} from '@nestjs/common/utils/shared.utils';
import { isEmpty } from '@nestjs/common/utils/shared.utils';
import { Controller } from '@nestjs/common/interfaces';
import { CanActivate, HttpStatus } from '@nestjs/common';
import { CanActivate } from '@nestjs/common';
import { Observable } from 'rxjs';
import { FORBIDDEN_MESSAGE } from './constants';
import { ExecutionContextHost } from '../helpers/execution-context.host';

export class GuardsConsumer {
Expand Down Expand Up @@ -49,7 +41,7 @@ export class GuardsConsumer {
result: boolean | Promise<boolean> | Observable<boolean>,
): Promise<boolean> {
if (result instanceof Observable) {
return await result.toPromise();
return result.toPromise();
}
return result;
}
Expand Down
7 changes: 1 addition & 6 deletions packages/core/injector/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class ModuleCompiler {
type: Type<any>;
dynamicMetadata?: Partial<DynamicModule> | undefined;
}> {
metatype = this.isDefferedModule(metatype) ? await metatype : metatype;
metatype = await metatype;
if (!this.isDynamicModule(metatype)) {
return { type: metatype };
}
Expand All @@ -39,9 +39,4 @@ export class ModuleCompiler {
return !!(module as DynamicModule).module;
}

public isDefferedModule(
module: Type<any> | DynamicModule | Promise<DynamicModule>,
): module is Promise<DynamicModule> {
return module && module instanceof Promise;
}
}
2 changes: 1 addition & 1 deletion packages/core/injector/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export class Module {
.filter(metatype => metatype)
.map(({ name }) => name);

if (importedRefNames.indexOf(token) < 0) {
if (!importedRefNames.includes(token)) {
const { name } = this.metatype;
throw new UnknownExportException(name);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/nest-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ export class NestApplication extends NestApplicationContext
!!app._router &&
!!app._router.stack &&
isFunction(app._router.stack.filter) &&
!!app._router.stack.filter(
app._router.stack.some(
layer => layer && layer.handle && layer.handle.name === name,
).length
)
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/router/router-response-controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RequestMethod, HttpStatus, HttpServer } from '@nestjs/common';
import { isNil, isObject, isFunction } from '@nestjs/common/utils/shared.utils';
import { isFunction } from '@nestjs/common/utils/shared.utils';

export interface CustomHeader {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export class DependenciesScanner {
const providersKeys = Object.keys(applyProvidersMap);
const type = component.provide;

if (providersKeys.indexOf(type) < 0) {
if (!providersKeys.includes(type)) {
return this.container.addComponent(component, token);
}
const providerToken = randomStringGenerator();
Expand Down
2 changes: 1 addition & 1 deletion packages/websockets/container.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WebSocketServerData, ObservableSocketServer } from './interfaces';
import { ObservableSocketServer } from './interfaces';

export class SocketsContainer {
private readonly observableServers = new Map<
Expand Down
7 changes: 2 additions & 5 deletions packages/websockets/socket-module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import 'reflect-metadata';
import iterate from 'iterare';
import {
NestContainer,
InstanceWrapper,
} from '@nestjs/core/injector/container';
import { InstanceWrapper } from '@nestjs/core/injector/container';
import { NestGateway } from './interfaces/nest-gateway.interface';
import { SocketsContainer } from './container';
import { WebSocketsController } from './web-sockets-controller';
Expand Down Expand Up @@ -58,7 +55,7 @@ export class SocketModule {
return;
}
const metadataKeys = Reflect.getMetadataKeys(metatype);
if (metadataKeys.indexOf(GATEWAY_METADATA) < 0) {
if (!metadataKeys.includes(GATEWAY_METADATA)) {
return;
}
this.webSocketsController.hookGatewayIntoServer(
Expand Down
1 change: 0 additions & 1 deletion packages/websockets/utils/subscribe-message.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'reflect-metadata';
import { MESSAGE_MAPPING_METADATA, MESSAGE_METADATA } from '../constants';
import { isObject, isUndefined } from '@nestjs/common/utils/shared.utils';

/**
* Subscribes to messages that fulfils chosen pattern.
Expand Down
1 change: 0 additions & 1 deletion sample/01-cats-app/src/common/pipes/validation.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
PipeTransform,
Injectable,
ArgumentMetadata,
HttpStatus,
} from '@nestjs/common';
import { validate } from 'class-validator';
import { plainToClass } from 'class-transformer';
Expand Down
4 changes: 1 addition & 3 deletions sample/04-grpc/src/hero/hero.controller.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Get, OnModuleInit, Controller } from '@nestjs/common';
import {
ClientProxy,
Client,
MessagePattern,
GrpcMethod,
ClientGrpc,
} from '@nestjs/microservices';
import { Observable } from 'rxjs';
import { grpcClientOptions } from './../grpc-client.options';
import { grpcClientOptions } from '../grpc-client.options';
import { HeroById } from './interfaces/hero-by-id.interface';
import { Hero } from './interfaces/hero.interface';

Expand Down
2 changes: 0 additions & 2 deletions sample/04-grpc/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { NestFactory } from '@nestjs/core';
import { Transport } from '@nestjs/microservices';
import { ApplicationModule } from './app.module';
import { join } from 'path';
import { grpcClientOptions } from './grpc-client.options';

async function bootstrap() {
Expand Down
2 changes: 1 addition & 1 deletion sample/06-mongoose/src/cats/cats.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller, Get, Post, Body, Param } from '@nestjs/common';
import { Controller, Get, Post, Body } from '@nestjs/common';
import { CreateCatDto } from './dto/create-cat.dto';
import { CatsService } from './cats.service';
import { Cat } from './interfaces/cat.interface';
Expand Down
2 changes: 1 addition & 1 deletion sample/07-sequelize/src/cats/cats.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller, Get, Post, Body, Param } from '@nestjs/common';
import { Controller, Get, Post, Body } from '@nestjs/common';
import { CreateCatDto } from './dto/create-cat.dto';
import { CatsService } from './cats.service';
import { Cat } from './cat.entity';
Expand Down
1 change: 0 additions & 1 deletion sample/09-babel-example/src/app.module.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Module } from '@nestjs/common';
import { CatsModule } from './cats/cats.module';
import { CatsController } from './cats/cats.controller';

@Module({
imports: [CatsModule],
Expand Down
1 change: 0 additions & 1 deletion sample/09-babel-example/src/cats/cats.service.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Injectable } from '@nestjs/common';
import { CatsModule } from './cats.module';

@Injectable()
export class CatsService {
Expand Down
1 change: 0 additions & 1 deletion sample/10-fastify/src/common/pipes/validation.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
PipeTransform,
Injectable,
ArgumentMetadata,
HttpStatus,
} from '@nestjs/common';
import { validate } from 'class-validator';
import { plainToClass } from 'class-transformer';
Expand Down
1 change: 0 additions & 1 deletion sample/11-swagger/src/cats/cats.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Injectable } from '@nestjs/common';
import { Cat } from './interfaces/cat.interface';
import { CatsModule } from './cats.module';

@Injectable()
export class CatsService {
Expand Down
2 changes: 1 addition & 1 deletion sample/14-mongoose-base/src/cats/cats.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller, Get, Post, Body, Param } from '@nestjs/common';
import { Controller, Get, Post, Body } from '@nestjs/common';
import { CreateCatDto } from './dto/create-cat.dto';
import { CatsService } from './cats.service';
import { Cat } from './interfaces/cat.interface';
Expand Down
10 changes: 5 additions & 5 deletions sample/22-graphql-prisma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
"start:prod": "node dist/main.js"
},
"dependencies": {
"@nestjs/common": "5.3.6",
"@nestjs/core": "5.3.6",
"@nestjs/graphql": "5.2.2",
"@nestjs/common": "5.3.7",
"@nestjs/core": "5.3.7",
"@nestjs/graphql": "5.3.1",
"apollo-server-express": "2.0.6",
"graphql": "0.13.2",
"graphql-tools": "3.1.1",
"prisma": "1.15.3",
"prisma": "1.16.2",
"prisma-binding": "2.1.5",
"reflect-metadata": "0.1.12",
"rxjs": "6.3.2",
Expand All @@ -28,7 +28,7 @@
"nodemon": "1.18.4",
"prettier": "1.14.2",
"ts-node": "7.0.1",
"tsconfig-paths": "3.5.0",
"tsconfig-paths": "3.6.0",
"tslint": "5.11.0"
}
}
15 changes: 3 additions & 12 deletions sample/22-graphql-prisma/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { join } from 'path';
import { PrismaModule } from './prisma/prisma.module';
import { PostsModule } from './posts/posts.module';
import { GraphqlOptions } from 'graphql.options';

@Module({
imports: [
GraphQLModule.forRoot({
typePaths: ['./**/*.graphql'],
path: '/',
installSubscriptionHandlers: true,
resolverValidationOptions: {
requireResolversForResolveType: false,
},
definitions: {
path: join(process.cwd(), 'src/graphql.schema.d.ts'),
outputAs: 'class',
},
GraphQLModule.forRootAsync({
useClass: GraphqlOptions,
}),
PrismaModule,
PostsModule,
Expand Down
21 changes: 21 additions & 0 deletions sample/22-graphql-prisma/src/graphql.options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { GqlOptionsFactory, GqlModuleOptions } from '@nestjs/graphql';
import { Injectable } from '@nestjs/common';
import { join } from 'path';

@Injectable()
export class GraphqlOptions implements GqlOptionsFactory {
createGqlOptions(): Promise<GqlModuleOptions> | GqlModuleOptions {
return {
typePaths: ['./**/*.graphql'],
path: '/',
installSubscriptionHandlers: true,
resolverValidationOptions: {
requireResolversForResolveType: false,
},
definitions: {
path: join(process.cwd(), 'src/graphql.schema.d.ts'),
outputAs: 'class',
},
};
}
}
Loading

0 comments on commit 0368d52

Please sign in to comment.