@nestjs/core 8.2.4 → 8.3.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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2021 Kamil Mysliwiec <https://kamilmysliwiec.com>
3
+ Copyright (c) 2017-2022 Kamil Mysliwiec <https://kamilmysliwiec.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/Readme.md CHANGED
@@ -84,7 +84,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
84
84
  <a href="https://www.myleodsc.com/" target="_blank"><img src="https://nestjs.com/img/myleo-logo.png" width="180" valign="middle" /></td><td>
85
85
  <a href="https://careers.meetdandy.com/?gh_src=063ba61e3us" target="_blank"><img src="https://nestjs.com/img/dandy-roles-logo.svg" width="150" valign="middle" /></td><td>
86
86
  <a href="https://www.castlecraft.in" target="_blank"><img src="https://nestjs.com/img/castlecraft-logo.png" width="150" valign="middle" /></td>
87
- <td><a href="https://www.tinystacks.com" target="_blank"><img src="https://nestjs.com/img/tinystacks-logo.png#1" width="140" valign="middle" /></td></tr></table>
87
+ <td><a href="https://www.tinystacks.com" target="_blank"><img src="https://nestjs.com/img/tinystacks-logo.png#1" width="140" valign="middle" /></td>
88
+ <td><a href="https://n.inc" target="_blank"><img src="https://nestjs.com/img/n-inc-logo.svg" width="120" valign="middle" /></td></tr></table>
88
89
 
89
90
  #### Sponsors
90
91
 
@@ -118,6 +119,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
118
119
  <td align="center" valign="middle"><a href="https://www.naologic.com/" target="_blank"><img src="https://nestjs.com/img/naologic-logo.svg" width="125" valign="middle" /></a></td>
119
120
  <td align="center" valign="middle"><a href="https://messaged.com/" target="_blank"><img src="https://nestjs.com/img/messaged-logo.png" width="50" valign="middle" /></a></td>
120
121
  <td align="center" valign="middle"><a href="https://triplecore.io" target="_blank"><img src="https://nestjs.com/img/triplecore-logo.svg" width="50" valign="middle" /></a></td>
122
+ <td align="center" valign="middle"><a href="https://klqc.de" target="_blank"><img src="https://nestjs.com/img/klcqcl-logo.png" width="120" valign="middle" /></a></td>
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
+ <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
+ <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>
121
127
  </tr></table>
122
128
 
123
129
  ## Backers
@@ -19,11 +19,15 @@ class ContextUtils {
19
19
  return Reflect.getMetadata(constants_1.RESPONSE_PASSTHROUGH_METADATA, instance.constructor, methodName);
20
20
  }
21
21
  getArgumentsLength(keys, metadata) {
22
- return Math.max(...keys.map(key => metadata[key].index)) + 1;
22
+ return keys.length
23
+ ? Math.max(...keys.map(key => metadata[key].index)) + 1
24
+ : 0;
23
25
  }
24
26
  createNullArray(length) {
25
- // eslint-disable-next-line prefer-spread
26
- return Array.apply(null, { length }).fill(undefined);
27
+ const a = new Array(length);
28
+ for (let i = 0; i < length; ++i)
29
+ a[i] = undefined;
30
+ return a;
27
31
  }
28
32
  mergeParamsMetatypes(paramsProperties, paramtypes) {
29
33
  if (!paramtypes) {
@@ -148,7 +148,7 @@ class ExternalContextCreator {
148
148
  : this.pipesConsumer.apply(value, { metatype, type, data }, pipes);
149
149
  }
150
150
  async transformToResult(resultOrDeferred) {
151
- if (resultOrDeferred && shared_utils_1.isFunction(resultOrDeferred.subscribe)) {
151
+ if (rxjs_1.isObservable(resultOrDeferred)) {
152
152
  return rxjs_1.lastValueFrom(resultOrDeferred);
153
153
  }
154
154
  return resultOrDeferred;
@@ -11,5 +11,4 @@ export declare class MiddlewareContainer {
11
11
  getConfigurations(): Map<string, Set<MiddlewareConfiguration>>;
12
12
  insertConfig(configList: MiddlewareConfiguration[], moduleKey: string): void;
13
13
  private getTargetConfig;
14
- private getClassScope;
15
14
  }
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MiddlewareContainer = void 0;
4
- const constants_1 = require("@nestjs/common/constants");
5
4
  const instance_wrapper_1 = require("../injector/instance-wrapper");
5
+ const get_class_scope_1 = require("../helpers/get-class-scope");
6
6
  class MiddlewareContainer {
7
7
  constructor(container) {
8
8
  this.container = container;
@@ -26,7 +26,7 @@ class MiddlewareContainer {
26
26
  const insertMiddleware = (metatype) => {
27
27
  const token = metatype;
28
28
  middleware.set(token, new instance_wrapper_1.InstanceWrapper({
29
- scope: this.getClassScope(metatype),
29
+ scope: get_class_scope_1.getClassScope(metatype),
30
30
  name: token,
31
31
  metatype,
32
32
  token,
@@ -43,9 +43,5 @@ class MiddlewareContainer {
43
43
  }
44
44
  return this.configurationSets.get(moduleName);
45
45
  }
46
- getClassScope(type) {
47
- const metadata = Reflect.getMetadata(constants_1.SCOPE_OPTIONS_METADATA, type);
48
- return metadata && metadata.scope;
49
- }
50
46
  }
51
47
  exports.MiddlewareContainer = MiddlewareContainer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/core",
3
- "version": "8.2.4",
3
+ "version": "8.3.1",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@core)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "uuid": "8.3.2"
37
37
  },
38
38
  "devDependencies": {
39
- "@nestjs/common": "8.2.4"
39
+ "@nestjs/common": "8.3.1"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@nestjs/common": "^8.0.0",
@@ -93,7 +93,10 @@ class RoutesResolver {
93
93
  }
94
94
  mapExternalException(err) {
95
95
  switch (true) {
96
- case err instanceof SyntaxError:
96
+ // SyntaxError is thrown by Express body-parser when given invalid JSON (#422, #430)
97
+ // URIError is thrown by Express when given a path parameter with an invalid percentage
98
+ // encoding, e.g. '%FF' (#8915)
99
+ case err instanceof SyntaxError || err instanceof URIError:
97
100
  return new common_1.BadRequestException(err.message);
98
101
  default:
99
102
  return err;
@@ -46,7 +46,7 @@ class SseStream extends stream_1.Transform {
46
46
  'X-Accel-Buffering': 'no' }));
47
47
  destination.flushHeaders();
48
48
  }
49
- destination.write(':\n');
49
+ destination.write('\n');
50
50
  return super.pipe(destination, options);
51
51
  }
52
52
  _transform(message, encoding, callback) {