@nestjs/common 11.1.16 → 12.0.0-alpha.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 (329) hide show
  1. package/constants.js +35 -38
  2. package/decorators/core/apply-decorators.js +1 -4
  3. package/decorators/core/bind.decorator.js +1 -4
  4. package/decorators/core/catch.decorator.d.ts +1 -1
  5. package/decorators/core/catch.decorator.js +4 -7
  6. package/decorators/core/controller.decorator.d.ts +1 -1
  7. package/decorators/core/controller.decorator.js +10 -13
  8. package/decorators/core/dependencies.decorator.js +4 -9
  9. package/decorators/core/exception-filters.decorator.d.ts +1 -1
  10. package/decorators/core/exception-filters.decorator.js +10 -14
  11. package/decorators/core/index.d.ts +14 -14
  12. package/decorators/core/index.js +14 -17
  13. package/decorators/core/inject.decorator.d.ts +1 -1
  14. package/decorators/core/inject.decorator.js +9 -12
  15. package/decorators/core/injectable.decorator.d.ts +2 -2
  16. package/decorators/core/injectable.decorator.js +7 -11
  17. package/decorators/core/optional.decorator.js +8 -11
  18. package/decorators/core/set-metadata.decorator.js +1 -5
  19. package/decorators/core/use-guards.decorator.d.ts +1 -1
  20. package/decorators/core/use-guards.decorator.js +10 -13
  21. package/decorators/core/use-interceptors.decorator.d.ts +1 -1
  22. package/decorators/core/use-interceptors.decorator.js +10 -13
  23. package/decorators/core/use-pipes.decorator.d.ts +1 -1
  24. package/decorators/core/use-pipes.decorator.js +9 -12
  25. package/decorators/core/version.decorator.d.ts +1 -1
  26. package/decorators/core/version.decorator.js +3 -6
  27. package/decorators/http/create-route-param-metadata.decorator.d.ts +6 -5
  28. package/decorators/http/create-route-param-metadata.decorator.js +48 -16
  29. package/decorators/http/header.decorator.js +4 -7
  30. package/decorators/http/http-code.decorator.js +3 -6
  31. package/decorators/http/index.d.ts +8 -8
  32. package/decorators/http/index.js +8 -11
  33. package/decorators/http/redirect.decorator.js +3 -6
  34. package/decorators/http/render.decorator.js +3 -6
  35. package/decorators/http/request-mapping.decorator.d.ts +1 -1
  36. package/decorators/http/request-mapping.decorator.js +28 -32
  37. package/decorators/http/route-params.decorator.d.ts +153 -3
  38. package/decorators/http/route-params.decorator.js +124 -49
  39. package/decorators/http/sse.decorator.d.ts +2 -2
  40. package/decorators/http/sse.decorator.js +7 -10
  41. package/decorators/index.d.ts +3 -3
  42. package/decorators/index.js +3 -6
  43. package/decorators/modules/global.decorator.js +3 -6
  44. package/decorators/modules/index.d.ts +2 -2
  45. package/decorators/modules/index.js +2 -5
  46. package/decorators/modules/module.decorator.d.ts +1 -1
  47. package/decorators/modules/module.decorator.js +3 -6
  48. package/enums/http-status.enum.js +2 -5
  49. package/enums/index.d.ts +4 -4
  50. package/enums/index.js +4 -7
  51. package/enums/request-method.enum.js +2 -5
  52. package/enums/route-paramtypes.enum.js +2 -5
  53. package/enums/shutdown-signal.enum.js +2 -5
  54. package/enums/version-type.enum.js +2 -5
  55. package/exceptions/bad-gateway.exception.d.ts +1 -1
  56. package/exceptions/bad-gateway.exception.js +5 -9
  57. package/exceptions/bad-request.exception.d.ts +1 -1
  58. package/exceptions/bad-request.exception.js +5 -9
  59. package/exceptions/conflict.exception.d.ts +1 -1
  60. package/exceptions/conflict.exception.js +5 -9
  61. package/exceptions/forbidden.exception.d.ts +1 -1
  62. package/exceptions/forbidden.exception.js +5 -9
  63. package/exceptions/gateway-timeout.exception.d.ts +1 -1
  64. package/exceptions/gateway-timeout.exception.js +5 -9
  65. package/exceptions/gone.exception.d.ts +1 -1
  66. package/exceptions/gone.exception.js +5 -9
  67. package/exceptions/http-version-not-supported.exception.d.ts +1 -1
  68. package/exceptions/http-version-not-supported.exception.js +5 -9
  69. package/exceptions/http.exception.d.ts +6 -2
  70. package/exceptions/http.exception.js +36 -17
  71. package/exceptions/im-a-teapot.exception.d.ts +1 -1
  72. package/exceptions/im-a-teapot.exception.js +5 -9
  73. package/exceptions/index.d.ts +23 -23
  74. package/exceptions/index.js +23 -26
  75. package/exceptions/internal-server-error.exception.d.ts +1 -1
  76. package/exceptions/internal-server-error.exception.js +5 -9
  77. package/exceptions/intrinsic.exception.js +1 -5
  78. package/exceptions/method-not-allowed.exception.d.ts +1 -1
  79. package/exceptions/method-not-allowed.exception.js +5 -9
  80. package/exceptions/misdirected.exception.d.ts +1 -1
  81. package/exceptions/misdirected.exception.js +5 -9
  82. package/exceptions/not-acceptable.exception.d.ts +1 -1
  83. package/exceptions/not-acceptable.exception.js +5 -9
  84. package/exceptions/not-found.exception.d.ts +1 -1
  85. package/exceptions/not-found.exception.js +5 -9
  86. package/exceptions/not-implemented.exception.d.ts +1 -1
  87. package/exceptions/not-implemented.exception.js +5 -9
  88. package/exceptions/payload-too-large.exception.d.ts +1 -1
  89. package/exceptions/payload-too-large.exception.js +5 -9
  90. package/exceptions/precondition-failed.exception.d.ts +1 -1
  91. package/exceptions/precondition-failed.exception.js +5 -9
  92. package/exceptions/request-timeout.exception.d.ts +1 -1
  93. package/exceptions/request-timeout.exception.js +5 -9
  94. package/exceptions/service-unavailable.exception.d.ts +1 -1
  95. package/exceptions/service-unavailable.exception.js +5 -9
  96. package/exceptions/unauthorized.exception.d.ts +1 -1
  97. package/exceptions/unauthorized.exception.js +5 -9
  98. package/exceptions/unprocessable-entity.exception.d.ts +1 -1
  99. package/exceptions/unprocessable-entity.exception.js +5 -9
  100. package/exceptions/unsupported-media-type.exception.d.ts +1 -1
  101. package/exceptions/unsupported-media-type.exception.js +5 -9
  102. package/file-stream/index.d.ts +1 -1
  103. package/file-stream/index.js +1 -4
  104. package/file-stream/interfaces/index.d.ts +2 -2
  105. package/file-stream/interfaces/index.js +2 -5
  106. package/file-stream/interfaces/streamable-handler-response.interface.js +1 -2
  107. package/file-stream/interfaces/streamable-options.interface.js +1 -2
  108. package/file-stream/streamable-file.d.ts +2 -2
  109. package/file-stream/streamable-file.js +26 -28
  110. package/index.d.ts +10 -10
  111. package/index.js +11 -17
  112. package/interfaces/abstract.interface.js +1 -2
  113. package/interfaces/controllers/controller-metadata.interface.js +1 -2
  114. package/interfaces/controllers/controller.interface.js +1 -2
  115. package/interfaces/controllers/index.d.ts +2 -2
  116. package/interfaces/controllers/index.js +2 -5
  117. package/interfaces/exceptions/exception-filter-metadata.interface.d.ts +2 -2
  118. package/interfaces/exceptions/exception-filter-metadata.interface.js +1 -2
  119. package/interfaces/exceptions/exception-filter.interface.d.ts +1 -1
  120. package/interfaces/exceptions/exception-filter.interface.js +1 -2
  121. package/interfaces/exceptions/index.d.ts +5 -5
  122. package/interfaces/exceptions/index.js +5 -8
  123. package/interfaces/exceptions/rpc-exception-filter-metadata.interface.d.ts +2 -2
  124. package/interfaces/exceptions/rpc-exception-filter-metadata.interface.js +1 -2
  125. package/interfaces/exceptions/rpc-exception-filter.interface.d.ts +1 -1
  126. package/interfaces/exceptions/rpc-exception-filter.interface.js +1 -2
  127. package/interfaces/exceptions/ws-exception-filter.interface.d.ts +1 -1
  128. package/interfaces/exceptions/ws-exception-filter.interface.js +1 -2
  129. package/interfaces/external/class-transform-options.interface.js +1 -2
  130. package/interfaces/external/cors-options.interface.js +1 -2
  131. package/interfaces/external/https-options.interface.js +1 -2
  132. package/interfaces/external/transformer-package.interface.d.ts +2 -2
  133. package/interfaces/external/transformer-package.interface.js +1 -2
  134. package/interfaces/external/validation-error.interface.js +1 -2
  135. package/interfaces/external/validator-options.interface.js +1 -2
  136. package/interfaces/external/validator-package.interface.d.ts +2 -2
  137. package/interfaces/external/validator-package.interface.js +1 -2
  138. package/interfaces/features/arguments-host.interface.js +1 -2
  139. package/interfaces/features/can-activate.interface.d.ts +1 -1
  140. package/interfaces/features/can-activate.interface.js +1 -2
  141. package/interfaces/features/custom-route-param-factory.interface.d.ts +1 -1
  142. package/interfaces/features/custom-route-param-factory.interface.js +1 -2
  143. package/interfaces/features/execution-context.interface.d.ts +2 -2
  144. package/interfaces/features/execution-context.interface.js +1 -2
  145. package/interfaces/features/nest-interceptor.interface.d.ts +1 -1
  146. package/interfaces/features/nest-interceptor.interface.js +1 -2
  147. package/interfaces/features/paramtype.interface.js +1 -2
  148. package/interfaces/features/pipe-transform.interface.d.ts +10 -4
  149. package/interfaces/features/pipe-transform.interface.js +1 -2
  150. package/interfaces/global-prefix-options.interface.d.ts +1 -1
  151. package/interfaces/global-prefix-options.interface.js +1 -2
  152. package/interfaces/hooks/before-application-shutdown.interface.js +1 -2
  153. package/interfaces/hooks/index.d.ts +5 -5
  154. package/interfaces/hooks/index.js +5 -8
  155. package/interfaces/hooks/on-application-bootstrap.interface.js +1 -2
  156. package/interfaces/hooks/on-application-shutdown.interface.js +1 -2
  157. package/interfaces/hooks/on-destroy.interface.js +1 -2
  158. package/interfaces/hooks/on-init.interface.js +1 -2
  159. package/interfaces/http/http-exception-body.interface.d.ts +2 -1
  160. package/interfaces/http/http-exception-body.interface.js +1 -2
  161. package/interfaces/http/http-redirect-response.interface.d.ts +1 -1
  162. package/interfaces/http/http-redirect-response.interface.js +1 -2
  163. package/interfaces/http/http-server.interface.d.ts +4 -3
  164. package/interfaces/http/http-server.interface.js +1 -2
  165. package/interfaces/http/index.d.ts +5 -5
  166. package/interfaces/http/index.js +5 -8
  167. package/interfaces/http/message-event.interface.js +1 -2
  168. package/interfaces/http/raw-body-request.interface.js +1 -2
  169. package/interfaces/index.d.ts +31 -30
  170. package/interfaces/index.js +31 -33
  171. package/interfaces/injectable.interface.js +1 -2
  172. package/interfaces/microservices/nest-hybrid-application-options.interface.js +1 -2
  173. package/interfaces/microservices/nest-microservice-options.interface.d.ts +1 -1
  174. package/interfaces/microservices/nest-microservice-options.interface.js +1 -2
  175. package/interfaces/microservices/pre-request-hook.interface.d.ts +22 -0
  176. package/interfaces/microservices/pre-request-hook.interface.js +1 -0
  177. package/interfaces/middleware/index.d.ts +4 -4
  178. package/interfaces/middleware/index.js +4 -7
  179. package/interfaces/middleware/middleware-config-proxy.interface.d.ts +3 -3
  180. package/interfaces/middleware/middleware-config-proxy.interface.js +1 -2
  181. package/interfaces/middleware/middleware-configuration.interface.d.ts +3 -3
  182. package/interfaces/middleware/middleware-configuration.interface.js +1 -2
  183. package/interfaces/middleware/middleware-consumer.interface.d.ts +2 -2
  184. package/interfaces/middleware/middleware-consumer.interface.js +1 -2
  185. package/interfaces/middleware/nest-middleware.interface.js +1 -2
  186. package/interfaces/modules/dynamic-module.interface.d.ts +2 -2
  187. package/interfaces/modules/dynamic-module.interface.js +1 -2
  188. package/interfaces/modules/forward-reference.interface.js +1 -2
  189. package/interfaces/modules/index.d.ts +8 -8
  190. package/interfaces/modules/index.js +8 -11
  191. package/interfaces/modules/injection-token.interface.d.ts +2 -2
  192. package/interfaces/modules/injection-token.interface.js +1 -2
  193. package/interfaces/modules/introspection-result.interface.d.ts +1 -1
  194. package/interfaces/modules/introspection-result.interface.js +1 -2
  195. package/interfaces/modules/module-metadata.interface.d.ts +5 -5
  196. package/interfaces/modules/module-metadata.interface.js +1 -2
  197. package/interfaces/modules/nest-module.interface.d.ts +1 -1
  198. package/interfaces/modules/nest-module.interface.js +1 -2
  199. package/interfaces/modules/optional-factory-dependency.interface.d.ts +1 -1
  200. package/interfaces/modules/optional-factory-dependency.interface.js +1 -2
  201. package/interfaces/modules/provider.interface.d.ts +4 -4
  202. package/interfaces/modules/provider.interface.js +1 -2
  203. package/interfaces/nest-application-context-options.interface.d.ts +1 -1
  204. package/interfaces/nest-application-context-options.interface.js +55 -5
  205. package/interfaces/nest-application-context.interface.d.ts +6 -6
  206. package/interfaces/nest-application-context.interface.js +1 -2
  207. package/interfaces/nest-application-options.interface.d.ts +9 -3
  208. package/interfaces/nest-application-options.interface.js +1 -2
  209. package/interfaces/nest-application.interface.d.ts +8 -8
  210. package/interfaces/nest-application.interface.js +1 -2
  211. package/interfaces/nest-microservice.interface.d.ts +15 -6
  212. package/interfaces/nest-microservice.interface.js +1 -2
  213. package/interfaces/scope-options.interface.js +2 -5
  214. package/interfaces/shutdown-hooks-options.interface.js +1 -2
  215. package/interfaces/type.interface.js +1 -2
  216. package/interfaces/version-options.interface.d.ts +1 -1
  217. package/interfaces/version-options.interface.js +1 -4
  218. package/interfaces/websockets/web-socket-adapter.interface.js +1 -2
  219. package/internal.d.ts +30 -0
  220. package/internal.js +19 -0
  221. package/module-utils/configurable-module.builder.d.ts +4 -4
  222. package/module-utils/configurable-module.builder.js +21 -20
  223. package/module-utils/constants.js +5 -8
  224. package/module-utils/index.d.ts +2 -2
  225. package/module-utils/index.js +2 -5
  226. package/module-utils/interfaces/configurable-module-async-options.interface.d.ts +2 -2
  227. package/module-utils/interfaces/configurable-module-async-options.interface.js +1 -2
  228. package/module-utils/interfaces/configurable-module-cls.interface.d.ts +3 -3
  229. package/module-utils/interfaces/configurable-module-cls.interface.js +1 -2
  230. package/module-utils/interfaces/configurable-module-host.interface.d.ts +2 -2
  231. package/module-utils/interfaces/configurable-module-host.interface.js +1 -2
  232. package/module-utils/interfaces/index.d.ts +3 -3
  233. package/module-utils/interfaces/index.js +3 -6
  234. package/module-utils/utils/generate-options-injection-token.util.js +3 -6
  235. package/module-utils/utils/get-injection-providers.util.d.ts +1 -1
  236. package/module-utils/utils/get-injection-providers.util.js +4 -7
  237. package/module-utils/utils/index.d.ts +2 -2
  238. package/module-utils/utils/index.js +2 -5
  239. package/package.json +35 -2
  240. package/pipes/default-value.pipe.d.ts +1 -1
  241. package/pipes/default-value.pipe.js +10 -12
  242. package/pipes/file/file-type.validator.d.ts +3 -3
  243. package/pipes/file/file-type.validator.js +5 -19
  244. package/pipes/file/file-validator-context.interface.d.ts +1 -1
  245. package/pipes/file/file-validator-context.interface.js +1 -2
  246. package/pipes/file/file-validator.interface.d.ts +1 -1
  247. package/pipes/file/file-validator.interface.js +2 -5
  248. package/pipes/file/index.d.ts +6 -6
  249. package/pipes/file/index.js +6 -9
  250. package/pipes/file/interfaces/file.interface.js +1 -2
  251. package/pipes/file/interfaces/index.d.ts +1 -1
  252. package/pipes/file/interfaces/index.js +1 -4
  253. package/pipes/file/max-file-size.validator.d.ts +3 -3
  254. package/pipes/file/max-file-size.validator.js +2 -6
  255. package/pipes/file/parse-file-options.interface.d.ts +2 -2
  256. package/pipes/file/parse-file-options.interface.js +1 -2
  257. package/pipes/file/parse-file-pipe.builder.d.ts +5 -5
  258. package/pipes/file/parse-file-pipe.builder.js +8 -14
  259. package/pipes/file/parse-file.pipe.d.ts +7 -7
  260. package/pipes/file/parse-file.pipe.js +17 -18
  261. package/pipes/index.d.ts +11 -10
  262. package/pipes/index.js +11 -13
  263. package/pipes/parse-array.pipe.d.ts +4 -4
  264. package/pipes/parse-array.pipe.js +23 -23
  265. package/pipes/parse-bool.pipe.d.ts +6 -6
  266. package/pipes/parse-bool.pipe.js +16 -17
  267. package/pipes/parse-date.pipe.d.ts +4 -4
  268. package/pipes/parse-date.pipe.js +17 -16
  269. package/pipes/parse-enum.pipe.d.ts +5 -5
  270. package/pipes/parse-enum.pipe.js +16 -16
  271. package/pipes/parse-float.pipe.d.ts +6 -6
  272. package/pipes/parse-float.pipe.js +17 -18
  273. package/pipes/parse-int.pipe.d.ts +5 -5
  274. package/pipes/parse-int.pipe.js +18 -19
  275. package/pipes/parse-uuid.pipe.d.ts +4 -4
  276. package/pipes/parse-uuid.pipe.js +27 -26
  277. package/pipes/standard-schema-validation.pipe.d.ts +86 -0
  278. package/pipes/standard-schema-validation.pipe.js +120 -0
  279. package/pipes/validation.pipe.d.ts +32 -14
  280. package/pipes/validation.pipe.js +60 -30
  281. package/serializer/class-serializer.constants.js +1 -4
  282. package/serializer/class-serializer.interceptor.d.ts +5 -5
  283. package/serializer/class-serializer.interceptor.js +21 -24
  284. package/serializer/class-serializer.interfaces.d.ts +2 -2
  285. package/serializer/class-serializer.interfaces.js +1 -2
  286. package/serializer/decorators/index.d.ts +1 -1
  287. package/serializer/decorators/index.js +1 -4
  288. package/serializer/decorators/serialize-options.decorator.d.ts +3 -2
  289. package/serializer/decorators/serialize-options.decorator.js +3 -7
  290. package/serializer/index.d.ts +5 -3
  291. package/serializer/index.js +5 -6
  292. package/serializer/standard-schema-serializer.interceptor.d.ts +50 -0
  293. package/serializer/standard-schema-serializer.interceptor.js +75 -0
  294. package/serializer/standard-schema-serializer.interfaces.d.ts +18 -0
  295. package/serializer/standard-schema-serializer.interfaces.js +1 -0
  296. package/services/console-logger.service.d.ts +22 -3
  297. package/services/console-logger.service.js +132 -66
  298. package/services/index.d.ts +3 -3
  299. package/services/index.js +3 -6
  300. package/services/logger.service.js +86 -83
  301. package/services/utils/filter-log-levels.util.d.ts +1 -1
  302. package/services/utils/filter-log-levels.util.js +7 -10
  303. package/services/utils/index.d.ts +3 -3
  304. package/services/utils/index.js +3 -6
  305. package/services/utils/is-log-level-enabled.util.d.ts +1 -1
  306. package/services/utils/is-log-level-enabled.util.js +1 -4
  307. package/services/utils/is-log-level.util.d.ts +1 -1
  308. package/services/utils/is-log-level.util.js +3 -6
  309. package/tsconfig.build.json +1 -2
  310. package/utils/assign-custom-metadata.util.d.ts +5 -4
  311. package/utils/assign-custom-metadata.util.js +4 -6
  312. package/utils/cli-colors.util.js +4 -8
  313. package/utils/extend-metadata.util.js +1 -4
  314. package/utils/forward-ref.util.d.ts +1 -1
  315. package/utils/forward-ref.util.js +1 -5
  316. package/utils/http-error-by-code.util.d.ts +2 -2
  317. package/utils/http-error-by-code.util.js +22 -25
  318. package/utils/index.d.ts +1 -1
  319. package/utils/index.js +1 -4
  320. package/utils/load-package.util.d.ts +29 -1
  321. package/utils/load-package.util.js +84 -9
  322. package/utils/merge-with-values.util.js +1 -5
  323. package/utils/random-string-generator.util.js +2 -6
  324. package/utils/select-exception-filter-metadata.util.d.ts +1 -1
  325. package/utils/select-exception-filter-metadata.util.js +1 -5
  326. package/utils/shared.utils.d.ts +11 -10
  327. package/utils/shared.utils.js +28 -30
  328. package/utils/validate-each.util.js +3 -7
  329. package/utils/validate-module-keys.util.js +8 -13
