@nestjs/common 7.6.13 → 7.6.17

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.
package/Readme.md CHANGED
@@ -37,6 +37,8 @@ Nest is a framework for building efficient, scalable <a href="http://nodejs.org"
37
37
 
38
38
  * To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
39
39
  * 要查看中文 [指南](readme_zh.md), 请访问 [docs.nestjs.cn](https://docs.nestjs.cn). :books:
40
+ * [가이드](readme_kr.md)를 확인하려면, [docs.nestjs.com](https://docs.nestjs.com)를 방문하세요.:books:
41
+ * チェックするには [ガイド](readme_jp.md), 詳しくは [docs.nestjs.com](https://docs.nestjs.com). :books:
40
42
 
41
43
  ## Questions
42
44
 
@@ -64,6 +66,7 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
64
66
  #### Gold Sponsors
65
67
 
66
68
  <table style="text-align:center;"><tr><td>
69
+ <a href="https://careers.labster.com/departments/platform" target="_blank"><img src="https://nestjs.com/img/labster-logo.png" width="170" valign="middle" /></a></td><td>
67
70
  <a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="170" valign="middle" /></a></td></tr></table>
68
71
 
69
72
  #### Silver Sponsors
@@ -72,7 +75,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
72
75
  <a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> </td><td>
73
76
  <a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" width="100" /></a> </td><td>
74
77
  <a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td><td>
75
- <a href="http://www.meetdandy.com" target="_blank"><img src="https://nestjs.com/img/dandy-wide-logo.png" width="150" valign="middle" /></td></tr></table>
78
+ <a href="http://www.meetdandy.com" target="_blank"><img src="https://nestjs.com/img/dandy-wide-logo.png" width="150" valign="middle" /></td><td>
79
+ <a href="https://www.castlecraft.in" target="_blank"><img src="https://nestjs.com/img/castlecraft-logo.png" width="150" valign="middle" /></td></tr></table>
76
80
 
77
81
  #### Sponsors
78
82
 
@@ -95,13 +99,13 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
95
99
  <td align="center" valign="middle">
96
100
  <a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td>
97
101
  <td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td></tr><tr><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://lambda-it.ch/" target="_blank"><img src="https://nestjs.com/img/lambda-it-logo.svg" width="115" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://pickwriters.com/top-10-translation-services" target="_blank"><img src="https://nestjs.com/img/pickwriters-logo.png" width="40" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://thewordpoint.com/services/localization" target="_blank"><img src="https://nestjs.com/img/thewordpoint-logo.png" width="40" valign="middle" /></a></td>
98
- <td align="center" valign="middle"><a href="https://streamat.se/" target="_blank"><img src="https://nestjs.com/img/streamat-logo.png" width="120" valign="middle" /></a></td>
99
- <td align="center" valign="middle"><a href="https://filmen.nu/" target="_blank"><img src="https://nestjs.com/img/filmen-logo.png" width="120" valign="middle" /></a></td></tr><tr>
100
102
  <td align="center" valign="middle"><a href="https://meercode.io/" target="_blank"><img src="https://nestjs.com/img/meercode-logo.png" width="60" valign="middle" /></a></td>
101
- <td align="center" valign="middle"><a href="https://www.najlepszeplatformyforex.pl/blog/broker-xtb/" target="_blank"><img src="https://nestjs.com/img/npf-logo.jpg" width="200" valign="middle" /></a></td>
103
+ <td align="center" valign="middle"><a href="https://www.najlepszeplatformyforex.pl/blog/broker-xtb/" target="_blank"><img src="https://nestjs.com/img/npf-logo.jpg" width="200" valign="middle" /></a></td></tr><tr>
102
104
  <td align="center" valign="middle"><a href="https://thestandarddaily.com/" target="_blank"><img src="https://nestjs.com/img/the-standard-daily-logo.png" width="180" valign="middle" /></a></td>
103
105
  <td align="center" valign="middle"><a href="https://houseofangular.io/" target="_blank"><img src="https://nestjs.com/img/house-of-angular.png" width="100" valign="middle" /></a></td>
104
106
  <td align="center" valign="middle"><a href="https://rocketech.it/cases/?utm_source=google&utm_medium=badge&utm_campaign=nestjs" target="_blank"><img src="https://nestjs.com/img/rocketech-logo.svg" width="110" valign="middle" /></a></td>
107
+ <td align="center" valign="middle"><a href="https://www.bystored.com/" target="_blank"><img src="https://nestjs.com/img/stored-logo.svg" width="110" valign="middle" /></a></td>
108
+ <td align="center" valign="middle"><a href="https://studyclerk.com/pay-for-research-paper" target="_blank"><img src="https://nestjs.com/img/studyclerk-logo.png" width="125" valign="middle" /></a></td>
105
109
  </tr></table>
106
110
 
107
111
  ## Backers
@@ -15,8 +15,9 @@ let CacheInterceptor = class CacheInterceptor {
15
15
  this.reflector = reflector;
16
16
  }
17
17
  async intercept(context, next) {
18
+ var _a;
18
19
  const key = this.trackBy(context);
19
- const ttlValueOrFactory = this.reflector.get(cache_constants_1.CACHE_TTL_METADATA, context.getHandler()) || null;
20
+ const ttlValueOrFactory = (_a = this.reflector.get(cache_constants_1.CACHE_TTL_METADATA, context.getHandler())) !== null && _a !== void 0 ? _a : null;
20
21
  if (!key) {
21
22
  return next.handle();
22
23
  }
@@ -33,7 +34,7 @@ let CacheInterceptor = class CacheInterceptor {
33
34
  this.cacheManager.set(...args);
34
35
  }));
35
36
  }
36
- catch (_a) {
37
+ catch (_b) {
37
38
  return next.handle();
38
39
  }
39
40
  }
@@ -55,4 +55,11 @@ export interface ClassTransformOptions {
55
55
  * This is useful when you convert a plain object to a class and have an optional field with a default value.
56
56
  */
57
57
  exposeDefaultValues?: boolean;
58
+ /**
59
+ * When set to true, fields with `undefined` as value will be included in class to plain transformation. Otherwise
60
+ * those fields will be omitted from the result.
61
+ *
62
+ * DEFAULT: `true`
63
+ */
64
+ exposeUnsetFields?: boolean;
58
65
  }
@@ -1,3 +1,4 @@
1
+ declare type StaticOrigin = boolean | string | RegExp | (string | RegExp)[];
1
2
  /**
2
3
  * Set origin to a function implementing some custom logic. The function takes the
3
4
  * request origin as the first parameter and a callback (which expects the signature
@@ -7,7 +8,7 @@
7
8
  *
8
9
  * @publicApi
9
10
  */
10
- export declare type CustomOrigin = (requestOrigin: string, callback: (err: Error | null, allow?: boolean) => void) => void;
11
+ export declare type CustomOrigin = (requestOrigin: string, callback: (err: Error | null, origin?: StaticOrigin) => void) => void;
11
12
  /**
12
13
  * Interface describing CORS options that can be set.
13
14
  *
@@ -18,7 +19,7 @@ export interface CorsOptions {
18
19
  /**
19
20
  * Configures the `Access-Control-Allow-Origins` CORS header. See [here for more detail.](https://github.com/expressjs/cors#configuration-options)
20
21
  */
21
- origin?: boolean | string | RegExp | (string | RegExp)[] | CustomOrigin;
22
+ origin?: StaticOrigin | CustomOrigin;
22
23
  /**
23
24
  * Configures the Access-Control-Allow-Methods CORS header.
24
25
  */
@@ -54,3 +55,4 @@ export interface CorsOptionsCallback {
54
55
  export interface CorsOptionsDelegate<T> {
55
56
  (req: T, cb: CorsOptionsCallback): void;
56
57
  }
58
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/common",
3
- "version": "7.6.13",
3
+ "version": "7.6.17",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@common)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "homepage": "https://nestjs.com",
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "axios": "0.21.1",
21
21
  "iterare": "1.2.1",
22
- "tslib": "2.1.0",
22
+ "tslib": "2.2.0",
23
23
  "uuid": "8.3.2"
24
24
  },
