routup 0.1.4 → 0.3.0-alpha.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 (101) hide show
  1. package/dist/decorators/controller/index.d.ts +2 -0
  2. package/dist/decorators/controller/index.d.ts.map +1 -0
  3. package/dist/decorators/controller/index.js +24 -0
  4. package/dist/decorators/controller/index.js.map +1 -0
  5. package/dist/decorators/controller/module.d.ts +4 -0
  6. package/dist/decorators/controller/module.d.ts.map +1 -0
  7. package/dist/decorators/controller/module.js +29 -0
  8. package/dist/decorators/controller/module.js.map +1 -0
  9. package/dist/decorators/index.d.ts +5 -0
  10. package/dist/decorators/index.d.ts.map +1 -0
  11. package/dist/decorators/index.js +27 -0
  12. package/dist/decorators/index.js.map +1 -0
  13. package/dist/decorators/method/arguments.d.ts +4 -0
  14. package/dist/decorators/method/arguments.d.ts.map +1 -0
  15. package/dist/decorators/method/arguments.js +22 -0
  16. package/dist/decorators/method/arguments.js.map +1 -0
  17. package/dist/decorators/method/index.d.ts +4 -0
  18. package/dist/decorators/method/index.d.ts.map +1 -0
  19. package/dist/decorators/method/index.js +26 -0
  20. package/dist/decorators/method/index.js.map +1 -0
  21. package/dist/decorators/method/module.d.ts +8 -0
  22. package/dist/decorators/method/module.d.ts.map +1 -0
  23. package/dist/decorators/method/module.js +46 -0
  24. package/dist/decorators/method/module.js.map +1 -0
  25. package/dist/decorators/method/type.d.ts +7 -0
  26. package/dist/decorators/method/type.d.ts.map +1 -0
  27. package/dist/decorators/method/type.js +9 -0
  28. package/dist/decorators/method/type.js.map +1 -0
  29. package/dist/decorators/parameter/index.d.ts +3 -0
  30. package/dist/decorators/parameter/index.d.ts.map +1 -0
  31. package/dist/decorators/parameter/index.js +25 -0
  32. package/dist/decorators/parameter/index.js.map +1 -0
  33. package/dist/decorators/parameter/module.d.ts +10 -0
  34. package/dist/decorators/parameter/module.d.ts.map +1 -0
  35. package/dist/decorators/parameter/module.js +58 -0
  36. package/dist/decorators/parameter/module.js.map +1 -0
  37. package/dist/decorators/parameter/type.d.ts +8 -0
  38. package/dist/decorators/parameter/type.d.ts.map +1 -0
  39. package/dist/decorators/parameter/type.js +9 -0
  40. package/dist/decorators/parameter/type.js.map +1 -0
  41. package/dist/decorators/type.d.ts +14 -0
  42. package/dist/decorators/type.d.ts.map +1 -0
  43. package/dist/decorators/type.js +9 -0
  44. package/dist/decorators/type.js.map +1 -0
  45. package/dist/decorators/utils/index.d.ts +2 -0
  46. package/dist/decorators/utils/index.d.ts.map +1 -0
  47. package/dist/decorators/utils/index.js +24 -0
  48. package/dist/decorators/utils/index.js.map +1 -0
  49. package/dist/decorators/utils/meta.d.ts +3 -0
  50. package/dist/decorators/utils/meta.d.ts.map +1 -0
  51. package/dist/decorators/utils/meta.js +24 -0
  52. package/dist/decorators/utils/meta.js.map +1 -0
  53. package/dist/handler/index.d.ts +3 -0
  54. package/dist/handler/index.d.ts.map +1 -0
  55. package/dist/handler/index.js +25 -0
  56. package/dist/handler/index.js.map +1 -0
  57. package/dist/handler/type.d.ts +7 -0
  58. package/dist/handler/type.d.ts.map +1 -0
  59. package/dist/handler/type.js +3 -0
  60. package/dist/handler/type.js.map +1 -0
  61. package/dist/handler/utils.d.ts +5 -0
  62. package/dist/handler/utils.d.ts.map +1 -0
  63. package/dist/handler/utils.js +37 -0
  64. package/dist/handler/utils.js.map +1 -0
  65. package/dist/helpers/request/index.d.ts +2 -2
  66. package/dist/helpers/request/index.d.ts.map +1 -1
  67. package/dist/helpers/request/index.js +2 -2
  68. package/dist/helpers/request/index.js.map +1 -1
  69. package/dist/helpers/request/params.d.ts +5 -4
  70. package/dist/helpers/request/params.d.ts.map +1 -1
  71. package/dist/helpers/request/params.js +11 -1
  72. package/dist/helpers/request/params.js.map +1 -1
  73. package/dist/helpers/response/index.d.ts +0 -1
  74. package/dist/helpers/response/index.d.ts.map +1 -1
  75. package/dist/helpers/response/index.js +0 -1
  76. package/dist/helpers/response/index.js.map +1 -1
  77. package/dist/helpers/response/send-format.d.ts +6 -4
  78. package/dist/helpers/response/send-format.d.ts.map +1 -1
  79. package/dist/helpers/response/send-format.js.map +1 -1
  80. package/dist/index.d.ts +2 -0
  81. package/dist/index.d.ts.map +1 -1
  82. package/dist/index.js +2 -0
  83. package/dist/index.js.map +1 -1
  84. package/dist/route/module.d.ts +2 -1
  85. package/dist/route/module.d.ts.map +1 -1
  86. package/dist/route/module.js.map +1 -1
  87. package/dist/router/module.d.ts +10 -7
  88. package/dist/router/module.d.ts.map +1 -1
  89. package/dist/router/module.js +81 -29
  90. package/dist/router/module.js.map +1 -1
  91. package/dist/type.d.ts +3 -6
  92. package/dist/type.d.ts.map +1 -1
  93. package/package.json +2 -2
  94. package/dist/helpers/request/body.d.ts +0 -5
  95. package/dist/helpers/request/body.d.ts.map +0 -1
  96. package/dist/helpers/request/body.js +0 -19
  97. package/dist/helpers/request/body.js.map +0 -1
  98. package/dist/helpers/response/body.d.ts +0 -7
  99. package/dist/helpers/response/body.d.ts.map +0 -1
  100. package/dist/helpers/response/body.js +0 -48
  101. package/dist/helpers/response/body.js.map +0 -1