@@ -1,4 +1,4 @@
1
- import { HttpException, HttpExceptionOptions } from './http.exception';
1
+ import { HttpException, HttpExceptionOptions } from './http.exception.js';
2
2
  /**
3
3
  * Defines an HTTP exception for *Forbidden* type errors.
4
4
  *
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ForbiddenException = void 0;
4
- const http_status_enum_1 = require("../enums/http-status.enum");
5
- const http_exception_1 = require("./http.exception");
1
+ import { HttpStatus } from '../enums/http-status.enum.js';
2
+ import { HttpException } from './http.exception.js';
6
3
  /**
7
4
  * Defines an HTTP exception for *Forbidden* type errors.
8
5
  *
@@ -10,7 +7,7 @@ const http_exception_1 = require("./http.exception");
10
7
  *
11
8
  * @publicApi
12
9
  */
13
- class ForbiddenException extends http_exception_1.HttpException {
10
+ export class ForbiddenException extends HttpException {
14
11
  /**
15
12
  * Instantiate a `ForbiddenException` Exception.
16
13
  *
@@ -36,8 +33,7 @@ class ForbiddenException extends http_exception_1.HttpException {
36
33
  * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
37
34
  */
38
35
  constructor(objectOrError, descriptionOrOptions = 'Forbidden') {
39
- const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
40
- super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.FORBIDDEN), http_status_enum_1.HttpStatus.FORBIDDEN, httpExceptionOptions);
36
+ const { description = 'Forbidden', httpExceptionOptions } = HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
37
+ super(HttpException.createBody(objectOrError, description, HttpStatus.FORBIDDEN), HttpStatus.FORBIDDEN, httpExceptionOptions);
41
38
  }
