@nestjs/common 11.0.7 → 11.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/common",
3
- "version": "11.0.7",
3
+ "version": "11.0.9",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@common)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "homepage": "https://nestjs.com",
@@ -73,6 +73,12 @@ let ValidationPipe = class ValidationPipe {
73
73
  if (errors.length > 0) {
74
74
  throw await this.exceptionFactory(errors);
75
75
  }
76
+ if (originalValue === undefined && originalEntity === '') {
77
+ // Since SWC requires empty string for validation (to avoid an error),
78
+ // a fallback is needed to revert to the original value (when undefined).
79
+ // @see https://github.com/nestjs/nest/issues/14430
80
+ return originalValue;
81
+ }
76
82
  if (isPrimitive) {
77
83
  // if the value is a primitive value and the validation process has been successfully completed
78
84
  // we have to revert the original value passed through the pipe
@@ -150,7 +156,7 @@ let ValidationPipe = class ValidationPipe {
150
156
  (metatype && 'prototype' in metatype && metatype.prototype?.constructor)) {
151
157
  return {};
152
158
  }
153
- // Builder like SWC require empty string to be returned instead of an empty object
159
+ // SWC requires empty string to be returned instead of an empty object
154
160
  // when the value is nil and the metatype is not a class instance, but a plain object (enum, for example).
155
161
  // Otherwise, the error will be thrown.
156
162
  // @see https://github.com/nestjs/nest/issues/12680
@@ -22,7 +22,7 @@ const isPlainObject = (fn) => {
22
22
  };
23
23
  exports.isPlainObject = isPlainObject;
24
24
  const addLeadingSlash = (path) => path && typeof path === 'string'
25
- ? path.charAt(0) !== '/'
25
+ ? path.charAt(0) !== '/' && path.substring(0, 2) !== '{/'
26
26
  ? '/' + path
27
27
  : path
28
28
  : '';