@@ -1,48 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022.
4
- * Author Peter Placzek (tada5hi)
5
- * For the full copyright and license information,
6
- * view the LICENSE file that was distributed with this source code.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.useResponseBodyFormatted = exports.setResponseBody = exports.useResponseBody = void 0;
10
- const constants_1 = require("../../constants");
11
- const BodySymbol = Symbol.for('ResBody');
12
- function useResponseBody(res) {
13
- if (BodySymbol in res) {
14
- return res[BodySymbol];
15
- }
16
- return undefined;
17
- }
18
- exports.useResponseBody = useResponseBody;
19
- function setResponseBody(res, body) {
20
- res[BodySymbol] = body;
21
- }
22
- exports.setResponseBody = setResponseBody;
23
- /* istanbul ignore next */
24
- function useResponseBodyFormatted(res) {
25
- const body = useResponseBody(res);
26
- if (typeof body === 'undefined') {
27
- return undefined;
28
- }
29
- let contentType = res.getHeader(constants_1.HeaderName.CONTENT_TYPE);
30
- if (!contentType) {
31
- return contentType;
32
- }
33
- if (Array.isArray(contentType)) {
34
- contentType = contentType.shift();
35
- }
36
- else {
37
- contentType = `${contentType}`.split('; ').shift();
38
- }
39
- switch (contentType) {
40
- case 'application/json':
41
- return JSON.parse(body.toString('utf-8'));
42
- case 'text/html':
43
- return body.toString('utf-8');
44
- }
45
- return body;
46
- }
47
- exports.useResponseBodyFormatted = useResponseBodyFormatted;
48
- //# sourceMappingURL=body.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"body.js","sourceRoot":"","sources":["../../../src/helpers/response/body.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,+CAA6C;AAE7C,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAEzC,SAAgB,eAAe,CAAC,GAAmB;IAC/C,IAAI,UAAU,IAAI,GAAG,EAAE;QACnB,OAAQ,GAAW,CAAC,UAAU,CAAC,CAAC;KACnC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAND,0CAMC;AAED,SAAgB,eAAe,CAAC,GAAmB,EAAE,IAAY;IAC5D,GAAW,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;AACpC,CAAC;AAFD,0CAEC;AAED,0BAA0B;AAC1B,SAAgB,wBAAwB,CAAC,GAAmB;IACxD,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC7B,OAAO,SAAS,CAAC;KACpB;IAED,IAAI,WAAW,GAAG,GAAG,CAAC,SAAS,CAAC,sBAAU,CAAC,YAAY,CAAC,CAAC;IACzD,IAAI,CAAC,WAAW,EAAE;QACd,OAAO,WAAW,CAAC;KACtB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QAC5B,WAAW,GAAG,WAAW,CAAC,KAAK,EAAE,CAAC;KACrC;SAAM;QACH,WAAW,GAAG,GAAG,WAAW,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;KACtD;IAED,QAAQ,WAAW,EAAE;QACjB,KAAK,kBAAkB;YACnB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9C,KAAK,WAAW;YACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;KACrC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAzBD,4DAyBC"}