42
39
  }
43
- exports.ForbiddenException = ForbiddenException;
@@ -1,4 +1,4 @@
1
- import { HttpException, HttpExceptionOptions } from './http.exception';
1
+ import { HttpException, HttpExceptionOptions } from './http.exception.js';
2
2
  /**
3
3
  * Defines an HTTP exception for *Gateway Timeout* type errors.
4
4
  *
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GatewayTimeoutException = void 0;
4
- const http_status_enum_1 = require("../enums/http-status.enum");
5
- const http_exception_1 = require("./http.exception");
1
+ import { HttpStatus } from '../enums/http-status.enum.js';
2
+ import { HttpException } from './http.exception.js';
6
3
  /**
7
4
  * Defines an HTTP exception for *Gateway Timeout* type errors.
8
5
  *
@@ -10,7 +7,7 @@ const http_exception_1 = require("./http.exception");
10
7
  *
11
8
  * @publicApi
12
9
  */
13
- class GatewayTimeoutException extends http_exception_1.HttpException {
10
+ export class GatewayTimeoutException extends HttpException {
14
11
  /**
15
12
  * Instantiate a `GatewayTimeoutException` Exception.
16
13
  *
@@ -36,8 +33,7 @@ class GatewayTimeoutException extends http_exception_1.HttpException {
36
33
  * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
37
34
  */
38
35
  constructor(objectOrError, descriptionOrOptions = 'Gateway Timeout') {
39
- const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
40
- super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.GATEWAY_TIMEOUT), http_status_enum_1.HttpStatus.GATEWAY_TIMEOUT, httpExceptionOptions);
36
+ const { description = 'Gateway Timeout', httpExceptionOptions } = HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
37
+ super(HttpException.createBody(objectOrError, description, HttpStatus.GATEWAY_TIMEOUT), HttpStatus.GATEWAY_TIMEOUT, httpExceptionOptions);
41
38
  }
