@venok/http 1.1.0 → 2.0.1-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -1,85 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const chai_1 = require("chai");
13
- const enums_1 = require("@venok/http/enums");
14
- const decorators_1 = require("@venok/http/decorators");
15
- describe("@RequestMapping", () => {
16
- const requestProps = {
17
- path: "test",
18
- method: enums_1.RequestMethod.ALL,
19
- };
20
- const requestPropsUsingArray = {
21
- path: ["foo", "bar"],
22
- method: enums_1.RequestMethod.ALL,
23
- };
24
- it("should enhance class with expected request metadata", () => {
25
- class Test {
26
- static test() { }
27
- static testUsingArray() { }
28
- }
29
- __decorate([
30
- (0, decorators_1.RequestMapping)(requestProps),
31
- __metadata("design:type", Function),
32
- __metadata("design:paramtypes", []),
33
- __metadata("design:returntype", void 0)
34
- ], Test, "test", null);
35
- __decorate([
36
- (0, decorators_1.RequestMapping)(requestPropsUsingArray),
37
- __metadata("design:type", Function),
38
- __metadata("design:paramtypes", []),
39
- __metadata("design:returntype", void 0)
40
- ], Test, "testUsingArray", null);
41
- const path = Reflect.getMetadata("path", Test.test);
42
- const method = Reflect.getMetadata("method", Test.test);
43
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
44
- const methodUsingArray = Reflect.getMetadata("method", Test.testUsingArray);
45
- (0, chai_1.expect)(path).to.be.eql(requestProps.path);
46
- (0, chai_1.expect)(method).to.be.eql(requestProps.method);
47
- (0, chai_1.expect)(pathUsingArray).to.be.eql(requestPropsUsingArray.path);
48
- (0, chai_1.expect)(methodUsingArray).to.be.eql(requestPropsUsingArray.method);
49
- });
50
- it("should set request method on GET by default", () => {
51
- class Test {
52
- static test() { }
53
- }
54
- __decorate([
55
- (0, decorators_1.RequestMapping)({ path: "" }),
56
- __metadata("design:type", Function),
57
- __metadata("design:paramtypes", []),
58
- __metadata("design:returntype", void 0)
59
- ], Test, "test", null);
60
- const method = Reflect.getMetadata("method", Test.test);
61
- (0, chai_1.expect)(method).to.be.eql(enums_1.RequestMethod.GET);
62
- });
63
- it('should set path on "/" by default', () => {
64
- class Test {
65
- static test() { }
66
- static testUsingArray() { }
67
- }
68
- __decorate([
69
- (0, decorators_1.RequestMapping)({}),
70
- __metadata("design:type", Function),
71
- __metadata("design:paramtypes", []),
72
- __metadata("design:returntype", void 0)
73
- ], Test, "test", null);
74
- __decorate([
75
- (0, decorators_1.RequestMapping)({ path: [] }),
76
- __metadata("design:type", Function),
77
- __metadata("design:paramtypes", []),
78
- __metadata("design:returntype", void 0)
79
- ], Test, "testUsingArray", null);
80
- const path = Reflect.getMetadata("path", Test.test);
81
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
82
- (0, chai_1.expect)(path).to.be.eql("/");
83
- (0, chai_1.expect)(pathUsingArray).to.be.eql("/");
84
- });
85
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,493 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const chai_1 = require("chai");
16
- const enums_1 = require("@venok/http/enums");
17
- const decorators_1 = require("@venok/http/decorators");
18
- describe("@Get", () => {
19
- const requestPath = "test";
20
- const requestProps = {
21
- path: requestPath,
22
- method: enums_1.RequestMethod.GET,
23
- };
24
- const requestPathUsingArray = ["foo", "bar"];
25
- const requestPropsUsingArray = {
26
- path: requestPathUsingArray,
27
- method: enums_1.RequestMethod.GET,
28
- };
29
- it("should enhance class with expected request metadata", () => {
30
- class Test {
31
- static test(params) { }
32
- static testUsingArray(params) { }
33
- }
34
- __decorate([
35
- (0, decorators_1.Get)(requestPath),
36
- __param(0, (0, decorators_1.Param)("id")),
37
- __metadata("design:type", Function),
38
- __metadata("design:paramtypes", [Object]),
39
- __metadata("design:returntype", void 0)
40
- ], Test, "test", null);
41
- __decorate([
42
- (0, decorators_1.Get)(requestPathUsingArray),
43
- __param(0, (0, decorators_1.Param)("id")),
44
- __metadata("design:type", Function),
45
- __metadata("design:paramtypes", [Object]),
46
- __metadata("design:returntype", void 0)
47
- ], Test, "testUsingArray", null);
48
- const path = Reflect.getMetadata("path", Test.test);
49
- const method = Reflect.getMetadata("method", Test.test);
50
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
51
- const methodUsingArray = Reflect.getMetadata("method", Test.testUsingArray);
52
- (0, chai_1.expect)(path).to.be.eql(requestPath);
53
- (0, chai_1.expect)(method).to.be.eql(requestProps.method);
54
- (0, chai_1.expect)(pathUsingArray).to.be.eql(requestPathUsingArray);
55
- (0, chai_1.expect)(methodUsingArray).to.be.eql(requestPropsUsingArray.method);
56
- });
57
- it('should set path on "/" by default', () => {
58
- class Test {
59
- static test() { }
60
- static testUsingArray() { }
61
- }
62
- __decorate([
63
- (0, decorators_1.Get)(),
64
- __metadata("design:type", Function),
65
- __metadata("design:paramtypes", []),
66
- __metadata("design:returntype", void 0)
67
- ], Test, "test", null);
68
- __decorate([
69
- (0, decorators_1.Get)([]),
70
- __metadata("design:type", Function),
71
- __metadata("design:paramtypes", []),
72
- __metadata("design:returntype", void 0)
73
- ], Test, "testUsingArray", null);
74
- const path = Reflect.getMetadata("path", Test.test);
75
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
76
- (0, chai_1.expect)(path).to.be.eql("/");
77
- (0, chai_1.expect)(pathUsingArray).to.be.eql("/");
78
- });
79
- });
80
- describe("@Post", () => {
81
- const requestPath = "test";
82
- const requestProps = {
83
- path: requestPath,
84
- method: enums_1.RequestMethod.POST,
85
- };
86
- const requestPathUsingArray = ["foo", "bar"];
87
- const requestPropsUsingArray = {
88
- path: requestPathUsingArray,
89
- method: enums_1.RequestMethod.POST,
90
- };
91
- it("should enhance class with expected request metadata", () => {
92
- class Test {
93
- static test() { }
94
- static testUsingArray() { }
95
- }
96
- __decorate([
97
- (0, decorators_1.Post)(requestPath),
98
- __metadata("design:type", Function),
99
- __metadata("design:paramtypes", []),
100
- __metadata("design:returntype", void 0)
101
- ], Test, "test", null);
102
- __decorate([
103
- (0, decorators_1.Post)(requestPathUsingArray),
104
- __metadata("design:type", Function),
105
- __metadata("design:paramtypes", []),
106
- __metadata("design:returntype", void 0)
107
- ], Test, "testUsingArray", null);
108
- const path = Reflect.getMetadata("path", Test.test);
109
- const method = Reflect.getMetadata("method", Test.test);
110
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
111
- const methodUsingArray = Reflect.getMetadata("method", Test.testUsingArray);
112
- (0, chai_1.expect)(path).to.be.eql(requestPath);
113
- (0, chai_1.expect)(method).to.be.eql(requestProps.method);
114
- (0, chai_1.expect)(pathUsingArray).to.be.eql(requestPathUsingArray);
115
- (0, chai_1.expect)(methodUsingArray).to.be.eql(requestPropsUsingArray.method);
116
- });
117
- it('should set path on "/" by default', () => {
118
- class Test {
119
- static test(query, params, hostParams) { }
120
- static testUsingArray(query, params, hostParams) { }
121
- }
122
- __decorate([
123
- (0, decorators_1.Post)(),
124
- __param(0, (0, decorators_1.Query)()),
125
- __param(1, (0, decorators_1.Param)()),
126
- __param(2, (0, decorators_1.HostParam)()),
127
- __metadata("design:type", Function),
128
- __metadata("design:paramtypes", [Object, Object, Object]),
129
- __metadata("design:returntype", void 0)
130
- ], Test, "test", null);
131
- __decorate([
132
- (0, decorators_1.Post)([]),
133
- __param(0, (0, decorators_1.Query)()),
134
- __param(1, (0, decorators_1.Param)()),
135
- __param(2, (0, decorators_1.HostParam)()),
136
- __metadata("design:type", Function),
137
- __metadata("design:paramtypes", [Object, Object, Object]),
138
- __metadata("design:returntype", void 0)
139
- ], Test, "testUsingArray", null);
140
- const path = Reflect.getMetadata("path", Test.test);
141
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
142
- (0, chai_1.expect)(path).to.be.eql("/");
143
- (0, chai_1.expect)(pathUsingArray).to.be.eql("/");
144
- });
145
- });
146
- describe("@Delete", () => {
147
- const requestPath = "test";
148
- const requestProps = {
149
- path: requestPath,
150
- method: enums_1.RequestMethod.DELETE,
151
- };
152
- const requestPathUsingArray = ["foo", "bar"];
153
- const requestPropsUsingArray = {
154
- path: requestPathUsingArray,
155
- method: enums_1.RequestMethod.DELETE,
156
- };
157
- it("should enhance class with expected request metadata", () => {
158
- class Test {
159
- static test(body) { }
160
- static testUsingArray(body) { }
161
- }
162
- __decorate([
163
- (0, decorators_1.Delete)(requestPath),
164
- __param(0, (0, decorators_1.Body)()),
165
- __metadata("design:type", Function),
166
- __metadata("design:paramtypes", [Object]),
167
- __metadata("design:returntype", void 0)
168
- ], Test, "test", null);
169
- __decorate([
170
- (0, decorators_1.Delete)(requestPathUsingArray),
171
- __param(0, (0, decorators_1.Body)()),
172
- __metadata("design:type", Function),
173
- __metadata("design:paramtypes", [Object]),
174
- __metadata("design:returntype", void 0)
175
- ], Test, "testUsingArray", null);
176
- const path = Reflect.getMetadata("path", Test.test);
177
- const method = Reflect.getMetadata("method", Test.test);
178
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
179
- const methodUsingArray = Reflect.getMetadata("method", Test.testUsingArray);
180
- (0, chai_1.expect)(path).to.be.eql(requestPath);
181
- (0, chai_1.expect)(method).to.be.eql(requestProps.method);
182
- (0, chai_1.expect)(pathUsingArray).to.be.eql(requestPathUsingArray);
183
- (0, chai_1.expect)(methodUsingArray).to.be.eql(requestPropsUsingArray.method);
184
- });
185
- it('should set path on "/" by default', () => {
186
- class Test {
187
- static test() { }
188
- static testUsingArray() { }
189
- }
190
- __decorate([
191
- (0, decorators_1.Delete)(),
192
- __metadata("design:type", Function),
193
- __metadata("design:paramtypes", []),
194
- __metadata("design:returntype", void 0)
195
- ], Test, "test", null);
196
- __decorate([
197
- (0, decorators_1.Delete)([]),
198
- __metadata("design:type", Function),
199
- __metadata("design:paramtypes", []),
200
- __metadata("design:returntype", void 0)
201
- ], Test, "testUsingArray", null);
202
- const path = Reflect.getMetadata("path", Test.test);
203
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
204
- (0, chai_1.expect)(path).to.be.eql("/");
205
- (0, chai_1.expect)(pathUsingArray).to.be.eql("/");
206
- });
207
- });
208
- describe("@All", () => {
209
- const requestPath = "test";
210
- const requestProps = {
211
- path: requestPath,
212
- method: enums_1.RequestMethod.ALL,
213
- };
214
- const requestPathUsingArray = ["foo", "bar"];
215
- const requestPropsUsingArray = {
216
- path: requestPathUsingArray,
217
- method: enums_1.RequestMethod.ALL,
218
- };
219
- it("should enhance class with expected request metadata", () => {
220
- class Test {
221
- static test() { }
222
- static testUsingArray() { }
223
- }
224
- __decorate([
225
- (0, decorators_1.All)(requestPath),
226
- __metadata("design:type", Function),
227
- __metadata("design:paramtypes", []),
228
- __metadata("design:returntype", void 0)
229
- ], Test, "test", null);
230
- __decorate([
231
- (0, decorators_1.All)(requestPathUsingArray),
232
- __metadata("design:type", Function),
233
- __metadata("design:paramtypes", []),
234
- __metadata("design:returntype", void 0)
235
- ], Test, "testUsingArray", null);
236
- const path = Reflect.getMetadata("path", Test.test);
237
- const method = Reflect.getMetadata("method", Test.test);
238
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
239
- const methodUsingArray = Reflect.getMetadata("method", Test.testUsingArray);
240
- (0, chai_1.expect)(path).to.be.eql(requestPath);
241
- (0, chai_1.expect)(method).to.be.eql(requestProps.method);
242
- (0, chai_1.expect)(pathUsingArray).to.be.eql(requestPathUsingArray);
243
- (0, chai_1.expect)(methodUsingArray).to.be.eql(requestPropsUsingArray.method);
244
- });
245
- it('should set path on "/" by default', () => {
246
- class Test {
247
- static test() { }
248
- static testUsingArray() { }
249
- }
250
- __decorate([
251
- (0, decorators_1.All)(),
252
- __metadata("design:type", Function),
253
- __metadata("design:paramtypes", []),
254
- __metadata("design:returntype", void 0)
255
- ], Test, "test", null);
256
- __decorate([
257
- (0, decorators_1.All)([]),
258
- __metadata("design:type", Function),
259
- __metadata("design:paramtypes", []),
260
- __metadata("design:returntype", void 0)
261
- ], Test, "testUsingArray", null);
262
- const path = Reflect.getMetadata("path", Test.test);
263
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
264
- (0, chai_1.expect)(path).to.be.eql("/");
265
- (0, chai_1.expect)(pathUsingArray).to.be.eql("/");
266
- });
267
- });
268
- describe("@Put", () => {
269
- const requestPath = "test";
270
- const requestProps = {
271
- path: requestPath,
272
- method: enums_1.RequestMethod.PUT,
273
- };
274
- const requestPathUsingArray = ["foo", "bar"];
275
- const requestPropsUsingArray = {
276
- path: requestPathUsingArray,
277
- method: enums_1.RequestMethod.PUT,
278
- };
279
- it("should enhance class with expected request metadata", () => {
280
- class Test {
281
- static test() { }
282
- static testUsingArray() { }
283
- }
284
- __decorate([
285
- (0, decorators_1.Put)(requestPath),
286
- __metadata("design:type", Function),
287
- __metadata("design:paramtypes", []),
288
- __metadata("design:returntype", void 0)
289
- ], Test, "test", null);
290
- __decorate([
291
- (0, decorators_1.Put)(requestPathUsingArray),
292
- __metadata("design:type", Function),
293
- __metadata("design:paramtypes", []),
294
- __metadata("design:returntype", void 0)
295
- ], Test, "testUsingArray", null);
296
- const path = Reflect.getMetadata("path", Test.test);
297
- const method = Reflect.getMetadata("method", Test.test);
298
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
299
- const methodUsingArray = Reflect.getMetadata("method", Test.testUsingArray);
300
- (0, chai_1.expect)(path).to.be.eql(requestPath);
301
- (0, chai_1.expect)(method).to.be.eql(requestProps.method);
302
- (0, chai_1.expect)(pathUsingArray).to.be.eql(requestPathUsingArray);
303
- (0, chai_1.expect)(methodUsingArray).to.be.eql(requestPropsUsingArray.method);
304
- });
305
- it('should set path on "/" by default', () => {
306
- class Test {
307
- static test() { }
308
- static testUsingArray() { }
309
- }
310
- __decorate([
311
- (0, decorators_1.Put)(),
312
- __metadata("design:type", Function),
313
- __metadata("design:paramtypes", []),
314
- __metadata("design:returntype", void 0)
315
- ], Test, "test", null);
316
- __decorate([
317
- (0, decorators_1.Put)([]),
318
- __metadata("design:type", Function),
319
- __metadata("design:paramtypes", []),
320
- __metadata("design:returntype", void 0)
321
- ], Test, "testUsingArray", null);
322
- const path = Reflect.getMetadata("path", Test.test);
323
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
324
- (0, chai_1.expect)(path).to.be.eql("/");
325
- (0, chai_1.expect)(pathUsingArray).to.be.eql("/");
326
- });
327
- });
328
- describe("@Patch", () => {
329
- const requestPath = "test";
330
- const requestProps = {
331
- path: requestPath,
332
- method: enums_1.RequestMethod.PATCH,
333
- };
334
- const requestPathUsingArray = ["foo", "bar"];
335
- const requestPropsUsingArray = {
336
- path: requestPathUsingArray,
337
- method: enums_1.RequestMethod.PATCH,
338
- };
339
- it("should enhance class with expected request metadata", () => {
340
- class Test {
341
- static test() { }
342
- static testUsingArray() { }
343
- }
344
- __decorate([
345
- (0, decorators_1.Patch)(requestPath),
346
- __metadata("design:type", Function),
347
- __metadata("design:paramtypes", []),
348
- __metadata("design:returntype", void 0)
349
- ], Test, "test", null);
350
- __decorate([
351
- (0, decorators_1.Patch)(requestPathUsingArray),
352
- __metadata("design:type", Function),
353
- __metadata("design:paramtypes", []),
354
- __metadata("design:returntype", void 0)
355
- ], Test, "testUsingArray", null);
356
- const path = Reflect.getMetadata("path", Test.test);
357
- const method = Reflect.getMetadata("method", Test.test);
358
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
359
- const methodUsingArray = Reflect.getMetadata("method", Test.testUsingArray);
360
- (0, chai_1.expect)(path).to.be.eql(requestPath);
361
- (0, chai_1.expect)(method).to.be.eql(requestProps.method);
362
- (0, chai_1.expect)(pathUsingArray).to.be.eql(requestPathUsingArray);
363
- (0, chai_1.expect)(methodUsingArray).to.be.eql(requestPropsUsingArray.method);
364
- });
365
- it('should set path on "/" by default', () => {
366
- class Test {
367
- static test() { }
368
- static testUsingArray() { }
369
- }
370
- __decorate([
371
- (0, decorators_1.Patch)(),
372
- __metadata("design:type", Function),
373
- __metadata("design:paramtypes", []),
374
- __metadata("design:returntype", void 0)
375
- ], Test, "test", null);
376
- __decorate([
377
- (0, decorators_1.Patch)([]),
378
- __metadata("design:type", Function),
379
- __metadata("design:paramtypes", []),
380
- __metadata("design:returntype", void 0)
381
- ], Test, "testUsingArray", null);
382
- const path = Reflect.getMetadata("path", Test.test);
383
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
384
- (0, chai_1.expect)(path).to.be.eql("/");
385
- (0, chai_1.expect)(pathUsingArray).to.be.eql("/");
386
- });
387
- });
388
- describe("@Search", () => {
389
- const requestPath = "test";
390
- const requestProps = {
391
- path: requestPath,
392
- method: enums_1.RequestMethod.SEARCH,
393
- };
394
- const requestPathUsingArray = ["foo", "bar"];
395
- const requestPropsUsingArray = {
396
- path: requestPathUsingArray,
397
- method: enums_1.RequestMethod.SEARCH,
398
- };
399
- it("should enhance class with expected request metadata", () => {
400
- class Test {
401
- static test() { }
402
- static testUsingArray() { }
403
- }
404
- __decorate([
405
- (0, decorators_1.Search)(requestPath),
406
- __metadata("design:type", Function),
407
- __metadata("design:paramtypes", []),
408
- __metadata("design:returntype", void 0)
409
- ], Test, "test", null);
410
- __decorate([
411
- (0, decorators_1.Search)(requestPathUsingArray),
412
- __metadata("design:type", Function),
413
- __metadata("design:paramtypes", []),
414
- __metadata("design:returntype", void 0)
415
- ], Test, "testUsingArray", null);
416
- const path = Reflect.getMetadata("path", Test.test);
417
- const method = Reflect.getMetadata("method", Test.test);
418
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
419
- const methodUsingArray = Reflect.getMetadata("method", Test.testUsingArray);
420
- (0, chai_1.expect)(path).to.be.eql(requestPath);
421
- (0, chai_1.expect)(method).to.be.eql(requestProps.method);
422
- (0, chai_1.expect)(pathUsingArray).to.be.eql(requestPathUsingArray);
423
- (0, chai_1.expect)(methodUsingArray).to.be.eql(requestPropsUsingArray.method);
424
- });
425
- it('should set path on "/" by default', () => {
426
- class Test {
427
- static test(query, params, hostParams) { }
428
- static testUsingArray(query, params, hostParams) { }
429
- }
430
- __decorate([
431
- (0, decorators_1.Search)(),
432
- __param(0, (0, decorators_1.Query)()),
433
- __param(1, (0, decorators_1.Param)()),
434
- __param(2, (0, decorators_1.HostParam)()),
435
- __metadata("design:type", Function),
436
- __metadata("design:paramtypes", [Object, Object, Object]),
437
- __metadata("design:returntype", void 0)
438
- ], Test, "test", null);
439
- __decorate([
440
- (0, decorators_1.Search)([]),
441
- __param(0, (0, decorators_1.Query)()),
442
- __param(1, (0, decorators_1.Param)()),
443
- __param(2, (0, decorators_1.HostParam)()),
444
- __metadata("design:type", Function),
445
- __metadata("design:paramtypes", [Object, Object, Object]),
446
- __metadata("design:returntype", void 0)
447
- ], Test, "testUsingArray", null);
448
- const path = Reflect.getMetadata("path", Test.test);
449
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
450
- (0, chai_1.expect)(path).to.be.eql("/");
451
- (0, chai_1.expect)(pathUsingArray).to.be.eql("/");
452
- });
453
- });
454
- describe("Inheritance", () => {
455
- const requestPath = "test";
456
- const requestProps = {
457
- path: requestPath,
458
- method: enums_1.RequestMethod.GET,
459
- };
460
- const requestPathUsingArray = ["foo", "bar"];
461
- const requestPropsUsingArray = {
462
- path: requestPathUsingArray,
463
- method: enums_1.RequestMethod.GET,
464
- };
465
- it("should enhance subclass with expected request metadata", () => {
466
- class Parent {
467
- static test() { }
468
- static testUsingArray() { }
469
- }
470
- __decorate([
471
- (0, decorators_1.Get)(requestPath),
472
- __metadata("design:type", Function),
473
- __metadata("design:paramtypes", []),
474
- __metadata("design:returntype", void 0)
475
- ], Parent, "test", null);
476
- __decorate([
477
- (0, decorators_1.Get)(requestPathUsingArray),
478
- __metadata("design:type", Function),
479
- __metadata("design:paramtypes", []),
480
- __metadata("design:returntype", void 0)
481
- ], Parent, "testUsingArray", null);
482
- class Test extends Parent {
483
- }
484
- const path = Reflect.getMetadata("path", Test.test);
485
- const method = Reflect.getMetadata("method", Test.test);
486
- const pathUsingArray = Reflect.getMetadata("path", Test.testUsingArray);
487
- const methodUsingArray = Reflect.getMetadata("method", Test.testUsingArray);
488
- (0, chai_1.expect)(path).to.be.eql(requestPath);
489
- (0, chai_1.expect)(method).to.be.eql(requestProps.method);
490
- (0, chai_1.expect)(pathUsingArray).to.be.eql(requestPathUsingArray);
491
- (0, chai_1.expect)(methodUsingArray).to.be.eql(requestPropsUsingArray.method);
492
- });
493
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const chai_1 = require("chai");
13
- const constants_1 = require("@venok/http/constants");
14
- const decorators_1 = require("@venok/http/decorators");
15
- const enums_1 = require("@venok/http/enums");
16
- describe("@Sse", () => {
17
- const prefix = "/prefix";
18
- class Test {
19
- static test() { }
20
- }
21
- __decorate([
22
- (0, decorators_1.Sse)(prefix),
23
- __metadata("design:type", Function),
24
- __metadata("design:paramtypes", []),
25
- __metadata("design:returntype", void 0)
26
- ], Test, "test", null);
27
- it("should enhance method with expected http status code", () => {
28
- const path = Reflect.getMetadata(constants_1.PATH_METADATA, Test.test);
29
- (0, chai_1.expect)(path).to.be.eql("/prefix");
30
- const method = Reflect.getMetadata(constants_1.METHOD_METADATA, Test.test);
31
- (0, chai_1.expect)(method).to.be.eql(enums_1.RequestMethod.GET);
32
- const metadata = Reflect.getMetadata(constants_1.SSE_METADATA, Test.test);
33
- (0, chai_1.expect)(metadata).to.be.eql(true);
34
- });
35
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const chai_1 = require("chai");
13
- const decorators_1 = require("@venok/http/decorators");
14
- const constants_1 = require("@venok/http/constants");
15
- describe("@Version", () => {
16
- const version = "1";
17
- const versions = ["1", "2", "2", "1", "2", "1"];
18
- const versionsWithoutDuplicates = ["1", "2"];
19
- class Test {
20
- static oneVersion() { }
21
- static multipleVersions() { }
22
- }
23
- __decorate([
24
- (0, decorators_1.Version)(version),
25
- __metadata("design:type", Function),
26
- __metadata("design:paramtypes", []),
27
- __metadata("design:returntype", void 0)
28
- ], Test, "oneVersion", null);
29
- __decorate([
30
- (0, decorators_1.Version)(versions),
31
- __metadata("design:type", Function),
32
- __metadata("design:paramtypes", []),
33
- __metadata("design:returntype", void 0)
34
- ], Test, "multipleVersions", null);
35
- it("should enhance method with expected version string", () => {
36
- const metadata = Reflect.getMetadata(constants_1.VERSION_METADATA, Test.oneVersion);
37
- (0, chai_1.expect)(metadata).to.be.eql(version);
38
- });
39
- it("should enhance method with expected version array", () => {
40
- const metadata = Reflect.getMetadata(constants_1.VERSION_METADATA, Test.multipleVersions);
41
- (0, chai_1.expect)(metadata).to.be.eql(versionsWithoutDuplicates);
42
- });
43
- });
@@ -1 +0,0 @@
1
- export {};