@nestjs/common 7.6.1 → 7.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import { ShutdownSignal } from '../enums/shutdown-signal.enum';
2
2
  import { LoggerService, LogLevel } from '../services/logger.service';
3
3
  import { Abstract } from './abstract.interface';
4
+ import { DynamicModule } from './modules';
4
5
  import { Type } from './type.interface';
5
6
  /**
6
7
  * Interface defining NestApplicationContext.
@@ -12,7 +13,7 @@ export interface INestApplicationContext {
12
13
  * Allows navigating through the modules tree, for example, to pull out a specific instance from the selected module.
13
14
  * @returns {INestApplicationContext}
14
15
  */
15
- select<T>(module: Type<T>): INestApplicationContext;
16
+ select<T>(module: Type<T> | DynamicModule): INestApplicationContext;
16
17
  /**
17
18
  * Retrieves an instance of either injectable or controller, otherwise, throws exception.
18
19
  * @returns {TResult}
@@ -1,3 +1,3 @@
1
- export interface Type<T> extends Function {
1
+ export interface Type<T = any> extends Function {
2
2
  new (...args: any[]): T;
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/common",
3
- "version": "7.6.1",
3
+ "version": "7.6.5",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@common)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "homepage": "https://nestjs.com",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
- "axios": "0.21.0",
20
+ "axios": "0.21.1",
21
21
  "iterare": "1.2.1",
22
22
  "tslib": "2.0.3",
23
23
  "uuid": "8.3.2"
@@ -11,6 +11,6 @@ export declare class ClassSerializerInterceptor implements NestInterceptor {
11
11
  intercept(context: ExecutionContext, next: CallHandler): Observable<any>;
12
12
  serialize(response: PlainLiteralObject | Array<PlainLiteralObject>, options: ClassTransformOptions): PlainLiteralObject | PlainLiteralObject[];
13
13
  transformToPlain(plainOrClass: any, options: ClassTransformOptions): PlainLiteralObject;
14
- private getContextOptions;
14
+ protected getContextOptions(context: ExecutionContext): ClassTransformOptions | undefined;
15
15
  private reflectSerializeMetadata;
16
16
  }
@@ -49,7 +49,7 @@ let Logger = Logger_1 = class Logger {
49
49
  this.printMessage(message, cli_colors_util_1.clc.green, context, isTimeDiffEnabled);
50
50
  }
51
51
  static error(message, trace = '', context = '', isTimeDiffEnabled = true) {
52
- this.printMessage(message, cli_colors_util_1.clc.red, context, isTimeDiffEnabled);
52
+ this.printMessage(message, cli_colors_util_1.clc.red, context, isTimeDiffEnabled, 'stderr');
53
53
  this.printStackTrace(trace);
54
54
  }
55
55
  static warn(message, context = '', isTimeDiffEnabled = true) {
@@ -88,15 +88,17 @@ let Logger = Logger_1 = class Logger {
88
88
  isLogLevelEnabled(level) {
89
89
  return Logger_1.logLevels.includes(level);
90
90
  }
91
- static printMessage(message, color, context = '', isTimeDiffEnabled) {
91
+ static printMessage(message, color, context = '', isTimeDiffEnabled, writeStreamType) {
92
+ var _a;
92
93
  const output = shared_utils_1.isObject(message)
93
94
  ? `${color('Object:')}\n${JSON.stringify(message, null, 2)}\n`
94
95
  : color(message);
95
96
  const pidMessage = color(`[Nest] ${process.pid} - `);
96
97
  const contextMessage = context ? cli_colors_util_1.yellow(`[${context}] `) : '';
97
98
  const timestampDiff = this.updateAndGetTimestampDiff(isTimeDiffEnabled);
98
- const instance = this.instance;
99
- process.stdout.write(`${pidMessage}${instance.getTimestamp()} ${contextMessage}${output}${timestampDiff}\n`);
99
+ const instance = (_a = this.instance) !== null && _a !== void 0 ? _a : Logger_1;
100
+ const computedMessage = `${pidMessage}${instance.getTimestamp()} ${contextMessage}${output}${timestampDiff}\n`;
101
+ process[writeStreamType !== null && writeStreamType !== void 0 ? writeStreamType : 'stdout'].write(computedMessage);
100
102
  }
101
103
  static updateAndGetTimestampDiff(isTimeDiffEnabled) {
102
104
  const includeTimestamp = Logger_1.lastTimestamp && isTimeDiffEnabled;
@@ -110,7 +112,7 @@ let Logger = Logger_1 = class Logger {
110
112
  if (!trace) {
111
113
  return;
112
114
  }
113
- process.stdout.write(`${trace}\n`);
115
+ process.stderr.write(`${trace}\n`);
114
116
  }
115
117
  };
116
118
  Logger.logLevels = [