42
39
  }
43
- exports.GatewayTimeoutException = GatewayTimeoutException;
@@ -1,4 +1,4 @@
1
- import { HttpException, HttpExceptionOptions } from './http.exception';
1
+ import { HttpException, HttpExceptionOptions } from './http.exception.js';
2
2
  /**
3
3
  * Defines an HTTP exception for *Gone* type errors.
4
4
  *
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoneException = void 0;
4
- const http_status_enum_1 = require("../enums/http-status.enum");
5
- const http_exception_1 = require("./http.exception");
1
+ import { HttpStatus } from '../enums/http-status.enum.js';
2
+ import { HttpException } from './http.exception.js';
6
3
  /**
7
4
  * Defines an HTTP exception for *Gone* type errors.
8
5
  *
@@ -10,7 +7,7 @@ const http_exception_1 = require("./http.exception");
10
7
  *
11
8
  * @publicApi
12
9
  */
13
- class GoneException extends http_exception_1.HttpException {
10
+ export class GoneException extends HttpException {
14
11
  /**
15
12
  * Instantiate a `GoneException` Exception.
16
13
  *
@@ -36,8 +33,7 @@ class GoneException extends http_exception_1.HttpException {
36
33
  * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
37
34
  */
38
35
  constructor(objectOrError, descriptionOrOptions = 'Gone') {
39
- const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
40
- super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.GONE), http_status_enum_1.HttpStatus.GONE, httpExceptionOptions);
36
+ const { description = 'Gone', httpExceptionOptions } = HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
37
+ super(HttpException.createBody(objectOrError, description, HttpStatus.GONE), HttpStatus.GONE, httpExceptionOptions);
41
38
  }
