@nestjs/common 8.3.0 → 8.4.1

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.
Files changed (62) hide show
  1. package/Readme.md +2 -1
  2. package/cache/cache.module.js +1 -1
  3. package/cache/decorators/index.js +2 -2
  4. package/cache/index.js +5 -5
  5. package/cache/interceptors/cache.interceptor.js +6 -6
  6. package/cache/interceptors/index.js +1 -1
  7. package/cache/interfaces/index.js +2 -2
  8. package/decorators/core/catch.decorator.d.ts +2 -2
  9. package/decorators/core/index.js +14 -14
  10. package/decorators/http/index.js +8 -8
  11. package/decorators/index.js +3 -3
  12. package/decorators/modules/index.js +2 -2
  13. package/enums/index.js +4 -4
  14. package/enums/version-type.enum.d.ts +2 -1
  15. package/enums/version-type.enum.js +1 -0
  16. package/exceptions/index.js +22 -22
  17. package/file-stream/index.js +1 -1
  18. package/file-stream/streamable-file.d.ts +1 -0
  19. package/file-stream/streamable-file.js +6 -2
  20. package/file-stream/streamable-options.interface.d.ts +1 -0
  21. package/http/http.module.js +1 -1
  22. package/http/http.service.js +3 -3
  23. package/http/index.js +3 -3
  24. package/http/interfaces/index.js +1 -1
  25. package/index.d.ts +1 -1
  26. package/index.js +10 -10
  27. package/interfaces/controllers/index.js +2 -2
  28. package/interfaces/exceptions/index.js +5 -5
  29. package/interfaces/hooks/index.js +5 -5
  30. package/interfaces/http/index.js +2 -2
  31. package/interfaces/index.js +29 -29
  32. package/interfaces/middleware/index.js +4 -4
  33. package/interfaces/middleware/nest-middleware.interface.d.ts +1 -1
  34. package/interfaces/modules/index.d.ts +2 -0
  35. package/interfaces/modules/index.js +8 -6
  36. package/interfaces/modules/injection-token.interface.d.ts +3 -0
  37. package/interfaces/modules/injection-token.interface.js +2 -0
  38. package/interfaces/modules/optional-factory-dependency.interface.d.ts +5 -0
  39. package/interfaces/modules/optional-factory-dependency.interface.js +2 -0
  40. package/interfaces/modules/provider.interface.d.ts +7 -6
  41. package/interfaces/version-options.interface.d.ts +13 -1
  42. package/package.json +2 -2
  43. package/pipes/default-value.pipe.js +2 -2
  44. package/pipes/index.js +8 -8
  45. package/pipes/parse-array.pipe.js +3 -3
  46. package/pipes/parse-bool.pipe.js +3 -3
  47. package/pipes/parse-enum.pipe.js +3 -3
  48. package/pipes/parse-float.pipe.js +3 -3
  49. package/pipes/parse-int.pipe.js +3 -3
  50. package/pipes/parse-uuid.pipe.js +3 -3
  51. package/pipes/validation.pipe.js +4 -4
  52. package/serializer/class-serializer.interceptor.js +4 -4
  53. package/serializer/decorators/index.js +1 -1
  54. package/serializer/index.js +2 -2
  55. package/services/console-logger.service.d.ts +4 -0
  56. package/services/console-logger.service.js +26 -12
  57. package/services/index.js +2 -2
  58. package/services/logger.service.js +44 -44
  59. package/services/utils/index.js +1 -1
  60. package/utils/cli-colors.util.js +2 -1
  61. package/utils/index.js +1 -1
  62. package/CHANGELOG.md +0 -18
package/Readme.md CHANGED
@@ -54,7 +54,7 @@ With official support, you can get expert help straight from Nest core team. We
54
54
 
55
55
  ## Support
56
56
 
57
- Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
57
+ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support from the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
58
58
 
59
59
  #### Principal Sponsors
60
60
  <table style="text-align:center;"><tr>
@@ -123,6 +123,7 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
123
123
  <td align="center" valign="middle"><a href="https://thecasinowizard.com/bonuses/no-deposit-bonuses/" target="_blank"><img src="https://nestjs.com/img/casinowizard-logo.png" width="120" valign="middle" /></a></td></tr><tr>
124
124
  <td align="center" valign="middle"><a href="https://polygon-software.ch/" target="_blank"><img src="https://nestjs.com/img/polygon-logo.svg" width="120" valign="middle" /></a></td>
125
125
  <td align="center" valign="middle"><a href="https://mobilereality.pl/" target="_blank"><img src="https://nestjs.com/img/mobile-reality-logo.png" width="45" valign="middle" /></a></td>
126
+ <td align="center" valign="middle"><a href="https://boringowl.io/" target="_blank"><img src="https://nestjs.com/img/boringowl-logo.svg" width="120" valign="middle" /></a></td>
126
127
  </tr></table>
127
128
 
128
129
  ## Backers
@@ -74,7 +74,7 @@ let CacheModule = CacheModule_1 = class CacheModule {
74
74
  };
75
75
  }
76
76
  };
