@venok/http 1.1.0 → 2.0.0

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 (337) hide show
  1. package/dist/constants.js +33 -0
  2. package/dist/decorators/controller.decorator.js +45 -0
  3. package/dist/decorators/header.decorator.js +28 -0
  4. package/dist/decorators/http-code.decorator.js +22 -0
  5. package/dist/decorators/http-params.decorator.js +63 -0
  6. package/dist/decorators/method.decorator.js +57 -0
  7. package/dist/decorators/redirect.decorator.js +28 -0
  8. package/dist/decorators/version.decorator.js +31 -0
  9. package/dist/enums/method.enum.js +32 -0
  10. package/dist/enums/paramtypes.enum.js +33 -0
  11. package/dist/enums/status.enum.js +71 -0
  12. package/dist/enums/version-type.enum.js +27 -0
  13. package/dist/exceptions/bad-gateway.exception.js +29 -0
  14. package/dist/exceptions/bad-request.exception.js +29 -0
  15. package/dist/exceptions/conflict.exception.js +29 -0
  16. package/dist/exceptions/expectation-failed.exception.js +29 -0
  17. package/dist/exceptions/failed-dependency.exception.js +29 -0
  18. package/dist/exceptions/forbidden.exception.js +29 -0
  19. package/dist/exceptions/gateway-timeout.exception.js +29 -0
  20. package/dist/exceptions/gone.exception.js +29 -0
  21. package/dist/exceptions/http-version-not-supported.exception.js +29 -0
  22. package/dist/exceptions/http.exception.js +94 -0
  23. package/dist/exceptions/im-a-teapot.exception.js +29 -0
  24. package/dist/exceptions/internal-server-error.exception.js +29 -0
  25. package/dist/exceptions/length-required.exception.js +29 -0
  26. package/dist/exceptions/method-not-allowed.exception.js +29 -0
  27. package/dist/exceptions/misdirected.exception.js +29 -0
  28. package/dist/exceptions/not-acceptable.exception.js +29 -0
  29. package/dist/exceptions/not-found.exception.js +29 -0
  30. package/dist/exceptions/not-implemented.exception.js +29 -0
  31. package/dist/exceptions/payload-too-large.exception.js +29 -0
  32. package/dist/exceptions/payment-required.exception.js +29 -0
  33. package/dist/exceptions/precondition-failed.exception.js +29 -0
  34. package/dist/exceptions/precondition-required.exception.js +29 -0
  35. package/dist/exceptions/proxy-authentication-required.exception.js +29 -0
  36. package/dist/exceptions/request-timeout.exception.js +29 -0
  37. package/dist/exceptions/requested-range-not-satisfiable.exception.js +29 -0
  38. package/dist/exceptions/service-unavailable.exception.js +29 -0
  39. package/dist/exceptions/too-many-requests.exception.js +29 -0
  40. package/dist/exceptions/unauthorized.exception.js +29 -0
  41. package/dist/exceptions/unprocessable-entity.exception.js +29 -0
  42. package/dist/exceptions/unsupported-media-type.exception.js +29 -0
  43. package/dist/exceptions/uri-too-long.exception.js +29 -0
  44. package/dist/filters/context.js +28 -0
  45. package/dist/filters/filter.js +56 -0
  46. package/dist/helpers/discovery.helper.js +69 -0
  47. package/dist/helpers/messages.helper.js +41 -0
  48. package/dist/helpers/middleware.helper.js +69 -0
  49. package/dist/helpers/path.helper.js +53 -0
  50. package/dist/helpers/route.helper.js +54 -0
  51. package/dist/http/adapter.js +294 -0
  52. package/dist/http/config.js +67 -0
  53. package/dist/http/configurable-module.js +26 -0
  54. package/dist/http/context.js +117 -0
  55. package/dist/http/explorer.js +133 -0
  56. package/dist/http/module.js +35 -0
  57. package/dist/http/starter-module.js +85 -0
  58. package/dist/index.d.ts +2117 -0
  59. package/dist/index.js +82 -0
  60. package/dist/interfaces/adapter.interface.js +0 -0
  61. package/dist/interfaces/exception.interface.js +0 -0
  62. package/dist/interfaces/index.js +7 -0
  63. package/dist/interfaces/middleware/config-proxy.interface.js +0 -0
  64. package/dist/interfaces/middleware/consumer.interface.js +0 -0
  65. package/dist/interfaces/middleware/index.js +3 -0
  66. package/dist/interfaces/options.interface.js +0 -0
  67. package/dist/interfaces/prefix.interface.js +0 -0
  68. package/dist/interfaces/router/definition.interface.js +0 -0
  69. package/dist/interfaces/router/exclude-route.interface.js +0 -0
  70. package/dist/interfaces/router/index.js +7 -0
  71. package/dist/interfaces/router/info.interface.js +0 -0
  72. package/dist/interfaces/router/path-metadata.interface.js +0 -0
  73. package/dist/interfaces/router/tree.interface.js +0 -0
  74. package/dist/interfaces/router/version.interface.js +21 -0
  75. package/dist/middleware/builder.js +96 -0
  76. package/dist/middleware/module.js +22 -0
  77. package/dist/middleware/routes-mapper.js +107 -0
  78. package/dist/middleware/service.js +48 -0
  79. package/dist/middleware/tree.js +91 -0
  80. package/dist/router/finder.js +64 -0
  81. package/dist/router/module.js +89 -0
  82. package/dist/router/path-factory.js +110 -0
  83. package/dist/symbols.js +33 -0
  84. package/package.json +41 -46
  85. package/adapter/adapter.d.ts +0 -57
  86. package/adapter/adapter.js +0 -58
  87. package/adapter/host.d.ts +0 -27
  88. package/adapter/host.js +0 -33
  89. package/application/application.d.ts +0 -18
  90. package/application/application.js +0 -51
  91. package/application/config.d.ts +0 -16
  92. package/application/config.js +0 -47
  93. package/application/http.module-defenition.d.ts +0 -8
  94. package/application/http.module-defenition.js +0 -6
  95. package/application/http.module.d.ts +0 -3
  96. package/application/http.module.js +0 -21
  97. package/application/http.service.d.ts +0 -11
  98. package/application/http.service.js +0 -43
  99. package/application/starter.d.ts +0 -41
  100. package/application/starter.js +0 -140
  101. package/constants.d.ts +0 -12
  102. package/constants.js +0 -15
  103. package/context/context.d.ts +0 -56
  104. package/context/context.js +0 -102
  105. package/context/response.controller.d.ts +0 -30
  106. package/context/response.controller.js +0 -86
  107. package/decorators/controller.decorator.d.ts +0 -82
  108. package/decorators/controller.decorator.js +0 -53
  109. package/decorators/header.decorator.d.ts +0 -12
  110. package/decorators/header.decorator.js +0 -23
  111. package/decorators/http-code.decorator.d.ts +0 -9
  112. package/decorators/http-code.decorator.js +0 -19
  113. package/decorators/index.d.ts +0 -9
  114. package/decorators/index.js +0 -25
  115. package/decorators/redirect.decorator.d.ts +0 -6
  116. package/decorators/redirect.decorator.js +0 -16
  117. package/decorators/render.decorator.d.ts +0 -10
  118. package/decorators/render.decorator.js +0 -20
  119. package/decorators/request-mapping.decorator.d.ts +0 -78
  120. package/decorators/request-mapping.decorator.js +0 -98
  121. package/decorators/route-params.decorator.d.ts +0 -378
  122. package/decorators/route-params.decorator.js +0 -227
  123. package/decorators/sse.decorator.d.ts +0 -6
  124. package/decorators/sse.decorator.js +0 -20
  125. package/decorators/version.decorator.d.ts +0 -7
  126. package/decorators/version.decorator.js +0 -20
  127. package/enums/http-status.enum.d.ts +0 -53
  128. package/enums/http-status.enum.js +0 -57
  129. package/enums/index.d.ts +0 -4
  130. package/enums/index.js +0 -20
  131. package/enums/request-method.enum.d.ts +0 -11
  132. package/enums/request-method.enum.js +0 -15
  133. package/enums/route-paramtypes.enum.d.ts +0 -14
  134. package/enums/route-paramtypes.enum.js +0 -18
  135. package/enums/version-type.enum.d.ts +0 -9
  136. package/enums/version-type.enum.js +0 -13
  137. package/errors/bad-gateway.exception.d.ts +0 -33
  138. package/errors/bad-gateway.exception.js +0 -41
  139. package/errors/bad-request.exception.d.ts +0 -33
  140. package/errors/bad-request.exception.js +0 -41
  141. package/errors/conflict.exception.d.ts +0 -33
  142. package/errors/conflict.exception.js +0 -41
  143. package/errors/forbidden.exception.d.ts +0 -33
  144. package/errors/forbidden.exception.js +0 -41
  145. package/errors/gateway-timeout.exception.d.ts +0 -33
  146. package/errors/gateway-timeout.exception.js +0 -41
  147. package/errors/gone.exception.d.ts +0 -33
  148. package/errors/gone.exception.js +0 -41
  149. package/errors/http-version-not-supported.exception.d.ts +0 -33
  150. package/errors/http-version-not-supported.exception.js +0 -41
  151. package/errors/http.exception.d.ts +0 -79
  152. package/errors/http.exception.js +0 -123
  153. package/errors/im-a-teapot.exception.d.ts +0 -36
  154. package/errors/im-a-teapot.exception.js +0 -44
  155. package/errors/index.d.ts +0 -11
  156. package/errors/index.js +0 -27
  157. package/errors/internal-server-error.exception.d.ts +0 -33
  158. package/errors/internal-server-error.exception.js +0 -41
  159. package/errors/invalid-middleware-configuration.exception.d.ts +0 -4
  160. package/errors/invalid-middleware-configuration.exception.js +0 -11
  161. package/errors/invalid-middleware.exception.d.ts +0 -4
  162. package/errors/invalid-middleware.exception.js +0 -11
  163. package/errors/not-found.exception.d.ts +0 -33
  164. package/errors/not-found.exception.js +0 -41
  165. package/errors/unknown-request-mapping.exception.d.ts +0 -5
  166. package/errors/unknown-request-mapping.exception.js +0 -11
  167. package/exceptions/messages.d.ts +0 -4
  168. package/exceptions/messages.js +0 -13
  169. package/explorers/path.explorer.d.ts +0 -8
  170. package/explorers/path.explorer.js +0 -38
  171. package/explorers/router.explorer.d.ts +0 -51
  172. package/explorers/router.explorer.js +0 -195
  173. package/factory/context-id.factory.d.ts +0 -41
  174. package/factory/context-id.factory.js +0 -52
  175. package/factory/index.d.ts +0 -4
  176. package/factory/index.js +0 -20
  177. package/factory/method.factory.d.ts +0 -5
  178. package/factory/method.factory.js +0 -30
  179. package/factory/params.factory.d.ts +0 -5
  180. package/factory/params.factory.js +0 -39
  181. package/factory/path.factory.d.ts +0 -13
  182. package/factory/path.factory.js +0 -95
  183. package/filters/context.d.ts +0 -9
  184. package/filters/context.js +0 -15
  185. package/filters/filter.d.ts +0 -22
  186. package/filters/filter.js +0 -78
  187. package/helpers/adapter.helper.d.ts +0 -27
  188. package/helpers/adapter.helper.js +0 -37
  189. package/helpers/exclude-route.helper.d.ts +0 -4
  190. package/helpers/exclude-route.helper.js +0 -18
  191. package/helpers/flatten-routes.helper.d.ts +0 -5
  192. package/helpers/flatten-routes.helper.js +0 -27
  193. package/helpers/index.d.ts +0 -6
  194. package/helpers/index.js +0 -22
  195. package/helpers/messages.helper.d.ts +0 -6
  196. package/helpers/messages.helper.js +0 -25
  197. package/helpers/path.helper.d.ts +0 -3
  198. package/helpers/path.helper.js +0 -13
  199. package/helpers/sse.helper.d.ts +0 -45
  200. package/helpers/sse.helper.js +0 -83
  201. package/index.d.ts +0 -1
  202. package/index.js +0 -3
  203. package/interfaces/http/cors.interface.d.ts +0 -58
  204. package/interfaces/http/cors.interface.js +0 -2
  205. package/interfaces/http/exception.interface.d.ts +0 -6
  206. package/interfaces/http/exception.interface.js +0 -2
  207. package/interfaces/http/exclude-route.interface.d.ts +0 -15
  208. package/interfaces/http/exclude-route.interface.js +0 -2
  209. package/interfaces/http/index.d.ts +0 -10
  210. package/interfaces/http/index.js +0 -26
  211. package/interfaces/http/message-event.interface.d.ts +0 -6
  212. package/interfaces/http/message-event.interface.js +0 -2
  213. package/interfaces/http/module.inteface.d.ts +0 -5
  214. package/interfaces/http/module.inteface.js +0 -2
  215. package/interfaces/http/options.interface.d.ts +0 -127
  216. package/interfaces/http/options.interface.js +0 -2
  217. package/interfaces/http/path-metadata.interface.d.ts +0 -31
  218. package/interfaces/http/path-metadata.interface.js +0 -2
  219. package/interfaces/http/prefix-options.interface.d.ts +0 -7
  220. package/interfaces/http/prefix-options.interface.js +0 -2
  221. package/interfaces/http/raw-request.d.ts +0 -4
  222. package/interfaces/http/raw-request.js +0 -2
  223. package/interfaces/http/routes.interface.d.ts +0 -7
  224. package/interfaces/http/routes.interface.js +0 -2
  225. package/interfaces/http/server.interface.d.ts +0 -54
  226. package/interfaces/http/server.interface.js +0 -2
  227. package/interfaces/index.d.ts +0 -3
  228. package/interfaces/index.js +0 -19
  229. package/interfaces/middleware/config-proxy.interface.d.ts +0 -23
  230. package/interfaces/middleware/config-proxy.interface.js +0 -2
  231. package/interfaces/middleware/configuration.interface.d.ts +0 -12
  232. package/interfaces/middleware/configuration.interface.js +0 -2
  233. package/interfaces/middleware/consumer.interface.d.ts +0 -16
  234. package/interfaces/middleware/consumer.interface.js +0 -2
  235. package/interfaces/middleware/index.d.ts +0 -4
  236. package/interfaces/middleware/index.js +0 -20
  237. package/interfaces/middleware/middleware.interface.d.ts +0 -7
  238. package/interfaces/middleware/middleware.interface.js +0 -2
  239. package/interfaces/router/callback-paramtypes.interface.d.ts +0 -1
  240. package/interfaces/router/callback-paramtypes.interface.js +0 -2
  241. package/interfaces/router/definition.interface.d.ts +0 -10
  242. package/interfaces/router/definition.interface.js +0 -2
  243. package/interfaces/router/index.d.ts +0 -3
  244. package/interfaces/router/index.js +0 -19
  245. package/interfaces/router/version-options.interface.d.ts +0 -92
  246. package/interfaces/router/version-options.interface.js +0 -9
  247. package/middleware/builder.d.ts +0 -15
  248. package/middleware/builder.js +0 -78
  249. package/middleware/container.d.ts +0 -13
  250. package/middleware/container.js +0 -50
  251. package/middleware/extractor.d.ts +0 -15
  252. package/middleware/extractor.js +0 -50
  253. package/middleware/index.d.ts +0 -1
  254. package/middleware/index.js +0 -17
  255. package/middleware/module.d.ts +0 -33
  256. package/middleware/module.js +0 -180
  257. package/middleware/resolver.d.ts +0 -10
  258. package/middleware/resolver.js +0 -27
  259. package/middleware/routes-mapper.d.ts +0 -19
  260. package/middleware/routes-mapper.js +0 -111
  261. package/middleware/utils.d.ts +0 -8
  262. package/middleware/utils.js +0 -86
  263. package/router/module.d.ts +0 -18
  264. package/router/module.js +0 -88
  265. package/router/resolver.d.ts +0 -31
  266. package/router/resolver.js +0 -128
  267. package/storage/http-instance.storage.d.ts +0 -9
  268. package/storage/http-instance.storage.js +0 -19
  269. package/stream/index.d.ts +0 -1
  270. package/stream/index.js +0 -17
  271. package/stream/interfaces/index.d.ts +0 -2
  272. package/stream/interfaces/index.js +0 -18
  273. package/stream/interfaces/streamable-handler-response.interface.d.ts +0 -12
  274. package/stream/interfaces/streamable-handler-response.interface.js +0 -2
  275. package/stream/interfaces/streamable-options.interface.d.ts +0 -10
  276. package/stream/interfaces/streamable-options.interface.js +0 -2
  277. package/stream/streamable-file.d.ts +0 -22
  278. package/stream/streamable-file.js +0 -55
  279. package/test/context/response.controller.spec.d.ts +0 -1
  280. package/test/context/response.controller.spec.js +0 -328
  281. package/test/decorators/controller.decorator.spec.d.ts +0 -1
  282. package/test/decorators/controller.decorator.spec.js +0 -113
  283. package/test/decorators/header.decorator.spec.d.ts +0 -1
  284. package/test/decorators/header.decorator.spec.js +0 -33
  285. package/test/decorators/http-code.decorator.spec.d.ts +0 -1
  286. package/test/decorators/http-code.decorator.spec.js +0 -30
  287. package/test/decorators/redirect.decorator.spec.d.ts +0 -1
  288. package/test/decorators/redirect.decorator.spec.js +0 -36
  289. package/test/decorators/render.decorator.spec.d.ts +0 -1
  290. package/test/decorators/render.decorator.spec.js +0 -30
  291. package/test/decorators/request-mapping.decorator.spec.d.ts +0 -1
  292. package/test/decorators/request-mapping.decorator.spec.js +0 -85
  293. package/test/decorators/route-params.decorator.spec.d.ts +0 -1
  294. package/test/decorators/route-params.decorator.spec.js +0 -493
  295. package/test/decorators/sse.decorator.spec.d.ts +0 -1
  296. package/test/decorators/sse.decorator.spec.js +0 -35
  297. package/test/decorators/version.decorator.spec.d.ts +0 -1
  298. package/test/decorators/version.decorator.spec.js +0 -43
  299. package/test/exceptions/handler.spec.d.ts +0 -1
  300. package/test/exceptions/handler.spec.js +0 -145
  301. package/test/exceptions/proxy.spec.d.ts +0 -1
  302. package/test/exceptions/proxy.spec.js +0 -74
  303. package/test/explorers/path.explorer.spec.d.ts +0 -1
  304. package/test/explorers/path.explorer.spec.js +0 -190
  305. package/test/explorers/router.explorer.spec.d.ts +0 -1
  306. package/test/explorers/router.explorer.spec.js +0 -206
  307. package/test/factory/method.factory.spec.d.ts +0 -1
  308. package/test/factory/method.factory.spec.js +0 -33
  309. package/test/factory/params.factory.spec.d.ts +0 -1
  310. package/test/factory/params.factory.spec.js +0 -104
  311. package/test/factory/path.factory.spec.d.ts +0 -1
  312. package/test/factory/path.factory.spec.js +0 -260
  313. package/test/filters/context.spec.d.ts +0 -1
  314. package/test/filters/context.spec.js +0 -96
  315. package/test/filters/filter.spec.d.ts +0 -1
  316. package/test/filters/filter.spec.js +0 -96
  317. package/test/helpers/flatten-routes.helper.spec.d.ts +0 -1
  318. package/test/helpers/flatten-routes.helper.spec.js +0 -131
  319. package/test/helpers/sse.helper.spec.d.ts +0 -1
  320. package/test/helpers/sse.helper.spec.js +0 -132
  321. package/test/middleware/builder.spec.d.ts +0 -1
  322. package/test/middleware/builder.spec.js +0 -235
  323. package/test/middleware/container.spec.d.ts +0 -1
  324. package/test/middleware/container.spec.js +0 -81
  325. package/test/middleware/module.spec.d.ts +0 -1
  326. package/test/middleware/module.spec.js +0 -206
  327. package/test/middleware/route-info-path-extractor.spec.d.ts +0 -1
  328. package/test/middleware/route-info-path-extractor.spec.js +0 -123
  329. package/test/middleware/routes-mapper.spec.d.ts +0 -1
  330. package/test/middleware/routes-mapper.spec.js +0 -162
  331. package/test/middleware/utils.spec.d.ts +0 -1
  332. package/test/middleware/utils.spec.js +0 -132
  333. package/test/router/module.spec.d.ts +0 -1
  334. package/test/router/module.spec.js +0 -40
  335. package/test/router/resolver.spec.d.ts +0 -1
  336. package/test/router/resolver.spec.js +0 -326
  337. package/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,2117 @@