42
39
  }
43
- exports.GoneException = GoneException;
@@ -1,4 +1,4 @@
1
- import { HttpException, HttpExceptionOptions } from './http.exception';
1
+ import { HttpException, HttpExceptionOptions } from './http.exception.js';
2
2
  /**
3
3
  * Defines an HTTP exception for *Http Version Not Supported* type errors.
4
4
  *
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpVersionNotSupportedException = void 0;
4
- const http_status_enum_1 = require("../enums/http-status.enum");
5
- const http_exception_1 = require("./http.exception");
1
+ import { HttpStatus } from '../enums/http-status.enum.js';
2
+ import { HttpException } from './http.exception.js';
6
3
  /**
7
4
  * Defines an HTTP exception for *Http Version Not Supported* type errors.
8
5
  *
@@ -10,7 +7,7 @@ const http_exception_1 = require("./http.exception");
10
7
  *
11
8
  * @publicApi
12
9
  */
13
- class HttpVersionNotSupportedException extends http_exception_1.HttpException {
10
+ export class HttpVersionNotSupportedException extends HttpException {
14
11
  /**
15
12
  * Instantiate a `HttpVersionNotSupportedException` Exception.
16
13
  *
@@ -36,8 +33,7 @@ class HttpVersionNotSupportedException extends http_exception_1.HttpException {
36
33
  * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
37
34
  */
38
35
  constructor(objectOrError, descriptionOrOptions = 'HTTP Version Not Supported') {
39
- const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
40
- super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.HTTP_VERSION_NOT_SUPPORTED), http_status_enum_1.HttpStatus.HTTP_VERSION_NOT_SUPPORTED, httpExceptionOptions);
36
+ const { description = 'HTTP Version Not Supported', httpExceptionOptions } = HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
37
+ super(HttpException.createBody(objectOrError, description, HttpStatus.HTTP_VERSION_NOT_SUPPORTED), HttpStatus.HTTP_VERSION_NOT_SUPPORTED, httpExceptionOptions);
41
38
  }
42
39
  }
43
- exports.HttpVersionNotSupportedException = HttpVersionNotSupportedException;
@@ -1,9 +1,10 @@
1
- import { HttpExceptionBody, HttpExceptionBodyMessage } from '../interfaces/http/http-exception-body.interface';
2
- import { IntrinsicException } from './intrinsic.exception';
1
+ import { HttpExceptionBody, HttpExceptionBodyMessage } from '../interfaces/http/http-exception-body.interface.js';
2
+ import { IntrinsicException } from './intrinsic.exception.js';
3
3
  export interface HttpExceptionOptions {
4
4
  /** original cause of the error */
5
5
  cause?: unknown;
6
6
  description?: string;
7
+ errorCode?: string;
7
8
  }