25
25
  "peerDependencies": {
@@ -1,4 +1,4 @@
1
- import { ArgumentMetadata, PipeTransform } from '../index';
1
+ import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface';
2
2
  /**
3
3
  * Defines the built-in DefaultValue Pipe
4
4
  *
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DefaultValuePipe = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const index_1 = require("../index");
5
+ const injectable_decorator_1 = require("../decorators/core/injectable.decorator");
6
6
  const shared_utils_1 = require("../utils/shared.utils");
7
7
  /**
8
8
  * Defines the built-in DefaultValue Pipe
@@ -24,7 +24,7 @@ let DefaultValuePipe = class DefaultValuePipe {
24
24
  }
25
25
  };
26
26
  DefaultValuePipe = tslib_1.__decorate([
27
- index_1.Injectable(),
27
+ injectable_decorator_1.Injectable(),
28
28
  tslib_1.__metadata("design:paramtypes", [Object])
29
29
  ], DefaultValuePipe);
30
30
  exports.DefaultValuePipe = DefaultValuePipe;
@@ -1,6 +1,5 @@
1
- import { ArgumentMetadata } from '../index';
2
1
  import { Type } from '../interfaces';
3
- import { PipeTransform } from '../interfaces/features/pipe-transform.interface';
2
+ import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface';
4
3
  import { ValidationPipe, ValidationPipeOptions } from './validation.pipe';
5
4
  export interface ParseArrayOptions extends Omit<ValidationPipeOptions, 'transform' | 'validateCustomDecorators' | 'exceptionFactory'> {
6
5
  items?: Type<unknown>;
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ParseArrayPipe = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const index_1 = require("../index");
5
+ const injectable_decorator_1 = require("../decorators/core/injectable.decorator");
6
+ const optional_decorator_1 = require("../decorators/core/optional.decorator");
7
+ const http_status_enum_1 = require("../enums/http-status.enum");
6
8
  const http_error_by_code_util_1 = require("../utils/http-error-by-code.util");
7
9
  const shared_utils_1 = require("../utils/shared.utils");
8
10
  const validation_pipe_1 = require("./validation.pipe");
@@ -19,7 +21,7 @@ let ParseArrayPipe = class ParseArrayPipe {
19
21
  constructor(options = {}) {
20
22
  this.options = options;
21
23
  this.validationPipe = new validation_pipe_1.ValidationPipe(Object.assign({ transform: true, validateCustomDecorators: true }, options));
22
- const { exceptionFactory, errorHttpStatusCode = index_1.HttpStatus.BAD_REQUEST, } = options;
24
+ const { exceptionFactory, errorHttpStatusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, } = options;
23
25
  this.exceptionFactory =
24
26
  exceptionFactory ||
25
27
  (error => new http_error_by_code_util_1.HttpErrorByCode[errorHttpStatusCode](error));
@@ -104,8 +106,8 @@ let ParseArrayPipe = class ParseArrayPipe {
104
106
  }
105
107
  };
106
108
  ParseArrayPipe = tslib_1.__decorate([
107
- index_1.Injectable(),
108
- tslib_1.__param(0, index_1.Optional()),
109
+ injectable_decorator_1.Injectable(),
110
+ tslib_1.__param(0, optional_decorator_1.Optional()),
109
111
  tslib_1.__metadata("design:paramtypes", [Object])
110
112
  ], ParseArrayPipe);
111
113
  exports.ParseArrayPipe = ParseArrayPipe;
@@ -1,5 +1,4 @@
1
- import { ArgumentMetadata } from '../index';
2
- import { PipeTransform } from '../interfaces/features/pipe-transform.interface';
1
+ import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface';
3
2
  import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
4
3
  export interface ParseBoolPipeOptions {
5
4
  errorHttpStatusCode?: ErrorHttpStatusCode;
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ParseBoolPipe = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const index_1 = require("../index");
5
+ const injectable_decorator_1 = require("../decorators/core/injectable.decorator");
6
+ const optional_decorator_1 = require("../decorators/core/optional.decorator");
7
+ const http_status_enum_1 = require("../enums/http-status.enum");
6
8
  const http_error_by_code_util_1 = require("../utils/http-error-by-code.util");
7
9
  /**
8
10
  * Defines the built-in ParseBool Pipe
@@ -14,7 +16,7 @@ const http_error_by_code_util_1 = require("../utils/http-error-by-code.util");
14
16
  let ParseBoolPipe = class ParseBoolPipe {
15
17
  constructor(options) {
16
18
  options = options || {};
17
- const { exceptionFactory, errorHttpStatusCode = index_1.HttpStatus.BAD_REQUEST, } = options;
19
+ const { exceptionFactory, errorHttpStatusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, } = options;
18
20
  this.exceptionFactory =
19
21
  exceptionFactory ||
20
22
  (error => new http_error_by_code_util_1.HttpErrorByCode[errorHttpStatusCode](error));
@@ -37,8 +39,8 @@ let ParseBoolPipe = class ParseBoolPipe {
37
39
  }
38
40
  };
39
41
  ParseBoolPipe = tslib_1.__decorate([
40
- index_1.Injectable(),
41
- tslib_1.__param(0, index_1.Optional()),
42
+ injectable_decorator_1.Injectable(),
43
+ tslib_1.__param(0, optional_decorator_1.Optional()),
42
44
  tslib_1.__metadata("design:paramtypes", [Object])
43
45
  ], ParseBoolPipe);
44
46
  exports.ParseBoolPipe = ParseBoolPipe;
@@ -1,5 +1,4 @@
1
- import { ArgumentMetadata } from '../index';
2
- import { PipeTransform } from '../interfaces/features/pipe-transform.interface';
1
+ import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface';
3
2
  import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
4
3
  export interface ParseIntPipeOptions {
5
4
  errorHttpStatusCode?: ErrorHttpStatusCode;
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ParseIntPipe = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const index_1 = require("../index");
5
+ const injectable_decorator_1 = require("../decorators/core/injectable.decorator");
6
+ const optional_decorator_1 = require("../decorators/core/optional.decorator");
7
+ const http_status_enum_1 = require("../enums/http-status.enum");
6
8
  const http_error_by_code_util_1 = require("../utils/http-error-by-code.util");
7
9
  /**
8
10
  * Defines the built-in ParseInt Pipe
@@ -14,7 +16,7 @@ const http_error_by_code_util_1 = require("../utils/http-error-by-code.util");
14
16
  let ParseIntPipe = class ParseIntPipe {
15
17
  constructor(options) {
16
18
  options = options || {};
17
- const { exceptionFactory, errorHttpStatusCode = index_1.HttpStatus.BAD_REQUEST, } = options;
19
+ const { exceptionFactory, errorHttpStatusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, } = options;
18
20
  this.exceptionFactory =
19
21
  exceptionFactory ||
20
22
  (error => new http_error_by_code_util_1.HttpErrorByCode[errorHttpStatusCode](error));
@@ -37,8 +39,8 @@ let ParseIntPipe = class ParseIntPipe {
37
39
  }
38
40
  };
39
41
  ParseIntPipe = tslib_1.__decorate([
40
- index_1.Injectable(),
41
- tslib_1.__param(0, index_1.Optional()),
42
+ injectable_decorator_1.Injectable(),
43
+ tslib_1.__param(0, optional_decorator_1.Optional()),
42
44
  tslib_1.__metadata("design:paramtypes", [Object])
43
45
  ], ParseIntPipe);
44
46
  exports.ParseIntPipe = ParseIntPipe;
@@ -1,5 +1,4 @@
1
- import { ArgumentMetadata } from '../index';
2
- import { PipeTransform } from '../interfaces/features/pipe-transform.interface';
1
+ import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface';
3
2
  import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
4
3
  export interface ParseUUIDPipeOptions {
5
4
  version?: '3' | '4' | '5';
@@ -2,14 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ParseUUIDPipe = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const decorators_1 = require("../decorators");
6
- const index_1 = require("../index");
5
+ const injectable_decorator_1 = require("../decorators/core/injectable.decorator");
6
+ const optional_decorator_1 = require("../decorators/core/optional.decorator");
7
+ const http_status_enum_1 = require("../enums/http-status.enum");
7
8
  const http_error_by_code_util_1 = require("../utils/http-error-by-code.util");
8
9
  const is_uuid_1 = require("../utils/is-uuid");
9
10
  let ParseUUIDPipe = class ParseUUIDPipe {
10
11
  constructor(options) {
11
12
  options = options || {};
12
- const { exceptionFactory, errorHttpStatusCode = index_1.HttpStatus.BAD_REQUEST, version, } = options;
13
+ const { exceptionFactory, errorHttpStatusCode = http_status_enum_1.HttpStatus.BAD_REQUEST, version, } = options;
13
14
  this.version = version;
14
15
  this.exceptionFactory =
15
16
  exceptionFactory ||
@@ -23,8 +24,8 @@ let ParseUUIDPipe = class ParseUUIDPipe {
23
24
  }
24
25
  };
25
26
  ParseUUIDPipe = tslib_1.__decorate([
26
- index_1.Injectable(),
27
- tslib_1.__param(0, decorators_1.Optional()),
27
+ injectable_decorator_1.Injectable(),
28
+ tslib_1.__param(0, optional_decorator_1.Optional()),
28
29
  tslib_1.__metadata("design:paramtypes", [Object])
29
30
  ], ParseUUIDPipe);
30
31
  exports.ParseUUIDPipe = ParseUUIDPipe;
@@ -1,7 +1,7 @@
1
- import { ArgumentMetadata, ValidationError } from '../index';
2
1
  import { ClassTransformOptions } from '../interfaces/external/class-transform-options.interface';
2
+ import { ValidationError } from '../interfaces/external/validation-error.interface';
3
3
  import { ValidatorOptions } from '../interfaces/external/validator-options.interface';
4
- import { PipeTransform } from '../interfaces/features/pipe-transform.interface';
4
+ import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface';
5
5
  import { Type } from '../interfaces/type.interface';
6
6
  import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
7
7
  export interface ValidationPipeOptions extends ValidatorOptions {