1
+ /**
2
+ * Thanks for using Venloc Venok <3
3
+ * https://github.com/venloc-tech/svm
4
+ */
5
+ import * as _venok_core from '@venok/core';
6
+ import { Type, VenokExceptionFilterContext, VenokContainer, ApplicationConfig, VenokParamsFactoryInterface, ScopeOptions, PipeTransform, ExceptionFilter, ArgumentsHost, VenokModule, ModulesContainer, CoreModule, DynamicModule } from '@venok/core';
7
+ import * as _venok_integration from '@venok/integration';
8
+
9
+ /**
10
+ * @publicApi
11
+ */
12
+ interface MiddlewareConfigProxy {
13
+ /**
14
+ * Excludes routes from the currently processed middleware.
15
+ *
16
+ * @param {(string | RouteInfo)[]} routes
17
+ * @returns {MiddlewareConfigProxy}
18
+ */
19
+ exclude(...routes: (string | RouteInfo)[]): MiddlewareConfigProxy;
20
+ /**
21
+ * Attaches passed either routes or controllers to the currently configured middleware.
22
+ * If you pass a class, Venok would attach middleware to every path defined within this controller.
23
+ *
24
+ * @param {(string | Type | RouteInfo)[]} routes
25
+ * @returns {HttpMiddlewareConsumer}
26
+ */
27
+ to(...routes: (string | Type | RouteInfo)[]): HttpMiddlewareConsumer;
28
+ }
29
+
30
+ /**
31
+ * Interface defining method for applying user defined middleware to routes.
32
+ *
33
+ * @publicApi
34
+ */
35
+ interface HttpMiddlewareConsumer {
36
+ /**
37
+ * @param {...(Type | Function)} middleware middleware class/function or array of classes/functions
38
+ * to be attached to the passed routes.
39
+ *
40
+ * @returns {MiddlewareConfigProxy}
41
+ */
42
+ apply(...middleware: (Type | Function)[]): MiddlewareConfigProxy;
43
+ }
44
+
45
+ declare enum HttpMethod {
46
+ GET = 0,
47
+ POST = 1,
48
+ PUT = 2,
49
+ DELETE = 3,
50
+ PATCH = 4,
51
+ ALL = 5,
52
+ OPTIONS = 6,
53
+ HEAD = 7,
54
+ SEARCH = 8
55
+ }
56
+
57
+ type RouteDefinition = {
58
+ paths: string[];
59
+ requestMethod: HttpMethod;
60
+ targetCallback: (...args: any[]) => void;
61
+ methodName: string;
62
+ version?: VersionValue;
63
+ };
64
+
65
+ interface ExcludeRouteMetadata {
66
+ /**
67
+ * Route path.
68
+ */
69
+ path: string;
70
+ /**
71
+ * Regular expression representing the route path.
72
+ */
73
+ pathRegex: RegExp;
74
+ /**
75
+ * HTTP request method (e.g., GET, POST).
76
+ */
77
+ requestMethod: HttpMethod;
78
+ }
79
+
80
+ interface RouteInfo {
81
+ path: string;
82
+ method: HttpMethod;
83
+ version?: VersionValue;
84
+ }
85
+
86
+ interface RoutePathMetadata {
87
+ /**
88
+ * Controller-level path (e.g., @Controller('resource') = "resource").
89
+ */
90
+ controllerPath?: string;
91
+ /**
92
+ * Method-level path (e.g., @Get('resource') = "resource").
93
+ */
94
+ methodPath?: string;
95
+ /**
96
+ * Global route prefix specified with the "VenokApplication#setGlobalPrefix" method.
97
+ */
98
+ globalPrefix?: string;
99
+ /**
100
+ * Module-level path registered through the "RouterModule".
101
+ */
102
+ modulePath?: string;
103
+ /**
104
+ * Controller-level version (e.g., @Controller({ version: '1.0' }) = "1.0").
105
+ */
106
+ controllerVersion?: VersionValue;
107
+ /**
108
+ * Method-level version (e.g., @Version('1.0') = "1.0").
109
+ */
110
+ methodVersion?: VersionValue;
111
+ /**
112
+ * API versioning options object.
113
+ */
114
+ versioningOptions?: VersioningOptions;
115
+ }
116
+
117
+ interface RouteTree {
118
+ path: string;
119
+ module?: Type;
120
+ children?: Routes | Type[];
121
+ }
122
+ type Routes = RouteTree[];
123
+
124
+ declare enum HttpVersioningType {
125
+ URI = 0,
126
+ HEADER = 1,
127
+ MEDIA_TYPE = 2,
128
+ CUSTOM = 3
129
+ }
130
+
131
+ /**
132
+ * Indicates that this will work for any version passed in the request, or no version.
133
+ */
134
+ declare const VERSION_NEUTRAL: unique symbol;
135
+ type VersionValue = string | typeof VERSION_NEUTRAL | Array<string | typeof VERSION_NEUTRAL>;
136
+ interface VersionOptions {
137
+ /**
138
+ * Specifies an optional API Version. When configured, methods
139
+ * within the controller will only be routed if the request version
140
+ * matches the specified value.
141
+ *
142
+ * Supported only by HTTP-based application.
143
+ *
144
+ */
145
+ version?: VersionValue;
146
+ }
147
+ interface HeaderVersioningOptions {
148
+ type: HttpVersioningType.HEADER;
149
+ /**
150
+ * The name of the Request Header that contains the version.
151
+ */
152
+ header: string;
153
+ }
154
+ interface UriVersioningOptions {
155
+ type: HttpVersioningType.URI;
156
+ /**
157
+ * Optional prefix that will prepend the version within the URI.
158
+ *
159
+ * Defaults to `v`.
160
+ *
161
+ * Ex. Assuming a version of `1`, for `/api/v1/route`, `v` is the prefix.
162
+ */
163
+ prefix?: string | false;
164
+ }
165
+ interface MediaTypeVersioningOptions {
166
+ type: HttpVersioningType.MEDIA_TYPE;
167
+ /**
168
+ * The key within the Media Type Header to determine the version from.
169
+ *
170
+ * Ex. For `application/json;v=1`, the key is `v=`.
171
+ */
172
+ key: string;
173
+ }
174
+ interface CustomVersioningOptions {
175
+ type: HttpVersioningType.CUSTOM;
176
+ /**
177
+ * A function that accepts a context and returns a single version value or
178
+ * an ordered array of versions, in order from HIGHEST to LOWEST.
179
+ *
180
+ * Ex. Returned version array = ['3.1', '3.0', '2.5', '2', '1.9']
181
+ *
182
+ * Use type assertion or narrowing to identify the specific request type.
183
+ */
184
+ extractor: (context: unknown[]) => string | string[];
185
+ }
186
+ interface VersioningCommonOptions {
187
+ /**
188
+ * The default version to be used as a fallback when you did not provide some
189
+ * version to `@Controller()` nor `@Version()`.
190
+ */
191
+ defaultVersion?: VersionOptions["version"];
192
+ }
193
+ type VersioningOptions = VersioningCommonOptions & (HeaderVersioningOptions | UriVersioningOptions | MediaTypeVersioningOptions | CustomVersioningOptions);
194
+
195
+ type AdapterRouteMetadata = {
196
+ useVersionFilter: boolean;
197
+ useHostFilter: boolean;
198
+ method: HttpMethod;
199
+ versioningOptions?: VersioningOptions;
200
+ hosts?: {
201
+ regexp: RegExp;
202
+ keys: any[];
203
+ }[];
204
+ handlers: {
205
+ version?: VersionValue;
206
+ handler: Function;
207
+ }[];
208
+ };
209
+ type AdapterPathMiddlewareMetadata = {
210
+ use: Function;
211
+ method: HttpMethod;
212
+ excludedPaths?: Exclude<RouteInfo, "version">[];
213
+ };
214
+ type AdapterInstanceRouteMetadata = {
215
+ handler: ((...args: any[]) => Promise<void>);
216
+ method: HttpMethod;
217
+ };
218
+ type AdapterMiddlewareMetadata = {
219
+ path: string;
220
+ handlers: AdapterPathMiddlewareMetadata[];
221
+ };
222
+
223
+ type HttpExceptionBodyMessage = string | string[];
224
+ interface HttpExceptionBody {
225
+ message?: HttpExceptionBodyMessage;
226
+ error: string;
227
+ statusCode: number;
228
+ }
229
+ interface HttpExceptionOptions {
230
+ /** original cause of the error */
231
+ cause?: unknown;
232
+ description?: string;
233
+ }
234
+ interface DescriptionAndOptions {
235
+ description: string;
236
+ httpExceptionOptions?: HttpExceptionOptions;
237
+ }
238
+
239
+ declare const VENOK_ADAPTER_BUILD: unique symbol;
240
+ declare const VENOK_ADAPTER_ADD_ROUTE: unique symbol;
241
+ declare const VENOK_ADAPTER_ADD_MIDDLEWARE: unique symbol;
242
+ declare const VENOK_ADAPTER_SET_EXCEPTION_FILTER: unique symbol;
243
+ declare const VENOK_APPLY_ROUTES_TO_INSTANCE: unique symbol;
244
+ declare const VENOK_ADAPTER_RESPONSE: unique symbol;
245
+ declare const VENOK_ADAPTER_TRANSFORM_NATIVE_ARGS_TO_CONTEXT: unique symbol;
246
+
247
+ declare abstract class AbstractHttpAdapter<Instance = any, Context extends any[] = any[]> {
248
+ #private;
249
+ constructor(instance: Instance);
250
+ get instance(): Instance;
251
+ protected readonly routes: Map<string, AdapterRouteMetadata>;
252
+ protected readonly globalVenokMiddlewares: Set<Function>;
253
+ protected readonly exactVenokMiddlewares: Map<string, AdapterPathMiddlewareMetadata[]>;
254
+ protected readonly patternVenokMiddlewares: Map<string, AdapterPathMiddlewareMetadata[]>;
255
+ private convertMiddlewares;
256
+ private applyMiddlewareFilterToHandler;
257
+ private applyHostFilterToHandler;
258
+ private applyVersionFilterToHandler;
259
+ private runChain;
260
+ protected createExceptionHandler(callback: (...args: any[]) => void): ReturnType<VenokExceptionFilterContext["create"]>;
261
+ abstract listen(port: number, hostname: string, callback: (...args: any[]) => Promise<void>): Promise<void>;
262
+ abstract close(): Promise<void>;
263
+ abstract [VENOK_APPLY_ROUTES_TO_INSTANCE](routes: Map<string, AdapterInstanceRouteMetadata>): void;
264
+ [VENOK_ADAPTER_SET_EXCEPTION_FILTER](container: VenokContainer, config: ApplicationConfig): void;
265
+ [VENOK_ADAPTER_BUILD](): Map<string, AdapterInstanceRouteMetadata>;
266
+ use(handler: Function): any;
267
+ use(path: string, handler: Function): any;
268
+ get(path: string, handler: (...args: any[]) => any): any;
269
+ post(path: string, handler: (...args: any[]) => any): any;
270
+ put(path: string, handler: (...args: any[]) => any): any;
271
+ delete(path: string, handler: (...args: any[]) => any): any;
272
+ patch(path: string, handler: (...args: any[]) => any): any;
273
+ all(path: string, handler: (...args: any[]) => any): any;
274
+ options(path: string, handler: (...args: any[]) => any): any;
275
+ head(path: string, handler: (...args: any[]) => any): any;
276
+ search(path: string, handler: (...args: any[]) => any): any;
277
+ [VENOK_ADAPTER_ADD_ROUTE](path: string, info: AdapterRouteMetadata): any;
278
+ [VENOK_ADAPTER_ADD_MIDDLEWARE](path: string, metadata: AdapterPathMiddlewareMetadata): this;
279
+ private addUserMiddleware;
280
+ private addUserRoute;
281
+ abstract [VENOK_ADAPTER_TRANSFORM_NATIVE_ARGS_TO_CONTEXT](...args: any[]): Context;
282
+ abstract getParamsFactory(): VenokParamsFactoryInterface;
283
+ abstract isResponseHandled(ctx: Context): boolean;
284
+ abstract getStatusByMethod(requestMethod: HttpMethod): number;
285
+ abstract addAdditionalProp(ctx: Context, key: string, value: any): void;
286
+ abstract getRequestMethod(ctx: Context): HttpMethod;
287
+ abstract getRequestUrl(ctx: Context): string;
288
+ abstract getRequestHostname(ctx: Context): string;
289
+ abstract getRequestHeaders(ctx: Context): Record<string, string>;
290
+ abstract setResponseStatus(ctx: Context, statusCode: number): any;
291
+ abstract setResponseRedirect(ctx: Context, statusCode: number, url: string): any;
292
+ abstract setResponseHeader(ctx: Context, name: string, value: string): any;
293
+ abstract setResponseReply(ctx: Context, result: any, statusCode?: number): any;
294
+ abstract registerNotFoundHandler(): void;
295
+ abstract registerExceptionHandler(): void;
296
+ }
297
+
298
+ declare class HttpConfig<T extends AbstractHttpAdapter = AbstractHttpAdapter> {
299
+ private readonly options;
300
+ private globalPrefix;
301
+ private globalPrefixOptions;
302
+ private versioningOptions;
303
+ private adapter;
304
+ constructor(options: Required<HttpAppOptions>);
305
+ setHttpAdapter(httpAdapter: T): void;
306
+ getHttpAdapterRef(): T;
307
+ setGlobalPrefix(prefix: string): void;
308
+ getGlobalPrefix(): string;
309
+ setGlobalPrefixOptions(options: GlobalPrefixOptions<ExcludeRouteMetadata>): void;
310
+ getGlobalPrefixOptions(): GlobalPrefixOptions<ExcludeRouteMetadata>;
311
+ enableVersioning(options: VersioningOptions): void;
312
+ getVersioning(): VersioningOptions | undefined;
313
+ }
314
+
315
+ interface HttpAppOptions {
316
+ port: number;
317
+ hostname?: string;
318
+ listenCallback?: (...args: any[]) => Promise<void>;
319
+ callback: (app: HttpConfig<any>) => void;
320
+ adapter: AbstractHttpAdapter;
321
+ }
322
+
323
+ interface GlobalPrefixOptions<T = string | RouteInfo> {
324
+ exclude?: T[];
325
+ }
326
+
327
+ /**
328
+ * Interface defining options that can be passed to `@Controller()` decorator
329
+ *
330
+ * @publicApi
331
+ */
332
+ interface ControllerOptions extends ScopeOptions, VersionOptions {
333
+ /**
334
+ * Specifies an optional `route path prefix`. The prefix is pre-pended to the
335
+ * path specified in any request decorator in the class.
336
+ *
337
+ * Supported only by HTTP-based application (does not apply to non-HTTP microservices).
338
+ */
339
+ path?: string | string[];
340
+ /**
341
+ * Specifies an optional HTTP Request host filter. When configured, methods
342
+ * within the controller will only be routed if the request host matches the
343
+ * specified value.
344
+ */
345
+ host?: string | RegExp | Array<string | RegExp>;
346
+ }
347
+ /**
348
+ * Decorator that marks a class as a Venok controller that can receive inbound
349
+ * requests and produce responses.
350
+ *
351
+ * An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
352
+ * It defines a class that provides the context for one or more related route
353
+ * handlers that correspond to HTTP request methods and associated routes
354
+ * for example `GET /api/profile`, `POST /users/resume`.
355
+ *
356
+ * A Microservice Controller responds to requests as well as events, running over
357
+ * a variety of transports. It defines a class that provides a context for
358
+ * one or more message or event handlers.
359
+ *
360
+ * @publicApi
361
+ */
362
+ declare function Controller(): ClassDecorator;
363
+ /**
364
+ * Decorator that marks a class as a Venok controller that can receive inbound
365
+ * requests and produce responses.
366
+ *
367
+ * An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
368
+ * It defines a class that provides the context for one or more related route
369
+ * handlers that correspond to HTTP request methods and associated routes
370
+ * for example `GET /api/profile`, `POST /users/resume`.
371
+ *
372
+ * A Microservice Controller responds to requests as well as events, running over
373
+ * a variety of transports. It defines a class that provides a context for
374
+ * one or more message or event handlers.
375
+ *
376
+ * @param {string|Array} prefix string that defines a `route path prefix`. The prefix
377
+ * is pre-pended to the path specified in any request decorator in the class.
378
+ *
379
+ * @publicApi
380
+ */
381
+ declare function Controller(prefix: string | string[]): ClassDecorator;
382
+ /**
383
+ * Decorator that marks a class as a Venok controller that can receive inbound
384
+ * requests and produce responses.
385
+ *
386
+ * An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
387
+ * It defines a class that provides the context for one or more related route
388
+ * handlers that correspond to HTTP request methods and associated routes
389
+ * for example `GET /api/profile`, `POST /users/resume`.
390
+ *
391
+ * A Microservice Controller responds to requests as well as events, running over
392
+ * a variety of transports. It defines a class that provides a context for
393
+ * one or more message or event handlers.
394
+ *
395
+ * @param {object} options configuration object specifying:
396
+ *
397
+ * - `scope` - symbol that determines the lifetime of a Controller instance.
398
+ * See Scope for more details.
399
+ * - `prefix` - string that defines a `route path prefix`. The prefix
400
+ * is pre-pended to the path specified in any request decorator in the class.
401
+ * - `version` - string, array of strings, or Symbol that defines the version
402
+ * of all routes in the class. See Versioning for more details.
403
+ *
404
+ * @publicApi
405
+ */
406
+ declare function Controller(options: ControllerOptions): ClassDecorator;
407
+ declare namespace Controller {
408
+ var KEY: string;
409
+ }
410
+
411
+ /**
412
+ * Request method Decorator. Sets a response header.
413
+ *
414
+ * For example:
415
+ * `@Header('Cache-Control', 'none')`
416
+ *
417
+ * @param name string to be used for header name
418
+ * @param value string to be used for header value
419
+ *
420
+ * @publicApi
421
+ */
422
+ declare function Header(name: string, value: string): MethodDecorator;
423
+
424
+ /**
425
+ * Request method Decorator. Defines the HTTP response status code. Overrides
426
+ * default status code for the decorated request method.
427
+ *
428
+ * @param statusCode HTTP response code to be returned by route handler.
429
+ *
430
+ * @publicApi
431
+ */
432
+ declare const HttpCode: _venok_core.ReflectableMethodDecorator<number, number>;
433
+
434
+ interface ResponseDecoratorOptions {
435
+ /**
436
+ * Determines whether the response will be sent manually within the route handler,
437
+ * with the use of native response handling methods exposed by the platform-specific response object,
438
+ * or if it should pass through Venok response processing pipeline.
439
+ *
440
+ * @default false
441
+ */
442
+ passthrough: boolean;
443
+ }
444
+ /**
445
+ * Route handler parameter decorator. Extracts the `Context`
446
+ * object from the execution context and populates the decorated
447
+ * parameter with the value of `Context`.
448
+ *
449
+ * Example: `logout(@Context() ctx)`
450
+ *
451
+ * @publicApi
452
+ */
453
+ declare const HttpContext: (options?: {
454
+ response?: ResponseDecoratorOptions;
455
+ }) => ParameterDecorator;
456
+ /**
457
+ * Route handler parameter decorator. Extracts the `Ip` property
458
+ * from the `req` object and populates the decorated
459
+ * parameter with the value of `ip`.
460
+ *
461
+ * @publicApi
462
+ */
463
+ declare const Ip: () => ParameterDecorator;
464
+ /**
465
+ * Route handler parameter decorator. Extracts the file object from context
466
+ * and populates the decorated parameter with the value of `file`.
467
+ * Used in conjunction with multer middleware
468
+ *
469
+ * For example:
470
+ * ```ts
471
+ * uploadFile(@UploadedFile("image") file) {
472
+ * console.log(file);
473
+ * }
474
+ * ```
475
+ *
476
+ * @param fileKey {string} File key from request body
477
+ *
478
+ * @publicApi
479
+ */
480
+ declare function UploadedFile(fileKey: string): ParameterDecorator;
481
+ /**
482
+ * Route handler parameter decorator. Extracts the file objects from context
483
+ * and populates the decorated parameter with the value of `files`.
484
+ *
485
+ * For example:
486
+ * ```ts
487
+ * uploadFile(@UploadedFiles("images") files) {
488
+ * console.log(files);
489
+ * }
490
+ * ```
491
+ *
492
+ * @param filesKey {string} Files key from request body
493
+ *
494
+ * @publicApi
495
+ */
496
+ declare function UploadedFiles(filesKey: string): ParameterDecorator;
497
+ /**
498
+ * Route handler parameter decorator. Extracts the file objects from context
499
+ * and populates the decorated parameter with the value of `files`.
500
+ *
501
+ * If fields not specified all files from context will return
502
+ *
503
+ * For example:
504
+ * ```ts
505
+ * uploadFile(@MultipleUploadedFiles("videos") files) {
506
+ * console.log(files);
507
+ * }
508
+ * ```
509
+ *
510
+ * @param fields Array of file keys from request body
511
+ *
512
+ * @publicApi
513
+ */
514
+ declare function MultipleUploadedFiles(fields?: {
515
+ field: string;
516
+ }[]): ParameterDecorator;
517
+ /**
518
+ * Route handler parameter decorator. Extracts the file objects from context
519
+ * and populates the decorated parameter with the value of `files`.
520
+ *
521
+ * If fields not specified all files from context will return
522
+ *
523
+ * For example:
524
+ * ```ts
525
+ * uploadFile(@MultipleUploadedFiles() files) {
526
+ * console.log(files);
527
+ * }
528
+ * ```
529
+ *
530
+ * @param fields Array of file keys from request body
531
+ * @param pipes One or more pipes to apply to the files
532
+ *
533
+ * @publicApi
534
+ */
535
+ declare function MultipleUploadedFiles(fields?: {
536
+ field: string;
537
+ }[], ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
538
+ /**
539
+ * Route handler parameter decorator. Extracts the `headers`
540
+ * property from the `req` object and populates the decorated
541
+ * parameter with the value of `headers`.
542
+ *
543
+ * For example: `async update(@Headers('Cache-Control') cacheControl: string)`
544
+ *
545
+ * @param property name of single header property to extract.
546
+ *
547
+ * @publicApi
548
+ */
549
+ declare const Headers: (property?: string) => ParameterDecorator;
550
+ /**
551
+ * Route handler parameter decorator. Extracts the `query`
552
+ * property from the `req` object and populates the decorated
553
+ * parameter with the value of `query`. May also apply pipes to the bound
554
+ * query parameter.
555
+ *
556
+ * For example:
557
+ * ```ts
558
+ * async find(@Query('user') user: string)
559
+ * ```
560
+ *
561
+ * @publicApi
562
+ */
563
+ declare function Query(): ParameterDecorator;
564
+ /**
565
+ * Route handler parameter decorator. Extracts the `query`
566
+ * property from the `req` object and populates the decorated
567
+ * parameter with the value of `query`. May also apply pipes to the bound
568
+ * query parameter.
569
+ *
570
+ * For example:
571
+ * ```ts
572
+ * async find(@Query('user') user: string)
573
+ * ```
574
+ *
575
+ * @param pipes one or more pipes to apply to the bound query parameter
576
+ *
577
+ * @publicApi
578
+ */
579
+ declare function Query(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
580
+ /**
581
+ * Route handler parameter decorator. Extracts the `query`
582
+ * property from the `req` object and populates the decorated
583
+ * parameter with the value of `query`. May also apply pipes to the bound
584
+ * query parameter.
585
+ *
586
+ * For example:
587
+ * ```ts
588
+ * async find(@Query('user') user: string)
589
+ * ```
590
+ *
591
+ * @param property name of single property to extract from the `query` object
592
+ * @param pipes one or more pipes to apply to the bound query parameter
593
+ *
594
+ * @publicApi
595
+ */
596
+ declare function Query(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
597
+ /**
598
+ * Route handler parameter decorator. Extracts the entire `body`
599
+ * object from the `req` object and populates the decorated
600
+ * parameter with the value of `body`.
601
+ *
602
+ * For example:
603
+ * ```ts
604
+ * async create(@Body() createDto: CreateCatDto)
605
+ * ```
606
+ *
607
+ * @publicApi
608
+ */
609
+ declare function Body(): ParameterDecorator;
610
+ /**
611
+ * Route handler parameter decorator. Extracts the entire `body`
612
+ * object from the `req` object and populates the decorated
613
+ * parameter with the value of `body`. Also applies the specified
614
+ * pipes to that parameter.
615
+ *
616
+ * For example:
617
+ * ```ts
618
+ * async create(@Body(new ValidationPipe()) createDto: CreateCatDto)
619
+ * ```
620
+ *
621
+ * @param pipes one or more pipes - either instances or classes - to apply to
622
+ * the bound body parameter.
623
+ *
624
+ * @publicApi
625
+ */
626
+ declare function Body(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
627
+ /**
628
+ * Route handler parameter decorator. Extracts a single property from
629
+ * the `body` object property of the `req` object and populates the decorated
630
+ * parameter with the value of that property. Also applies pipes to the bound
631
+ * body parameter.
632
+ *
633
+ * For example:
634
+ * ```ts
635
+ * async create(@Body('role', new ValidationPipe()) role: string)
636
+ * ```
637
+ *
638
+ * @param property name of single property to extract from the `body` object
639
+ * @param pipes one or more pipes - either instances or classes - to apply to
640
+ * the bound body parameter.
641
+ *
642
+ * @publicApi
643
+ */
644
+ declare function Body(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
645
+ /**
646
+ * Route handler parameter decorator. Extracts the `params`
647
+ * property from the `req` object and populates the decorated
648
+ * parameter with the value of `params`. May also apply pipes to the bound
649
+ * parameter.
650
+ *
651
+ * For example, extracting all params:
652
+ * ```ts
653
+ * findOne(@Param() params: string[])
654
+ * ```
655
+ *
656
+ * For example, extracting a single param:
657
+ * ```ts
658
+ * findOne(@Param('id') id: string)
659
+ * ```
660
+ *
661
+ * @publicApi
662
+ */
663
+ declare function Param(): ParameterDecorator;
664
+ /**
665
+ * Route handler parameter decorator. Extracts the `params`
666
+ * property from the `req` object and populates the decorated
667
+ * parameter with the value of `params`. May also apply pipes to the bound
668
+ * parameter.
669
+ *
670
+ * For example, extracting all params:
671
+ * ```ts
672
+ * findOne(@Param() params: string[])
673
+ * ```
674
+ *
675
+ * For example, extracting a single param:
676
+ * ```ts
677
+ * findOne(@Param('id') id: string)
678
+ * ```
679
+ *
680
+ * @param pipes one or more pipes - either instances or classes - to apply to
681
+ * the bound parameter.
682
+ *
683
+ * @publicApi
684
+ */
685
+ declare function Param(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
686
+ /**
687
+ * Route handler parameter decorator. Extracts the `params`
688
+ * property from the `req` object and populates the decorated
689
+ * parameter with the value of `params`. May also apply pipes to the bound
690
+ * parameter.
691
+ *
692
+ * For example, extracting all params:
693
+ * ```ts
694
+ * findOne(@Param() params: string[])
695
+ * ```
696
+ *
697
+ * For example, extracting a single param:
698
+ * ```ts
699
+ * findOne(@Param('id') id: string)
700
+ * ```
701
+ *
702
+ * @param property name of single property to extract from the `req` object
703
+ * @param pipes one or more pipes - either instances or classes - to apply to
704
+ * the bound parameter.
705
+ *
706
+ * @publicApi
707
+ */
708
+ declare function Param(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
709
+ /**
710
+ * Route handler parameter decorator. Extracts the `hosts`
711
+ * property from the `req` object and populates the decorated
712
+ * parameter with the value of `hosts`. May also apply pipes to the bound
713
+ * parameter.
714
+ *
715
+ * For example, extracting all params:
716
+ * ```ts
717
+ * findOne(@HostParam() params: string[])
718
+ * ```
719
+ *
720
+ * For example, extracting a single param:
721
+ * ```ts
722
+ * findOne(@HostParam('id') id: string)
723
+ * ```
724
+ *
725
+ * @publicApi
726
+ */
727
+ declare function HostParam(): ParameterDecorator;
728
+ /**
729
+ * Route handler parameter decorator. Extracts the `hosts`
730
+ * property from the `req` object and populates the decorated
731
+ * parameter with the value of `hosts`. May also apply pipes to the bound
732
+ * parameter.
733
+ *
734
+ * For example, extracting all params:
735
+ * ```ts
736
+ * findOne(@HostParam() params: string[])
737
+ * ```
738
+ *
739
+ * For example, extracting a single param:
740
+ * ```ts
741
+ * findOne(@HostParam('id') id: string)
742
+ * ```
743
+ * @param property name of single property to extract from the `req` object
744
+ *
745
+ * @publicApi
746
+ */
747
+ declare function HostParam(property: string): ParameterDecorator;
748
+
749
+ declare const HOST_METADATA = "host";
750
+ declare const PATH_METADATA = "path";
751
+ declare const HEADERS_METADATA = "__headers__";
752
+ declare const REDIRECT_METADATA = "__redirect__";
753
+ declare const RESPONSE_PASSTHROUGH_METADATA = "__responsePassthrough__";
754
+ declare const VERSION_METADATA = "__version__";
755
+ declare const METHOD_METADATA = "method";
756
+
757
+ interface MethodMappingMetadata {
758
+ path?: string | string[];
759
+ method?: HttpMethod;
760
+ }
761
+ type RequestMappingDecorator = {
762
+ [PATH_METADATA]: string | string[];
763
+ [METHOD_METADATA]: HttpMethod;
764
+ };
765
+ declare const MethodMapping: _venok_core.ReflectableMethodDecorator<MethodMappingMetadata, RequestMappingDecorator>;
766
+ /**
767
+ * Route handler (method) Decorator. Routes HTTP POST requests to the specified path.
768
+ *
769
+ * @publicApi
770
+ */
771
+ declare const Post: (path?: string | string[]) => MethodDecorator;
772
+ /**
773
+ * Route handler (method) Decorator. Routes HTTP GET requests to the specified path.
774
+ *
775
+ * @publicApi
776
+ */
777
+ declare const Get: (path?: string | string[]) => MethodDecorator;
778
+ /**
779
+ * Route handler (method) Decorator. Routes HTTP DELETE requests to the specified path.
780
+ *
781
+ * @publicApi
782
+ */
783
+ declare const Delete: (path?: string | string[]) => MethodDecorator;
784
+ /**
785
+ * Route handler (method) Decorator. Routes HTTP PUT requests to the specified path.
786
+ *
787
+ * @publicApi
788
+ */
789
+ declare const Put: (path?: string | string[]) => MethodDecorator;
790
+ /**
791
+ * Route handler (method) Decorator. Routes HTTP PATCH requests to the specified path.
792
+ *
793
+ * @publicApi
794
+ */
795
+ declare const Patch: (path?: string | string[]) => MethodDecorator;
796
+ /**
797
+ * Route handler (method) Decorator. Routes HTTP OPTIONS requests to the specified path.
798
+ *
799
+ * @publicApi
800
+ */
801
+ declare const Options: (path?: string | string[]) => MethodDecorator;
802
+ /**
803
+ * Route handler (method) Decorator. Routes HTTP HEAD requests to the specified path.
804
+ *
805
+ * @publicApi
806
+ */
807
+ declare const Head: (path?: string | string[]) => MethodDecorator;
808
+ /**
809
+ * Route handler (method) Decorator. Routes all HTTP requests to the specified path.
810
+ *
811
+ * @publicApi
812
+ */
813
+ declare const All: (path?: string | string[]) => MethodDecorator;
814
+ /**
815
+ * Route handler (method) Decorator. Routes all HTTP requests to the specified path.
816
+ *
817
+ * @publicApi
818
+ */
819
+ declare const Search: (path?: string | string[]) => MethodDecorator;
820
+
821
+ type RedirectOptions = {
822
+ url: string;
823
+ statusCode?: number;
824
+ };
825
+ declare const Redirect: (url: string, statusCode?: number) => MethodDecorator;
826
+
827
+ /**
828
+ * Sets the version of the endpoint to the passed version
829
+ *
830
+ * @publicApi
831
+ */
832
+ declare const Version: _venok_core.ReflectableMethodDecorator<VersionValue, VersionValue>;
833
+
834
+ declare enum HttpParamtypes {
835
+ CONTEXT = 0,
836
+ BODY = 1,
837
+ QUERY = 2,
838
+ PARAM = 3,
839
+ HEADERS = 4,
840
+ FILE = 5,
841
+ FILES = 6,
842
+ MULTIPLE_FILES = 7,
843
+ HOST = 8,
844
+ IP = 9
845
+ }
846
+
847
+ declare enum HttpStatus {
848
+ CONTINUE = 100,
849
+ SWITCHING_PROTOCOLS = 101,
850
+ PROCESSING = 102,
851
+ EARLYHINTS = 103,
852
+ OK = 200,
853
+ CREATED = 201,
854
+ ACCEPTED = 202,
855
+ NON_AUTHORITATIVE_INFORMATION = 203,
856
+ NO_CONTENT = 204,
857
+ RESET_CONTENT = 205,
858
+ PARTIAL_CONTENT = 206,
859
+ AMBIGUOUS = 300,
860
+ MOVED_PERMANENTLY = 301,
861
+ FOUND = 302,
862
+ SEE_OTHER = 303,
863
+ NOT_MODIFIED = 304,
864
+ TEMPORARY_REDIRECT = 307,
865
+ PERMANENT_REDIRECT = 308,
866
+ BAD_REQUEST = 400,
867
+ UNAUTHORIZED = 401,
868
+ PAYMENT_REQUIRED = 402,
869
+ FORBIDDEN = 403,
870
+ NOT_FOUND = 404,
871
+ METHOD_NOT_ALLOWED = 405,
872
+ NOT_ACCEPTABLE = 406,
873
+ PROXY_AUTHENTICATION_REQUIRED = 407,
874
+ REQUEST_TIMEOUT = 408,
875
+ CONFLICT = 409,
876
+ GONE = 410,
877
+ LENGTH_REQUIRED = 411,
878
+ PRECONDITION_FAILED = 412,
879
+ PAYLOAD_TOO_LARGE = 413,
880
+ URI_TOO_LONG = 414,
881
+ UNSUPPORTED_MEDIA_TYPE = 415,
882
+ REQUESTED_RANGE_NOT_SATISFIABLE = 416,
883
+ EXPECTATION_FAILED = 417,
884
+ I_AM_A_TEAPOT = 418,
885
+ MISDIRECTED = 421,
886
+ UNPROCESSABLE_ENTITY = 422,
887
+ FAILED_DEPENDENCY = 424,
888
+ PRECONDITION_REQUIRED = 428,
889
+ TOO_MANY_REQUESTS = 429,
890
+ INTERNAL_SERVER_ERROR = 500,
891
+ NOT_IMPLEMENTED = 501,
892
+ BAD_GATEWAY = 502,
893
+ SERVICE_UNAVAILABLE = 503,
894
+ GATEWAY_TIMEOUT = 504,
895
+ HTTP_VERSION_NOT_SUPPORTED = 505
896
+ }
897
+
898
+ /**
899
+ * Defines the base Venok HTTP exception, which is handled by the default
900
+ * Exceptions Handler.
901
+ *
902
+ * @publicApi
903
+ */
904
+ declare class HttpException extends Error {
905
+ private readonly info;
906
+ private readonly status;
907
+ private readonly options?;
908
+ /**
909
+ * Instantiate a plain HTTP Exception.
910
+ *
911
+ * @example
912
+ * throw new HttpException()
913
+ * throw new HttpException('message', HttpStatus.BAD_REQUEST)
914
+ * throw new HttpException('custom message', HttpStatus.BAD_REQUEST, {
915
+ * cause: new Error('Cause Error'),
916
+ * description: "Validation Error",
917
+ * })
918
+ * throw new HttpException({ status: 400, custom: "Hello innovators" })
919
+ *
920
+ * @usageNotes
921
+ * The constructor arguments define the response message and the HTTP response status code.
922
+ * - The `info` argument (required) argument defines JSON object or the message string.
923
+ * - The `status` argument (required) defines the HTTP Status Code.
924
+ * - The `options` argument (optional) defines additional error options. Currently, it supports the `cause` attribute,
925
+ * and can be used as an alternative way to specify the error cause: `const error = new HttpException('description', 400, { cause: new Error() });`
926
+ *
927
+ * By default, the JSON response body contains two properties:
928
+ * - `statusCode`: the Http Status Code.
929
+ * - `message`: a short description of the HTTP error by default; override this
930
+ * by supplying a string in the `response` parameter.
931
+ *
932
+ * To override the entire JSON response body, pass an object to the `createBody`
933
+ * method. Venok will serialize the object and return it as the JSON response body.
934
+ *
935
+ * The `status` argument is required, and should be a valid HTTP status code.
936
+ * Best practice is to use the `HttpStatus` enum.
937
+ *
938
+ * @param info JSON object or message string describing the error condition
939
+ * @param status HTTP response status code.
940
+ * @param options An object used to add an error cause.
941
+ */
942
+ constructor(info: string | Record<string, any>, status: number, options?: HttpExceptionOptions | undefined);
943
+ cause: unknown;
944
+ /**
945
+ * Configures error chaining support
946
+ *
947
+ * @see https://nodejs.org/en/blog/release/v16.9.0/#error-cause
948
+ * @see https://github.com/microsoft/TypeScript/issues/45167
949
+ */
950
+ initCause(): void;
951
+ initMessage(): void;
952
+ initName(): void;
953
+ getInfo(): string | object;
954
+ /**
955
+ * @deprecated
956
+ */
957
+ getResponse(): string | object;
958
+ getStatus(): number;
959
+ static createBody(nothing: null | "" | any, message: HttpExceptionBodyMessage, statusCode: number): HttpExceptionBody;
960
+ static createBody(message: HttpExceptionBodyMessage, error: string, statusCode: number): HttpExceptionBody;
961
+ static createBody<Body extends Record<string, unknown>>(custom: Body): Body;
962
+ static getDescriptionFrom(descriptionOrOptions: string | HttpExceptionOptions): string;
963
+ static getHttpExceptionOptionsFrom(descriptionOrOptions: string | HttpExceptionOptions): HttpExceptionOptions;
964
+ /**
965
+ * Utility method used to extract the error description and httpExceptionOptions from the given argument.
966
+ * This is used by inheriting classes to correctly parse both options.
967
+ * @returns the error description and the httpExceptionOptions as an object.
968
+ */
969
+ static extractDescriptionAndOptionsFrom(descriptionOrOptions: string | HttpExceptionOptions, fallbackDescription?: string): DescriptionAndOptions;
970
+ }
971
+
972
+ /**
973
+ * Defines an HTTP exception for *Bad Gateway* type errors.
974
+ *
975
+ * @publicApi
976
+ */
977
+ declare class BadGatewayException extends HttpException {
978
+ /**
979
+ * Instantiate a `BadGatewayException` Exception.
980
+ *
981
+ * @example
982
+ * `throw new BadGatewayException()`
983
+ *
984
+ * @usageNotes
985
+ * The HTTP response status code will be 502.
986
+ * - The `info` argument defines JSON object or the message string.
987
+ * - The `descriptionOrOptions` argument contains either a short description of
988
+ * the HTTP error or an options object used to provide an underlying error cause.
989
+ *
990
+ * By default, the JSON response body contains two properties:
991
+ * - `statusCode`: this will be the value 502.
992
+ * - `message`: the string `'Bad Gateway'` by default;
993
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
994
+ *
995
+ * If the parameter `info` is a string, the body will contain an
996
+ * additional property, `message`.
997
+ *
998
+ * By default, `error` will contain a string with a short description of the HTTP error.
999
+ * To override the entire JSON response body, pass an object instead.
1000
+ * Venok will serialize the object and return it as the JSON response body.
1001
+ *
1002
+ * @param info string or object describing the error condition.
1003
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1004
+ */
1005
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1006
+ }
1007
+
1008
+ /**
1009
+ * Defines an HTTP exception for *Bad Request* type errors.
1010
+ *
1011
+ * @publicApi
1012
+ */
1013
+ declare class BadRequestException extends HttpException {
1014
+ /**
1015
+ * Instantiate a `BadRequestException` Exception.
1016
+ *
1017
+ * @example
1018
+ * `throw new BadRequestException()`
1019
+ *
1020
+ * @usageNotes
1021
+ * The HTTP response status code will be 400.
1022
+ * - The `info` argument defines JSON object or the message string.
1023
+ * - The `descriptionOrOptions` argument contains either a short description of
1024
+ * the HTTP error or an options object used to provide an underlying error cause.
1025
+ *
1026
+ * By default, the JSON response body contains two properties:
1027
+ * - `statusCode`: this will be the value 400.
1028
+ * - `message`: the string `'Bad Request'` by default;
1029
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1030
+ *
1031
+ * If the parameter `info` is a string, the body will contain an
1032
+ * additional property, `message`.
1033
+ *
1034
+ * By default, `error` will contain a string with a short description of the HTTP error.
1035
+ * To override the entire JSON response body, pass an object instead.
1036
+ * Venok will serialize the object and return it as the JSON response body.
1037
+ *
1038
+ * @param info string or object describing the error condition.
1039
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1040
+ */
1041
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1042
+ }
1043
+
1044
+ /**
1045
+ * Defines an HTTP exception for *Conflict* type errors.
1046
+ *
1047
+ * @publicApi
1048
+ */
1049
+ declare class ConflictException extends HttpException {
1050
+ /**
1051
+ * Instantiate a `ConflictException` Exception.
1052
+ *
1053
+ * @example
1054
+ * `throw new ConflictException()`
1055
+ *
1056
+ * @usageNotes
1057
+ * The HTTP response status code will be 409.
1058
+ * - The `info` argument defines JSON object or the message string.
1059
+ * - The `descriptionOrOptions` argument contains either a short description of
1060
+ * the HTTP error or an options object used to provide an underlying error cause.
1061
+ *
1062
+ * By default, the JSON response body contains two properties:
1063
+ * - `statusCode`: this will be the value 409.
1064
+ * - `message`: the string `'Conflict'` by default;
1065
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1066
+ *
1067
+ * If the parameter `info` is a string, the body will contain an
1068
+ * additional property, `message`.
1069
+ *
1070
+ * By default, `error` will contain a string with a short description of the HTTP error.
1071
+ * To override the entire JSON response body, pass an object instead.
1072
+ * Venok will serialize the object and return it as the JSON response body.
1073
+ *
1074
+ * @param info string or object describing the error condition.
1075
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1076
+ */
1077
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1078
+ }
1079
+
1080
+ /**
1081
+ * Defines an HTTP exception for *Expectation Failed* type errors.
1082
+ *
1083
+ * @publicApi
1084
+ */
1085
+ declare class ExpectationFailedException extends HttpException {
1086
+ /**
1087
+ * Instantiate a `ExpectationFailedException` Exception.
1088
+ *
1089
+ * @example
1090
+ * `throw new ExpectationFailedException()`
1091
+ *
1092
+ * @usageNotes
1093
+ * The HTTP response status code will be 417.
1094
+ * - The `info` argument defines JSON object or the message string.
1095
+ * - The `descriptionOrOptions` argument contains either a short description of
1096
+ * the HTTP error or an options object used to provide an underlying error cause.
1097
+ *
1098
+ * By default, the JSON response body contains two properties:
1099
+ * - `statusCode`: this will be the value 417.
1100
+ * - `message`: the string `'Expectation Failed'` by default;
1101
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1102
+ *
1103
+ * If the parameter `info` is a string, the body will contain an
1104
+ * additional property, `message`.
1105
+ *
1106
+ * By default, `error` will contain a string with a short description of the HTTP error.
1107
+ * To override the entire JSON response body, pass an object instead.
1108
+ * Venok will serialize the object and return it as the JSON response body.
1109
+ *
1110
+ * @param info string or object describing the error condition.
1111
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1112
+ */
1113
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1114
+ }
1115
+
1116
+ /**
1117
+ * Defines an HTTP exception for *Failed Dependency* type errors.
1118
+ *
1119
+ * @publicApi
1120
+ */
1121
+ declare class FailedDependencyException extends HttpException {
1122
+ /**
1123
+ * Instantiate a `FailedDependencyException` Exception.
1124
+ *
1125
+ * @example
1126
+ * `throw new FailedDependencyException()`
1127
+ *
1128
+ * @usageNotes
1129
+ * The HTTP response status code will be 424.
1130
+ * - The `info` argument defines JSON object or the message string.
1131
+ * - The `descriptionOrOptions` argument contains either a short description of
1132
+ * the HTTP error or an options object used to provide an underlying error cause.
1133
+ *
1134
+ * By default, the JSON response body contains two properties:
1135
+ * - `statusCode`: this will be the value 424.
1136
+ * - `message`: the string `'Failed Dependency'` by default;
1137
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1138
+ *
1139
+ * If the parameter `info` is a string, the body will contain an
1140
+ * additional property, `message`.
1141
+ *
1142
+ * By default, `error` will contain a string with a short description of the HTTP error.
1143
+ * To override the entire JSON response body, pass an object instead.
1144
+ * Venok will serialize the object and return it as the JSON response body.
1145
+ *
1146
+ * @param info string or object describing the error condition.
1147
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1148
+ */
1149
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1150
+ }
1151
+
1152
+ /**
1153
+ * Defines an HTTP exception for *Forbidden* type errors.
1154
+ *
1155
+ * @publicApi
1156
+ */
1157
+ declare class ForbiddenException extends HttpException {
1158
+ /**
1159
+ * Instantiate a `ForbiddenException` Exception.
1160
+ *
1161
+ * @example
1162
+ * `throw new ForbiddenException()`
1163
+ *
1164
+ * @usageNotes
1165
+ * The HTTP response status code will be 403.
1166
+ * - The `info` argument defines JSON object or the message string.
1167
+ * - The `descriptionOrOptions` argument contains either a short description of
1168
+ * the HTTP error or an options object used to provide an underlying error cause.
1169
+ *
1170
+ * By default, the JSON response body contains two properties:
1171
+ * - `statusCode`: this will be the value 403.
1172
+ * - `message`: the string `'Forbidden'` by default;
1173
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1174
+ *
1175
+ * If the parameter `info` is a string, the body will contain an
1176
+ * additional property, `message`.
1177
+ *
1178
+ * By default, `error` will contain a string with a short description of the HTTP error.
1179
+ * To override the entire JSON response body, pass an object instead.
1180
+ * Venok will serialize the object and return it as the JSON response body.
1181
+ *
1182
+ * @param info string or object describing the error condition.
1183
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1184
+ */
1185
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1186
+ }
1187
+
1188
+ /**
1189
+ * Defines an HTTP exception for *Gateway Timeout* type errors.
1190
+ *
1191
+ * @publicApi
1192
+ */
1193
+ declare class GatewayTimeoutException extends HttpException {
1194
+ /**
1195
+ * Instantiate a `GatewayTimeoutException` Exception.
1196
+ *
1197
+ * @example
1198
+ * `throw new GatewayTimeoutException()`
1199
+ *
1200
+ * @usageNotes
1201
+ * The HTTP response status code will be 504.
1202
+ * - The `info` argument defines JSON object or the message string.
1203
+ * - The `descriptionOrOptions` argument contains either a short description of
1204
+ * the HTTP error or an options object used to provide an underlying error cause.
1205
+ *
1206
+ * By default, the JSON response body contains two properties:
1207
+ * - `statusCode`: this will be the value 504.
1208
+ * - `message`: the string `'Gateway Timeout'` by default;
1209
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1210
+ *
1211
+ * If the parameter `info` is a string, the body will contain an
1212
+ * additional property, `message`.
1213
+ *
1214
+ * By default, `error` will contain a string with a short description of the HTTP error.
1215
+ * To override the entire JSON response body, pass an object instead.
1216
+ * Venok will serialize the object and return it as the JSON response body.
1217
+ *
1218
+ * @param info string or object describing the error condition.
1219
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1220
+ */
1221
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1222
+ }
1223
+
1224
+ /**
1225
+ * Defines an HTTP exception for *Gone* type errors.
1226
+ *
1227
+ * @publicApi
1228
+ */
1229
+ declare class GoneException extends HttpException {
1230
+ /**
1231
+ * Instantiate a `GoneException` Exception.
1232
+ *
1233
+ * @example
1234
+ * `throw new GoneException()`
1235
+ *
1236
+ * @usageNotes
1237
+ * The HTTP response status code will be 410.
1238
+ * - The `info` argument defines JSON object or the message string.
1239
+ * - The `descriptionOrOptions` argument contains either a short description of
1240
+ * the HTTP error or an options object used to provide an underlying error cause.
1241
+ *
1242
+ * By default, the JSON response body contains two properties:
1243
+ * - `statusCode`: this will be the value 410.
1244
+ * - `message`: the string `'Gone'` by default;
1245
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1246
+ *
1247
+ * If the parameter `info` is a string, the body will contain an
1248
+ * additional property, `message`.
1249
+ *
1250
+ * By default, `error` will contain a string with a short description of the HTTP error.
1251
+ * To override the entire JSON response body, pass an object instead.
1252
+ * Venok will serialize the object and return it as the JSON response body.
1253
+ *
1254
+ * @param info string or object describing the error condition.
1255
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1256
+ */
1257
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1258
+ }
1259
+
1260
+ /**
1261
+ * Defines an HTTP exception for *HTTP Version Not Supported* type errors.
1262
+ *
1263
+ * @publicApi
1264
+ */
1265
+ declare class HttpVersionNotSupportedException extends HttpException {
1266
+ /**
1267
+ * Instantiate a `HttpVersionNotSupportedException` Exception.
1268
+ *
1269
+ * @example
1270
+ * `throw new HttpVersionNotSupportedException()`
1271
+ *
1272
+ * @usageNotes
1273
+ * The HTTP response status code will be 505.
1274
+ * - The `info` argument defines JSON object or the message string.
1275
+ * - The `descriptionOrOptions` argument contains either a short description of
1276
+ * the HTTP error or an options object used to provide an underlying error cause.
1277
+ *
1278
+ * By default, the JSON response body contains two properties:
1279
+ * - `statusCode`: this will be the value 505.
1280
+ * - `message`: the string `'HTTP Version Not Supported'` by default;
1281
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1282
+ *
1283
+ * If the parameter `info` is a string, the body will contain an
1284
+ * additional property, `message`.
1285
+ *
1286
+ * By default, `error` will contain a string with a short description of the HTTP error.
1287
+ * To override the entire JSON response body, pass an object instead.
1288
+ * Venok will serialize the object and return it as the JSON response body.
1289
+ *
1290
+ * @param info string or object describing the error condition.
1291
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1292
+ */
1293
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1294
+ }
1295
+
1296
+ /**
1297
+ * Defines an HTTP exception for *I'm a teapot* type errors.
1298
+ *
1299
+ * @publicApi
1300
+ */
1301
+ declare class ImATeapotException extends HttpException {
1302
+ /**
1303
+ * Instantiate a `ImATeapotException` Exception.
1304
+ *
1305
+ * @example
1306
+ * `throw new ImATeapotException()`
1307
+ *
1308
+ * @usageNotes
1309
+ * The HTTP response status code will be 418.
1310
+ * - The `info` argument defines JSON object or the message string.
1311
+ * - The `descriptionOrOptions` argument contains either a short description of
1312
+ * the HTTP error or an options object used to provide an underlying error cause.
1313
+ *
1314
+ * By default, the JSON response body contains two properties:
1315
+ * - `statusCode`: this will be the value 418.
1316
+ * - `message`: the string `'I'm a teapot'` by default;
1317
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1318
+ *
1319
+ * If the parameter `info` is a string, the body will contain an
1320
+ * additional property, `message`.
1321
+ *
1322
+ * By default, `error` will contain a string with a short description of the HTTP error.
1323
+ * To override the entire JSON response body, pass an object instead.
1324
+ * Venok will serialize the object and return it as the JSON response body.
1325
+ *
1326
+ * @param info string or object describing the error condition.
1327
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1328
+ */
1329
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1330
+ }
1331
+
1332
+ /**
1333
+ * Defines an HTTP exception for *Internal Server Error* type errors.
1334
+ *
1335
+ * @publicApi
1336
+ */
1337
+ declare class InternalServerErrorException extends HttpException {
1338
+ /**
1339
+ * Instantiate a `InternalServerErrorException` Exception.
1340
+ *
1341
+ * @example
1342
+ * `throw new InternalServerErrorException()`
1343
+ *
1344
+ * @usageNotes
1345
+ * The HTTP response status code will be 500.
1346
+ * - The `info` argument defines JSON object or the message string.
1347
+ * - The `descriptionOrOptions` argument contains either a short description of
1348
+ * the HTTP error or an options object used to provide an underlying error cause.
1349
+ *
1350
+ * By default, the JSON response body contains two properties:
1351
+ * - `statusCode`: this will be the value 500.
1352
+ * - `message`: the string `'Internal Server Error'` by default;
1353
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1354
+ *
1355
+ * If the parameter `info` is a string, the body will contain an
1356
+ * additional property, `message`.
1357
+ *
1358
+ * By default, `error` will contain a string with a short description of the HTTP error.
1359
+ * To override the entire JSON response body, pass an object instead.
1360
+ * Venok will serialize the object and return it as the JSON response body.
1361
+ *
1362
+ * @param info string or object describing the error condition.
1363
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1364
+ */
1365
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1366
+ }
1367
+
1368
+ /**
1369
+ * Defines an HTTP exception for *Length Required* type errors.
1370
+ *
1371
+ * @publicApi
1372
+ */
1373
+ declare class LengthRequiredException extends HttpException {
1374
+ /**
1375
+ * Instantiate a `LengthRequiredException` Exception.
1376
+ *
1377
+ * @example
1378
+ * `throw new LengthRequiredException()`
1379
+ *
1380
+ * @usageNotes
1381
+ * The HTTP response status code will be 411.
1382
+ * - The `info` argument defines JSON object or the message string.
1383
+ * - The `descriptionOrOptions` argument contains either a short description of
1384
+ * the HTTP error or an options object used to provide an underlying error cause.
1385
+ *
1386
+ * By default, the JSON response body contains two properties:
1387
+ * - `statusCode`: this will be the value 411.
1388
+ * - `message`: the string `'Length Required'` by default;
1389
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1390
+ *
1391
+ * If the parameter `info` is a string, the body will contain an
1392
+ * additional property, `message`.
1393
+ *
1394
+ * By default, `error` will contain a string with a short description of the HTTP error.
1395
+ * To override the entire JSON response body, pass an object instead.
1396
+ * Venok will serialize the object and return it as the JSON response body.
1397
+ *
1398
+ * @param info string or object describing the error condition.
1399
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1400
+ */
1401
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1402
+ }
1403
+
1404
+ /**
1405
+ * Defines an HTTP exception for *Method Not Allowed* type errors.
1406
+ *
1407
+ * @publicApi
1408
+ */
1409
+ declare class MethodNotAllowedException extends HttpException {
1410
+ /**
1411
+ * Instantiate a `MethodNotAllowedException` Exception.
1412
+ *
1413
+ * @example
1414
+ * `throw new MethodNotAllowedException()`
1415
+ *
1416
+ * @usageNotes
1417
+ * The HTTP response status code will be 405.
1418
+ * - The `info` argument defines JSON object or the message string.
1419
+ * - The `descriptionOrOptions` argument contains either a short description of
1420
+ * the HTTP error or an options object used to provide an underlying error cause.
1421
+ *
1422
+ * By default, the JSON response body contains two properties:
1423
+ * - `statusCode`: this will be the value 405.
1424
+ * - `message`: the string `'Method Not Allowed'` by default;
1425
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1426
+ *
1427
+ * If the parameter `info` is a string, the body will contain an
1428
+ * additional property, `message`.
1429
+ *
1430
+ * By default, `error` will contain a string with a short description of the HTTP error.
1431
+ * To override the entire JSON response body, pass an object instead.
1432
+ * Venok will serialize the object and return it as the JSON response body.
1433
+ *
1434
+ * @param info string or object describing the error condition.
1435
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1436
+ */
1437
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1438
+ }
1439
+
1440
+ /**
1441
+ * Defines an HTTP exception for *Misdirected* type errors.
1442
+ *
1443
+ * @publicApi
1444
+ */
1445
+ declare class MisdirectedException extends HttpException {
1446
+ /**
1447
+ * Instantiate a `MisdirectedException` Exception.
1448
+ *
1449
+ * @example
1450
+ * `throw new MisdirectedException()`
1451
+ *
1452
+ * @usageNotes
1453
+ * The HTTP response status code will be 421.
1454
+ * - The `info` argument defines JSON object or the message string.
1455
+ * - The `descriptionOrOptions` argument contains either a short description of
1456
+ * the HTTP error or an options object used to provide an underlying error cause.
1457
+ *
1458
+ * By default, the JSON response body contains two properties:
1459
+ * - `statusCode`: this will be the value 421.
1460
+ * - `message`: the string `'Misdirected'` by default;
1461
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1462
+ *
1463
+ * If the parameter `info` is a string, the body will contain an
1464
+ * additional property, `message`.
1465
+ *
1466
+ * By default, `error` will contain a string with a short description of the HTTP error.
1467
+ * To override the entire JSON response body, pass an object instead.
1468
+ * Venok will serialize the object and return it as the JSON response body.
1469
+ *
1470
+ * @param info string or object describing the error condition.
1471
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1472
+ */
1473
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1474
+ }
1475
+
1476
+ /**
1477
+ * Defines an HTTP exception for *Not Acceptable* type errors.
1478
+ *
1479
+ * @publicApi
1480
+ */
1481
+ declare class NotAcceptableException extends HttpException {
1482
+ /**
1483
+ * Instantiate a `NotAcceptableException` Exception.
1484
+ *
1485
+ * @example
1486
+ * `throw new NotAcceptableException()`
1487
+ *
1488
+ * @usageNotes
1489
+ * The HTTP response status code will be 406.
1490
+ * - The `info` argument defines JSON object or the message string.
1491
+ * - The `descriptionOrOptions` argument contains either a short description of
1492
+ * the HTTP error or an options object used to provide an underlying error cause.
1493
+ *
1494
+ * By default, the JSON response body contains two properties:
1495
+ * - `statusCode`: this will be the value 406.
1496
+ * - `message`: the string `'Not Acceptable'` by default;
1497
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1498
+ *
1499
+ * If the parameter `info` is a string, the body will contain an
1500
+ * additional property, `message`.
1501
+ *
1502
+ * By default, `error` will contain a string with a short description of the HTTP error.
1503
+ * To override the entire JSON response body, pass an object instead.
1504
+ * Venok will serialize the object and return it as the JSON response body.
1505
+ *
1506
+ * @param info string or object describing the error condition.
1507
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1508
+ */
1509
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1510
+ }
1511
+
1512
+ /**
1513
+ * Defines an HTTP exception for *Not Found* type errors.
1514
+ *
1515
+ * @publicApi
1516
+ */
1517
+ declare class NotFoundException extends HttpException {
1518
+ /**
1519
+ * Instantiate a `NotFoundException` Exception.
1520
+ *
1521
+ * @example
1522
+ * `throw new NotFoundException()`
1523
+ *
1524
+ * @usageNotes
1525
+ * The HTTP response status code will be 404.
1526
+ * - The `info` argument defines JSON object or the message string.
1527
+ * - The `descriptionOrOptions` argument contains either a short description of
1528
+ * the HTTP error or an options object used to provide an underlying error cause.
1529
+ *
1530
+ * By default, the JSON response body contains two properties:
1531
+ * - `statusCode`: this will be the value 404.
1532
+ * - `message`: the string `'Not Found'` by default;
1533
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1534
+ *
1535
+ * If the parameter `info` is a string, the body will contain an
1536
+ * additional property, `message`.
1537
+ *
1538
+ * By default, `error` will contain a string with a short description of the HTTP error.
1539
+ * To override the entire JSON response body, pass an object instead.
1540
+ * Venok will serialize the object and return it as the JSON response body.
1541
+ *
1542
+ * @param info string or object describing the error condition.
1543
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1544
+ */
1545
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1546
+ }
1547
+
1548
+ /**
1549
+ * Defines an HTTP exception for *Not Implemented* type errors.
1550
+ *
1551
+ * @publicApi
1552
+ */
1553
+ declare class NotImplementedException extends HttpException {
1554
+ /**
1555
+ * Instantiate a `NotImplementedException` Exception.
1556
+ *
1557
+ * @example
1558
+ * `throw new NotImplementedException()`
1559
+ *
1560
+ * @usageNotes
1561
+ * The HTTP response status code will be 501.
1562
+ * - The `info` argument defines JSON object or the message string.
1563
+ * - The `descriptionOrOptions` argument contains either a short description of
1564
+ * the HTTP error or an options object used to provide an underlying error cause.
1565
+ *
1566
+ * By default, the JSON response body contains two properties:
1567
+ * - `statusCode`: this will be the value 501.
1568
+ * - `message`: the string `'Not Implemented'` by default;
1569
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1570
+ *
1571
+ * If the parameter `info` is a string, the body will contain an
1572
+ * additional property, `message`.
1573
+ *
1574
+ * By default, `error` will contain a string with a short description of the HTTP error.
1575
+ * To override the entire JSON response body, pass an object instead.
1576
+ * Venok will serialize the object and return it as the JSON response body.
1577
+ *
1578
+ * @param info string or object describing the error condition.
1579
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1580
+ */
1581
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1582
+ }
1583
+
1584
+ /**
1585
+ * Defines an HTTP exception for *Payload Too Large* type errors.
1586
+ *
1587
+ * @publicApi
1588
+ */
1589
+ declare class PayloadTooLargeException extends HttpException {
1590
+ /**
1591
+ * Instantiate a `PayloadTooLargeException` Exception.
1592
+ *
1593
+ * @example
1594
+ * `throw new PayloadTooLargeException()`
1595
+ *
1596
+ * @usageNotes
1597
+ * The HTTP response status code will be 413.
1598
+ * - The `info` argument defines JSON object or the message string.
1599
+ * - The `descriptionOrOptions` argument contains either a short description of
1600
+ * the HTTP error or an options object used to provide an underlying error cause.
1601
+ *
1602
+ * By default, the JSON response body contains two properties:
1603
+ * - `statusCode`: this will be the value 413.
1604
+ * - `message`: the string `'Payload Too Large'` by default;
1605
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1606
+ *
1607
+ * If the parameter `info` is a string, the body will contain an
1608
+ * additional property, `message`.
1609
+ *
1610
+ * By default, `error` will contain a string with a short description of the HTTP error.
1611
+ * To override the entire JSON response body, pass an object instead.
1612
+ * Venok will serialize the object and return it as the JSON response body.
1613
+ *
1614
+ * @param info string or object describing the error condition.
1615
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1616
+ */
1617
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1618
+ }
1619
+
1620
+ /**
1621
+ * Defines an HTTP exception for *Payment Required* type errors.
1622
+ *
1623
+ * @publicApi
1624
+ */
1625
+ declare class PaymentRequiredException extends HttpException {
1626
+ /**
1627
+ * Instantiate a `PaymentRequiredException` Exception.
1628
+ *
1629
+ * @example
1630
+ * `throw new PaymentRequiredException()`
1631
+ *
1632
+ * @usageNotes
1633
+ * The HTTP response status code will be 402.
1634
+ * - The `info` argument defines JSON object or the message string.
1635
+ * - The `descriptionOrOptions` argument contains either a short description of
1636
+ * the HTTP error or an options object used to provide an underlying error cause.
1637
+ *
1638
+ * By default, the JSON response body contains two properties:
1639
+ * - `statusCode`: this will be the value 402.
1640
+ * - `message`: the string `'Payment Required'` by default;
1641
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1642
+ *
1643
+ * If the parameter `info` is a string, the body will contain an
1644
+ * additional property, `message`.
1645
+ *
1646
+ * By default, `error` will contain a string with a short description of the HTTP error.
1647
+ * To override the entire JSON response body, pass an object instead.
1648
+ * Venok will serialize the object and return it as the JSON response body.
1649
+ *
1650
+ * @param info string or object describing the error condition.
1651
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1652
+ */
1653
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1654
+ }
1655
+
1656
+ /**
1657
+ * Defines an HTTP exception for *Precondition Failed* type errors.
1658
+ *
1659
+ * @publicApi
1660
+ */
1661
+ declare class PreconditionFailedException extends HttpException {
1662
+ /**
1663
+ * Instantiate a `PreconditionFailedException` Exception.
1664
+ *
1665
+ * @example
1666
+ * `throw new PreconditionFailedException()`
1667
+ *
1668
+ * @usageNotes
1669
+ * The HTTP response status code will be 412.
1670
+ * - The `info` argument defines JSON object or the message string.
1671
+ * - The `descriptionOrOptions` argument contains either a short description of
1672
+ * the HTTP error or an options object used to provide an underlying error cause.
1673
+ *
1674
+ * By default, the JSON response body contains two properties:
1675
+ * - `statusCode`: this will be the value 412.
1676
+ * - `message`: the string `'Precondition Failed'` by default;
1677
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1678
+ *
1679
+ * If the parameter `info` is a string, the body will contain an
1680
+ * additional property, `message`.
1681
+ *
1682
+ * By default, `error` will contain a string with a short description of the HTTP error.
1683
+ * To override the entire JSON response body, pass an object instead.
1684
+ * Venok will serialize the object and return it as the JSON response body.
1685
+ *
1686
+ * @param info string or object describing the error condition.
1687
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1688
+ */
1689
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1690
+ }
1691
+
1692
+ /**
1693
+ * Defines an HTTP exception for *Precondition Required* type errors.
1694
+ *
1695
+ * @publicApi
1696
+ */
1697
+ declare class PreconditionRequiredException extends HttpException {
1698
+ /**
1699
+ * Instantiate a `PreconditionRequiredException` Exception.
1700
+ *
1701
+ * @example
1702
+ * `throw new PreconditionRequiredException()`
1703
+ *
1704
+ * @usageNotes
1705
+ * The HTTP response status code will be 428.
1706
+ * - The `info` argument defines JSON object or the message string.
1707
+ * - The `descriptionOrOptions` argument contains either a short description of
1708
+ * the HTTP error or an options object used to provide an underlying error cause.
1709
+ *
1710
+ * By default, the JSON response body contains two properties:
1711
+ * - `statusCode`: this will be the value 428.
1712
+ * - `message`: the string `'Precondition Required'` by default;
1713
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1714
+ *
1715
+ * If the parameter `info` is a string, the body will contain an
1716
+ * additional property, `message`.
1717
+ *
1718
+ * By default, `error` will contain a string with a short description of the HTTP error.
1719
+ * To override the entire JSON response body, pass an object instead.
1720
+ * Venok will serialize the object and return it as the JSON response body.
1721
+ *
1722
+ * @param info string or object describing the error condition.
1723
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1724
+ */
1725
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1726
+ }
1727
+
1728
+ /**
1729
+ * Defines an HTTP exception for *Proxy Authentication Required* type errors.
1730
+ *
1731
+ * @publicApi
1732
+ */
1733
+ declare class ProxyAuthenticationRequiredException extends HttpException {
1734
+ /**
1735
+ * Instantiate a `ProxyAuthenticationRequiredException` Exception.
1736
+ *
1737
+ * @example
1738
+ * `throw new ProxyAuthenticationRequiredException()`
1739
+ *
1740
+ * @usageNotes
1741
+ * The HTTP response status code will be 407.
1742
+ * - The `info` argument defines JSON object or the message string.
1743
+ * - The `descriptionOrOptions` argument contains either a short description of
1744
+ * the HTTP error or an options object used to provide an underlying error cause.
1745
+ *
1746
+ * By default, the JSON response body contains two properties:
1747
+ * - `statusCode`: this will be the value 407.
1748
+ * - `message`: the string `'Proxy Authentication Required'` by default;
1749
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1750
+ *
1751
+ * If the parameter `info` is a string, the body will contain an
1752
+ * additional property, `message`.
1753
+ *
1754
+ * By default, `error` will contain a string with a short description of the HTTP error.
1755
+ * To override the entire JSON response body, pass an object instead.
1756
+ * Venok will serialize the object and return it as the JSON response body.
1757
+ *
1758
+ * @param info string or object describing the error condition.
1759
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1760
+ */
1761
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1762
+ }
1763
+
1764
+ /**
1765
+ * Defines an HTTP exception for *Request Timeout* type errors.
1766
+ *
1767
+ * @publicApi
1768
+ */
1769
+ declare class RequestTimeoutException extends HttpException {
1770
+ /**
1771
+ * Instantiate a `RequestTimeoutException` Exception.
1772
+ *
1773
+ * @example
1774
+ * `throw new RequestTimeoutException()`
1775
+ *
1776
+ * @usageNotes
1777
+ * The HTTP response status code will be 408.
1778
+ * - The `info` argument defines JSON object or the message string.
1779
+ * - The `descriptionOrOptions` argument contains either a short description of
1780
+ * the HTTP error or an options object used to provide an underlying error cause.
1781
+ *
1782
+ * By default, the JSON response body contains two properties:
1783
+ * - `statusCode`: this will be the value 408.
1784
+ * - `message`: the string `'Request Timeout'` by default;
1785
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1786
+ *
1787
+ * If the parameter `info` is a string, the body will contain an
1788
+ * additional property, `message`.
1789
+ *
1790
+ * By default, `error` will contain a string with a short description of the HTTP error.
1791
+ * To override the entire JSON response body, pass an object instead.
1792
+ * Venok will serialize the object and return it as the JSON response body.
1793
+ *
1794
+ * @param info string or object describing the error condition.
1795
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1796
+ */
1797
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1798
+ }
1799
+
1800
+ /**
1801
+ * Defines an HTTP exception for *Requested Range Not Satisfiable* type errors.
1802
+ *
1803
+ * @publicApi
1804
+ */
1805
+ declare class RequestedRangeNotSatisfiableException extends HttpException {
1806
+ /**
1807
+ * Instantiate a `RequestedRangeNotSatisfiableException` Exception.
1808
+ *
1809
+ * @example
1810
+ * `throw new RequestedRangeNotSatisfiableException()`
1811
+ *
1812
+ * @usageNotes
1813
+ * The HTTP response status code will be 416.
1814
+ * - The `info` argument defines JSON object or the message string.
1815
+ * - The `descriptionOrOptions` argument contains either a short description of
1816
+ * the HTTP error or an options object used to provide an underlying error cause.
1817
+ *
1818
+ * By default, the JSON response body contains two properties:
1819
+ * - `statusCode`: this will be the value 416.
1820
+ * - `message`: the string `'Requested Range Not Satisfiable'` by default;
1821
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1822
+ *
1823
+ * If the parameter `info` is a string, the body will contain an
1824
+ * additional property, `message`.
1825
+ *
1826
+ * By default, `error` will contain a string with a short description of the HTTP error.
1827
+ * To override the entire JSON response body, pass an object instead.
1828
+ * Venok will serialize the object and return it as the JSON response body.
1829
+ *
1830
+ * @param info string or object describing the error condition.
1831
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1832
+ */
1833
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1834
+ }
1835
+
1836
+ /**
1837
+ * Defines an HTTP exception for *Service Unavailable* type errors.
1838
+ *
1839
+ * @publicApi
1840
+ */
1841
+ declare class ServiceUnavailableException extends HttpException {
1842
+ /**
1843
+ * Instantiate a `ServiceUnavailableException` Exception.
1844
+ *
1845
+ * @example
1846
+ * `throw new ServiceUnavailableException()`
1847
+ *
1848
+ * @usageNotes
1849
+ * The HTTP response status code will be 503.
1850
+ * - The `info` argument defines JSON object or the message string.
1851
+ * - The `descriptionOrOptions` argument contains either a short description of
1852
+ * the HTTP error or an options object used to provide an underlying error cause.
1853
+ *
1854
+ * By default, the JSON response body contains two properties:
1855
+ * - `statusCode`: this will be the value 503.
1856
+ * - `message`: the string `'Service Unavailable'` by default;
1857
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1858
+ *
1859
+ * If the parameter `info` is a string, the body will contain an
1860
+ * additional property, `message`.
1861
+ *
1862
+ * By default, `error` will contain a string with a short description of the HTTP error.
1863
+ * To override the entire JSON response body, pass an object instead.
1864
+ * Venok will serialize the object and return it as the JSON response body.
1865
+ *
1866
+ * @param info string or object describing the error condition.
1867
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1868
+ */
1869
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1870
+ }
1871
+
1872
+ /**
1873
+ * Defines an HTTP exception for *Too Many Requests* type errors.
1874
+ *
1875
+ * @publicApi
1876
+ */
1877
+ declare class TooManyRequestsException extends HttpException {
1878
+ /**
1879
+ * Instantiate a `TooManyRequestsException` Exception.
1880
+ *
1881
+ * @example
1882
+ * `throw new TooManyRequestsException()`
1883
+ *
1884
+ * @usageNotes
1885
+ * The HTTP response status code will be 429.
1886
+ * - The `info` argument defines JSON object or the message string.
1887
+ * - The `descriptionOrOptions` argument contains either a short description of
1888
+ * the HTTP error or an options object used to provide an underlying error cause.
1889
+ *
1890
+ * By default, the JSON response body contains two properties:
1891
+ * - `statusCode`: this will be the value 429.
1892
+ * - `message`: the string `'Too Many Requests'` by default;
1893
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1894
+ *
1895
+ * If the parameter `info` is a string, the body will contain an
1896
+ * additional property, `message`.
1897
+ *
1898
+ * By default, `error` will contain a string with a short description of the HTTP error.
1899
+ * To override the entire JSON response body, pass an object instead.
1900
+ * Venok will serialize the object and return it as the JSON response body.
1901
+ *
1902
+ * @param info string or object describing the error condition.
1903
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1904
+ */
1905
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1906
+ }
1907
+
1908
+ /**
1909
+ * Defines an HTTP exception for *Unauthorized* type errors.
1910
+ *
1911
+ * @publicApi
1912
+ */
1913
+ declare class UnauthorizedException extends HttpException {
1914
+ /**
1915
+ * Instantiate a `UnauthorizedException` Exception.
1916
+ *
1917
+ * @example
1918
+ * `throw new UnauthorizedException()`
1919
+ *
1920
+ * @usageNotes
1921
+ * The HTTP response status code will be 401.
1922
+ * - The `info` argument defines JSON object or the message string.
1923
+ * - The `descriptionOrOptions` argument contains either a short description of
1924
+ * the HTTP error or an options object used to provide an underlying error cause.
1925
+ *
1926
+ * By default, the JSON response body contains two properties:
1927
+ * - `statusCode`: this will be the value 401.
1928
+ * - `message`: the string `'Unauthorized'` by default;
1929
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1930
+ *
1931
+ * If the parameter `info` is a string, the body will contain an
1932
+ * additional property, `message`.
1933
+ *
1934
+ * By default, `error` will contain a string with a short description of the HTTP error.
1935
+ * To override the entire JSON response body, pass an object instead.
1936
+ * Venok will serialize the object and return it as the JSON response body.
1937
+ *
1938
+ * @param info string or object describing the error condition.
1939
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1940
+ */
1941
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1942
+ }
1943
+
1944
+ /**
1945
+ * Defines an HTTP exception for *Unprocessable Entity* type errors.
1946
+ *
1947
+ * @publicApi
1948
+ */
1949
+ declare class UnprocessableEntityException extends HttpException {
1950
+ /**
1951
+ * Instantiate a `UnprocessableEntityException` Exception.
1952
+ *
1953
+ * @example
1954
+ * `throw new UnprocessableEntityException()`
1955
+ *
1956
+ * @usageNotes
1957
+ * The HTTP response status code will be 422.
1958
+ * - The `info` argument defines JSON object or the message string.
1959
+ * - The `descriptionOrOptions` argument contains either a short description of
1960
+ * the HTTP error or an options object used to provide an underlying error cause.
1961
+ *
1962
+ * By default, the JSON response body contains two properties:
1963
+ * - `statusCode`: this will be the value 422.
1964
+ * - `message`: the string `'Unprocessable Entity'` by default;
1965
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
1966
+ *
1967
+ * If the parameter `info` is a string, the body will contain an
1968
+ * additional property, `message`.
1969
+ *
1970
+ * By default, `error` will contain a string with a short description of the HTTP error.
1971
+ * To override the entire JSON response body, pass an object instead.
1972
+ * Venok will serialize the object and return it as the JSON response body.
1973
+ *
1974
+ * @param info string or object describing the error condition.
1975
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
1976
+ */
1977
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
1978
+ }
1979
+
1980
+ /**
1981
+ * Defines an HTTP exception for *Unsupported Media Type* type errors.
1982
+ *
1983
+ * @publicApi
1984
+ */
1985
+ declare class UnsupportedMediaTypeException extends HttpException {
1986
+ /**
1987
+ * Instantiate a `UnsupportedMediaTypeException` Exception.
1988
+ *
1989
+ * @example
1990
+ * `throw new UnsupportedMediaTypeException()`
1991
+ *
1992
+ * @usageNotes
1993
+ * The HTTP response status code will be 415.
1994
+ * - The `info` argument defines JSON object or the message string.
1995
+ * - The `descriptionOrOptions` argument contains either a short description of
1996
+ * the HTTP error or an options object used to provide an underlying error cause.
1997
+ *
1998
+ * By default, the JSON response body contains two properties:
1999
+ * - `statusCode`: this will be the value 415.
2000
+ * - `message`: the string `'Unsupported Media Type'` by default;
2001
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
2002
+ *
2003
+ * If the parameter `info` is a string, the body will contain an
2004
+ * additional property, `message`.
2005
+ *
2006
+ * By default, `error` will contain a string with a short description of the HTTP error.
2007
+ * To override the entire JSON response body, pass an object instead.
2008
+ * Venok will serialize the object and return it as the JSON response body.
2009
+ *
2010
+ * @param info string or object describing the error condition.
2011
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
2012
+ */
2013
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
2014
+ }
2015
+
2016
+ /**
2017
+ * Defines an HTTP exception for *URI Too Long* type errors.
2018
+ *
2019
+ * @publicApi
2020
+ */
2021
+ declare class UriTooLongException extends HttpException {
2022
+ /**
2023
+ * Instantiate a `UriTooLongException` Exception.
2024
+ *
2025
+ * @example
2026
+ * `throw new UriTooLongException()`
2027
+ *
2028
+ * @usageNotes
2029
+ * The HTTP response status code will be 414.
2030
+ * - The `info` argument defines JSON object or the message string.
2031
+ * - The `descriptionOrOptions` argument contains either a short description of
2032
+ * the HTTP error or an options object used to provide an underlying error cause.
2033
+ *
2034
+ * By default, the JSON response body contains two properties:
2035
+ * - `statusCode`: this will be the value 414.
2036
+ * - `message`: the string `'URI Too Long'` by default;
2037
+ * override this by supplying a string in the `descriptionOrOptions` parameter.
2038
+ *
2039
+ * If the parameter `info` is a string, the body will contain an
2040
+ * additional property, `message`.
2041
+ *
2042
+ * By default, `error` will contain a string with a short description of the HTTP error.
2043
+ * To override the entire JSON response body, pass an object instead.
2044
+ * Venok will serialize the object and return it as the JSON response body.
2045
+ *
2046
+ * @param info string or object describing the error condition.
2047
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
2048
+ */
2049
+ constructor(info?: string | object, descriptionOrOptions?: string | HttpExceptionOptions);
2050
+ }
2051
+
2052
+ declare class HttpExceptionFilter<T = any> implements ExceptionFilter<T> {
2053
+ protected readonly container: VenokContainer;
2054
+ private static readonly logger;
2055
+ private readonly context;
2056
+ constructor(container: VenokContainer);
2057
+ catch(exception: T, host: ArgumentsHost): void;
2058
+ handleUnknownError(exception: T, host: ArgumentsHost, applicationRef: AbstractHttpAdapter): void;
2059
+ isExceptionObject(err: any): err is Error;
2060
+ /**
2061
+ * Checks if the thrown error comes from the "http-errors" library.
2062
+ * @param err error object
2063
+ */
2064
+ isHttpError(err: any): err is {
2065
+ statusCode: number;
2066
+ message: string;
2067
+ };
2068
+ }
2069
+
2070
+ declare const mapToExcludeRoute: (routes: (string | RouteInfo)[]) => ExcludeRouteMetadata[];
2071
+ declare const filterMiddleware: <T extends Function | Type = any>(middleware: T[]) => Type<any>[];
2072
+ declare const mapToClass: <T extends Function | Type<any>>(middleware: T) => Type<any>;
2073
+ declare const isMiddlewareClass: (middleware: any) => middleware is Type;
2074
+ declare const assignToken: (metatype: Type, token?: string) => Type;
2075
+
2076
+ declare const addLeadingSlash: (path?: string) => string;
2077
+ declare const normalizePath: (path?: string) => string;
2078
+ declare const stripEndSlash: (path: string) => string;
2079
+ declare const isWildcard: (path: string) => boolean;
2080
+ declare const isParam: (path: string) => boolean;
2081
+ declare const isOptionalParam: (path: string) => boolean;
2082
+ type PathType = "static" | "param" | "optional-param" | "wildcard";
2083
+ declare const getPathType: (path: string) => PathType;
2084
+
2085
+ declare const isRequestMethodAll: (method: HttpMethod) => boolean;
2086
+ declare const isRouteExcluded: (excludedRoutes: ExcludeRouteMetadata[], path: string, requestMethod?: HttpMethod) => boolean;
2087
+ declare const flattenRoutePaths: (routes: Routes) => {
2088
+ module: any;
2089
+ path: string;
2090
+ }[];
2091
+
2092
+ declare const HttpConfigurableModuleClass: _venok_integration.ConfigurableModuleCls<HttpAppOptions, "register", "create", object>;
2093
+
2094
+ declare class HttpModule extends HttpConfigurableModuleClass {
2095
+ }
2096
+
2097
+ declare abstract class HttpMiddlewareModule implements VenokModule {
2098
+ abstract configure(consumer: HttpMiddlewareConsumer): void | Promise<void>;
2099
+ }
2100
+
2101
+ declare const ROUTES: unique symbol;
2102
+ declare const targetModulesByContainer: WeakMap<ModulesContainer, WeakSet<CoreModule>>;
2103
+ /**
2104
+ * @publicApi
2105
+ */
2106
+ declare class RouterModule {
2107
+ private readonly modulesContainer;
2108
+ private readonly routes;
2109
+ constructor(modulesContainer: ModulesContainer, routes: Routes);
2110
+ static register(routes: Routes): DynamicModule;
2111
+ private deepCloneRoutes;
2112
+ private initialize;
2113
+ private registerModulePathMetadata;
2114
+ private updateTargetModulesCache;
2115
+ }
2116
+
2117
+ export { AbstractHttpAdapter, type AdapterInstanceRouteMetadata, type AdapterMiddlewareMetadata, type AdapterPathMiddlewareMetadata, type AdapterRouteMetadata, All, BadGatewayException, BadRequestException, Body, ConflictException, Controller, type ControllerOptions, type CustomVersioningOptions, Delete, type DescriptionAndOptions, type ExcludeRouteMetadata, ExpectationFailedException, FailedDependencyException, ForbiddenException, GatewayTimeoutException, Get, type GlobalPrefixOptions, GoneException, HEADERS_METADATA, HOST_METADATA, Head, Header, type HeaderVersioningOptions, Headers, HostParam, type HttpAppOptions, HttpCode, HttpConfig, HttpContext, HttpException, type HttpExceptionBody, type HttpExceptionBodyMessage, HttpExceptionFilter, type HttpExceptionOptions, HttpMethod, type HttpMiddlewareConsumer, HttpMiddlewareModule, HttpModule, HttpParamtypes, HttpStatus, HttpVersionNotSupportedException, HttpVersioningType, ImATeapotException, InternalServerErrorException, Ip, LengthRequiredException, METHOD_METADATA, type MediaTypeVersioningOptions, MethodMapping, type MethodMappingMetadata, MethodNotAllowedException, type MiddlewareConfigProxy, MisdirectedException, MultipleUploadedFiles, NotAcceptableException, NotFoundException, NotImplementedException, Options, PATH_METADATA, Param, Patch, PayloadTooLargeException, PaymentRequiredException, Post, PreconditionFailedException, PreconditionRequiredException, ProxyAuthenticationRequiredException, Put, Query, REDIRECT_METADATA, RESPONSE_PASSTHROUGH_METADATA, ROUTES, Redirect, type RedirectOptions, RequestTimeoutException, RequestedRangeNotSatisfiableException, type ResponseDecoratorOptions, type RouteDefinition, type RouteInfo, type RoutePathMetadata, type RouteTree, RouterModule, type Routes, Search, ServiceUnavailableException, TooManyRequestsException, UnauthorizedException, UnprocessableEntityException, UnsupportedMediaTypeException, UploadedFile, UploadedFiles, UriTooLongException, type UriVersioningOptions, VENOK_ADAPTER_RESPONSE, VENOK_ADAPTER_TRANSFORM_NATIVE_ARGS_TO_CONTEXT, VENOK_APPLY_ROUTES_TO_INSTANCE, VERSION_METADATA, VERSION_NEUTRAL, Version, type VersionOptions, type VersionValue, type VersioningOptions, addLeadingSlash, assignToken, filterMiddleware, flattenRoutePaths, getPathType, isMiddlewareClass, isOptionalParam, isParam, isRequestMethodAll, isRouteExcluded, isWildcard, mapToClass, mapToExcludeRoute, normalizePath, stripEndSlash, targetModulesByContainer };