@venok/http 1.0.1-canary.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 (254) hide show
  1. package/adapter/adapter.d.ts +57 -0
  2. package/adapter/adapter.js +58 -0
  3. package/adapter/host.d.ts +27 -0
  4. package/adapter/host.js +33 -0
  5. package/application/application.d.ts +18 -0
  6. package/application/application.js +51 -0
  7. package/application/config.d.ts +16 -0
  8. package/application/config.js +47 -0
  9. package/application/http.module-defenition.d.ts +8 -0
  10. package/application/http.module-defenition.js +6 -0
  11. package/application/http.module.d.ts +3 -0
  12. package/application/http.module.js +21 -0
  13. package/application/http.service.d.ts +11 -0
  14. package/application/http.service.js +43 -0
  15. package/application/starter.d.ts +41 -0
  16. package/application/starter.js +140 -0
  17. package/constants.d.ts +12 -0
  18. package/constants.js +15 -0
  19. package/context/context.d.ts +56 -0
  20. package/context/context.js +102 -0
  21. package/context/response.controller.d.ts +30 -0
  22. package/context/response.controller.js +86 -0
  23. package/decorators/controller.decorator.d.ts +82 -0
  24. package/decorators/controller.decorator.js +53 -0
  25. package/decorators/header.decorator.d.ts +12 -0
  26. package/decorators/header.decorator.js +23 -0
  27. package/decorators/http-code.decorator.d.ts +9 -0
  28. package/decorators/http-code.decorator.js +19 -0
  29. package/decorators/index.d.ts +9 -0
  30. package/decorators/index.js +25 -0
  31. package/decorators/redirect.decorator.d.ts +6 -0
  32. package/decorators/redirect.decorator.js +16 -0
  33. package/decorators/render.decorator.d.ts +10 -0
  34. package/decorators/render.decorator.js +20 -0
  35. package/decorators/request-mapping.decorator.d.ts +78 -0
  36. package/decorators/request-mapping.decorator.js +98 -0
  37. package/decorators/route-params.decorator.d.ts +378 -0
  38. package/decorators/route-params.decorator.js +227 -0
  39. package/decorators/sse.decorator.d.ts +6 -0
  40. package/decorators/sse.decorator.js +20 -0
  41. package/decorators/version.decorator.d.ts +7 -0
  42. package/decorators/version.decorator.js +20 -0
  43. package/enums/http-status.enum.d.ts +53 -0
  44. package/enums/http-status.enum.js +57 -0
  45. package/enums/index.d.ts +4 -0
  46. package/enums/index.js +20 -0
  47. package/enums/request-method.enum.d.ts +11 -0
  48. package/enums/request-method.enum.js +15 -0
  49. package/enums/route-paramtypes.enum.d.ts +14 -0
  50. package/enums/route-paramtypes.enum.js +18 -0
  51. package/enums/version-type.enum.d.ts +9 -0
  52. package/enums/version-type.enum.js +13 -0
  53. package/errors/bad-gateway.exception.d.ts +33 -0
  54. package/errors/bad-gateway.exception.js +41 -0
  55. package/errors/bad-request.exception.d.ts +33 -0
  56. package/errors/bad-request.exception.js +41 -0
  57. package/errors/conflict.exception.d.ts +33 -0
  58. package/errors/conflict.exception.js +41 -0
  59. package/errors/forbidden.exception.d.ts +33 -0
  60. package/errors/forbidden.exception.js +41 -0
  61. package/errors/gateway-timeout.exception.d.ts +33 -0
  62. package/errors/gateway-timeout.exception.js +41 -0
  63. package/errors/gone.exception.d.ts +33 -0
  64. package/errors/gone.exception.js +41 -0
  65. package/errors/http-version-not-supported.exception.d.ts +33 -0
  66. package/errors/http-version-not-supported.exception.js +41 -0
  67. package/errors/http.exception.d.ts +79 -0
  68. package/errors/http.exception.js +123 -0
  69. package/errors/im-a-teapot.exception.d.ts +36 -0
  70. package/errors/im-a-teapot.exception.js +44 -0
  71. package/errors/index.d.ts +11 -0
  72. package/errors/index.js +27 -0
  73. package/errors/internal-server-error.exception.d.ts +33 -0
  74. package/errors/internal-server-error.exception.js +41 -0
  75. package/errors/invalid-middleware-configuration.exception.d.ts +4 -0
  76. package/errors/invalid-middleware-configuration.exception.js +11 -0
  77. package/errors/invalid-middleware.exception.d.ts +4 -0
  78. package/errors/invalid-middleware.exception.js +11 -0
  79. package/errors/not-found.exception.d.ts +33 -0
  80. package/errors/not-found.exception.js +41 -0
  81. package/errors/unknown-request-mapping.exception.d.ts +5 -0
  82. package/errors/unknown-request-mapping.exception.js +11 -0
  83. package/exceptions/messages.d.ts +4 -0
  84. package/exceptions/messages.js +13 -0
  85. package/explorers/path.explorer.d.ts +8 -0
  86. package/explorers/path.explorer.js +38 -0
  87. package/explorers/router.explorer.d.ts +51 -0
  88. package/explorers/router.explorer.js +195 -0
  89. package/factory/context-id.factory.d.ts +41 -0
  90. package/factory/context-id.factory.js +52 -0
  91. package/factory/index.d.ts +4 -0
  92. package/factory/index.js +20 -0
  93. package/factory/method.factory.d.ts +5 -0
  94. package/factory/method.factory.js +30 -0
  95. package/factory/params.factory.d.ts +5 -0
  96. package/factory/params.factory.js +39 -0
  97. package/factory/path.factory.d.ts +13 -0
  98. package/factory/path.factory.js +95 -0
  99. package/filters/context.d.ts +9 -0
  100. package/filters/context.js +15 -0
  101. package/filters/filter.d.ts +22 -0
  102. package/filters/filter.js +78 -0
  103. package/helpers/adapter.helper.d.ts +27 -0
  104. package/helpers/adapter.helper.js +37 -0
  105. package/helpers/exclude-route.helper.d.ts +4 -0
  106. package/helpers/exclude-route.helper.js +18 -0
  107. package/helpers/flatten-routes.helper.d.ts +5 -0
  108. package/helpers/flatten-routes.helper.js +27 -0
  109. package/helpers/index.d.ts +6 -0
  110. package/helpers/index.js +22 -0
  111. package/helpers/messages.helper.d.ts +6 -0
  112. package/helpers/messages.helper.js +25 -0
  113. package/helpers/path.helper.d.ts +3 -0
  114. package/helpers/path.helper.js +13 -0
  115. package/helpers/sse.helper.d.ts +45 -0
  116. package/helpers/sse.helper.js +83 -0
  117. package/index.d.ts +1 -0
  118. package/index.js +3 -0
  119. package/interfaces/http/cors.interface.d.ts +58 -0
  120. package/interfaces/http/cors.interface.js +2 -0
  121. package/interfaces/http/exception.interface.d.ts +6 -0
  122. package/interfaces/http/exception.interface.js +2 -0
  123. package/interfaces/http/exclude-route.interface.d.ts +15 -0
  124. package/interfaces/http/exclude-route.interface.js +2 -0
  125. package/interfaces/http/index.d.ts +10 -0
  126. package/interfaces/http/index.js +26 -0
  127. package/interfaces/http/message-event.interface.d.ts +6 -0
  128. package/interfaces/http/message-event.interface.js +2 -0
  129. package/interfaces/http/module.inteface.d.ts +5 -0
  130. package/interfaces/http/module.inteface.js +2 -0
  131. package/interfaces/http/options.interface.d.ts +127 -0
  132. package/interfaces/http/options.interface.js +2 -0
  133. package/interfaces/http/path-metadata.interface.d.ts +31 -0
  134. package/interfaces/http/path-metadata.interface.js +2 -0
  135. package/interfaces/http/prefix-options.interface.d.ts +7 -0
  136. package/interfaces/http/prefix-options.interface.js +2 -0
  137. package/interfaces/http/raw-request.d.ts +4 -0
  138. package/interfaces/http/raw-request.js +2 -0
  139. package/interfaces/http/routes.interface.d.ts +7 -0
  140. package/interfaces/http/routes.interface.js +2 -0
  141. package/interfaces/http/server.interface.d.ts +54 -0
  142. package/interfaces/http/server.interface.js +2 -0
  143. package/interfaces/index.d.ts +3 -0
  144. package/interfaces/index.js +19 -0
  145. package/interfaces/middleware/config-proxy.interface.d.ts +23 -0
  146. package/interfaces/middleware/config-proxy.interface.js +2 -0
  147. package/interfaces/middleware/configuration.interface.d.ts +12 -0
  148. package/interfaces/middleware/configuration.interface.js +2 -0
  149. package/interfaces/middleware/consumer.interface.d.ts +16 -0
  150. package/interfaces/middleware/consumer.interface.js +2 -0
  151. package/interfaces/middleware/index.d.ts +4 -0
  152. package/interfaces/middleware/index.js +20 -0
  153. package/interfaces/middleware/middleware.interface.d.ts +7 -0
  154. package/interfaces/middleware/middleware.interface.js +2 -0
  155. package/interfaces/router/callback-paramtypes.interface.d.ts +1 -0
  156. package/interfaces/router/callback-paramtypes.interface.js +2 -0
  157. package/interfaces/router/definition.interface.d.ts +10 -0
  158. package/interfaces/router/definition.interface.js +2 -0
  159. package/interfaces/router/index.d.ts +3 -0
  160. package/interfaces/router/index.js +19 -0
  161. package/interfaces/router/version-options.interface.d.ts +92 -0
  162. package/interfaces/router/version-options.interface.js +9 -0
  163. package/middleware/builder.d.ts +15 -0
  164. package/middleware/builder.js +78 -0
  165. package/middleware/container.d.ts +13 -0
  166. package/middleware/container.js +50 -0
  167. package/middleware/extractor.d.ts +15 -0
  168. package/middleware/extractor.js +50 -0
  169. package/middleware/index.d.ts +1 -0
  170. package/middleware/index.js +17 -0
  171. package/middleware/module.d.ts +33 -0
  172. package/middleware/module.js +180 -0
  173. package/middleware/resolver.d.ts +10 -0
  174. package/middleware/resolver.js +27 -0
  175. package/middleware/routes-mapper.d.ts +19 -0
  176. package/middleware/routes-mapper.js +111 -0
  177. package/middleware/utils.d.ts +8 -0
  178. package/middleware/utils.js +86 -0
  179. package/package.json +41 -0
  180. package/router/module.d.ts +18 -0
  181. package/router/module.js +88 -0
  182. package/router/resolver.d.ts +31 -0
  183. package/router/resolver.js +128 -0
  184. package/storage/http-instance.storage.d.ts +9 -0
  185. package/storage/http-instance.storage.js +19 -0
  186. package/stream/index.d.ts +1 -0
  187. package/stream/index.js +17 -0
  188. package/stream/interfaces/index.d.ts +2 -0
  189. package/stream/interfaces/index.js +18 -0
  190. package/stream/interfaces/streamable-handler-response.interface.d.ts +12 -0
  191. package/stream/interfaces/streamable-handler-response.interface.js +2 -0
  192. package/stream/interfaces/streamable-options.interface.d.ts +10 -0
  193. package/stream/interfaces/streamable-options.interface.js +2 -0
  194. package/stream/streamable-file.d.ts +22 -0
  195. package/stream/streamable-file.js +55 -0
  196. package/test/context/response.controller.spec.d.ts +1 -0
  197. package/test/context/response.controller.spec.js +328 -0
  198. package/test/decorators/controller.decorator.spec.d.ts +1 -0
  199. package/test/decorators/controller.decorator.spec.js +113 -0
  200. package/test/decorators/header.decorator.spec.d.ts +1 -0
  201. package/test/decorators/header.decorator.spec.js +33 -0
  202. package/test/decorators/http-code.decorator.spec.d.ts +1 -0
  203. package/test/decorators/http-code.decorator.spec.js +30 -0
  204. package/test/decorators/redirect.decorator.spec.d.ts +1 -0
  205. package/test/decorators/redirect.decorator.spec.js +36 -0
  206. package/test/decorators/render.decorator.spec.d.ts +1 -0
  207. package/test/decorators/render.decorator.spec.js +30 -0
  208. package/test/decorators/request-mapping.decorator.spec.d.ts +1 -0
  209. package/test/decorators/request-mapping.decorator.spec.js +85 -0
  210. package/test/decorators/route-params.decorator.spec.d.ts +1 -0
  211. package/test/decorators/route-params.decorator.spec.js +493 -0
  212. package/test/decorators/sse.decorator.spec.d.ts +1 -0
  213. package/test/decorators/sse.decorator.spec.js +35 -0
  214. package/test/decorators/version.decorator.spec.d.ts +1 -0
  215. package/test/decorators/version.decorator.spec.js +43 -0
  216. package/test/exceptions/handler.spec.d.ts +1 -0
  217. package/test/exceptions/handler.spec.js +145 -0
  218. package/test/exceptions/proxy.spec.d.ts +1 -0
  219. package/test/exceptions/proxy.spec.js +74 -0
  220. package/test/explorers/path.explorer.spec.d.ts +1 -0
  221. package/test/explorers/path.explorer.spec.js +190 -0
  222. package/test/explorers/router.explorer.spec.d.ts +1 -0
  223. package/test/explorers/router.explorer.spec.js +206 -0
  224. package/test/factory/method.factory.spec.d.ts +1 -0
  225. package/test/factory/method.factory.spec.js +33 -0
  226. package/test/factory/params.factory.spec.d.ts +1 -0
  227. package/test/factory/params.factory.spec.js +104 -0
  228. package/test/factory/path.factory.spec.d.ts +1 -0
  229. package/test/factory/path.factory.spec.js +260 -0
  230. package/test/filters/context.spec.d.ts +1 -0
  231. package/test/filters/context.spec.js +96 -0
  232. package/test/filters/filter.spec.d.ts +1 -0
  233. package/test/filters/filter.spec.js +96 -0
  234. package/test/helpers/flatten-routes.helper.spec.d.ts +1 -0
  235. package/test/helpers/flatten-routes.helper.spec.js +131 -0
  236. package/test/helpers/sse.helper.spec.d.ts +1 -0
  237. package/test/helpers/sse.helper.spec.js +132 -0
  238. package/test/middleware/builder.spec.d.ts +1 -0
  239. package/test/middleware/builder.spec.js +235 -0
  240. package/test/middleware/container.spec.d.ts +1 -0
  241. package/test/middleware/container.spec.js +81 -0
  242. package/test/middleware/module.spec.d.ts +1 -0
  243. package/test/middleware/module.spec.js +206 -0
  244. package/test/middleware/route-info-path-extractor.spec.d.ts +1 -0
  245. package/test/middleware/route-info-path-extractor.spec.js +123 -0
  246. package/test/middleware/routes-mapper.spec.d.ts +1 -0
  247. package/test/middleware/routes-mapper.spec.js +162 -0
  248. package/test/middleware/utils.spec.d.ts +1 -0
  249. package/test/middleware/utils.spec.js +132 -0
  250. package/test/router/module.spec.d.ts +1 -0
  251. package/test/router/module.spec.js +40 -0
  252. package/test/router/resolver.spec.d.ts +1 -0
  253. package/test/router/resolver.spec.js +326 -0
  254. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Sse = void 0;