8
9
  export interface DescriptionAndOptions {
9
10
  description?: string;
@@ -26,6 +27,7 @@ export declare class HttpException extends IntrinsicException {
26
27
  * It is used when catching and re-throwing an error with a more-specific or useful error message in order to still have access to the original error.
27
28
  */
28
29
  cause: unknown;
30
+ errorCode?: string;
29
31
  /**
30
32
  * Instantiate a plain HTTP Exception.
31
33
  *
@@ -67,12 +69,14 @@ export declare class HttpException extends IntrinsicException {
67
69
  * @see https://github.com/microsoft/TypeScript/issues/45167
68
70
  */
69
71
  initCause(): void;
72
+ initErrorCode(): void;
70
73
  initMessage(): void;
71
74
  initName(): void;
72
75
  getResponse(): string | object;
73
76
  getStatus(): number;
74
77
  static createBody(nil: null | '', message: HttpExceptionBodyMessage, statusCode: number): HttpExceptionBody;
75
78
  static createBody(message: HttpExceptionBodyMessage, error: string, statusCode: number): HttpExceptionBody;
79
+ static createBody(message: HttpExceptionBodyMessage, error: string, statusCode: number, errorCode?: string): HttpExceptionBody;
76
80
  static createBody<Body extends Record<string, unknown>>(custom: Body): Body;
77
81
  static getDescriptionFrom(descriptionOrOptions: string | HttpExceptionOptions): string;
78
82
  static getHttpExceptionOptionsFrom(descriptionOrOptions: string | HttpExceptionOptions): HttpExceptionOptions;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpException = void 0;
4
- const shared_utils_1 = require("../utils/shared.utils");
5
- const intrinsic_exception_1 = require("./intrinsic.exception");
1
+ import { isNumber, isObject, isString } from '../utils/shared.utils.js';
2
+ import { IntrinsicException } from './intrinsic.exception.js';
6
3
  /**
7
4
  * Defines the base Nest HTTP exception, which is handled by the default
8
5
  * Exceptions Handler.
@@ -11,7 +8,16 @@ const intrinsic_exception_1 = require("./intrinsic.exception");
11
8
  *
12
9
  * @publicApi
13
10
  */
14
- class HttpException extends intrinsic_exception_1.IntrinsicException {
11
+ export class HttpException extends IntrinsicException {
12
+ response;
13
+ status;
14
+ options;
15
+ /**
16
+ * Exception cause. Indicates the specific original cause of the error.
17
+ * It is used when catching and re-throwing an error with a more-specific or useful error message in order to still have access to the original error.
18
+ */
19
+ cause;
20
+ errorCode;
15
21
  /**
16
22
  * Instantiate a plain HTTP Exception.
17
23
  *
@@ -53,6 +59,7 @@ class HttpException extends intrinsic_exception_1.IntrinsicException {
53
59
  this.initMessage();
54
60
  this.initName();
55
61
  this.initCause();
62
+ this.initErrorCode();
56
63
  }
57
64
  /**
58
65
  * Configures error chaining support
@@ -66,11 +73,16 @@ class HttpException extends intrinsic_exception_1.IntrinsicException {
66
73
  return;
67
74
  }
68
75
  }
76
+ initErrorCode() {
77
+ if (this.options?.errorCode) {
78
+ this.errorCode = this.options.errorCode;
79
+ }
80
+ }
69
81
  initMessage() {
70
- if ((0, shared_utils_1.isString)(this.response)) {
82
+ if (isString(this.response)) {
71
83
  this.message = this.response;
72
84
  }
73
- else if ((0, shared_utils_1.isObject)(this.response) && (0, shared_utils_1.isString)(this.response.message)) {
85
+ else if (isObject(this.response) && isString(this.response.message)) {
74
86
  this.message = this.response.message;
75
87
  }
76
88
  else if (this.constructor) {
@@ -88,29 +100,37 @@ class HttpException extends intrinsic_exception_1.IntrinsicException {
88
100
  getStatus() {
89
101
  return this.status;
90
102
  }
91
- static createBody(arg0, arg1, statusCode) {
103
+ static createBody(arg0, arg1, statusCode, errorCode) {
92
104
  if (!arg0) {
93
- return {
105
+ const body = {
94
106
  message: arg1,
95
107
  statusCode: statusCode,
96
108
  };
109
+ if (errorCode) {
110
+ body.errorCode = errorCode;
111
+ }
112
+ return body;
97
113
  }
98
- if ((0, shared_utils_1.isString)(arg0) || Array.isArray(arg0) || (0, shared_utils_1.isNumber)(arg0)) {
99
- return {
114
+ if (isString(arg0) || Array.isArray(arg0) || isNumber(arg0)) {
115
+ const body = {
100
116
  message: arg0,
101
117
  error: arg1,
102
118
  statusCode: statusCode,
103
119
  };
120
+ if (errorCode) {
121
+ body.errorCode = errorCode;
122
+ }
123
+ return body;
104
124
  }
105
125
  return arg0;
106
126
  }
107
127
  static getDescriptionFrom(descriptionOrOptions) {
108
- return (0, shared_utils_1.isString)(descriptionOrOptions)
128
+ return isString(descriptionOrOptions)
109
129
  ? descriptionOrOptions
110
130
  : descriptionOrOptions?.description;
111
131
  }
112
132
  static getHttpExceptionOptionsFrom(descriptionOrOptions) {
113
- return (0, shared_utils_1.isString)(descriptionOrOptions) ? {} : descriptionOrOptions;
133
+ return isString(descriptionOrOptions) ? {} : descriptionOrOptions;
114
134
  }
115
135
  /**
116
136
  * Utility method used to extract the error description and httpExceptionOptions from the given argument.
@@ -118,10 +138,10 @@ class HttpException extends intrinsic_exception_1.IntrinsicException {
118
138
  * @returns the error description and the httpExceptionOptions as an object.
119
139
  */
120
140
  static extractDescriptionAndOptionsFrom(descriptionOrOptions) {
121
- const description = (0, shared_utils_1.isString)(descriptionOrOptions)
141
+ const description = isString(descriptionOrOptions)
122
142
  ? descriptionOrOptions
123
143
  : descriptionOrOptions?.description;
124
- const httpExceptionOptions = (0, shared_utils_1.isString)(descriptionOrOptions)
144
+ const httpExceptionOptions = isString(descriptionOrOptions)
125
145
  ? {}
126
146
  : descriptionOrOptions;
127
147
  return {
@@ -130,4 +150,3 @@ class HttpException extends intrinsic_exception_1.IntrinsicException {
130
150
  };
131
151
  }
132
152
  }
133
- exports.HttpException = HttpException;
@@ -1,4 +1,4 @@
1
- import { HttpException, HttpExceptionOptions } from './http.exception';
1
+ import { HttpException, HttpExceptionOptions } from './http.exception.js';
2
2
  /**
3
3
  * Defines an HTTP exception for *ImATeapotException* type errors.
4
4
  *
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImATeapotException = void 0;
4
- const http_status_enum_1 = require("../enums/http-status.enum");
5
- const http_exception_1 = require("./http.exception");
1
+ import { HttpStatus } from '../enums/http-status.enum.js';
2
+ import { HttpException } from './http.exception.js';
6
3
  /**
7
4
  * Defines an HTTP exception for *ImATeapotException* type errors.
8
5
  *
@@ -13,7 +10,7 @@ const http_exception_1 = require("./http.exception");
13
10
  *
14
11
  * @publicApi
15
12
  */
16
- class ImATeapotException extends http_exception_1.HttpException {
13
+ export class ImATeapotException extends HttpException {
17
14
  /**
18
15
  * Instantiate an `ImATeapotException` Exception.
19
16
  *
@@ -39,8 +36,7 @@ class ImATeapotException extends http_exception_1.HttpException {
39
36
  * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
40
37
  */
41
38
  constructor(objectOrError, descriptionOrOptions = `I'm a teapot`) {
42
- const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
43
- super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.I_AM_A_TEAPOT), http_status_enum_1.HttpStatus.I_AM_A_TEAPOT, httpExceptionOptions);
39
+ const { description = `I'm a teapot`, httpExceptionOptions } = HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
40
+ super(HttpException.createBody(objectOrError, description, HttpStatus.I_AM_A_TEAPOT), HttpStatus.I_AM_A_TEAPOT, httpExceptionOptions);
44
41
  }
45
42
  }
46
- exports.ImATeapotException = ImATeapotException;
@@ -1,23 +1,23 @@
1
- export * from './bad-gateway.exception';
2
- export * from './bad-request.exception';
3
- export * from './conflict.exception';
4
- export * from './forbidden.exception';
5
- export * from './gateway-timeout.exception';
6
- export * from './gone.exception';
7
- export * from './http-version-not-supported.exception';
8
- export * from './http.exception';
9
- export * from './im-a-teapot.exception';
10
- export * from './internal-server-error.exception';
11
- export * from './intrinsic.exception';
12
- export * from './method-not-allowed.exception';
13
- export * from './misdirected.exception';
14
- export * from './not-acceptable.exception';
15
- export * from './not-found.exception';
16
- export * from './not-implemented.exception';
17
- export * from './payload-too-large.exception';
18
- export * from './precondition-failed.exception';
19
- export * from './request-timeout.exception';
20
- export * from './service-unavailable.exception';
21
- export * from './unauthorized.exception';
22
- export * from './unprocessable-entity.exception';
23
- export * from './unsupported-media-type.exception';
1
+ export * from './bad-gateway.exception.js';
2
+ export * from './bad-request.exception.js';
3
+ export * from './conflict.exception.js';
4
+ export * from './forbidden.exception.js';
5
+ export * from './gateway-timeout.exception.js';
6
+ export * from './gone.exception.js';
7
+ export * from './http-version-not-supported.exception.js';
8
+ export * from './http.exception.js';
9
+ export * from './im-a-teapot.exception.js';
10
+ export * from './internal-server-error.exception.js';
11
+ export * from './intrinsic.exception.js';
12
+ export * from './method-not-allowed.exception.js';
13
+ export * from './misdirected.exception.js';
14
+ export * from './not-acceptable.exception.js';
15
+ export * from './not-found.exception.js';
16
+ export * from './not-implemented.exception.js';
17
+ export * from './payload-too-large.exception.js';
18
+ export * from './precondition-failed.exception.js';
19
+ export * from './request-timeout.exception.js';
20
+ export * from './service-unavailable.exception.js';
21
+ export * from './unauthorized.exception.js';
22
+ export * from './unprocessable-entity.exception.js';
23
+ export * from './unsupported-media-type.exception.js';
@@ -1,26 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./bad-gateway.exception"), exports);
5
- tslib_1.__exportStar(require("./bad-request.exception"), exports);
6
- tslib_1.__exportStar(require("./conflict.exception"), exports);
7
- tslib_1.__exportStar(require("./forbidden.exception"), exports);
8
- tslib_1.__exportStar(require("./gateway-timeout.exception"), exports);
9
- tslib_1.__exportStar(require("./gone.exception"), exports);
10
- tslib_1.__exportStar(require("./http-version-not-supported.exception"), exports);
11
- tslib_1.__exportStar(require("./http.exception"), exports);
12
- tslib_1.__exportStar(require("./im-a-teapot.exception"), exports);
13
- tslib_1.__exportStar(require("./internal-server-error.exception"), exports);
14
- tslib_1.__exportStar(require("./intrinsic.exception"), exports);
15
- tslib_1.__exportStar(require("./method-not-allowed.exception"), exports);
16
- tslib_1.__exportStar(require("./misdirected.exception"), exports);
17
- tslib_1.__exportStar(require("./not-acceptable.exception"), exports);
18
- tslib_1.__exportStar(require("./not-found.exception"), exports);
19
- tslib_1.__exportStar(require("./not-implemented.exception"), exports);
20
- tslib_1.__exportStar(require("./payload-too-large.exception"), exports);
21
- tslib_1.__exportStar(require("./precondition-failed.exception"), exports);
22
- tslib_1.__exportStar(require("./request-timeout.exception"), exports);
23
- tslib_1.__exportStar(require("./service-unavailable.exception"), exports);
24
- tslib_1.__exportStar(require("./unauthorized.exception"), exports);
25
- tslib_1.__exportStar(require("./unprocessable-entity.exception"), exports);
26
- tslib_1.__exportStar(require("./unsupported-media-type.exception"), exports);
1
+ export * from './bad-gateway.exception.js';
2
+ export * from './bad-request.exception.js';
3
+ export * from './conflict.exception.js';
4
+ export * from './forbidden.exception.js';
5
+ export * from './gateway-timeout.exception.js';
6
+ export * from './gone.exception.js';
7
+ export * from './http-version-not-supported.exception.js';
8
+ export * from './http.exception.js';
9
+ export * from './im-a-teapot.exception.js';
10
+ export * from './internal-server-error.exception.js';
11
+ export * from './intrinsic.exception.js';
12
+ export * from './method-not-allowed.exception.js';
13
+ export * from './misdirected.exception.js';
14
+ export * from './not-acceptable.exception.js';
15
+ export * from './not-found.exception.js';
16
+ export * from './not-implemented.exception.js';
17
+ export * from './payload-too-large.exception.js';
18
+ export * from './precondition-failed.exception.js';
19
+ export * from './request-timeout.exception.js';
20
+ export * from './service-unavailable.exception.js';
21
+ export * from './unauthorized.exception.js';
22
+ export * from './unprocessable-entity.exception.js';
23
+ export * from './unsupported-media-type.exception.js';
@@ -1,4 +1,4 @@
1
- import { HttpException, HttpExceptionOptions } from './http.exception';
1
+ import { HttpException, HttpExceptionOptions } from './http.exception.js';
2
2
  /**
3
3
  * Defines an HTTP exception for *Internal Server Error* type errors.
4
4
  *
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InternalServerErrorException = void 0;
4
- const http_status_enum_1 = require("../enums/http-status.enum");
5
- const http_exception_1 = require("./http.exception");
1
+ import { HttpStatus } from '../enums/http-status.enum.js';
2
+ import { HttpException } from './http.exception.js';
6
3
  /**
7
4
  * Defines an HTTP exception for *Internal Server Error* type errors.
8
5
  *
@@ -10,7 +7,7 @@ const http_exception_1 = require("./http.exception");
10
7
  *
11
8
  * @publicApi
12
9
  */
13
- class InternalServerErrorException extends http_exception_1.HttpException {
10
+ export class InternalServerErrorException extends HttpException {
14
11
  /**
15
12
  * Instantiate an `InternalServerErrorException` Exception.
16
13
  *
@@ -36,8 +33,7 @@ class InternalServerErrorException extends http_exception_1.HttpException {
36
33
  * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
37
34
  */
38
35
  constructor(objectOrError, descriptionOrOptions = 'Internal Server Error') {
39
- const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
40
- super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.INTERNAL_SERVER_ERROR), http_status_enum_1.HttpStatus.INTERNAL_SERVER_ERROR, httpExceptionOptions);
36
+ const { description = 'Internal Server Error', httpExceptionOptions } = HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
37
+ super(HttpException.createBody(objectOrError, description, HttpStatus.INTERNAL_SERVER_ERROR), HttpStatus.INTERNAL_SERVER_ERROR, httpExceptionOptions);
41
38
  }
42
39
  }
43
- exports.InternalServerErrorException = InternalServerErrorException;
@@ -1,12 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IntrinsicException = void 0;
4
1
  /**
5
2
  * Exception that represents an intrinsic error in the application.
6
3
  * When thrown, the default exception filter will not log the error message.
7
4
  *
8
5
  * @publicApi
9
6
  */
10
- class IntrinsicException extends Error {
7
+ export class IntrinsicException extends Error {
11
8
  }
12
- exports.IntrinsicException = IntrinsicException;
@@ -1,4 +1,4 @@
1
- import { HttpException, HttpExceptionOptions } from './http.exception';
1
+ import { HttpException, HttpExceptionOptions } from './http.exception.js';
2
2
  /**
3
3
  * Defines an HTTP exception for *Method Not Allowed* type errors.
4
4
  *
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MethodNotAllowedException = void 0;
4
- const http_status_enum_1 = require("../enums/http-status.enum");
5
- const http_exception_1 = require("./http.exception");
1
+ import { HttpStatus } from '../enums/http-status.enum.js';
2
+ import { HttpException } from './http.exception.js';
6
3
  /**
7
4
  * Defines an HTTP exception for *Method Not Allowed* type errors.
8
5
  *
@@ -10,7 +7,7 @@ const http_exception_1 = require("./http.exception");
10
7
  *
11
8
  * @publicApi
12
9
  */
13
- class MethodNotAllowedException extends http_exception_1.HttpException {
10
+ export class MethodNotAllowedException extends HttpException {
14
11
  /**
15
12
  * Instantiate a `MethodNotAllowedException` Exception.
16
13
  *
@@ -36,8 +33,7 @@ class MethodNotAllowedException extends http_exception_1.HttpException {
36
33
  * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
37
34
  */
38
35
  constructor(objectOrError, descriptionOrOptions = 'Method Not Allowed') {
39
- const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
40
- super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.METHOD_NOT_ALLOWED), http_status_enum_1.HttpStatus.METHOD_NOT_ALLOWED, httpExceptionOptions);
36
+ const { description = 'Method Not Allowed', httpExceptionOptions } = HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
37
+ super(HttpException.createBody(objectOrError, description, HttpStatus.METHOD_NOT_ALLOWED), HttpStatus.METHOD_NOT_ALLOWED, httpExceptionOptions);
41
38
  }
42
39
  }
43
- exports.MethodNotAllowedException = MethodNotAllowedException;
@@ -1,4 +1,4 @@
1
- import { HttpException, HttpExceptionOptions } from './http.exception';
1
+ import { HttpException, HttpExceptionOptions } from './http.exception.js';
2
2
  /**
3
3
  * Defines an HTTP exception for *Misdirected* type errors.
4
4
  *
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MisdirectedException = void 0;
4
- const http_status_enum_1 = require("../enums/http-status.enum");
5
- const http_exception_1 = require("./http.exception");
1
+ import { HttpStatus } from '../enums/http-status.enum.js';
2
+ import { HttpException } from './http.exception.js';
6
3
  /**
7
4
  * Defines an HTTP exception for *Misdirected* type errors.
8
5
  *
@@ -10,7 +7,7 @@ const http_exception_1 = require("./http.exception");
10
7
  *
11
8
  * @publicApi
12
9
  */
13
- class MisdirectedException extends http_exception_1.HttpException {
10
+ export class MisdirectedException extends HttpException {
14
11
  /**
15
12
  * Instantiate a `MisdirectedException` Exception.
16
13
  *
@@ -36,8 +33,7 @@ class MisdirectedException extends http_exception_1.HttpException {
36
33
  * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
37
34
  */
38
35
  constructor(objectOrError, descriptionOrOptions = 'Misdirected') {
39
- const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
40
- super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.MISDIRECTED), http_status_enum_1.HttpStatus.MISDIRECTED, httpExceptionOptions);
36
+ const { description = 'Misdirected', httpExceptionOptions } = HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
37
+ super(HttpException.createBody(objectOrError, description, HttpStatus.MISDIRECTED), HttpStatus.MISDIRECTED, httpExceptionOptions);
41
38
  }
42
39
  }
43
- exports.MisdirectedException = MisdirectedException;
@@ -1,4 +1,4 @@
1
- import { HttpException, HttpExceptionOptions } from './http.exception';
1
+ import { HttpException, HttpExceptionOptions } from './http.exception.js';
2
2
  /**
3
3
  * Defines an HTTP exception for *Not Acceptable* type errors.
4
4
  *
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotAcceptableException = void 0;
4
- const http_status_enum_1 = require("../enums/http-status.enum");
5
- const http_exception_1 = require("./http.exception");
1
+ import { HttpStatus } from '../enums/http-status.enum.js';
2
+ import { HttpException } from './http.exception.js';
6
3
  /**
7
4
  * Defines an HTTP exception for *Not Acceptable* type errors.
8
5
  *
@@ -10,7 +7,7 @@ const http_exception_1 = require("./http.exception");
10
7
  *
11
8
  * @publicApi
12
9
  */
13
- class NotAcceptableException extends http_exception_1.HttpException {
10
+ export class NotAcceptableException extends HttpException {
14
11
  /**
15
12
  * Instantiate a `NotAcceptableException` Exception.
16
13
  *
@@ -36,8 +33,7 @@ class NotAcceptableException extends http_exception_1.HttpException {
36
33
  * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
37
34
  */
38
35
  constructor(objectOrError, descriptionOrOptions = 'Not Acceptable') {
39
- const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
40
- super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.NOT_ACCEPTABLE), http_status_enum_1.HttpStatus.NOT_ACCEPTABLE, httpExceptionOptions);
36
+ const { description = 'Not Acceptable', httpExceptionOptions } = HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
37
+ super(HttpException.createBody(objectOrError, description, HttpStatus.NOT_ACCEPTABLE), HttpStatus.NOT_ACCEPTABLE, httpExceptionOptions);
41
38
  }
42
39
  }
43
- exports.NotAcceptableException = NotAcceptableException;
@@ -1,4 +1,4 @@
1
- import { HttpException, HttpExceptionOptions } from './http.exception';
1
+ import { HttpException, HttpExceptionOptions } from './http.exception.js';
2
2
  /**
3
3
  * Defines an HTTP exception for *Not Found* type errors.
4
4
  *