Skip to content

Commit

Permalink
bugfix: fix incorrect dependencies, simplify relations
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Oct 19, 2018
1 parent b03e36c commit 6f9b242
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 30 deletions.
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
**/*.ts
*.ts

# definitions
!**/*.d.ts
!*.d.ts

# configuration
package-lock.json
tslint.json
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nestjs",
"version": "5.3.13",
"version": "5.3.14",
"description": "Modern, fast, powerful node.js web framework",
"scripts": {
"coverage": "nyc report --reporter=text-lcov | coveralls",
Expand All @@ -15,20 +15,21 @@
"prettier **/**/*.ts --ignore-path ./.prettierignore --write && git status",
"clean": "gulp clean:bundle",
"build": "npm run clean && gulp build",
"prebuild:dev": "rm -rf node_modules/@nestjs",
"build:dev": "gulp build --dist node_modules/@nestjs && gulp move",
"postinstall": "opencollective",
"copy-misc": "gulp copy-misc",
"prepare": "npm run build:dev && npm run copy-misc",
"prepare": "npm run build:dev && gulp copy-misc",
"prerelease": "gulp copy-misc && npm run build:dev",
"publish":
"npm run build && ./node_modules/.bin/lerna publish --force-publish --exact -m \"chore(@nestjs) publish %s release\"",
"npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --force-publish --exact -m \"chore(@nestjs) publish %s release\"",
"publish:rc":
"npm run build && ./node_modules/.bin/lerna publish --npm-tag=rc -m \"chore(@nestjs) publish %s release\"",
"npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --npm-tag=rc -m \"chore(@nestjs) publish %s release\"",
"publish:next":
"npm run build && ./node_modules/.bin/lerna publish --npm-tag=next --skip-git -m \"chore(@nestjs) publish %s release\"",
"npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --npm-tag=next --skip-git -m \"chore(@nestjs) publish %s release\"",
"publish:beta":
"npm run build && ./node_modules/.bin/lerna publish --npm-tag=beta -m \"chore(@nestjs) publish %s release\"",
"npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --npm-tag=beta -m \"chore(@nestjs) publish %s release\"",
"publish:test":
"npm run build && ./node_modules/.bin/lerna publish --force-publish --npm-tag=test --skip-git -m \"chore(@nestjs) publish %s release\""
"npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --force-publish --npm-tag=test --skip-git -m \"chore(@nestjs) publish %s release\""
},
"engines": {
"node": ">= 8.9.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ModuleMetadata, Type } from '@nestjs/common/interfaces';
import { ModuleMetadata, Type } from '../../interfaces';
import { MulterOptions } from '../../interfaces/external/multer-options.interface';

export interface MulterModuleOptions extends MulterOptions {}
Expand All @@ -12,7 +12,7 @@ export interface MulterModuleAsyncOptions
useExisting?: Type<MulterOptionsFactory>;
useClass?: Type<MulterOptionsFactory>;
useFactory?: (
...args: any[],
...args: any[]
) => Promise<MulterModuleOptions> | MulterModuleOptions;
inject?: any[];
}
6 changes: 4 additions & 2 deletions packages/common/files/multer.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DynamicModule, Module, Provider } from '@nestjs/common';
import { Module } from './../decorators';
import { DynamicModule, Provider } from './../interfaces';
import { MULTER_MODULE_OPTIONS } from './files.constants';
import {
MulterModuleAsyncOptions,
Expand Down Expand Up @@ -52,7 +53,8 @@ export class MulterModule {
}
return {
provide: MULTER_MODULE_OPTIONS,
useFactory: async (optionsFactory: MulterOptionsFactory) => optionsFactory.createMulterOptions(),
useFactory: async (optionsFactory: MulterOptionsFactory) =>
optionsFactory.createMulterOptions(),
inject: [options.useExisting || options.useClass],
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/common/serializer/class-serializer.interceptor.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { Inject } from '../decorators/core';
import { Inject, Injectable } from '../decorators/core';
import { ClassTransformOptions } from '../interfaces/external/class-transform-options.interface';
import { loadPackage } from '../utils/load-package.util';
import { isObject } from '../utils/shared.utils';
import { ExecutionContext, NestInterceptor } from './../interfaces';
import { CLASS_SERIALIZER_OPTIONS } from './class-serializer.constants';

let classTransformer: any = {};
Expand Down
13 changes: 10 additions & 3 deletions packages/common/utils/validate-each.util.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { RuntimeException } from '@nestjs/core/errors/exceptions/runtime.exception';
export class InvalidDecoratorItemException extends Error {
private readonly msg: string;

export class InvalidDecoratorItemException extends RuntimeException {
constructor(decorator: string, item: string, context: string) {
super(`Invalid ${item} passed to ${decorator}() decorator (${context}).`);
const message = `Invalid ${item} passed to ${decorator}() decorator (${context}).`;
super(message);

this.msg = message;
}

public what(): string {
return this.msg;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/microservices/nest-microservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { ApplicationConfig } from '@nestjs/core/application-config';
import { MESSAGES } from '@nestjs/core/constants';
import { NestContainer } from '@nestjs/core/injector/container';
import { NestApplicationContext } from '@nestjs/core/nest-application-context';
import { CustomTransportStrategy } from '@nestjs/microservices';
import * as optional from 'optional';
import { Transport } from './enums/transport.enum';
import { CustomTransportStrategy } from './interfaces/custom-transport-strategy.interface';
import { MicroserviceOptions } from './interfaces/microservice-configuration.interface';
import { MicroservicesModule } from './microservices-module';
import { Server } from './server/server';
Expand Down
3 changes: 1 addition & 2 deletions packages/microservices/server/server-mqtt.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ReadPacket } from '@nestjs/microservices';
import { Observable } from 'rxjs';
import {
CONNECT_EVENT,
Expand All @@ -8,7 +7,7 @@ import {
NO_PATTERN_MESSAGE,
} from '../constants';
import { MqttClient } from '../external/mqtt-client.interface';
import { CustomTransportStrategy, PacketId } from '../interfaces';
import { CustomTransportStrategy, PacketId, ReadPacket } from '../interfaces';
import {
MicroserviceOptions,
MqttOptions,
Expand Down
3 changes: 1 addition & 2 deletions packages/microservices/server/server-redis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ReadPacket } from '@nestjs/microservices';
import { Observable } from 'rxjs';
import {
CONNECT_EVENT,
Expand All @@ -12,7 +11,7 @@ import {
RedisClient,
RetryStrategyOptions,
} from '../external/redis.interface';
import { CustomTransportStrategy, PacketId } from '../interfaces';
import { CustomTransportStrategy, PacketId, ReadPacket } from '../interfaces';
import {
MicroserviceOptions,
RedisOptions,
Expand Down
13 changes: 5 additions & 8 deletions packages/testing/testing-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,13 @@ import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-applicati
import { INestExpressApplication } from '@nestjs/common/interfaces/nest-express-application.interface';
import { INestFastifyApplication } from '@nestjs/common/interfaces/nest-fastify-application.interface';
import { Type } from '@nestjs/common/interfaces/type.interface';
import { loadPackage } from '@nestjs/common/utils/load-package.util';
import { NestApplication, NestApplicationContext } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/core/adapters/express-adapter';
import { ExpressFactory } from '@nestjs/core/adapters/express-factory';
import { FastifyAdapter } from '@nestjs/core/adapters/fastify-adapter';
import { ApplicationConfig } from '@nestjs/core/application-config';
import { MicroservicesPackageNotFoundException } from '@nestjs/core/errors/exceptions/microservices-package-not-found.exception';
import { NestContainer } from '@nestjs/core/injector/container';
import * as optional from 'optional';

const { NestMicroservice } =
optional('@nestjs/microservices/nest-microservice') || ({} as any);

export class TestingModule extends NestApplicationContext {
constructor(
Expand Down Expand Up @@ -65,9 +61,10 @@ export class TestingModule extends NestApplicationContext {
public createNestMicroservice(
options: NestMicroserviceOptions & MicroserviceOptions,
): INestMicroservice {
if (!NestMicroservice) {
throw new MicroservicesPackageNotFoundException();
}
const { NestMicroservice } = loadPackage(
'@nestjs/microservices',
'TestingModule',
);
this.applyLogger(options);
return new NestMicroservice(
this.container,
Expand Down

0 comments on commit 6f9b242

Please sign in to comment.