4
+ const constants_1 = require("@venok/http/constants");
5
+ const enums_1 = require("@venok/http/enums");
6
+ /**
7
+ * Declares this route as a Server-Sent-Events endpoint
8
+ *
9
+ * @publicApi
10
+ */
11
+ function Sse(path) {
12
+ return (target, key, descriptor) => {
13
+ path = path && path.length ? path : "/";
14
+ Reflect.defineMetadata(constants_1.PATH_METADATA, path, descriptor.value);
15
+ Reflect.defineMetadata(constants_1.METHOD_METADATA, enums_1.RequestMethod.GET, descriptor.value);
16
+ Reflect.defineMetadata(constants_1.SSE_METADATA, true, descriptor.value);
17
+ return descriptor;
18
+ };
19
+ }
20
+ exports.Sse = Sse;
@@ -0,0 +1,7 @@
1
+ import { VersionValue } from "../interfaces";
2
+ /**
3
+ * Sets the version of the endpoint to the passed version
4
+ *
5
+ * @publicApi
6
+ */
7
+ export declare function Version(version: VersionValue): MethodDecorator;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Version = void 0;
4
+ const constants_1 = require("@venok/http/constants");
5
+ /**
6
+ * Sets the version of the endpoint to the passed version
7
+ *
8
+ * @publicApi
9
+ */
10
+ function Version(version) {
11
+ if (Array.isArray(version)) {
12
+ // Drop duplicated versions
13
+ version = Array.from(new Set(version));
14
+ }
15
+ return (target, key, descriptor) => {
16
+ Reflect.defineMetadata(constants_1.VERSION_METADATA, version, descriptor.value);
17
+ return descriptor;
18
+ };
19
+ }
20
+ exports.Version = Version;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @publicApi
3
+ */
4
+ export declare enum HttpStatus {
5
+ CONTINUE = 100,
6
+ SWITCHING_PROTOCOLS = 101,
7
+ PROCESSING = 102,
8
+ EARLYHINTS = 103,
9
+ OK = 200,
10
+ CREATED = 201,
11
+ ACCEPTED = 202,
12
+ NON_AUTHORITATIVE_INFORMATION = 203,
13
+ NO_CONTENT = 204,
14
+ RESET_CONTENT = 205,
15
+ PARTIAL_CONTENT = 206,
16
+ AMBIGUOUS = 300,
17
+ MOVED_PERMANENTLY = 301,
18
+ FOUND = 302,
19
+ SEE_OTHER = 303,
20
+ NOT_MODIFIED = 304,
21
+ TEMPORARY_REDIRECT = 307,
22
+ PERMANENT_REDIRECT = 308,
23
+ BAD_REQUEST = 400,
24
+ UNAUTHORIZED = 401,
25
+ PAYMENT_REQUIRED = 402,
26
+ FORBIDDEN = 403,
27
+ NOT_FOUND = 404,
28
+ METHOD_NOT_ALLOWED = 405,
29
+ NOT_ACCEPTABLE = 406,
30
+ PROXY_AUTHENTICATION_REQUIRED = 407,
31
+ REQUEST_TIMEOUT = 408,
32
+ CONFLICT = 409,
33
+ GONE = 410,
34
+ LENGTH_REQUIRED = 411,
35
+ PRECONDITION_FAILED = 412,
36
+ PAYLOAD_TOO_LARGE = 413,
37
+ URI_TOO_LONG = 414,
38
+ UNSUPPORTED_MEDIA_TYPE = 415,
39
+ REQUESTED_RANGE_NOT_SATISFIABLE = 416,
40
+ EXPECTATION_FAILED = 417,
41
+ I_AM_A_TEAPOT = 418,
42
+ MISDIRECTED = 421,
43
+ UNPROCESSABLE_ENTITY = 422,
44
+ FAILED_DEPENDENCY = 424,
45
+ PRECONDITION_REQUIRED = 428,
46
+ TOO_MANY_REQUESTS = 429,
47
+ INTERNAL_SERVER_ERROR = 500,
48
+ NOT_IMPLEMENTED = 501,
49
+ BAD_GATEWAY = 502,
50
+ SERVICE_UNAVAILABLE = 503,
51
+ GATEWAY_TIMEOUT = 504,
52
+ HTTP_VERSION_NOT_SUPPORTED = 505
53
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpStatus = void 0;
4
+ /**
5
+ * @publicApi
6
+ */
7
+ var HttpStatus;
8
+ (function (HttpStatus) {
9
+ HttpStatus[HttpStatus["CONTINUE"] = 100] = "CONTINUE";
10
+ HttpStatus[HttpStatus["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
11
+ HttpStatus[HttpStatus["PROCESSING"] = 102] = "PROCESSING";
12
+ HttpStatus[HttpStatus["EARLYHINTS"] = 103] = "EARLYHINTS";
13
+ HttpStatus[HttpStatus["OK"] = 200] = "OK";
14
+ HttpStatus[HttpStatus["CREATED"] = 201] = "CREATED";
15
+ HttpStatus[HttpStatus["ACCEPTED"] = 202] = "ACCEPTED";
16
+ HttpStatus[HttpStatus["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
17
+ HttpStatus[HttpStatus["NO_CONTENT"] = 204] = "NO_CONTENT";
18
+ HttpStatus[HttpStatus["RESET_CONTENT"] = 205] = "RESET_CONTENT";
19
+ HttpStatus[HttpStatus["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
20
+ HttpStatus[HttpStatus["AMBIGUOUS"] = 300] = "AMBIGUOUS";
21
+ HttpStatus[HttpStatus["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
22
+ HttpStatus[HttpStatus["FOUND"] = 302] = "FOUND";
23
+ HttpStatus[HttpStatus["SEE_OTHER"] = 303] = "SEE_OTHER";
24
+ HttpStatus[HttpStatus["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
25
+ HttpStatus[HttpStatus["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
26
+ HttpStatus[HttpStatus["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
27
+ HttpStatus[HttpStatus["BAD_REQUEST"] = 400] = "BAD_REQUEST";
28
+ HttpStatus[HttpStatus["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
29
+ HttpStatus[HttpStatus["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
30
+ HttpStatus[HttpStatus["FORBIDDEN"] = 403] = "FORBIDDEN";
31
+ HttpStatus[HttpStatus["NOT_FOUND"] = 404] = "NOT_FOUND";
32
+ HttpStatus[HttpStatus["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
33
+ HttpStatus[HttpStatus["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
34
+ HttpStatus[HttpStatus["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
35
+ HttpStatus[HttpStatus["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
36
+ HttpStatus[HttpStatus["CONFLICT"] = 409] = "CONFLICT";
37
+ HttpStatus[HttpStatus["GONE"] = 410] = "GONE";
38
+ HttpStatus[HttpStatus["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
39
+ HttpStatus[HttpStatus["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
40
+ HttpStatus[HttpStatus["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
41
+ HttpStatus[HttpStatus["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
42
+ HttpStatus[HttpStatus["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
43
+ HttpStatus[HttpStatus["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
44
+ HttpStatus[HttpStatus["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
45
+ HttpStatus[HttpStatus["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
46
+ HttpStatus[HttpStatus["MISDIRECTED"] = 421] = "MISDIRECTED";
47
+ HttpStatus[HttpStatus["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
48
+ HttpStatus[HttpStatus["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
49
+ HttpStatus[HttpStatus["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
50
+ HttpStatus[HttpStatus["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
51
+ HttpStatus[HttpStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
52
+ HttpStatus[HttpStatus["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
53
+ HttpStatus[HttpStatus["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
54
+ HttpStatus[HttpStatus["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
55
+ HttpStatus[HttpStatus["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
56
+ HttpStatus[HttpStatus["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
57
+ })(HttpStatus || (exports.HttpStatus = HttpStatus = {}));
@@ -0,0 +1,4 @@
1
+ export * from "./request-method.enum";
2
+ export * from "./http-status.enum";
3
+ export * from "./route-paramtypes.enum";
4
+ export * from "./version-type.enum";
package/enums/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./request-method.enum"), exports);
18
+ __exportStar(require("./http-status.enum"), exports);
19
+ __exportStar(require("./route-paramtypes.enum"), exports);
20
+ __exportStar(require("./version-type.enum"), exports);
@@ -0,0 +1,11 @@
1
+ export declare enum RequestMethod {
2
+ GET = 0,
3
+ POST = 1,
4
+ PUT = 2,
5
+ DELETE = 3,
6
+ PATCH = 4,
7
+ ALL = 5,
8
+ OPTIONS = 6,
9
+ HEAD = 7,
10
+ SEARCH = 8
11
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RequestMethod = void 0;
4
+ var RequestMethod;
5
+ (function (RequestMethod) {
6
+ RequestMethod[RequestMethod["GET"] = 0] = "GET";
7
+ RequestMethod[RequestMethod["POST"] = 1] = "POST";
8
+ RequestMethod[RequestMethod["PUT"] = 2] = "PUT";
9
+ RequestMethod[RequestMethod["DELETE"] = 3] = "DELETE";
10
+ RequestMethod[RequestMethod["PATCH"] = 4] = "PATCH";
11
+ RequestMethod[RequestMethod["ALL"] = 5] = "ALL";
12
+ RequestMethod[RequestMethod["OPTIONS"] = 6] = "OPTIONS";
13
+ RequestMethod[RequestMethod["HEAD"] = 7] = "HEAD";
14
+ RequestMethod[RequestMethod["SEARCH"] = 8] = "SEARCH";
15
+ })(RequestMethod || (exports.RequestMethod = RequestMethod = {}));
@@ -0,0 +1,14 @@
1
+ export declare enum RouteParamtypes {
2
+ REQUEST = 0,
3
+ RESPONSE = 1,
4
+ NEXT = 2,
5
+ BODY = 3,
6
+ QUERY = 4,
7
+ PARAM = 5,
8
+ HEADERS = 6,
9
+ SESSION = 7,
10
+ FILE = 8,
11
+ FILES = 9,
12
+ HOST = 10,
13
+ IP = 11
14
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RouteParamtypes = void 0;
4
+ var RouteParamtypes;
5
+ (function (RouteParamtypes) {
6
+ RouteParamtypes[RouteParamtypes["REQUEST"] = 0] = "REQUEST";
7
+ RouteParamtypes[RouteParamtypes["RESPONSE"] = 1] = "RESPONSE";
8
+ RouteParamtypes[RouteParamtypes["NEXT"] = 2] = "NEXT";
9
+ RouteParamtypes[RouteParamtypes["BODY"] = 3] = "BODY";
10
+ RouteParamtypes[RouteParamtypes["QUERY"] = 4] = "QUERY";
11
+ RouteParamtypes[RouteParamtypes["PARAM"] = 5] = "PARAM";
12
+ RouteParamtypes[RouteParamtypes["HEADERS"] = 6] = "HEADERS";
13
+ RouteParamtypes[RouteParamtypes["SESSION"] = 7] = "SESSION";
14
+ RouteParamtypes[RouteParamtypes["FILE"] = 8] = "FILE";
15
+ RouteParamtypes[RouteParamtypes["FILES"] = 9] = "FILES";
16
+ RouteParamtypes[RouteParamtypes["HOST"] = 10] = "HOST";
17
+ RouteParamtypes[RouteParamtypes["IP"] = 11] = "IP";
18
+ })(RouteParamtypes || (exports.RouteParamtypes = RouteParamtypes = {}));
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @publicApi
3
+ */
4
+ export declare enum VersioningType {
5
+ URI = 0,
6
+ HEADER = 1,
7
+ MEDIA_TYPE = 2,
8
+ CUSTOM = 3
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VersioningType = void 0;
4
+ /**
5
+ * @publicApi
6
+ */
7
+ var VersioningType;
8
+ (function (VersioningType) {
9
+ VersioningType[VersioningType["URI"] = 0] = "URI";
10
+ VersioningType[VersioningType["HEADER"] = 1] = "HEADER";
11
+ VersioningType[VersioningType["MEDIA_TYPE"] = 2] = "MEDIA_TYPE";
12
+ VersioningType[VersioningType["CUSTOM"] = 3] = "CUSTOM";
13
+ })(VersioningType || (exports.VersioningType = VersioningType = {}));
@@ -0,0 +1,33 @@
1
+ import { HttpException, HttpExceptionOptions } from "./http.exception";
2
+ /**
3
+ * Defines an HTTP exception for *Bad Gateway* type errors.
4
+ *
5
+ * @publicApi
6
+ */
7
+ export declare class BadGatewayException extends HttpException {
8
+ /**
9
+ * Instantiate a `BadGatewayException` Exception.
10
+ *
11
+ * @example
12
+ * `throw new BadGatewayException()`
13
+ *
14
+ * @usageNotes
15
+ * The HTTP response status code will be 502.
16
+ * - The `objectOrError` argument defines the JSON response body or the message string.
17
+ * - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
18
+ *
19
+ * By default, the JSON response body contains two properties:
20
+ * - `statusCode`: this will be the value 502.
21
+ * - `message`: the string `'Bad Gateway'` by default; override this by supplying
22
+ * a string in the `objectOrError` parameter.
23
+ *
24
+ * If the parameter `objectOrError` is a string, the response body will contain an
25
+ * additional property, `error`, with a short description of the HTTP error. To override the
26
+ * entire JSON response body, pass an object instead. Venok will serialize the object
27
+ * and return it as the JSON response body.
28
+ *
29
+ * @param objectOrError string or object describing the error condition.
30
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
31
+ */
32
+ constructor(objectOrError?: string | object | any, descriptionOrOptions?: string | HttpExceptionOptions);
33
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BadGatewayException = void 0;
4
+ const enums_1 = require("../enums");
5
+ const http_exception_1 = require("./http.exception");
6
+ /**
7
+ * Defines an HTTP exception for *Bad Gateway* type errors.
8
+ *
9
+ * @publicApi
10
+ */
11
+ class BadGatewayException extends http_exception_1.HttpException {
12
+ /**
13
+ * Instantiate a `BadGatewayException` Exception.
14
+ *
15
+ * @example
16
+ * `throw new BadGatewayException()`
17
+ *
18
+ * @usageNotes
19
+ * The HTTP response status code will be 502.
20
+ * - The `objectOrError` argument defines the JSON response body or the message string.
21
+ * - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
22
+ *
23
+ * By default, the JSON response body contains two properties:
24
+ * - `statusCode`: this will be the value 502.
25
+ * - `message`: the string `'Bad Gateway'` by default; override this by supplying
26
+ * a string in the `objectOrError` parameter.
27
+ *
28
+ * If the parameter `objectOrError` is a string, the response body will contain an
29
+ * additional property, `error`, with a short description of the HTTP error. To override the
30
+ * entire JSON response body, pass an object instead. Venok will serialize the object
31
+ * and return it as the JSON response body.
32
+ *
33
+ * @param objectOrError string or object describing the error condition.
34
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
35
+ */
36
+ constructor(objectOrError, descriptionOrOptions = "Bad Gateway") {
37
+ const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
38
+ super(http_exception_1.HttpException.createBody(objectOrError, description, enums_1.HttpStatus.BAD_GATEWAY), enums_1.HttpStatus.BAD_GATEWAY, httpExceptionOptions);
39
+ }
40
+ }
41
+ exports.BadGatewayException = BadGatewayException;
@@ -0,0 +1,33 @@
1
+ import { HttpException, HttpExceptionOptions } from "./http.exception";
2
+ /**
3
+ * Defines an HTTP exception for *Bad Request* type errors.
4
+ *
5
+ * @publicApi
6
+ */
7
+ export declare class BadRequestException extends HttpException {
8
+ /**
9
+ * Instantiate a `BadRequestException` Exception.
10
+ *
11
+ * @example
12
+ * `throw new BadRequestException()`
13
+ *
14
+ * @usageNotes
15
+ * The HTTP response status code will be 400.
16
+ * - The `objectOrError` argument defines the JSON response body or the message string.
17
+ * - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
18
+ *
19
+ * By default, the JSON response body contains two properties:
20
+ * - `statusCode`: this will be the value 400.
21
+ * - `message`: the string `'Bad Request'` by default; override this by supplying
22
+ * a string in the `objectOrError` parameter.
23
+ *
24
+ * If the parameter `objectOrError` is a string, the response body will contain an
25
+ * additional property, `error`, with a short description of the HTTP error. To override the
26
+ * entire JSON response body, pass an object instead. Venok will serialize the object
27
+ * and return it as the JSON response body.
28
+ *
29
+ * @param objectOrError string or object describing the error condition.
30
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
31
+ */
32
+ constructor(objectOrError?: string | object | any, descriptionOrOptions?: string | HttpExceptionOptions);
33
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BadRequestException = void 0;
4
+ const enums_1 = require("../enums");
5
+ const http_exception_1 = require("./http.exception");
6
+ /**
7
+ * Defines an HTTP exception for *Bad Request* type errors.
8
+ *
9
+ * @publicApi
10
+ */
11
+ class BadRequestException extends http_exception_1.HttpException {
12
+ /**
13
+ * Instantiate a `BadRequestException` Exception.
14
+ *
15
+ * @example
16
+ * `throw new BadRequestException()`
17
+ *
18
+ * @usageNotes
19
+ * The HTTP response status code will be 400.
20
+ * - The `objectOrError` argument defines the JSON response body or the message string.
21
+ * - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
22
+ *
23
+ * By default, the JSON response body contains two properties:
24
+ * - `statusCode`: this will be the value 400.
25
+ * - `message`: the string `'Bad Request'` by default; override this by supplying
26
+ * a string in the `objectOrError` parameter.
27
+ *
28
+ * If the parameter `objectOrError` is a string, the response body will contain an
29
+ * additional property, `error`, with a short description of the HTTP error. To override the
30
+ * entire JSON response body, pass an object instead. Venok will serialize the object
31
+ * and return it as the JSON response body.
32
+ *
33
+ * @param objectOrError string or object describing the error condition.
34
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
35
+ */
36
+ constructor(objectOrError, descriptionOrOptions = "Bad Request") {
37
+ const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
38
+ super(http_exception_1.HttpException.createBody(objectOrError, description, enums_1.HttpStatus.BAD_REQUEST), enums_1.HttpStatus.BAD_REQUEST, httpExceptionOptions);
39
+ }
40
+ }
41
+ exports.BadRequestException = BadRequestException;
@@ -0,0 +1,33 @@
1
+ import { HttpException, HttpExceptionOptions } from "./http.exception";
2
+ /**
3
+ * Defines an HTTP exception for *Conflict* type errors.
4
+ *
5
+ * @publicApi
6
+ */
7
+ export declare class ConflictException extends HttpException {
8
+ /**
9
+ * Instantiate a `ConflictException` Exception.
10
+ *
11
+ * @example
12
+ * `throw new ConflictException()`
13
+ *
14
+ * @usageNotes
15
+ * The HTTP response status code will be 409.
16
+ * - The `objectOrError` argument defines the JSON response body or the message string.
17
+ * - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
18
+ *
19
+ * By default, the JSON response body contains two properties:
20
+ * - `statusCode`: this will be the value 409.
21
+ * - `message`: the string `'Conflict'` by default; override this by supplying
22
+ * a string in the `objectOrError` parameter.
23
+ *
24
+ * If the parameter `objectOrError` is a string, the response body will contain an
25
+ * additional property, `error`, with a short description of the HTTP error. To override the
26
+ * entire JSON response body, pass an object instead. Venok will serialize the object
27
+ * and return it as the JSON response body.
28
+ *
29
+ * @param objectOrError string or object describing the error condition.
30
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
31
+ */
32
+ constructor(objectOrError?: string | object | any, descriptionOrOptions?: string | HttpExceptionOptions);
33
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConflictException = void 0;
4
+ const enums_1 = require("../enums");
5
+ const http_exception_1 = require("./http.exception");
6
+ /**
7
+ * Defines an HTTP exception for *Conflict* type errors.
8
+ *
9
+ * @publicApi
10
+ */
11
+ class ConflictException extends http_exception_1.HttpException {
12
+ /**
13
+ * Instantiate a `ConflictException` Exception.
14
+ *
15
+ * @example
16
+ * `throw new ConflictException()`
17
+ *
18
+ * @usageNotes
19
+ * The HTTP response status code will be 409.
20
+ * - The `objectOrError` argument defines the JSON response body or the message string.
21
+ * - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
22
+ *
23
+ * By default, the JSON response body contains two properties:
24
+ * - `statusCode`: this will be the value 409.
25
+ * - `message`: the string `'Conflict'` by default; override this by supplying
26
+ * a string in the `objectOrError` parameter.
27
+ *
28
+ * If the parameter `objectOrError` is a string, the response body will contain an
29
+ * additional property, `error`, with a short description of the HTTP error. To override the
30
+ * entire JSON response body, pass an object instead. Venok will serialize the object
31
+ * and return it as the JSON response body.
32
+ *
33
+ * @param objectOrError string or object describing the error condition.
34
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
35
+ */
36
+ constructor(objectOrError, descriptionOrOptions = "Conflict") {
37
+ const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
38
+ super(http_exception_1.HttpException.createBody(objectOrError, description, enums_1.HttpStatus.CONFLICT), enums_1.HttpStatus.CONFLICT, httpExceptionOptions);
39
+ }
40
+ }
41
+ exports.ConflictException = ConflictException;
@@ -0,0 +1,33 @@
1
+ import { HttpException, HttpExceptionOptions } from "./http.exception";
2
+ /**
3
+ * Defines an HTTP exception for *Forbidden* type errors.
4
+ *
5
+ * @publicApi
6
+ */
7
+ export declare class ForbiddenException extends HttpException {
8
+ /**
9
+ * Instantiate a `ForbiddenException` Exception.
10
+ *
11
+ * @example
12
+ * `throw new ForbiddenException()`
13
+ *
14
+ * @usageNotes
15
+ * The HTTP response status code will be 403.
16
+ * - The `objectOrError` argument defines the JSON response body or the message string.
17
+ * - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
18
+ *
19
+ * By default, the JSON response body contains two properties:
20
+ * - `statusCode`: this will be the value 403.
21
+ * - `message`: the string `'Forbidden'` by default; override this by supplying
22
+ * a string in the `objectOrError` parameter.
23
+ *
24
+ * If the parameter `objectOrError` is a string, the response body will contain an
25
+ * additional property, `error`, with a short description of the HTTP error. To override the
26
+ * entire JSON response body, pass an object instead. Venok will serialize the object
27
+ * and return it as the JSON response body.
28
+ *
29
+ * @param objectOrError string or object describing the error condition.
30
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
31
+ */
32
+ constructor(objectOrError?: string | object | any, descriptionOrOptions?: string | HttpExceptionOptions);
33
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ForbiddenException = void 0;
4
+ const enums_1 = require("../enums");
5
+ const http_exception_1 = require("./http.exception");
6
+ /**
7
+ * Defines an HTTP exception for *Forbidden* type errors.
8
+ *
9
+ * @publicApi
10
+ */
11
+ class ForbiddenException extends http_exception_1.HttpException {
12
+ /**
13
+ * Instantiate a `ForbiddenException` Exception.
14
+ *
15
+ * @example
16
+ * `throw new ForbiddenException()`
17
+ *
18
+ * @usageNotes
19
+ * The HTTP response status code will be 403.
20
+ * - The `objectOrError` argument defines the JSON response body or the message string.
21
+ * - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
22
+ *
23
+ * By default, the JSON response body contains two properties:
24
+ * - `statusCode`: this will be the value 403.
25
+ * - `message`: the string `'Forbidden'` by default; override this by supplying
26
+ * a string in the `objectOrError` parameter.
27
+ *
28
+ * If the parameter `objectOrError` is a string, the response body will contain an
29
+ * additional property, `error`, with a short description of the HTTP error. To override the
30
+ * entire JSON response body, pass an object instead. Venok will serialize the object
31
+ * and return it as the JSON response body.
32
+ *
33
+ * @param objectOrError string or object describing the error condition.
34
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
35
+ */
36
+ constructor(objectOrError, descriptionOrOptions = "Forbidden") {
37
+ const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
38
+ super(http_exception_1.HttpException.createBody(objectOrError, description, enums_1.HttpStatus.FORBIDDEN), enums_1.HttpStatus.FORBIDDEN, httpExceptionOptions);
39
+ }
40
+ }
41
+ exports.ForbiddenException = ForbiddenException;
@@ -0,0 +1,33 @@
1
+ import { HttpException, HttpExceptionOptions } from "./http.exception";
2
+ /**
3
+ * Defines an HTTP exception for *Gateway Timeout* type errors.
4
+ *
5
+ * @publicApi
6
+ */
7
+ export declare class GatewayTimeoutException extends HttpException {
8
+ /**
9
+ * Instantiate a `GatewayTimeoutException` Exception.
10
+ *
11
+ * @example
12
+ * `throw new GatewayTimeoutException()`
13
+ *
14
+ * @usageNotes
15
+ * The HTTP response status code will be 504.
16
+ * - The `objectOrError` argument defines the JSON response body or the message string.
17
+ * - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
18
+ *
19
+ * By default, the JSON response body contains two properties:
20
+ * - `statusCode`: this will be the value 504.
21
+ * - `message`: the string `'Gateway Timeout'` by default; override this by supplying
22
+ * a string in the `objectOrError` parameter.
23
+ *
24
+ * If the parameter `objectOrError` is a string, the response body will contain an
25
+ * additional property, `error`, with a short description of the HTTP error. To override the
26
+ * entire JSON response body, pass an object instead. Venok will serialize the object
27
+ * and return it as the JSON response body.
28
+ *
29
+ * @param objectOrError string or object describing the error condition.
30
+ * @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
31
+ */
32
+ constructor(objectOrError?: string | object | any, descriptionOrOptions?: string | HttpExceptionOptions);
33
+ }