77
- CacheModule = CacheModule_1 = (0, tslib_1.__decorate)([
77
+ CacheModule = CacheModule_1 = tslib_1.__decorate([
78
78
  (0, decorators_1.Module)({
79
79
  providers: [(0, cache_providers_1.createCacheManager)()],
80
80
  exports: [cache_constants_1.CACHE_MANAGER],
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./cache-key.decorator"), exports);
5
- (0, tslib_1.__exportStar)(require("./cache-ttl.decorator"), exports);
4
+ tslib_1.__exportStar(require("./cache-key.decorator"), exports);
5
+ tslib_1.__exportStar(require("./cache-ttl.decorator"), exports);
package/cache/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./cache.constants"), exports);
5
- (0, tslib_1.__exportStar)(require("./cache.module"), exports);
6
- (0, tslib_1.__exportStar)(require("./decorators"), exports);
7
- (0, tslib_1.__exportStar)(require("./interceptors"), exports);
8
- (0, tslib_1.__exportStar)(require("./interfaces"), exports);
4
+ tslib_1.__exportStar(require("./cache.constants"), exports);
5
+ tslib_1.__exportStar(require("./cache.module"), exports);
6
+ tslib_1.__exportStar(require("./decorators"), exports);
7
+ tslib_1.__exportStar(require("./interceptors"), exports);
8
+ tslib_1.__exportStar(require("./interfaces"), exports);
@@ -57,15 +57,15 @@ let CacheInterceptor = class CacheInterceptor {
57
57
  return this.allowedMethods.includes(req.method);
58
58
  }
59
59
  };
60
- (0, tslib_1.__decorate)([
60
+ tslib_1.__decorate([
61
61
  (0, decorators_1.Optional)(),
62
62
  (0, decorators_1.Inject)(HTTP_ADAPTER_HOST),
63
- (0, tslib_1.__metadata)("design:type", Object)
63
+ tslib_1.__metadata("design:type", Object)
64
64
  ], CacheInterceptor.prototype, "httpAdapterHost", void 0);
65
- CacheInterceptor = (0, tslib_1.__decorate)([
65
+ CacheInterceptor = tslib_1.__decorate([
66
66
  (0, decorators_1.Injectable)(),
67
- (0, tslib_1.__param)(0, (0, decorators_1.Inject)(cache_constants_1.CACHE_MANAGER)),
68
- (0, tslib_1.__param)(1, (0, decorators_1.Inject)(REFLECTOR)),
69
- (0, tslib_1.__metadata)("design:paramtypes", [Object, Object])
67
+ tslib_1.__param(0, (0, decorators_1.Inject)(cache_constants_1.CACHE_MANAGER)),
68
+ tslib_1.__param(1, (0, decorators_1.Inject)(REFLECTOR)),
69
+ tslib_1.__metadata("design:paramtypes", [Object, Object])
70
70
  ], CacheInterceptor);
71
71
  exports.CacheInterceptor = CacheInterceptor;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./cache.interceptor"), exports);
4
+ tslib_1.__exportStar(require("./cache.interceptor"), exports);
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./cache-manager.interface"), exports);
5
- (0, tslib_1.__exportStar)(require("./cache-module.interface"), exports);
4
+ tslib_1.__exportStar(require("./cache-manager.interface"), exports);
5
+ tslib_1.__exportStar(require("./cache-module.interface"), exports);
@@ -1,4 +1,4 @@
1
- import { Type } from '../../interfaces';
1
+ import { Type, Abstract } from '../../interfaces';
2
2
  /**
3
3
  * Decorator that marks a class as a Nest exception filter. An exception filter
4
4
  * handles exceptions thrown by or not handled by your application code.
@@ -16,4 +16,4 @@ import { Type } from '../../interfaces';
16
16
  *
17
17
  * @publicApi
18
18
  */
19
- export declare function Catch(...exceptions: Type<any>[]): ClassDecorator;
19
+ export declare function Catch(...exceptions: Array<Type<any> | Abstract<any>>): ClassDecorator;
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./bind.decorator"), exports);
5
- (0, tslib_1.__exportStar)(require("./catch.decorator"), exports);
6
- (0, tslib_1.__exportStar)(require("./controller.decorator"), exports);
7
- (0, tslib_1.__exportStar)(require("./dependencies.decorator"), exports);
8
- (0, tslib_1.__exportStar)(require("./exception-filters.decorator"), exports);
9
- (0, tslib_1.__exportStar)(require("./inject.decorator"), exports);
10
- (0, tslib_1.__exportStar)(require("./injectable.decorator"), exports);
11
- (0, tslib_1.__exportStar)(require("./optional.decorator"), exports);
12
- (0, tslib_1.__exportStar)(require("./set-metadata.decorator"), exports);
13
- (0, tslib_1.__exportStar)(require("./use-guards.decorator"), exports);
14
- (0, tslib_1.__exportStar)(require("./use-interceptors.decorator"), exports);
15
- (0, tslib_1.__exportStar)(require("./use-pipes.decorator"), exports);
16
- (0, tslib_1.__exportStar)(require("./apply-decorators"), exports);
17
- (0, tslib_1.__exportStar)(require("./version.decorator"), exports);
4
+ tslib_1.__exportStar(require("./bind.decorator"), exports);
5
+ tslib_1.__exportStar(require("./catch.decorator"), exports);
6
+ tslib_1.__exportStar(require("./controller.decorator"), exports);
7
+ tslib_1.__exportStar(require("./dependencies.decorator"), exports);
8
+ tslib_1.__exportStar(require("./exception-filters.decorator"), exports);
9
+ tslib_1.__exportStar(require("./inject.decorator"), exports);
10
+ tslib_1.__exportStar(require("./injectable.decorator"), exports);
11
+ tslib_1.__exportStar(require("./optional.decorator"), exports);
12
+ tslib_1.__exportStar(require("./set-metadata.decorator"), exports);
13
+ tslib_1.__exportStar(require("./use-guards.decorator"), exports);
14
+ tslib_1.__exportStar(require("./use-interceptors.decorator"), exports);
15
+ tslib_1.__exportStar(require("./use-pipes.decorator"), exports);
16
+ tslib_1.__exportStar(require("./apply-decorators"), exports);
17
+ tslib_1.__exportStar(require("./version.decorator"), exports);
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./request-mapping.decorator"), exports);
5
- (0, tslib_1.__exportStar)(require("./route-params.decorator"), exports);
6
- (0, tslib_1.__exportStar)(require("./http-code.decorator"), exports);
7
- (0, tslib_1.__exportStar)(require("./create-route-param-metadata.decorator"), exports);
8
- (0, tslib_1.__exportStar)(require("./render.decorator"), exports);
9
- (0, tslib_1.__exportStar)(require("./header.decorator"), exports);
10
- (0, tslib_1.__exportStar)(require("./redirect.decorator"), exports);
11
- (0, tslib_1.__exportStar)(require("./sse.decorator"), exports);
4
+ tslib_1.__exportStar(require("./request-mapping.decorator"), exports);
5
+ tslib_1.__exportStar(require("./route-params.decorator"), exports);
6
+ tslib_1.__exportStar(require("./http-code.decorator"), exports);
7
+ tslib_1.__exportStar(require("./create-route-param-metadata.decorator"), exports);
8
+ tslib_1.__exportStar(require("./render.decorator"), exports);
9
+ tslib_1.__exportStar(require("./header.decorator"), exports);
10
+ tslib_1.__exportStar(require("./redirect.decorator"), exports);
11
+ tslib_1.__exportStar(require("./sse.decorator"), exports);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./core"), exports);
5
- (0, tslib_1.__exportStar)(require("./modules"), exports);
6
- (0, tslib_1.__exportStar)(require("./http"), exports);
4
+ tslib_1.__exportStar(require("./core"), exports);
5
+ tslib_1.__exportStar(require("./modules"), exports);
6
+ tslib_1.__exportStar(require("./http"), exports);
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./global.decorator"), exports);
5
- (0, tslib_1.__exportStar)(require("./module.decorator"), exports);
4
+ tslib_1.__exportStar(require("./global.decorator"), exports);
5
+ tslib_1.__exportStar(require("./module.decorator"), exports);
package/enums/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./request-method.enum"), exports);
5
- (0, tslib_1.__exportStar)(require("./http-status.enum"), exports);
6
- (0, tslib_1.__exportStar)(require("./shutdown-signal.enum"), exports);
7
- (0, tslib_1.__exportStar)(require("./version-type.enum"), exports);
4
+ tslib_1.__exportStar(require("./request-method.enum"), exports);
5
+ tslib_1.__exportStar(require("./http-status.enum"), exports);
6
+ tslib_1.__exportStar(require("./shutdown-signal.enum"), exports);
7
+ tslib_1.__exportStar(require("./version-type.enum"), exports);
@@ -4,5 +4,6 @@
4
4
  export declare enum VersioningType {
5
5
  URI = 0,
6
6
  HEADER = 1,
7
- MEDIA_TYPE = 2
7
+ MEDIA_TYPE = 2,
8
+ CUSTOM = 3
8
9
  }
@@ -9,4 +9,5 @@ var VersioningType;
9
9
  VersioningType[VersioningType["URI"] = 0] = "URI";
10
10
  VersioningType[VersioningType["HEADER"] = 1] = "HEADER";
11
11
  VersioningType[VersioningType["MEDIA_TYPE"] = 2] = "MEDIA_TYPE";
12
+ VersioningType[VersioningType["CUSTOM"] = 3] = "CUSTOM";
12
13
  })(VersioningType = exports.VersioningType || (exports.VersioningType = {}));
@@ -1,25 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./bad-request.exception"), exports);
5
- (0, tslib_1.__exportStar)(require("./http.exception"), exports);
6
- (0, tslib_1.__exportStar)(require("./unauthorized.exception"), exports);
7
- (0, tslib_1.__exportStar)(require("./method-not-allowed.exception"), exports);
8
- (0, tslib_1.__exportStar)(require("./not-found.exception"), exports);
9
- (0, tslib_1.__exportStar)(require("./forbidden.exception"), exports);
10
- (0, tslib_1.__exportStar)(require("./not-acceptable.exception"), exports);
11
- (0, tslib_1.__exportStar)(require("./request-timeout.exception"), exports);
12
- (0, tslib_1.__exportStar)(require("./conflict.exception"), exports);
13
- (0, tslib_1.__exportStar)(require("./gone.exception"), exports);
14
- (0, tslib_1.__exportStar)(require("./payload-too-large.exception"), exports);
15
- (0, tslib_1.__exportStar)(require("./unsupported-media-type.exception"), exports);
16
- (0, tslib_1.__exportStar)(require("./unprocessable-entity.exception"), exports);
17
- (0, tslib_1.__exportStar)(require("./internal-server-error.exception"), exports);
18
- (0, tslib_1.__exportStar)(require("./not-implemented.exception"), exports);
19
- (0, tslib_1.__exportStar)(require("./http-version-not-supported.exception"), exports);
20
- (0, tslib_1.__exportStar)(require("./bad-gateway.exception"), exports);
21
- (0, tslib_1.__exportStar)(require("./service-unavailable.exception"), exports);
22
- (0, tslib_1.__exportStar)(require("./gateway-timeout.exception"), exports);
23
- (0, tslib_1.__exportStar)(require("./im-a-teapot.exception"), exports);
24
- (0, tslib_1.__exportStar)(require("./precondition-failed.exception"), exports);
25
- (0, tslib_1.__exportStar)(require("./misdirected.exception"), exports);
4
+ tslib_1.__exportStar(require("./bad-request.exception"), exports);
5
+ tslib_1.__exportStar(require("./http.exception"), exports);
6
+ tslib_1.__exportStar(require("./unauthorized.exception"), exports);
7
+ tslib_1.__exportStar(require("./method-not-allowed.exception"), exports);
8
+ tslib_1.__exportStar(require("./not-found.exception"), exports);
9
+ tslib_1.__exportStar(require("./forbidden.exception"), exports);
10
+ tslib_1.__exportStar(require("./not-acceptable.exception"), exports);
11
+ tslib_1.__exportStar(require("./request-timeout.exception"), exports);
12
+ tslib_1.__exportStar(require("./conflict.exception"), exports);
13
+ tslib_1.__exportStar(require("./gone.exception"), exports);
14
+ tslib_1.__exportStar(require("./payload-too-large.exception"), exports);
15
+ tslib_1.__exportStar(require("./unsupported-media-type.exception"), exports);
16
+ tslib_1.__exportStar(require("./unprocessable-entity.exception"), exports);
17
+ tslib_1.__exportStar(require("./internal-server-error.exception"), exports);
18
+ tslib_1.__exportStar(require("./not-implemented.exception"), exports);
19
+ tslib_1.__exportStar(require("./http-version-not-supported.exception"), exports);
20
+ tslib_1.__exportStar(require("./bad-gateway.exception"), exports);
21
+ tslib_1.__exportStar(require("./service-unavailable.exception"), exports);
22
+ tslib_1.__exportStar(require("./gateway-timeout.exception"), exports);
23
+ tslib_1.__exportStar(require("./im-a-teapot.exception"), exports);
24
+ tslib_1.__exportStar(require("./precondition-failed.exception"), exports);
25
+ tslib_1.__exportStar(require("./misdirected.exception"), exports);
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./streamable-file"), exports);
4
+ tslib_1.__exportStar(require("./streamable-file"), exports);
@@ -10,5 +10,6 @@ export declare class StreamableFile {
10
10
  getHeaders(): {
11
11
  type: string;
12
12
  disposition: string;
13
+ length: number;
13
14
  };
14
15
  }
@@ -20,8 +20,12 @@ class StreamableFile {
20
20
  return this.stream;
21
21
  }
22
22
  getHeaders() {
23
- const { type = 'application/octet-stream', disposition = null } = this.options;
24
- return { type, disposition };
23
+ const { type = 'application/octet-stream', disposition = undefined, length = undefined, } = this.options;
24
+ return {
25
+ type,
26
+ disposition,
27
+ length,
28
+ };
25
29
  }
26
30
  }
27
31
  exports.StreamableFile = StreamableFile;
@@ -1,4 +1,5 @@
1
1
  export interface StreamableFileOptions {
2
2
  type?: string;
3
3
  disposition?: string;
4
+ length?: number;
4
5
  }
@@ -73,7 +73,7 @@ let HttpModule = HttpModule_1 = class HttpModule {
73
73
  };
74
74
  }
75
75
  };
76
- HttpModule = HttpModule_1 = (0, tslib_1.__decorate)([
76
+ HttpModule = HttpModule_1 = tslib_1.__decorate([
77
77
  (0, module_decorator_1.Module)({
78
78
  providers: [
79
79
  http_service_1.HttpService,
@@ -67,8 +67,8 @@ let HttpService = class HttpService {
67
67
  });
68
68
  }
69
69
  };
70
- HttpService = (0, tslib_1.__decorate)([
71
- (0, tslib_1.__param)(0, (0, decorators_1.Inject)(http_constants_1.AXIOS_INSTANCE_TOKEN)),
72
- (0, tslib_1.__metadata)("design:paramtypes", [Function])
70
+ HttpService = tslib_1.__decorate([
71
+ tslib_1.__param(0, (0, decorators_1.Inject)(http_constants_1.AXIOS_INSTANCE_TOKEN)),
72
+ tslib_1.__metadata("design:paramtypes", [Function])
73
73
  ], HttpService);
74
74
  exports.HttpService = HttpService;
package/http/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./http.module"), exports);
5
- (0, tslib_1.__exportStar)(require("./http.service"), exports);
6
- (0, tslib_1.__exportStar)(require("./interfaces"), exports);
4
+ tslib_1.__exportStar(require("./http.module"), exports);
5
+ tslib_1.__exportStar(require("./http.service"), exports);
6
+ tslib_1.__exportStar(require("./interfaces"), exports);
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./http-module.interface"), exports);
4
+ tslib_1.__exportStar(require("./http-module.interface"), exports);
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export * from './enums';
5
5
  export * from './exceptions';
6
6
  export * from './file-stream';
7
7
  export * from './http';
8
- export { Abstract, ArgumentMetadata, ArgumentsHost, BeforeApplicationShutdown, CallHandler, CanActivate, ClassProvider, ContextType, DynamicModule, ExceptionFilter, ExecutionContext, ExistingProvider, FactoryProvider, ForwardReference, HttpServer, INestApplication, INestApplicationContext, INestMicroservice, IntrospectionResult, MessageEvent, MiddlewareConsumer, ModuleMetadata, NestApplicationOptions, NestHybridApplicationOptions, NestInterceptor, NestMiddleware, NestModule, OnApplicationBootstrap, OnApplicationShutdown, OnModuleDestroy, OnModuleInit, Paramtype, PipeTransform, Provider, RpcExceptionFilter, Scope, ScopeOptions, Type, ValidationError, ValueProvider, VersioningOptions, VERSION_NEUTRAL, WebSocketAdapter, WsExceptionFilter, WsMessageHandler, } from './interfaces';
8
+ export { Abstract, ArgumentMetadata, ArgumentsHost, BeforeApplicationShutdown, CallHandler, CanActivate, ClassProvider, ContextType, DynamicModule, ExceptionFilter, ExecutionContext, ExistingProvider, FactoryProvider, ForwardReference, HttpServer, INestApplication, INestApplicationContext, INestMicroservice, InjectionToken, IntrospectionResult, MessageEvent, MiddlewareConsumer, ModuleMetadata, NestApplicationOptions, NestHybridApplicationOptions, NestInterceptor, NestMiddleware, NestModule, OnApplicationBootstrap, OnApplicationShutdown, OnModuleDestroy, OnModuleInit, OptionalFactoryDependency, Paramtype, PipeTransform, Provider, RpcExceptionFilter, Scope, ScopeOptions, Type, ValidationError, ValueProvider, VersioningOptions, VERSION_NEUTRAL, WebSocketAdapter, WsExceptionFilter, WsMessageHandler, } from './interfaces';
9
9
  export * from './pipes';
10
10
  export * from './serializer';
11
11
  export * from './services';
package/index.js CHANGED
@@ -9,16 +9,16 @@ const tslib_1 = require("tslib");
9
9
  * MIT Licensed
10
10
  */
11
11
  require("reflect-metadata");
12
- (0, tslib_1.__exportStar)(require("./cache"), exports);
13
- (0, tslib_1.__exportStar)(require("./decorators"), exports);
14
- (0, tslib_1.__exportStar)(require("./enums"), exports);
15
- (0, tslib_1.__exportStar)(require("./exceptions"), exports);
16
- (0, tslib_1.__exportStar)(require("./file-stream"), exports);
17
- (0, tslib_1.__exportStar)(require("./http"), exports);
12
+ tslib_1.__exportStar(require("./cache"), exports);
13
+ tslib_1.__exportStar(require("./decorators"), exports);
14
+ tslib_1.__exportStar(require("./enums"), exports);
15
+ tslib_1.__exportStar(require("./exceptions"), exports);
16
+ tslib_1.__exportStar(require("./file-stream"), exports);
17
+ tslib_1.__exportStar(require("./http"), exports);
18
18
  var interfaces_1 = require("./interfaces");
19
19
  Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return interfaces_1.Scope; } });
20
20
  Object.defineProperty(exports, "VERSION_NEUTRAL", { enumerable: true, get: function () { return interfaces_1.VERSION_NEUTRAL; } });
21
- (0, tslib_1.__exportStar)(require("./pipes"), exports);
22
- (0, tslib_1.__exportStar)(require("./serializer"), exports);
23
- (0, tslib_1.__exportStar)(require("./services"), exports);
24
- (0, tslib_1.__exportStar)(require("./utils"), exports);
21
+ tslib_1.__exportStar(require("./pipes"), exports);
22
+ tslib_1.__exportStar(require("./serializer"), exports);
23
+ tslib_1.__exportStar(require("./services"), exports);
24
+ tslib_1.__exportStar(require("./utils"), exports);
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./controller-metadata.interface"), exports);
5
- (0, tslib_1.__exportStar)(require("./controller.interface"), exports);
4
+ tslib_1.__exportStar(require("./controller-metadata.interface"), exports);
5
+ tslib_1.__exportStar(require("./controller.interface"), exports);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./exception-filter-metadata.interface"), exports);
5
- (0, tslib_1.__exportStar)(require("./exception-filter.interface"), exports);
6
- (0, tslib_1.__exportStar)(require("./rpc-exception-filter-metadata.interface"), exports);
7
- (0, tslib_1.__exportStar)(require("./rpc-exception-filter.interface"), exports);
8
- (0, tslib_1.__exportStar)(require("./ws-exception-filter.interface"), exports);
4
+ tslib_1.__exportStar(require("./exception-filter-metadata.interface"), exports);
5
+ tslib_1.__exportStar(require("./exception-filter.interface"), exports);
6
+ tslib_1.__exportStar(require("./rpc-exception-filter-metadata.interface"), exports);
7
+ tslib_1.__exportStar(require("./rpc-exception-filter.interface"), exports);
8
+ tslib_1.__exportStar(require("./ws-exception-filter.interface"), exports);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./before-application-shutdown.interface"), exports);
5
- (0, tslib_1.__exportStar)(require("./on-application-bootstrap.interface"), exports);
6
- (0, tslib_1.__exportStar)(require("./on-application-shutdown.interface"), exports);
7
- (0, tslib_1.__exportStar)(require("./on-destroy.interface"), exports);
8
- (0, tslib_1.__exportStar)(require("./on-init.interface"), exports);
4
+ tslib_1.__exportStar(require("./before-application-shutdown.interface"), exports);
5
+ tslib_1.__exportStar(require("./on-application-bootstrap.interface"), exports);
6
+ tslib_1.__exportStar(require("./on-application-shutdown.interface"), exports);
7
+ tslib_1.__exportStar(require("./on-destroy.interface"), exports);
8
+ tslib_1.__exportStar(require("./on-init.interface"), exports);
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./http-server.interface"), exports);
5
- (0, tslib_1.__exportStar)(require("./message-event.interface"), exports);
4
+ tslib_1.__exportStar(require("./http-server.interface"), exports);
5
+ tslib_1.__exportStar(require("./message-event.interface"), exports);
@@ -1,32 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./abstract.interface"), exports);
5
- (0, tslib_1.__exportStar)(require("./controllers/controller-metadata.interface"), exports);
6
- (0, tslib_1.__exportStar)(require("./controllers/controller.interface"), exports);
7
- (0, tslib_1.__exportStar)(require("./exceptions/exception-filter.interface"), exports);
8
- (0, tslib_1.__exportStar)(require("./exceptions/rpc-exception-filter.interface"), exports);
9
- (0, tslib_1.__exportStar)(require("./exceptions/ws-exception-filter.interface"), exports);
10
- (0, tslib_1.__exportStar)(require("./external/validation-error.interface"), exports);
11
- (0, tslib_1.__exportStar)(require("./features/arguments-host.interface"), exports);
12
- (0, tslib_1.__exportStar)(require("./features/can-activate.interface"), exports);
13
- (0, tslib_1.__exportStar)(require("./features/custom-route-param-factory.interface"), exports);
14
- (0, tslib_1.__exportStar)(require("./features/execution-context.interface"), exports);
15
- (0, tslib_1.__exportStar)(require("./features/nest-interceptor.interface"), exports);
16
- (0, tslib_1.__exportStar)(require("./features/paramtype.interface"), exports);
17
- (0, tslib_1.__exportStar)(require("./features/pipe-transform.interface"), exports);
18
- (0, tslib_1.__exportStar)(require("./global-prefix-options.interface"), exports);
19
- (0, tslib_1.__exportStar)(require("./hooks"), exports);
20
- (0, tslib_1.__exportStar)(require("./http"), exports);
21
- (0, tslib_1.__exportStar)(require("./injectable.interface"), exports);
22
- (0, tslib_1.__exportStar)(require("./microservices/nest-hybrid-application-options.interface"), exports);
23
- (0, tslib_1.__exportStar)(require("./middleware"), exports);
24
- (0, tslib_1.__exportStar)(require("./modules"), exports);
25
- (0, tslib_1.__exportStar)(require("./nest-application-context.interface"), exports);
26
- (0, tslib_1.__exportStar)(require("./nest-application-options.interface"), exports);
27
- (0, tslib_1.__exportStar)(require("./nest-application.interface"), exports);
28
- (0, tslib_1.__exportStar)(require("./nest-microservice.interface"), exports);
29
- (0, tslib_1.__exportStar)(require("./scope-options.interface"), exports);
30
- (0, tslib_1.__exportStar)(require("./type.interface"), exports);
31
- (0, tslib_1.__exportStar)(require("./version-options.interface"), exports);
32
- (0, tslib_1.__exportStar)(require("./websockets/web-socket-adapter.interface"), exports);
4
+ tslib_1.__exportStar(require("./abstract.interface"), exports);
5
+ tslib_1.__exportStar(require("./controllers/controller-metadata.interface"), exports);
6
+ tslib_1.__exportStar(require("./controllers/controller.interface"), exports);
7
+ tslib_1.__exportStar(require("./exceptions/exception-filter.interface"), exports);
8
+ tslib_1.__exportStar(require("./exceptions/rpc-exception-filter.interface"), exports);
9
+ tslib_1.__exportStar(require("./exceptions/ws-exception-filter.interface"), exports);
10
+ tslib_1.__exportStar(require("./external/validation-error.interface"), exports);
11
+ tslib_1.__exportStar(require("./features/arguments-host.interface"), exports);
12
+ tslib_1.__exportStar(require("./features/can-activate.interface"), exports);
13
+ tslib_1.__exportStar(require("./features/custom-route-param-factory.interface"), exports);
14
+ tslib_1.__exportStar(require("./features/execution-context.interface"), exports);
15
+ tslib_1.__exportStar(require("./features/nest-interceptor.interface"), exports);
16
+ tslib_1.__exportStar(require("./features/paramtype.interface"), exports);
17
+ tslib_1.__exportStar(require("./features/pipe-transform.interface"), exports);
18
+ tslib_1.__exportStar(require("./global-prefix-options.interface"), exports);
19
+ tslib_1.__exportStar(require("./hooks"), exports);
20
+ tslib_1.__exportStar(require("./http"), exports);
21
+ tslib_1.__exportStar(require("./injectable.interface"), exports);
22
+ tslib_1.__exportStar(require("./microservices/nest-hybrid-application-options.interface"), exports);
23
+ tslib_1.__exportStar(require("./middleware"), exports);
24
+ tslib_1.__exportStar(require("./modules"), exports);
25
+ tslib_1.__exportStar(require("./nest-application-context.interface"), exports);
26
+ tslib_1.__exportStar(require("./nest-application-options.interface"), exports);
27
+ tslib_1.__exportStar(require("./nest-application.interface"), exports);
28
+ tslib_1.__exportStar(require("./nest-microservice.interface"), exports);
29
+ tslib_1.__exportStar(require("./scope-options.interface"), exports);
30
+ tslib_1.__exportStar(require("./type.interface"), exports);
31
+ tslib_1.__exportStar(require("./version-options.interface"), exports);
32
+ tslib_1.__exportStar(require("./websockets/web-socket-adapter.interface"), exports);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./middleware-config-proxy.interface"), exports);
5
- (0, tslib_1.__exportStar)(require("./middleware-configuration.interface"), exports);
6
- (0, tslib_1.__exportStar)(require("./middleware-consumer.interface"), exports);
7
- (0, tslib_1.__exportStar)(require("./nest-middleware.interface"), exports);
4
+ tslib_1.__exportStar(require("./middleware-config-proxy.interface"), exports);
5
+ tslib_1.__exportStar(require("./middleware-configuration.interface"), exports);
6
+ tslib_1.__exportStar(require("./middleware-consumer.interface"), exports);
7
+ tslib_1.__exportStar(require("./nest-middleware.interface"), exports);
@@ -1,3 +1,3 @@
1
1
  export interface NestMiddleware<TRequest = any, TResponse = any> {
2
- use(req: TRequest, res: TResponse, next: () => void): any;
2
+ use(req: TRequest, res: TResponse, next: (error?: Error | any) => void): any;
3
3
  }
@@ -1,6 +1,8 @@
1
1
  export * from './dynamic-module.interface';
2
2
  export * from './forward-reference.interface';
3
+ export * from './injection-token.interface';
3
4
  export * from './introspection-result.interface';
4
5
  export * from './module-metadata.interface';
5
6
  export * from './nest-module.interface';
7
+ export * from './optional-factory-dependency.interface';
6
8
  export * from './provider.interface';
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./dynamic-module.interface"), exports);
5
- (0, tslib_1.__exportStar)(require("./forward-reference.interface"), exports);
6
- (0, tslib_1.__exportStar)(require("./introspection-result.interface"), exports);
7
- (0, tslib_1.__exportStar)(require("./module-metadata.interface"), exports);
8
- (0, tslib_1.__exportStar)(require("./nest-module.interface"), exports);
9
- (0, tslib_1.__exportStar)(require("./provider.interface"), exports);
4
+ tslib_1.__exportStar(require("./dynamic-module.interface"), exports);
5
+ tslib_1.__exportStar(require("./forward-reference.interface"), exports);
6
+ tslib_1.__exportStar(require("./injection-token.interface"), exports);
7
+ tslib_1.__exportStar(require("./introspection-result.interface"), exports);
8
+ tslib_1.__exportStar(require("./module-metadata.interface"), exports);
9
+ tslib_1.__exportStar(require("./nest-module.interface"), exports);
10
+ tslib_1.__exportStar(require("./optional-factory-dependency.interface"), exports);
11
+ tslib_1.__exportStar(require("./provider.interface"), exports);
@@ -0,0 +1,3 @@
1
+ import { Abstract } from '../abstract.interface';
2
+ import { Type } from '../type.interface';
3
+ export declare type InjectionToken = string | symbol | Type<any> | Abstract<any> | Function;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { InjectionToken } from './injection-token.interface';
2
+ export declare type OptionalFactoryDependency = {
3
+ token: InjectionToken;
4
+ optional: boolean;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,7 @@
1
- import { Abstract } from '../abstract.interface';
2
1
  import { Scope } from '../scope-options.interface';
3
2
  import { Type } from '../type.interface';
3
+ import { InjectionToken } from './injection-token.interface';
4
+ import { OptionalFactoryDependency } from './optional-factory-dependency.interface';
4
5
  /**
5
6
  *
6
7
  * @publicApi
@@ -29,7 +30,7 @@ export interface ClassProvider<T = any> {
29
30
  /**
30
31
  * Injection token
31
32
  */
32
- provide: string | symbol | Type<any> | Abstract<any> | Function;
33
+ provide: InjectionToken;
33
34
  /**
34
35
  * Type (class name) of provider (instance to be injected).
35
36
  */
@@ -58,7 +59,7 @@ export interface ValueProvider<T = any> {
58
59
  /**
59
60
  * Injection token
60
61
  */
61
- provide: string | symbol | Type<any> | Abstract<any> | Function;
62
+ provide: InjectionToken;
62
63
  /**
63
64
  * Instance of a provider to be injected.
64
65
  */
@@ -88,7 +89,7 @@ export interface FactoryProvider<T = any> {
88
89
  /**
89
90
  * Injection token
90
91
  */
91
- provide: string | symbol | Type<any> | Abstract<any> | Function;
92
+ provide: InjectionToken;
92
93
  /**
93
94
  * Factory function that returns an instance of the provider to be injected.
94
95
  */
@@ -96,7 +97,7 @@ export interface FactoryProvider<T = any> {
96
97
  /**
97
98
  * Optional list of providers to be injected into the context of the Factory function.
98
99
  */
99
- inject?: Array<Type<any> | string | symbol | Abstract<any> | Function>;
100
+ inject?: Array<InjectionToken | OptionalFactoryDependency>;
100
101
  /**
101
102
  * Optional enum defining lifetime of the provider that is returned by the Factory function.
102
103
  */
@@ -121,7 +122,7 @@ export interface ExistingProvider<T = any> {
121
122
  /**
122
123
  * Injection token
123
124
  */
124
- provide: string | symbol | Type<any> | Abstract<any> | Function;
125
+ provide: InjectionToken;
125
126
  /**
126
127
  * Provider to be aliased by the Injection token.
127
128
  */
@@ -48,6 +48,18 @@ export interface MediaTypeVersioningOptions {
48
48
  */
49
49
  key: string;
50
50
  }
51
+ export interface CustomVersioningOptions {
52
+ type: VersioningType.CUSTOM;
53
+ /**
54
+ * A function that accepts a request object (specific to the underlying platform, ie Express or Fastify)
55
+ * and returns a single version value or an ordered array of versions, in order from HIGHEST to LOWEST.
56
+ *
57
+ * Ex. Returned version array = ['3.1', '3.0', '2.5', '2', '1.9']
58
+ *
59
+ * Use type assertion or narrowing to identify the specific request type.
60
+ */
61
+ extractor: (request: unknown) => string | string[];
62
+ }
51
63
  interface VersioningCommonOptions {
52
64
  /**
53
65
  * The default version to be used as a fallback when you did not provide some
@@ -58,5 +70,5 @@ interface VersioningCommonOptions {
58
70
  /**
59
71
  * @publicApi
60
72
  */
61
- export declare type VersioningOptions = VersioningCommonOptions & (HeaderVersioningOptions | UriVersioningOptions | MediaTypeVersioningOptions);
73
+ export declare type VersioningOptions = VersioningCommonOptions & (HeaderVersioningOptions | UriVersioningOptions | MediaTypeVersioningOptions | CustomVersioningOptions);
62
74
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/common",
3
- "version": "8.3.0",
3
+ "version": "8.4.1",
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.26.0",
20
+ "axios": "0.26.1",
21
21
  "iterare": "1.2.1",
22
22
  "tslib": "2.3.1",
23
23
  "uuid": "8.3.2"
@@ -23,8 +23,8 @@ let DefaultValuePipe = class DefaultValuePipe {
23
23
  return value;
24
24
  }
25
25
  };
26
- DefaultValuePipe = (0, tslib_1.__decorate)([
26
+ DefaultValuePipe = tslib_1.__decorate([
27
27
  (0, injectable_decorator_1.Injectable)(),
28
- (0, tslib_1.__metadata)("design:paramtypes", [Object])
28
+ tslib_1.__metadata("design:paramtypes", [Object])
29
29
  ], DefaultValuePipe);
30
30
  exports.DefaultValuePipe = DefaultValuePipe;
package/pipes/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./default-value.pipe"), exports);
5
- (0, tslib_1.__exportStar)(require("./parse-array.pipe"), exports);
6
- (0, tslib_1.__exportStar)(require("./parse-bool.pipe"), exports);
7
- (0, tslib_1.__exportStar)(require("./parse-int.pipe"), exports);
8
- (0, tslib_1.__exportStar)(require("./parse-float.pipe"), exports);
9
- (0, tslib_1.__exportStar)(require("./parse-enum.pipe"), exports);
10
- (0, tslib_1.__exportStar)(require("./parse-uuid.pipe"), exports);
11
- (0, tslib_1.__exportStar)(require("./validation.pipe"), exports);
4
+ tslib_1.__exportStar(require("./default-value.pipe"), exports);
5
+ tslib_1.__exportStar(require("./parse-array.pipe"), exports);
6
+ tslib_1.__exportStar(require("./parse-bool.pipe"), exports);
7
+ tslib_1.__exportStar(require("./parse-int.pipe"), exports);
8
+ tslib_1.__exportStar(require("./parse-float.pipe"), exports);
9
+ tslib_1.__exportStar(require("./parse-enum.pipe"), exports);
10
+ tslib_1.__exportStar(require("./parse-uuid.pipe"), exports);
11
+ tslib_1.__exportStar(require("./validation.pipe"), exports);
@@ -132,9 +132,9 @@ let ParseArrayPipe = class ParseArrayPipe {
132
132
  return originalValue;
133
133
  }
134
134
  };
135
- ParseArrayPipe = (0, tslib_1.__decorate)([
135
+ ParseArrayPipe = tslib_1.__decorate([
136
136
  (0, injectable_decorator_1.Injectable)(),
137
- (0, tslib_1.__param)(0, (0, optional_decorator_1.Optional)()),
138
- (0, tslib_1.__metadata)("design:paramtypes", [Object])
137
+ tslib_1.__param(0, (0, optional_decorator_1.Optional)()),
138
+ tslib_1.__metadata("design:paramtypes", [Object])
139
139
  ], ParseArrayPipe);
140
140
  exports.ParseArrayPipe = ParseArrayPipe;
@@ -38,9 +38,9 @@ let ParseBoolPipe = class ParseBoolPipe {
38
38
  throw this.exceptionFactory('Validation failed (boolean string is expected)');
39
39
  }
40
40
  };
41
- ParseBoolPipe = (0, tslib_1.__decorate)([
41
+ ParseBoolPipe = tslib_1.__decorate([
42
42
  (0, injectable_decorator_1.Injectable)(),
43
- (0, tslib_1.__param)(0, (0, optional_decorator_1.Optional)()),
44
- (0, tslib_1.__metadata)("design:paramtypes", [Object])
43
+ tslib_1.__param(0, (0, optional_decorator_1.Optional)()),
44
+ tslib_1.__metadata("design:paramtypes", [Object])
45
45
  ], ParseBoolPipe);
46
46
  exports.ParseBoolPipe = ParseBoolPipe;
@@ -41,9 +41,9 @@ let ParseEnumPipe = class ParseEnumPipe {
41
41
  return enumValues.includes(value);
42
42
  }
43
43
  };
44
- ParseEnumPipe = (0, tslib_1.__decorate)([
44
+ ParseEnumPipe = tslib_1.__decorate([
45
45
  (0, index_1.Injectable)(),
46
- (0, tslib_1.__param)(1, (0, index_1.Optional)()),
47
- (0, tslib_1.__metadata)("design:paramtypes", [Object, Object])
46
+ tslib_1.__param(1, (0, index_1.Optional)()),
47
+ tslib_1.__metadata("design:paramtypes", [Object, Object])
48
48
  ], ParseEnumPipe);
49
49
  exports.ParseEnumPipe = ParseEnumPipe;
@@ -36,9 +36,9 @@ let ParseFloatPipe = class ParseFloatPipe {
36
36
  return parseFloat(value);
37
37
  }
38
38
  };
39
- ParseFloatPipe = (0, tslib_1.__decorate)([
39
+ ParseFloatPipe = tslib_1.__decorate([
40
40
  (0, index_1.Injectable)(),
41
- (0, tslib_1.__param)(0, (0, index_1.Optional)()),
42
- (0, tslib_1.__metadata)("design:paramtypes", [Object])
41
+ tslib_1.__param(0, (0, index_1.Optional)()),
42
+ tslib_1.__metadata("design:paramtypes", [Object])
43
43
  ], ParseFloatPipe);
44
44
  exports.ParseFloatPipe = ParseFloatPipe;
@@ -38,9 +38,9 @@ let ParseIntPipe = class ParseIntPipe {
38
38
  return parseInt(value, 10);
39
39
  }
40
40
  };
41
- ParseIntPipe = (0, tslib_1.__decorate)([
41
+ ParseIntPipe = tslib_1.__decorate([
42
42
  (0, injectable_decorator_1.Injectable)(),
43
- (0, tslib_1.__param)(0, (0, optional_decorator_1.Optional)()),
44
- (0, tslib_1.__metadata)("design:paramtypes", [Object])
43
+ tslib_1.__param(0, (0, optional_decorator_1.Optional)()),
44
+ tslib_1.__metadata("design:paramtypes", [Object])
45
45
  ], ParseIntPipe);
46
46
  exports.ParseIntPipe = ParseIntPipe;
@@ -23,9 +23,9 @@ let ParseUUIDPipe = class ParseUUIDPipe {
23
23
  return value;
24
24
  }
25
25
  };
26
- ParseUUIDPipe = (0, tslib_1.__decorate)([
26
+ ParseUUIDPipe = tslib_1.__decorate([
27
27
  (0, injectable_decorator_1.Injectable)(),
28
- (0, tslib_1.__param)(0, (0, optional_decorator_1.Optional)()),
29
- (0, tslib_1.__metadata)("design:paramtypes", [Object])
28
+ tslib_1.__param(0, (0, optional_decorator_1.Optional)()),
29
+ tslib_1.__metadata("design:paramtypes", [Object])
30
30
  ], ParseUUIDPipe);
31
31
  exports.ParseUUIDPipe = ParseUUIDPipe;
@@ -14,7 +14,7 @@ let classTransformer = {};
14
14
  let ValidationPipe = class ValidationPipe {
15
15
  constructor(options) {
16
16
  options = options || {};
17
- const { transform, disableErrorMessages, errorHttpStatusCode, expectedType, transformOptions, validateCustomDecorators } = options, validatorOptions = (0, tslib_1.__rest)(options, ["transform", "disableErrorMessages", "errorHttpStatusCode", "expectedType", "transformOptions", "validateCustomDecorators"]);
17
+ const { transform, disableErrorMessages, errorHttpStatusCode, expectedType, transformOptions, validateCustomDecorators } = options, validatorOptions = tslib_1.__rest(options, ["transform", "disableErrorMessages", "errorHttpStatusCode", "expectedType", "transformOptions", "validateCustomDecorators"]);
18
18
  this.isTransformEnabled = !!transform;
19
19
  this.validatorOptions = validatorOptions;
20
20
  this.transformOptions = transformOptions;
@@ -163,9 +163,9 @@ let ValidationPipe = class ValidationPipe {
163
163
  return Object.assign(Object.assign({}, error), { constraints });
164
164
  }
165
165
  };
166
- ValidationPipe = (0, tslib_1.__decorate)([
166
+ ValidationPipe = tslib_1.__decorate([
167
167
  (0, core_1.Injectable)(),
168
- (0, tslib_1.__param)(0, (0, decorators_1.Optional)()),
169
- (0, tslib_1.__metadata)("design:paramtypes", [Object])
168
+ tslib_1.__param(0, (0, decorators_1.Optional)()),
169
+ tslib_1.__metadata("design:paramtypes", [Object])
170
170
  ], ValidationPipe);
171
171
  exports.ValidationPipe = ValidationPipe;
@@ -55,10 +55,10 @@ let ClassSerializerInterceptor = class ClassSerializerInterceptor {
55
55
  return this.reflector.get(class_serializer_constants_1.CLASS_SERIALIZER_OPTIONS, obj);
56
56
  }
57
57
  };
58
- ClassSerializerInterceptor = (0, tslib_1.__decorate)([
58
+ ClassSerializerInterceptor = tslib_1.__decorate([
59
59
  (0, core_1.Injectable)(),
60
- (0, tslib_1.__param)(0, (0, core_1.Inject)(REFLECTOR)),
61
- (0, tslib_1.__param)(1, (0, core_1.Optional)()),
62
- (0, tslib_1.__metadata)("design:paramtypes", [Object, Object])
60
+ tslib_1.__param(0, (0, core_1.Inject)(REFLECTOR)),
61
+ tslib_1.__param(1, (0, core_1.Optional)()),
62
+ tslib_1.__metadata("design:paramtypes", [Object, Object])
63
63
  ], ClassSerializerInterceptor);
64
64
  exports.ClassSerializerInterceptor = ClassSerializerInterceptor;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./serialize-options.decorator"), exports);
4
+ tslib_1.__exportStar(require("./serialize-options.decorator"), exports);
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./class-serializer.interceptor"), exports);
5
- (0, tslib_1.__exportStar)(require("./decorators"), exports);
4
+ tslib_1.__exportStar(require("./class-serializer.interceptor"), exports);
5
+ tslib_1.__exportStar(require("./decorators"), exports);
@@ -64,6 +64,10 @@ export declare class ConsoleLogger implements LoggerService {
64
64
  isLevelEnabled(level: LogLevel): boolean;
65
65
  protected getTimestamp(): string;
66
66
  protected printMessages(messages: unknown[], context?: string, logLevel?: LogLevel, writeStreamType?: 'stdout' | 'stderr'): void;
67
+ protected formatPid(pid: number): string;
68
+ protected formatMessage(logLevel: LogLevel, message: unknown, pidMessage: string, formattedLogLevel: string, contextMessage: string, timestampDiff: string): string;
69
+ protected stringifyMessage(message: unknown, logLevel: LogLevel): string;
70
+ protected colorize(message: string, logLevel: LogLevel): string;
67
71
  protected printStackTrace(stack: string): void;
68
72
  private updateAndGetTimestampDiff;
69
73
  private getContextAndMessagesToPrint;
@@ -114,19 +114,33 @@ let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
114
114
  return new Date(Date.now()).toLocaleString(undefined, localeStringOptions);
115
115
  }
116
116
  printMessages(messages, context = '', logLevel = 'log', writeStreamType) {
117
- const color = this.getColorByLogLevel(logLevel);
118
117
  messages.forEach(message => {
119
- const output = (0, shared_utils_1.isPlainObject)(message)
120
- ? `${color('Object:')}\n${JSON.stringify(message, (key, value) => typeof value === 'bigint' ? value.toString() : value, 2)}\n`
121
- : color(message);
122
- const pidMessage = color(`[Nest] ${process.pid} - `);
118
+ const pidMessage = this.formatPid(process.pid);
123
119
  const contextMessage = context ? (0, cli_colors_util_1.yellow)(`[${context}] `) : '';
124
120
  const timestampDiff = this.updateAndGetTimestampDiff();
125
- const formattedLogLevel = color(logLevel.toUpperCase().padStart(7, ' '));
126
- const computedMessage = `${pidMessage}${this.getTimestamp()} ${formattedLogLevel} ${contextMessage}${output}${timestampDiff}\n`;
127
- process[writeStreamType !== null && writeStreamType !== void 0 ? writeStreamType : 'stdout'].write(computedMessage);
121
+ const formattedLogLevel = logLevel.toUpperCase().padStart(7, ' ');
122
+ const formatedMessage = this.formatMessage(logLevel, message, pidMessage, formattedLogLevel, contextMessage, timestampDiff);
123
+ process[writeStreamType !== null && writeStreamType !== void 0 ? writeStreamType : 'stdout'].write(formatedMessage);
128
124
  });
129
125
  }
126
+ formatPid(pid) {
127
+ return `[Nest] ${pid} - `;
128
+ }
129
+ formatMessage(logLevel, message, pidMessage, formattedLogLevel, contextMessage, timestampDiff) {
130
+ const output = this.stringifyMessage(message, logLevel);
131
+ pidMessage = this.colorize(pidMessage, logLevel);
132
+ formattedLogLevel = this.colorize(formattedLogLevel, logLevel);
133
+ return `${pidMessage}${this.getTimestamp()} ${formattedLogLevel} ${contextMessage}${output}${timestampDiff}\n`;
134
+ }
135
+ stringifyMessage(message, logLevel) {
136
+ return (0, shared_utils_1.isPlainObject)(message)
137
+ ? `${this.colorize('Object:', logLevel)}\n${JSON.stringify(message, (key, value) => typeof value === 'bigint' ? value.toString() : value, 2)}\n`
138
+ : this.colorize(message, logLevel);
139
+ }
140
+ colorize(message, logLevel) {
141
+ const color = this.getColorByLogLevel(logLevel);
142
+ return color(message);
143
+ }
130
144
  printStackTrace(stack) {
131
145
  if (!stack) {
132
146
  return;
@@ -187,10 +201,10 @@ let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
187
201
  }
188
202
  }
189
203
  };
190
- ConsoleLogger = ConsoleLogger_1 = (0, tslib_1.__decorate)([
204
+ ConsoleLogger = ConsoleLogger_1 = tslib_1.__decorate([
191
205
  (0, injectable_decorator_1.Injectable)(),
192
- (0, tslib_1.__param)(0, (0, optional_decorator_1.Optional)()),
193
- (0, tslib_1.__param)(1, (0, optional_decorator_1.Optional)()),
194
- (0, tslib_1.__metadata)("design:paramtypes", [String, Object])
206
+ tslib_1.__param(0, (0, optional_decorator_1.Optional)()),
207
+ tslib_1.__param(1, (0, optional_decorator_1.Optional)()),
208
+ tslib_1.__metadata("design:paramtypes", [String, Object])
195
209
  ], ConsoleLogger);
196
210
  exports.ConsoleLogger = ConsoleLogger;
package/services/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./console-logger.service"), exports);
5
- (0, tslib_1.__exportStar)(require("./logger.service"), exports);
4
+ tslib_1.__exportStar(require("./console-logger.service"), exports);
5
+ tslib_1.__exportStar(require("./logger.service"), exports);
@@ -163,70 +163,70 @@ Logger.WrapBuffer = (target, propertyKey, descriptor) => {
163
163
  return originalFn.call(this, ...args);
164
164
  };
165
165
  };
166
- (0, tslib_1.__decorate)([
166
+ tslib_1.__decorate([
167
167
  Logger_1.WrapBuffer,
168
- (0, tslib_1.__metadata)("design:type", Function),
169
- (0, tslib_1.__metadata)("design:paramtypes", [Object, Object]),
170
- (0, tslib_1.__metadata)("design:returntype", void 0)
168
+ tslib_1.__metadata("design:type", Function),
169
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
170
+ tslib_1.__metadata("design:returntype", void 0)
171
171
  ], Logger.prototype, "error", null);
172
- (0, tslib_1.__decorate)([
172
+ tslib_1.__decorate([
173
173
  Logger_1.WrapBuffer,
174
- (0, tslib_1.__metadata)("design:type", Function),
175
- (0, tslib_1.__metadata)("design:paramtypes", [Object, Object]),
176
- (0, tslib_1.__metadata)("design:returntype", void 0)
174
+ tslib_1.__metadata("design:type", Function),
175
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
176
+ tslib_1.__metadata("design:returntype", void 0)
177
177
  ], Logger.prototype, "log", null);
178
- (0, tslib_1.__decorate)([
178
+ tslib_1.__decorate([
179
179
  Logger_1.WrapBuffer,
180
- (0, tslib_1.__metadata)("design:type", Function),
181
- (0, tslib_1.__metadata)("design:paramtypes", [Object, Object]),
182
- (0, tslib_1.__metadata)("design:returntype", void 0)
180
+ tslib_1.__metadata("design:type", Function),
181
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
182
+ tslib_1.__metadata("design:returntype", void 0)
183
183
  ], Logger.prototype, "warn", null);
184
- (0, tslib_1.__decorate)([
184
+ tslib_1.__decorate([
185
185
  Logger_1.WrapBuffer,
186
- (0, tslib_1.__metadata)("design:type", Function),
187
- (0, tslib_1.__metadata)("design:paramtypes", [Object, Object]),
188
- (0, tslib_1.__metadata)("design:returntype", void 0)
186
+ tslib_1.__metadata("design:type", Function),
187
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
188
+ tslib_1.__metadata("design:returntype", void 0)
189
189
  ], Logger.prototype, "debug", null);
190
- (0, tslib_1.__decorate)([
190
+ tslib_1.__decorate([
191
191
  Logger_1.WrapBuffer,
192
- (0, tslib_1.__metadata)("design:type", Function),
193
- (0, tslib_1.__metadata)("design:paramtypes", [Object, Object]),
194
- (0, tslib_1.__metadata)("design:returntype", void 0)
192
+ tslib_1.__metadata("design:type", Function),
193
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
194
+ tslib_1.__metadata("design:returntype", void 0)
195
195
  ], Logger.prototype, "verbose", null);
196
- (0, tslib_1.__decorate)([
196
+ tslib_1.__decorate([
197
197
  Logger_1.WrapBuffer,
198
- (0, tslib_1.__metadata)("design:type", Function),
199
- (0, tslib_1.__metadata)("design:paramtypes", [Object, Object]),
200
- (0, tslib_1.__metadata)("design:returntype", void 0)
198
+ tslib_1.__metadata("design:type", Function),
199
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
200
+ tslib_1.__metadata("design:returntype", void 0)
201
201
  ], Logger, "error", null);
202
- (0, tslib_1.__decorate)([
202
+ tslib_1.__decorate([
203
203
  Logger_1.WrapBuffer,
204
- (0, tslib_1.__metadata)("design:type", Function),
205
- (0, tslib_1.__metadata)("design:paramtypes", [Object, Object]),
206
- (0, tslib_1.__metadata)("design:returntype", void 0)
204
+ tslib_1.__metadata("design:type", Function),
205
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
206
+ tslib_1.__metadata("design:returntype", void 0)
207
207
  ], Logger, "log", null);
208
- (0, tslib_1.__decorate)([
208
+ tslib_1.__decorate([
209
209
  Logger_1.WrapBuffer,
210
- (0, tslib_1.__metadata)("design:type", Function),
211
- (0, tslib_1.__metadata)("design:paramtypes", [Object, Object]),
212
- (0, tslib_1.__metadata)("design:returntype", void 0)
210
+ tslib_1.__metadata("design:type", Function),
211
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
212
+ tslib_1.__metadata("design:returntype", void 0)
213
213
  ], Logger, "warn", null);
214
- (0, tslib_1.__decorate)([
214
+ tslib_1.__decorate([
215
215
  Logger_1.WrapBuffer,
216
- (0, tslib_1.__metadata)("design:type", Function),
217
- (0, tslib_1.__metadata)("design:paramtypes", [Object, Object]),
218
- (0, tslib_1.__metadata)("design:returntype", void 0)
216
+ tslib_1.__metadata("design:type", Function),
217
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
218
+ tslib_1.__metadata("design:returntype", void 0)
219
219
  ], Logger, "debug", null);
220
- (0, tslib_1.__decorate)([
220
+ tslib_1.__decorate([
221
221
  Logger_1.WrapBuffer,
222
- (0, tslib_1.__metadata)("design:type", Function),
223
- (0, tslib_1.__metadata)("design:paramtypes", [Object, Object]),
224
- (0, tslib_1.__metadata)("design:returntype", void 0)
222
+ tslib_1.__metadata("design:type", Function),
223
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
224
+ tslib_1.__metadata("design:returntype", void 0)
225
225
  ], Logger, "verbose", null);
226
- Logger = Logger_1 = (0, tslib_1.__decorate)([
226
+ Logger = Logger_1 = tslib_1.__decorate([
227
227
  (0, injectable_decorator_1.Injectable)(),
228
- (0, tslib_1.__param)(0, (0, optional_decorator_1.Optional)()),
229
- (0, tslib_1.__param)(1, (0, optional_decorator_1.Optional)()),
230
- (0, tslib_1.__metadata)("design:paramtypes", [String, Object])
228
+ tslib_1.__param(0, (0, optional_decorator_1.Optional)()),
229
+ tslib_1.__param(1, (0, optional_decorator_1.Optional)()),
230
+ tslib_1.__metadata("design:paramtypes", [String, Object])
231
231
  ], Logger);
232
232
  exports.Logger = Logger;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./is-log-level-enabled.util"), exports);
4
+ tslib_1.__exportStar(require("./is-log-level-enabled.util"), exports);
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.yellow = exports.clc = void 0;
4
- const isColorAllowed = () => !process.env.NO_COLOR;
4
+ const tty_1 = require("tty");
5
+ const isColorAllowed = () => !process.env.NO_COLOR && tty_1.WriteStream.prototype.hasColors();
5
6
  const colorIfAllowed = (colorFn) => (text) => isColorAllowed() ? colorFn(text) : text;
6
7
  exports.clc = {
7
8
  green: colorIfAllowed((text) => `\x1B[32m${text}\x1B[39m`),
package/utils/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./forward-ref.util"), exports);
4
+ tslib_1.__exportStar(require("./forward-ref.util"), exports);
package/CHANGELOG.md DELETED
@@ -1,18 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- <a name="8.2.0"></a>
7
- # [8.2.0](https://github.com/nestjs/nest/compare/v8.1.2...v8.2.0) (2021-11-08)
8
-
9
-
10
- ### Bug Fixes
11
-
12
- * **deps:** update dependency axios to v0.24.0 ([fc77e4f](https://github.com/nestjs/nest/commit/fc77e4f))
13
-
14
-
15
- ### Features
16
-
17
- * **common:** add the ability to set some extra metadata about returned files ([5100573](https://github.com/nestjs/nest/commit/5100573))
18
- * **common:** allow to swap out class-validator and class-transformer ([2a1cc62](https://github.com/nestjs/nest/commit/2a1cc62))