@pristine-ts/networking 0.0.162 → 0.0.166

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 (186) hide show
  1. package/dist/lib/cjs/decorators/body.decorator.js +20 -1
  2. package/dist/lib/cjs/decorators/body.decorator.js.map +1 -1
  3. package/dist/lib/cjs/decorators/controller.decorator.js +13 -1
  4. package/dist/lib/cjs/decorators/controller.decorator.js.map +1 -1
  5. package/dist/lib/cjs/decorators/decorators.js +1 -1
  6. package/dist/lib/cjs/decorators/decorators.js.map +1 -1
  7. package/dist/lib/cjs/decorators/headers.decorator.js +20 -1
  8. package/dist/lib/cjs/decorators/headers.decorator.js.map +1 -1
  9. package/dist/lib/cjs/decorators/identity.decorator.js +20 -1
  10. package/dist/lib/cjs/decorators/identity.decorator.js.map +1 -1
  11. package/dist/lib/cjs/decorators/query-parameter.decorator.js +22 -1
  12. package/dist/lib/cjs/decorators/query-parameter.decorator.js.map +1 -1
  13. package/dist/lib/cjs/decorators/query-parameters.decorator.js +20 -1
  14. package/dist/lib/cjs/decorators/query-parameters.decorator.js.map +1 -1
  15. package/dist/lib/cjs/decorators/request.decorator.js +20 -1
  16. package/dist/lib/cjs/decorators/request.decorator.js.map +1 -1
  17. package/dist/lib/cjs/decorators/response-header.decorator.js +24 -2
  18. package/dist/lib/cjs/decorators/response-header.decorator.js.map +1 -1
  19. package/dist/lib/cjs/decorators/route-parameter.decorator.js +21 -1
  20. package/dist/lib/cjs/decorators/route-parameter.decorator.js.map +1 -1
  21. package/dist/lib/cjs/decorators/route.decorator.js +21 -1
  22. package/dist/lib/cjs/decorators/route.decorator.js.map +1 -1
  23. package/dist/lib/cjs/enrichers/router-response.enricher.js +4 -0
  24. package/dist/lib/cjs/enrichers/router-response.enricher.js.map +1 -1
  25. package/dist/lib/cjs/errors/errors.js +3 -1
  26. package/dist/lib/cjs/errors/errors.js.map +1 -1
  27. package/dist/lib/cjs/errors/http.error.js +1 -1
  28. package/dist/lib/cjs/errors/http.error.js.map +1 -1
  29. package/dist/lib/cjs/errors/method-router-adding.error.js +25 -0
  30. package/dist/lib/cjs/errors/method-router-adding.error.js.map +1 -0
  31. package/dist/lib/cjs/errors/path-router-adding.error.js +3 -2
  32. package/dist/lib/cjs/errors/path-router-adding.error.js.map +1 -1
  33. package/dist/lib/cjs/errors/path-router-instantiation.error.js +3 -2
  34. package/dist/lib/cjs/errors/path-router-instantiation.error.js.map +1 -1
  35. package/dist/lib/cjs/interfaces/interfaces.js +2 -2
  36. package/dist/lib/cjs/interfaces/interfaces.js.map +1 -1
  37. package/dist/lib/cjs/models/models.js +0 -1
  38. package/dist/lib/cjs/models/models.js.map +1 -1
  39. package/dist/lib/cjs/models/request.js +10 -4
  40. package/dist/lib/cjs/models/request.js.map +1 -1
  41. package/dist/lib/cjs/models/response.js +6 -0
  42. package/dist/lib/cjs/models/response.js.map +1 -1
  43. package/dist/lib/cjs/models/route.js +4 -0
  44. package/dist/lib/cjs/models/route.js.map +1 -1
  45. package/dist/lib/cjs/networking.module.js +0 -6
  46. package/dist/lib/cjs/networking.module.js.map +1 -1
  47. package/dist/lib/cjs/nodes/method-router.node.js +19 -4
  48. package/dist/lib/cjs/nodes/method-router.node.js.map +1 -1
  49. package/dist/lib/cjs/nodes/path-router.node.js +22 -12
  50. package/dist/lib/cjs/nodes/path-router.node.js.map +1 -1
  51. package/dist/lib/cjs/resolvers/body-parameter-decorator.resolver.js +18 -0
  52. package/dist/lib/cjs/resolvers/body-parameter-decorator.resolver.js.map +1 -1
  53. package/dist/lib/cjs/resolvers/controller-method-parameter-decorator.resolver.js +14 -0
  54. package/dist/lib/cjs/resolvers/controller-method-parameter-decorator.resolver.js.map +1 -1
  55. package/dist/lib/cjs/resolvers/headers-parameter-decorator.resolver.js +18 -0
  56. package/dist/lib/cjs/resolvers/headers-parameter-decorator.resolver.js.map +1 -1
  57. package/dist/lib/cjs/resolvers/identity-parameter-decorator.resolver.js +18 -0
  58. package/dist/lib/cjs/resolvers/identity-parameter-decorator.resolver.js.map +1 -1
  59. package/dist/lib/cjs/resolvers/query-parameter-decorator.resolver.js +19 -0
  60. package/dist/lib/cjs/resolvers/query-parameter-decorator.resolver.js.map +1 -1
  61. package/dist/lib/cjs/resolvers/query-parameters-decorator.resolver.js +18 -0
  62. package/dist/lib/cjs/resolvers/query-parameters-decorator.resolver.js.map +1 -1
  63. package/dist/lib/cjs/resolvers/request-parameter-decorator.resolver.js +18 -0
  64. package/dist/lib/cjs/resolvers/request-parameter-decorator.resolver.js.map +1 -1
  65. package/dist/lib/cjs/resolvers/route-parameter-decorator.resolver.js +18 -0
  66. package/dist/lib/cjs/resolvers/route-parameter-decorator.resolver.js.map +1 -1
  67. package/dist/lib/cjs/router.js +25 -10
  68. package/dist/lib/cjs/router.js.map +1 -1
  69. package/dist/lib/esm/decorators/body.decorator.js +20 -1
  70. package/dist/lib/esm/decorators/body.decorator.js.map +1 -1
  71. package/dist/lib/esm/decorators/controller.decorator.js +13 -1
  72. package/dist/lib/esm/decorators/controller.decorator.js.map +1 -1
  73. package/dist/lib/esm/decorators/decorators.js +1 -1
  74. package/dist/lib/esm/decorators/decorators.js.map +1 -1
  75. package/dist/lib/esm/decorators/headers.decorator.js +20 -1
  76. package/dist/lib/esm/decorators/headers.decorator.js.map +1 -1
  77. package/dist/lib/esm/decorators/identity.decorator.js +20 -1
  78. package/dist/lib/esm/decorators/identity.decorator.js.map +1 -1
  79. package/dist/lib/esm/decorators/query-parameter.decorator.js +22 -1
  80. package/dist/lib/esm/decorators/query-parameter.decorator.js.map +1 -1
  81. package/dist/lib/esm/decorators/query-parameters.decorator.js +20 -1
  82. package/dist/lib/esm/decorators/query-parameters.decorator.js.map +1 -1
  83. package/dist/lib/esm/decorators/request.decorator.js +20 -1
  84. package/dist/lib/esm/decorators/request.decorator.js.map +1 -1
  85. package/dist/lib/esm/decorators/response-header.decorator.js +24 -2
  86. package/dist/lib/esm/decorators/response-header.decorator.js.map +1 -1
  87. package/dist/lib/esm/decorators/route-parameter.decorator.js +21 -1
  88. package/dist/lib/esm/decorators/route-parameter.decorator.js.map +1 -1
  89. package/dist/lib/esm/decorators/route.decorator.js +21 -1
  90. package/dist/lib/esm/decorators/route.decorator.js.map +1 -1
  91. package/dist/lib/esm/enrichers/router-response.enricher.js +4 -0
  92. package/dist/lib/esm/enrichers/router-response.enricher.js.map +1 -1
  93. package/dist/lib/esm/errors/errors.js +3 -1
  94. package/dist/lib/esm/errors/errors.js.map +1 -1
  95. package/dist/lib/esm/errors/http.error.js +1 -1
  96. package/dist/lib/esm/errors/http.error.js.map +1 -1
  97. package/dist/lib/esm/errors/method-router-adding.error.js +21 -0
  98. package/dist/lib/esm/errors/method-router-adding.error.js.map +1 -0
  99. package/dist/lib/esm/errors/path-router-adding.error.js +3 -2
  100. package/dist/lib/esm/errors/path-router-adding.error.js.map +1 -1
  101. package/dist/lib/esm/errors/path-router-instantiation.error.js +3 -2
  102. package/dist/lib/esm/errors/path-router-instantiation.error.js.map +1 -1
  103. package/dist/lib/esm/interfaces/interfaces.js +2 -2
  104. package/dist/lib/esm/interfaces/interfaces.js.map +1 -1
  105. package/dist/lib/esm/models/models.js +0 -1
  106. package/dist/lib/esm/models/models.js.map +1 -1
  107. package/dist/lib/esm/models/request.js +10 -4
  108. package/dist/lib/esm/models/request.js.map +1 -1
  109. package/dist/lib/esm/models/response.js +6 -0
  110. package/dist/lib/esm/models/response.js.map +1 -1
  111. package/dist/lib/esm/models/route.js +4 -0
  112. package/dist/lib/esm/models/route.js.map +1 -1
  113. package/dist/lib/esm/networking.module.js +0 -6
  114. package/dist/lib/esm/networking.module.js.map +1 -1
  115. package/dist/lib/esm/nodes/method-router.node.js +19 -4
  116. package/dist/lib/esm/nodes/method-router.node.js.map +1 -1
  117. package/dist/lib/esm/nodes/path-router.node.js +22 -12
  118. package/dist/lib/esm/nodes/path-router.node.js.map +1 -1
  119. package/dist/lib/esm/resolvers/body-parameter-decorator.resolver.js +18 -0
  120. package/dist/lib/esm/resolvers/body-parameter-decorator.resolver.js.map +1 -1
  121. package/dist/lib/esm/resolvers/controller-method-parameter-decorator.resolver.js +14 -0
  122. package/dist/lib/esm/resolvers/controller-method-parameter-decorator.resolver.js.map +1 -1
  123. package/dist/lib/esm/resolvers/headers-parameter-decorator.resolver.js +18 -0
  124. package/dist/lib/esm/resolvers/headers-parameter-decorator.resolver.js.map +1 -1
  125. package/dist/lib/esm/resolvers/identity-parameter-decorator.resolver.js +18 -0
  126. package/dist/lib/esm/resolvers/identity-parameter-decorator.resolver.js.map +1 -1
  127. package/dist/lib/esm/resolvers/query-parameter-decorator.resolver.js +19 -0
  128. package/dist/lib/esm/resolvers/query-parameter-decorator.resolver.js.map +1 -1
  129. package/dist/lib/esm/resolvers/query-parameters-decorator.resolver.js +18 -0
  130. package/dist/lib/esm/resolvers/query-parameters-decorator.resolver.js.map +1 -1
  131. package/dist/lib/esm/resolvers/request-parameter-decorator.resolver.js +18 -0
  132. package/dist/lib/esm/resolvers/request-parameter-decorator.resolver.js.map +1 -1
  133. package/dist/lib/esm/resolvers/route-parameter-decorator.resolver.js +18 -0
  134. package/dist/lib/esm/resolvers/route-parameter-decorator.resolver.js.map +1 -1
  135. package/dist/lib/esm/router.js +25 -10
  136. package/dist/lib/esm/router.js.map +1 -1
  137. package/dist/types/decorators/body.decorator.d.ts +3 -0
  138. package/dist/types/decorators/controller.decorator.d.ts +4 -0
  139. package/dist/types/decorators/decorators.d.ts +1 -1
  140. package/dist/types/decorators/headers.decorator.d.ts +3 -0
  141. package/dist/types/decorators/identity.decorator.d.ts +3 -0
  142. package/dist/types/decorators/query-parameter.decorator.d.ts +4 -0
  143. package/dist/types/decorators/query-parameters.decorator.d.ts +3 -0
  144. package/dist/types/decorators/request.decorator.d.ts +3 -0
  145. package/dist/types/decorators/response-header.decorator.d.ts +7 -0
  146. package/dist/types/decorators/route-parameter.decorator.d.ts +4 -0
  147. package/dist/types/decorators/route.decorator.d.ts +6 -1
  148. package/dist/types/enrichers/router-response.enricher.d.ts +4 -0
  149. package/dist/types/errors/errors.d.ts +3 -1
  150. package/dist/types/errors/http.error.d.ts +1 -1
  151. package/dist/types/errors/method-router-adding.error.d.ts +10 -0
  152. package/dist/types/errors/path-router-adding.error.d.ts +4 -3
  153. package/dist/types/errors/path-router-instantiation.error.d.ts +4 -3
  154. package/dist/types/interfaces/controller-method-parameter-decorator-resolver.interface.d.ts +19 -2
  155. package/dist/types/interfaces/interfaces.d.ts +2 -2
  156. package/dist/types/interfaces/parameter-decorator.interface.d.ts +4 -0
  157. package/dist/types/interfaces/query-parameters-decorator.interface.d.ts +4 -0
  158. package/dist/types/interfaces/route-parameter-decorator.interface.d.ts +1 -1
  159. package/dist/types/interfaces/router.interface.d.ts +2 -2
  160. package/dist/types/models/models.d.ts +0 -1
  161. package/dist/types/models/request.d.ts +16 -4
  162. package/dist/types/models/response.d.ts +15 -0
  163. package/dist/types/models/route.d.ts +4 -0
  164. package/dist/types/nodes/method-router.node.d.ts +17 -4
  165. package/dist/types/nodes/path-router.node.d.ts +11 -7
  166. package/dist/types/nodes/router.node.d.ts +3 -3
  167. package/dist/types/resolvers/body-parameter-decorator.resolver.d.ts +22 -2
  168. package/dist/types/resolvers/controller-method-parameter-decorator.resolver.d.ts +14 -0
  169. package/dist/types/resolvers/headers-parameter-decorator.resolver.d.ts +22 -2
  170. package/dist/types/resolvers/identity-parameter-decorator.resolver.d.ts +22 -2
  171. package/dist/types/resolvers/query-parameter-decorator.resolver.d.ts +23 -2
  172. package/dist/types/resolvers/query-parameters-decorator.resolver.d.ts +22 -2
  173. package/dist/types/resolvers/request-parameter-decorator.resolver.d.ts +22 -2
  174. package/dist/types/resolvers/route-parameter-decorator.resolver.d.ts +22 -2
  175. package/dist/types/router.d.ts +13 -3
  176. package/package.json +5 -5
  177. package/dist/lib/cjs/enums/enums.js +0 -1
  178. package/dist/lib/cjs/enums/enums.js.map +0 -1
  179. package/dist/lib/cjs/models/error-response-body.js +0 -7
  180. package/dist/lib/cjs/models/error-response-body.js.map +0 -1
  181. package/dist/lib/esm/enums/enums.js +0 -1
  182. package/dist/lib/esm/enums/enums.js.map +0 -1
  183. package/dist/lib/esm/models/error-response-body.js +0 -3
  184. package/dist/lib/esm/models/error-response-body.js.map +0 -1
  185. package/dist/types/enums/enums.d.ts +0 -0
  186. package/dist/types/models/error-response-body.d.ts +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"route-parameter.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/route-parameter.decorator.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE;IAC3C,OAAO,CACH,MAAc,EACd,WAA4B,EAC5B,cAAsB,EACxB,EAAE;QACA,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,cAAc,CAAC,KAAK,KAAK,EAAE;YACtE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,CAAA;SACpD;QAED,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,KAAK,EAAE;YACjF,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAA;SAC/D;QAED,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,KAAK,EAAE;YAC9F,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAA;SAC5E;QAED,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,KAAK,EAAE;YAC3G,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;SAC1F;QAED,MAAM,eAAe,GAAqC;YACtD,IAAI,EAAE,gBAAgB;YACtB,kBAAkB,EAAE,IAAI;SAC3B,CAAC;QAEF,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,GAAG,eAAe,CAAC;IACxH,CAAC,CAAA;AACL,CAAC,CAAA"}
1
+ {"version":3,"file":"route-parameter.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/route-parameter.decorator.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE;IAC3C,OAAO;IACH;;OAEG;IACH,MAAc;IAEd;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QACA,mIAAmI;QACnI,6KAA6K;QAC7K,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,cAAc,CAAC,KAAK,KAAK,EAAE;YACtE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,CAAA;SACpD;QAED,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,KAAK,EAAE;YACjF,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAA;SAC/D;QAED,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,KAAK,EAAE;YAC9F,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAA;SAC5E;QAED,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,KAAK,EAAE;YAC3G,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;SAC1F;QAED,gFAAgF;QAChF,MAAM,eAAe,GAAqC;YACtD,IAAI,EAAE,gBAAgB;YACtB,kBAAkB,EAAE,IAAI;SAC3B,CAAC;QAEF,4HAA4H;QAC5H,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,GAAG,eAAe,CAAC;IACxH,CAAC,CAAA;AACL,CAAC,CAAA"}
@@ -1,5 +1,24 @@
1
+ /**
2
+ * The route decorator can be used on a method to register this method as a route of the controller in the router.
3
+ * @param httpMethod The http method of the route
4
+ * @param path The part of the path following the base path of the controller. For path parameters use the colons. (ie: resources/:id)
5
+ */
1
6
  export const route = (httpMethod, path) => {
2
- return (target, propertyKey, descriptor) => {
7
+ return (
8
+ /**
9
+ * The class on which the decorator is used.
10
+ */
11
+ target,
12
+ /**
13
+ * The method on which the decorator is used.
14
+ */
15
+ propertyKey,
16
+ /**
17
+ * The descriptor of the property.
18
+ */
19
+ descriptor) => {
20
+ // Verify that the object target.constructor.prototype["__metadata__"]["methods"][propertyKey]["route"] exists or we create it.
21
+ // This object is a convention defined by Pristine on where to save the route decorator information and is used in the router to retrieve that information.
3
22
  if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
4
23
  target.constructor.prototype["__metadata__"] = {};
5
24
  }
@@ -9,6 +28,7 @@ export const route = (httpMethod, path) => {
9
28
  if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
10
29
  target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
11
30
  }
31
+ // Set the route.
12
32
  const route = {
13
33
  httpMethod,
14
34
  methodKeyname: propertyKey,
@@ -1 +1 @@
1
- {"version":3,"file":"route.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/route.decorator.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,UAA+B,EAAE,IAAY,EAAE,EAAE;IACnE,OAAO,CACH,MAAW,EACX,WAAmB,EACnB,UAA8B,EAChC,EAAE;QACA,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,cAAc,CAAC,KAAK,KAAK,EAAE;YACtE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,CAAA;SACpD;QAED,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,KAAK,EAAE;YACjF,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAA;SAC/D;QAED,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,KAAK,EAAE;YAC9F,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAA;SAC5E;QAED,MAAM,KAAK,GAAwB;YAC/B,UAAU;YACV,aAAa,EAAE,WAAW;YAC1B,IAAI;SACP,CAAA;QAED,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;IAC1F,CAAC,CAAC;AACN,CAAC,CAAA"}
1
+ {"version":3,"file":"route.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/route.decorator.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,UAA+B,EAAE,IAAY,EAAE,EAAE;IACnE,OAAO;IACH;;OAEG;IACH,MAAc;IAEd;;OAEG;IACH,WAAmB;IAEnB;;OAEG;IACH,UAA8B,EAChC,EAAE;QACA,+HAA+H;QAC/H,2JAA2J;QAC3J,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,cAAc,CAAC,KAAK,KAAK,EAAE;YACtE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,CAAA;SACpD;QAED,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,KAAK,EAAE;YACjF,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAA;SAC/D;QAED,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,KAAK,EAAE;YAC9F,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAA;SAC5E;QAED,iBAAiB;QACjB,MAAM,KAAK,GAAyB;YAChC,UAAU;YACV,aAAa,EAAE,WAAW;YAC1B,IAAI;SACP,CAAA;QAED,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;IAC1F,CAAC,CAAC;AACN,CAAC,CAAA"}
@@ -15,6 +15,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
15
15
  };
16
16
  import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
17
17
  import { NetworkingModuleKeyname } from "../networking.module.keyname";
18
+ /**
19
+ * The RouterResponseEnricher enriches the response of the router by adding the response headers specified by the response header decorator.
20
+ * It is tagged as an RouterResponseEnricher so it can be automatically injected with the all the other RouterResponseEnrichers.
21
+ */
18
22
  let RouterResponseEnricher = class RouterResponseEnricher {
19
23
  enrichResponse(response, request, methodNode) {
20
24
  return __awaiter(this, void 0, void 0, function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"router-response.enricher.js","sourceRoot":"","sources":["../../../../src/enrichers/router-response.enricher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAMrE,IAAa,sBAAsB,GAAnC,MAAa,sBAAsB;IACzB,cAAc,CAAC,QAAkB,EAAE,OAAgB,EAAE,UAA4B;;YACnF,IAAG,UAAU,CAAC,KAAK,CAAC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAC;gBACtF,QAAQ,CAAC,OAAO,mCAAO,QAAQ,CAAC,OAAO,GAAK,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;aACxF;YACD,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CACJ,CAAA;AAPY,sBAAsB;IAFlC,GAAG,CAAC,wBAAwB,CAAC,sBAAsB,CAAC;IACpD,YAAY,CAAC,uBAAuB,CAAC;GACzB,sBAAsB,CAOlC;SAPY,sBAAsB"}
1
+ {"version":3,"file":"router-response.enricher.js","sourceRoot":"","sources":["../../../../src/enrichers/router-response.enricher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAIrE;;;GAGG;AAGH,IAAa,sBAAsB,GAAnC,MAAa,sBAAsB;IACzB,cAAc,CAAC,QAAkB,EAAE,OAAgB,EAAE,UAA4B;;YACnF,IAAG,UAAU,CAAC,KAAK,CAAC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAC;gBACtF,QAAQ,CAAC,OAAO,mCAAO,QAAQ,CAAC,OAAO,GAAK,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;aACxF;YACD,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CACJ,CAAA;AAPY,sBAAsB;IAFlC,GAAG,CAAC,wBAAwB,CAAC,sBAAsB,CAAC;IACpD,YAAY,CAAC,uBAAuB,CAAC;GACzB,sBAAsB,CAOlC;SAPY,sBAAsB"}
@@ -2,6 +2,8 @@ export * from "./bad-request.http-error";
2
2
  export * from "./forbidden.http-error";
3
3
  export * from "./http.error";
4
4
  export * from "./invalid-body.http-error";
5
- export * from "./path-router-instantiation.error";
5
+ export * from "./method-router-adding.error";
6
6
  export * from "./not-found.http-error";
7
+ export * from "./path-router-adding.error";
8
+ export * from "./path-router-instantiation.error";
7
9
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/errors/errors.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/errors/errors.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC"}
@@ -1,8 +1,8 @@
1
+ import { LoggableError } from "@pristine-ts/common";
1
2
  /**
2
3
  * This class defines a basic HttpError. In your code, feel free to throw an HttpError to have this error returned via HTTP.
3
4
  * If you throw this error when handling an Event, it won't be returned.
4
5
  */
5
- import { LoggableError } from "@pristine-ts/common";
6
6
  export class HttpError extends LoggableError {
7
7
  constructor(httpStatus, message, errors) {
8
8
  super(message, {
@@ -1 +1 @@
1
- {"version":3,"file":"http.error.js","sourceRoot":"","sources":["../../../../src/errors/http.error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAElD,MAAM,OAAO,SAAU,SAAQ,aAAa;IACxC,YAAmC,UAAkB,EAAW,OAAe,EAAkB,MAAc;QAC3G,KAAK,CAAC,OAAO,EAAE;YACX,UAAU;YACV,MAAM;SACT,CAAC,CAAC;QAJ4B,eAAU,GAAV,UAAU,CAAQ;QAAW,YAAO,GAAP,OAAO,CAAQ;QAAkB,WAAM,GAAN,MAAM,CAAQ;QAM3G,gCAAgC;QAChC,kDAAkD;QAClD,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;CACJ"}
1
+ {"version":3,"file":"http.error.js","sourceRoot":"","sources":["../../../../src/errors/http.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,aAAa;IACxC,YAAmC,UAAkB,EAAW,OAAe,EAAkB,MAAc;QAC3G,KAAK,CAAC,OAAO,EAAE;YACX,UAAU;YACV,MAAM;SACT,CAAC,CAAC;QAJ4B,eAAU,GAAV,UAAU,CAAQ;QAAW,YAAO,GAAP,OAAO,CAAQ;QAAkB,WAAM,GAAN,MAAM,CAAQ;QAM3G,gCAAgC;QAChC,kDAAkD;QAClD,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;CACJ"}
@@ -0,0 +1,21 @@
1
+ import { LoggableError } from "@pristine-ts/common";
2
+ import { MethodRouterNode } from "../nodes/method-router.node";
3
+ /**
4
+ * This Error is thrown when there's an error that happens when the networking is being initialized.
5
+ * It is thrown when trying to add a child node to a MethodRouterNode, since a MethodRouterNode is a leaf it cannot have any children.
6
+ */
7
+ export class MethodRouterAddingError extends LoggableError {
8
+ constructor(message, splitPaths, method, route, methodRouterNode) {
9
+ super(message, {
10
+ splitPaths,
11
+ method,
12
+ route,
13
+ methodRouterNode,
14
+ });
15
+ // Set the prototype explicitly.
16
+ // As specified in the documentation in TypeScript
17
+ // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
18
+ Object.setPrototypeOf(this, MethodRouterNode.prototype);
19
+ }
20
+ }
21
+ //# sourceMappingURL=method-router-adding.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method-router-adding.error.js","sourceRoot":"","sources":["../../../../src/errors/method-router-adding.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAC;AAE7D;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,aAAa;IAEtD,YAAmB,OAAe,EAAE,UAAoB,EAAE,MAA2B,EAAE,KAAY,EAAE,gBAAkC;QACnI,KAAK,CAAC,OAAO,EAAE;YACX,UAAU;YACV,MAAM;YACN,KAAK;YACL,gBAAgB;SACnB,CAAC,CAAC;QAEH,gCAAgC;QAChC,kDAAkD;QAClD,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAAI,CAAC;CACpE"}
@@ -1,7 +1,8 @@
1
+ import { LoggableError } from "@pristine-ts/common";
1
2
  /**
2
- * This Error is thrown when there's an error that happens when the networking is being initialized
3
+ * This Error is thrown when there's an error that happens when the networking is being initialized.
4
+ * It is thrown when an error occurs when trying to add a child node to a PathRouterNode.
3
5
  */
4
- import { LoggableError } from "@pristine-ts/common";
5
6
  export class PathRouterAddingError extends LoggableError {
6
7
  constructor(message, splitPaths, method, route, pathRouterNode) {
7
8
  super(message, {
@@ -1 +1 @@
1
- {"version":3,"file":"path-router-adding.error.js","sourceRoot":"","sources":["../../../../src/errors/path-router-adding.error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAa,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAI9D,MAAM,OAAO,qBAAsB,SAAQ,aAAa;IAEpD,YAAmB,OAAe,EAAE,UAAoB,EAAE,MAA2B,EAAE,KAAY,EAAE,cAA8B;QAC/H,KAAK,CAAC,OAAO,EAAE;YACX,UAAU;YACV,MAAM;YACN,KAAK;YACL,cAAc;SACjB,CAAC,CAAC;QAEH,gCAAgC;QAChC,kDAAkD;QAClD,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAAI,CAAC;CACzE"}
1
+ {"version":3,"file":"path-router-adding.error.js","sourceRoot":"","sources":["../../../../src/errors/path-router-adding.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAI9D;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,aAAa;IAEpD,YAAmB,OAAe,EAAE,UAAoB,EAAE,MAA2B,EAAE,KAAY,EAAE,cAA8B;QAC/H,KAAK,CAAC,OAAO,EAAE;YACX,UAAU;YACV,MAAM;YACN,KAAK;YACL,cAAc;SACjB,CAAC,CAAC;QAEH,gCAAgC;QAChC,kDAAkD;QAClD,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAAI,CAAC;CACzE"}
@@ -1,7 +1,8 @@
1
+ import { LoggableError } from "@pristine-ts/common";
1
2
  /**
2
- * This Error is thrown when there's an error that happens when the networking is being initialized
3
+ * This Error is thrown when there's an error that happens when the networking is being initialized.
4
+ * It is thrown when an error occurs when trying to instantiate a PathRouterNode.
3
5
  */
4
- import { LoggableError } from "@pristine-ts/common";
5
6
  export class PathRouterInstantiationError extends LoggableError {
6
7
  constructor(message, path, parent) {
7
8
  super(message, {
@@ -1 +1 @@
1
- {"version":3,"file":"path-router-instantiation.error.js","sourceRoot":"","sources":["../../../../src/errors/path-router-instantiation.error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAGlD,MAAM,OAAO,4BAA6B,SAAQ,aAAa;IAE3D,YAAmB,OAAe,EAAE,IAAY,EAAE,MAAuB;QACrE,KAAK,CAAC,OAAO,EAAE;YACX,IAAI;YACJ,MAAM;SACT,CAAC,CAAC;QAEH,gCAAgC;QAChC,kDAAkD;QAClD,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,4BAA4B,CAAC,SAAS,CAAC,CAAC;IAAI,CAAC;CAChF"}
1
+ {"version":3,"file":"path-router-instantiation.error.js","sourceRoot":"","sources":["../../../../src/errors/path-router-instantiation.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAGlD;;;GAGG;AACH,MAAM,OAAO,4BAA6B,SAAQ,aAAa;IAE3D,YAAmB,OAAe,EAAE,IAAY,EAAE,MAAuB;QACrE,KAAK,CAAC,OAAO,EAAE;YACX,IAAI;YACJ,MAAM;SACT,CAAC,CAAC;QAEH,gCAAgC;QAChC,kDAAkD;QAClD,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,4BAA4B,CAAC,SAAS,CAAC,CAAC;IAAI,CAAC;CAChF"}
@@ -6,9 +6,9 @@ export * from "./parameter-decorator.interface";
6
6
  export * from "./query-parameter-decorator.interface";
7
7
  export * from "./query-parameters-decorator.interface";
8
8
  export * from "./request-parameter-decorator.interface";
9
- export * from "./router-request-enricher.interface";
10
- export * from "./router-response-enricher.interface";
11
9
  export * from "./route-method-decorator.interface";
12
10
  export * from "./route-parameter-decorator.interface";
13
11
  export * from "./router.interface";
12
+ export * from "./router-request-enricher.interface";
13
+ export * from "./router-response-enricher.interface";
14
14
  //# sourceMappingURL=interfaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/interfaces/interfaces.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,cAAc,4DAA4D,CAAC;AAC3E,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/interfaces/interfaces.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,cAAc,4DAA4D,CAAC;AAC3E,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oBAAoB,CAAC;AACnC,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC"}
@@ -1,4 +1,3 @@
1
- export * from "./error-response-body";
2
1
  export * from "./request";
3
2
  export * from "./response";
4
3
  export * from "./route";
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/models/models.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/models/models.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
@@ -4,7 +4,13 @@
4
4
  export class Request {
5
5
  constructor(requestInterface) {
6
6
  var _a, _b;
7
+ /**
8
+ * The headers of the request.
9
+ */
7
10
  this.headers = {};
11
+ /**
12
+ * The body of the request.
13
+ */
8
14
  this.body = {};
9
15
  this.httpMethod = requestInterface.httpMethod;
10
16
  this.url = requestInterface.url;
@@ -14,8 +20,8 @@ export class Request {
14
20
  /**
15
21
  * This method sets a header parameter in the Request.
16
22
  *
17
- * @param name
18
- * @param value
23
+ * @param name The name of the header.
24
+ * @param value The value of the header.
19
25
  */
20
26
  setHeader(name, value) {
21
27
  this.headers[name] = value;
@@ -23,7 +29,7 @@ export class Request {
23
29
  /**
24
30
  * This method returns whether or not the header exists in the Request.
25
31
  *
26
- * @param name
32
+ * @param name The name of the header.
27
33
  */
28
34
  hasHeader(name) {
29
35
  return this.headers.hasOwnProperty(name);
@@ -31,7 +37,7 @@ export class Request {
31
37
  /**
32
38
  * This method returns the header corresponding to the name or undefined if it doesn't exist.
33
39
  *
34
- * @param name
40
+ * @param name The name of the header.
35
41
  */
36
42
  getHeader(name) {
37
43
  return this.headers[name];
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/models/request.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAO,OAAO;IAMhB,YAAY,gBAAkC;;QAH9C,YAAO,GAA8B,EAAE,CAAC;QACxC,SAAI,GAAQ,EAAE,CAAC;QAGX,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,UAAU,CAAC;QAC9C,IAAI,CAAC,GAAG,GAAG,gBAAgB,CAAC,GAAG,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,MAAA,gBAAgB,CAAC,OAAO,mCAAI,EAAE,CAAC;QAC9C,IAAI,CAAC,IAAI,GAAG,MAAA,gBAAgB,CAAC,IAAI,mCAAI,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,IAAY,EAAE,KAAa;QACjC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,IAAY;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,IAAY;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;CACJ"}
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/models/request.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAO,OAAO;IAqBhB,YAAY,gBAAkC;;QAV9C;;WAEG;QACH,YAAO,GAA8B,EAAE,CAAC;QAExC;;WAEG;QACH,SAAI,GAAQ,EAAE,CAAC;QAGX,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,UAAU,CAAC;QAC9C,IAAI,CAAC,GAAG,GAAG,gBAAgB,CAAC,GAAG,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,MAAA,gBAAgB,CAAC,OAAO,mCAAI,EAAE,CAAC;QAC9C,IAAI,CAAC,IAAI,GAAG,MAAA,gBAAgB,CAAC,IAAI,mCAAI,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,IAAY,EAAE,KAAa;QACjC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,IAAY;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,IAAY;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;CACJ"}
@@ -1,5 +1,11 @@
1
+ /**
2
+ * This Response object represents the class used internally that represents a Response.
3
+ */
1
4
  export class Response {
2
5
  constructor() {
6
+ /**
7
+ * The status code of the response. By default we return a 200.
8
+ */
3
9
  this.status = 200;
4
10
  }
5
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../../src/models/response.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,QAAQ;IAArB;QACI,WAAM,GAAW,GAAG,CAAC;IAIzB,CAAC;CAAA"}
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../../src/models/response.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,QAAQ;IAArB;QACI;;WAEG;QACH,WAAM,GAAW,GAAG,CAAC;IAgBzB,CAAC;CAAA"}
@@ -2,6 +2,10 @@
2
2
  * This class represents a Route and how it can be routed to the proper controller method.
3
3
  */
4
4
  export class Route {
5
+ /**
6
+ * @param controllerInstantiationToken The instantiation token of the controller. Usually this will be the controller's constructor name.
7
+ * @param methodPropertyKey The name of the method that corresponds to the route in the controller.
8
+ */
5
9
  constructor(controllerInstantiationToken, methodPropertyKey) {
6
10
  this.controllerInstantiationToken = controllerInstantiationToken;
7
11
  this.methodPropertyKey = methodPropertyKey;
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../src/models/route.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAO,KAAK;IAWd,YAA4B,4BAAiC,EAAkB,iBAAyB;QAA5E,iCAA4B,GAA5B,4BAA4B,CAAK;QAAkB,sBAAiB,GAAjB,iBAAiB,CAAQ;QAVxG;;WAEG;QACH,oBAAe,GAAkC,EAAE,CAAC;IAQpD,CAAC;CACJ"}
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../src/models/route.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,KAAK;IAWd;;;OAGG;IACH,YAA4B,4BAAiC,EAAkB,iBAAyB;QAA5E,iCAA4B,GAA5B,4BAA4B,CAAK;QAAkB,sBAAiB,GAAjB,iBAAiB,CAAQ;QAdxG;;WAEG;QACH,oBAAe,GAAkC,EAAE,CAAC;IAYpD,CAAC;CACJ"}
@@ -3,7 +3,6 @@ import { SecurityModule } from "@pristine-ts/security";
3
3
  import { TelemetryModule } from "@pristine-ts/telemetry";
4
4
  export * from "./decorators/decorators";
5
5
  export * from "./enrichers/enrichers";
6
- //export * from "./enums/enums";
7
6
  export * from "./errors/errors";
8
7
  export * from "./interfaces/interfaces";
9
8
  export * from "./models/models";
@@ -13,11 +12,6 @@ export * from "./utils/utils";
13
12
  export * from "./router";
14
13
  export const NetworkingModule = {
15
14
  keyname: NetworkingModuleKeyname,
16
- /**
17
- * This property allows you to custom register specific services. For example, you can assign a tag or use a factory
18
- * to instantiate a specific class.
19
- */
20
- providerRegistrations: [],
21
15
  importModules: [
22
16
  SecurityModule,
23
17
  TelemetryModule,
@@ -1 +1 @@
1
- {"version":3,"file":"networking.module.js","sourceRoot":"","sources":["../../../src/networking.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAEvD,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,gCAAgC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAE9B,cAAc,UAAU,CAAC;AAEzB,MAAM,CAAC,MAAM,gBAAgB,GAAoB;IAC7C,OAAO,EAAE,uBAAuB;IAChC;;;OAGG;IACH,qBAAqB,EAAE,EACtB;IAED,aAAa,EAAE;QACX,cAAc;QACd,eAAe;KAClB;IACD,wBAAwB,EAAE,EAEzB;CACJ,CAAA"}
1
+ {"version":3,"file":"networking.module.js","sourceRoot":"","sources":["../../../src/networking.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAEvD,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAE9B,cAAc,UAAU,CAAC;AAEzB,MAAM,CAAC,MAAM,gBAAgB,GAAoB;IAC7C,OAAO,EAAE,uBAAuB;IAChC,aAAa,EAAE;QACX,cAAc;QACd,eAAe;KAClB;IACD,wBAAwB,EAAE,EAEzB;CACJ,CAAA"}
@@ -1,8 +1,16 @@
1
1
  import { RouterNode } from "./router.node";
2
+ import { MethodRouterAddingError } from "../errors/method-router-adding.error";
2
3
  /**
3
4
  * This class represents the Leaf node of the RouteTree.
5
+ * It will always have a parent node that will be a PathRouterNode.
4
6
  */
5
7
  export class MethodRouterNode extends RouterNode {
8
+ /**
9
+ * @param parent The parent node of the current node.
10
+ * @param method The http method of the current method node.
11
+ * @param route The route associated with the current node.
12
+ * @param levelFromRoot The depth level from the root node.
13
+ */
6
14
  constructor(parent, method, route, levelFromRoot) {
7
15
  super();
8
16
  this.method = method;
@@ -10,6 +18,11 @@ export class MethodRouterNode extends RouterNode {
10
18
  this.levelFromRoot = levelFromRoot;
11
19
  this.parent = parent;
12
20
  }
21
+ /**
22
+ * Returns whether or not the node matches.
23
+ * This verification is made by verify the http method matches with the http method of the current node.
24
+ * @param method The http method to compare.
25
+ */
13
26
  matches(method) {
14
27
  return this.method === method;
15
28
  }
@@ -21,20 +34,22 @@ export class MethodRouterNode extends RouterNode {
21
34
  }
22
35
  /**
23
36
  * This method adds all the required nodes to match the splitPaths and the method.
24
- *
37
+ * Since a MethodRouterNode is a leaf node, you can't add anything after it, this method therefore doesn't do anything.
25
38
  * @param splitPaths
26
39
  * @param method
27
40
  * @param route
28
41
  */
29
42
  add(splitPaths, method, route) {
43
+ throw new MethodRouterAddingError("Impossible to add a child node to a MethodRouterNode.", splitPaths, method, route, this);
30
44
  }
31
45
  /**
32
- * This method checks to see if the method matches. If yes,
46
+ * This method receives an array of path and recursively calls its children if this node matches
47
+ * the first splitPath. If the node is a MethodRouterNode, it checks to see if the method matches. If yes,
33
48
  * it returns itself as the node found. This method should always return a MethodRouterNode. However, Typescript
34
49
  * doesn't like these recursive imports so we return the base class
35
50
  *
36
- * @param splitPaths
37
- * @param method
51
+ * @param splitPaths A list of all the parts of the paths spliced at the forward slashes.
52
+ * @param method The http method for which to find a node.
38
53
  */
39
54
  find(splitPaths, method) {
40
55
  if (this.parent.isCatchAll()) {
@@ -1 +1 @@
1
- {"version":3,"file":"method-router.node.js","sourceRoot":"","sources":["../../../../src/nodes/method-router.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EA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AAkB,aAAqB;QACvJ,KAAK,EAAE,CAAC;QAD+C,WAAM,GAAN,MAAM,CAAqB;QAAkB,UAAK,GAAL,KAAK,CAAO;QAAkB,kBAAa,GAAb,aAAa,CAAQ;QAGvJ,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,MAA2B;QAC/B,OAAO,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,UAAU;QACN,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACH,GAAG,CAAC,UAAoB,EAAE,MAA2B,EAAE,KAAY;QAC/D,MAAM,IAAI,uBAAuB,CAAC,uDAAuD,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAChI,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAC,UAAoB,EAAE,MAA2B;QAClD,IAAG,IAAI,CAAC,MAAO,CAAC,UAAU,EAAE,EAAE;YAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;SAC7C;QAED,OAAO,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3E,CAAC;CACJ"}
@@ -6,6 +6,10 @@ import { PathRouterAddingError } from "../errors/path-router-adding.error";
6
6
  * This class represents a Path Node in the Router Node. It can never be a leaf node and will always have children.
7
7
  */
8
8
  export class PathRouterNode extends RouterNode {
9
+ /**
10
+ * @param path The path associated with the current node.
11
+ * @param parent The parent node of the current node.
12
+ */
9
13
  constructor(path, parent) {
10
14
  super();
11
15
  this.path = path;
@@ -17,9 +21,9 @@ export class PathRouterNode extends RouterNode {
17
21
  /**
18
22
  * This method adds all the required nodes to match the splitPaths and the method.
19
23
  *
20
- * @param splitPaths
21
- * @param method
22
- * @param route
24
+ * @param splitPaths A list of all the parts of the paths spliced at the forward slashes.
25
+ * @param method The http method for this route.
26
+ * @param route The route.
23
27
  */
24
28
  add(splitPaths, method, route, levelFromRoot) {
25
29
  // Check to make sure that the first split path matches the current node
@@ -34,13 +38,15 @@ export class PathRouterNode extends RouterNode {
34
38
  if (matchedMethodRouterNodeChild !== undefined) {
35
39
  throw new PathRouterAddingError("There is already an HTTP Method associated with this path.", splitPaths, method, route, this);
36
40
  }
41
+ // Add a new child node of type MethodRouterNode for this new http method.
37
42
  this.children.push(new MethodRouterNode(this, method, route, levelFromRoot + 1));
38
43
  return;
39
44
  }
40
45
  // Loop over our children that are of PathRouterNode and check if the next path matches
41
46
  const matchedChild = this.children.filter(child => child instanceof PathRouterNode).find((child) => child.matches(splitPaths[1]));
42
- // If there's a matched child, call the add httpMethod on it and return.
47
+ // If there's a matched child, call the add method on it and return.
43
48
  if (matchedChild !== undefined) {
49
+ // Remove the first part of the path as it is used by the current node.
44
50
  matchedChild.add(splitPaths.slice(1), method, route, levelFromRoot + 1);
45
51
  return;
46
52
  }
@@ -48,6 +54,7 @@ export class PathRouterNode extends RouterNode {
48
54
  const pathRouterNode = new PathRouterNode(splitPaths[1], this);
49
55
  this.children.push(pathRouterNode);
50
56
  // Then, call add on the latest pathRouterNode child
57
+ // Remove the first part of the path as it is used by the current node.
51
58
  pathRouterNode.add(splitPaths.slice(1), method, route, levelFromRoot + 1);
52
59
  return;
53
60
  }
@@ -57,8 +64,8 @@ export class PathRouterNode extends RouterNode {
57
64
  * it returns itself as the node found. This method should always return a MethodRouterNode. However, Typescript
58
65
  * doesn't like these recursive imports so we return the base class
59
66
  *
60
- * @param splitPaths
61
- * @param method
67
+ * @param splitPaths A list of all the parts of the paths spliced at the forward slashes.
68
+ * @param method The http method for which to find a node.
62
69
  */
63
70
  find(splitPaths, method) {
64
71
  // If splitPaths is 0 or if the first path doesn't match this current node, we return
@@ -66,7 +73,8 @@ export class PathRouterNode extends RouterNode {
66
73
  return null;
67
74
  }
68
75
  const foundChildren = [];
69
- // Since we checked above if we didn't match, it means we match. We check if one of our children matches.
76
+ // Since we checked above if we didn't match, it means we match.
77
+ // We check if one of our children matches the next part of the path.
70
78
  for (const child of this.children) {
71
79
  const foundChild = child.find(splitPaths.slice(1), method);
72
80
  if (foundChild !== null) {
@@ -88,12 +96,14 @@ export class PathRouterNode extends RouterNode {
88
96
  /**
89
97
  * This httpMethod navigates the tree upwards and returns all the routeParameters
90
98
  *
91
- * @param splitPaths
99
+ * @param splitPaths A list of all the parts of the paths spliced at the forward slashes.
92
100
  */
93
101
  getRouteParameters(splitPaths) {
94
102
  let parameters = {};
95
103
  if (this.matches(splitPaths[0])) {
96
- // If the current path is a parameter path, meaning has services/{id-of-service}
104
+ // If the current path is a path parameter
105
+ // We support both ways of setting a path parameter, either curly brackets, or colons
106
+ // ie: services/{serviceId} or service/:serviceId
97
107
  if (this.path.startsWith("/{") && this.path.endsWith("}")) {
98
108
  const name = this.path.slice(2, this.path.length - 1);
99
109
  parameters[name] = splitPaths[0].slice(1, splitPaths[0].length);
@@ -117,14 +127,14 @@ export class PathRouterNode extends RouterNode {
117
127
  return this.path.startsWith("/*");
118
128
  }
119
129
  /**
120
- * This method returns whether or not this pathRouterNode represents a route parameter, e.g.: /{id} or :id
130
+ * This method returns whether or not this pathRouterNode represents a route parameter, e.g.: /{id} or /:id
121
131
  */
122
132
  isRouteParameter() {
123
- // If the current path is a parameter path, meaning has services/{id-of-service}
133
+ // If the current path is a path parameter, meaning has services/{id-of-service}
124
134
  if (this.path.startsWith("/{") && this.path.endsWith("}")) {
125
135
  return true;
126
136
  }
127
- // We also support parameter path written as services/:id-of-service
137
+ // We also support path parameter written as services/:id-of-service
128
138
  if (this.path.startsWith("/:")) {
129
139
  return true;
130
140
  }
@@ -1 +1 @@
1
- {"version":3,"file":"path-router.node.js","sourceRoot":"","sources":["../../../../src/nodes/path-router.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,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACvD,OAAO,IAAI,CAAC;SACf;QAED,oEAAoE;QACpE,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,IAAY;QAChB,IAAG,IAAI,CAAC,UAAU,EAAE,EAAE;YAClB,OAAO,IAAI,CAAC;SACf;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE,EAAE;YACzB,OAAO,IAAI,CAAC;SACf;QAED,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;IAC9B,CAAC;CACJ"}
@@ -8,11 +8,29 @@ import "reflect-metadata";
8
8
  import { injectable } from "tsyringe";
9
9
  import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
10
10
  import { NetworkingModuleKeyname } from "../networking.module.keyname";
11
+ /**
12
+ * The BodyParameterDecoratorResolver resolves the value of the body of the request so that it can be injected it into the
13
+ * parameter of the route of the controller that was annotated with the @body decorator.
14
+ * It is tagged as an MethodParameterDecoratorResolver so it can be automatically injected with the all the other MethodParameterDecoratorResolvers.
15
+ */
11
16
  let BodyParameterDecoratorResolver = class BodyParameterDecoratorResolver {
17
+ /**
18
+ * Resolves the value of the body of the request.
19
+ * The router than injects that value into the parameter of the controller method.
20
+ * @param methodArgument The method argument created by the decorator.
21
+ * @param request The request
22
+ * @param routeParameters The router parameters
23
+ * @param identity The identity making the request
24
+ */
12
25
  resolve(methodArgument, request, routeParameters, identity) {
13
26
  var _a;
14
27
  return Promise.resolve((_a = request.body) !== null && _a !== void 0 ? _a : null);
15
28
  }
29
+ /**
30
+ * Returns whether or not the resolver support such a method argument.
31
+ * Usually we will check the methodArgument.type field to determine if it is a supported type.
32
+ * @param methodArgument
33
+ */
16
34
  supports(methodArgument) {
17
35
  return methodArgument && methodArgument.hasOwnProperty("type") && methodArgument.type === "body";
18
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"body-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/body-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,kBAAkB,CAAA;AACzB,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAKrE,IAAa,8BAA8B,GAA3C,MAAa,8BAA8B;IACvC,OAAO,CAAC,cAAmB,EACnB,OAAgB,EAChB,eAAwC,EACxC,QAA4B;;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAA,OAAO,CAAC,IAAI,mCAAI,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,QAAQ,CAAC,cAAmB;QACxB,OAAO,cAAc,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,KAAK,MAAM,CAAC;IACrG,CAAC;CACJ,CAAA;AAXY,8BAA8B;IAH1C,YAAY,CAAC,uBAAuB,CAAC;IACrC,GAAG,CAAC,wBAAwB,CAAC,gCAAgC,CAAC;IAC9D,UAAU,EAAE;GACA,8BAA8B,CAW1C;SAXY,8BAA8B"}
1
+ {"version":3,"file":"body-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/body-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,kBAAkB,CAAA;AACzB,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAIrE;;;;GAIG;AAIH,IAAa,8BAA8B,GAA3C,MAAa,8BAA8B;IAEvC;;;;;;;OAOG;IACH,OAAO,CAAC,cAA+C,EAC/C,OAAgB,EAChB,eAAwC,EACxC,QAA4B;;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAA,OAAO,CAAC,IAAI,mCAAI,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,cAA2C;QAChD,OAAO,cAAc,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,KAAK,MAAM,CAAC;IACrG,CAAC;CACJ,CAAA;AAzBY,8BAA8B;IAH1C,YAAY,CAAC,uBAAuB,CAAC;IACrC,GAAG,CAAC,wBAAwB,CAAC,gCAAgC,CAAC;IAC9D,UAAU,EAAE;GACA,8BAA8B,CAyB1C;SAzBY,8BAA8B"}
@@ -12,10 +12,24 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  };
13
13
  import { injectable, injectAll } from "tsyringe";
14
14
  import { ServiceDefinitionTagEnum } from "@pristine-ts/common";
15
+ /**
16
+ * This service calls the resolvers to resolve the value to be injected in the parameter of a method.
17
+ */
15
18
  let ControllerMethodParameterDecoratorResolver = class ControllerMethodParameterDecoratorResolver {
19
+ /**
20
+ * This service calls the resolvers to resolve the value to be injected in the parameter of a method.
21
+ * @param methodParameterDecoratorResolvers The parameter decorator resolvers. All services with the tag ServiceDefinitionTagEnum.MethodParameterDecoratorResolver will be automatically injected here.
22
+ */
16
23
  constructor(methodParameterDecoratorResolvers) {
17
24
  this.methodParameterDecoratorResolvers = methodParameterDecoratorResolvers;
18
25
  }
26
+ /**
27
+ * This method calls the parameter decorator resolver that supports the type of the decorator and resolves the value to be injected in the parameter.
28
+ * @param methodArgument The method argument created by the decorator.
29
+ * @param request The request
30
+ * @param routeParameters The router parameters
31
+ * @param identity The identity making the request
32
+ */
19
33
  resolve(methodArgument, request, routeParameters, identity) {
20
34
  for (let methodParameterDecoratorResolver of this.methodParameterDecoratorResolvers) {
21
35
  if (methodParameterDecoratorResolver.supports(methodArgument)) {
@@ -1 +1 @@
1
- {"version":3,"file":"controller-method-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/controller-method-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAoB,wBAAwB,EAAC,MAAM,qBAAqB,CAAC;AAMhF,IAAa,0CAA0C,GAAvD,MAAa,0CAA0C;IACnD,YAAmG,iCAAwF;QAAxF,sCAAiC,GAAjC,iCAAiC,CAAuD;IAC3L,CAAC;IAEM,OAAO,CAAC,cAA2C,EAC3C,OAAgB,EAChB,eAA0C,EAC1C,QAA4B;QAEvC,KAAK,IAAI,gCAAgC,IAAI,IAAI,CAAC,iCAAiC,EAAE;YACjF,IAAG,gCAAgC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;gBAC1D,OAAO,gCAAgC,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;aACvG;SACJ;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CACJ,CAAA;AAjBY,0CAA0C;IADtD,UAAU,EAAE;IAEI,WAAA,SAAS,CAAC,wBAAwB,CAAC,gCAAgC,CAAC,CAAA;;GADxE,0CAA0C,CAiBtD;SAjBY,0CAA0C"}
1
+ {"version":3,"file":"controller-method-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/controller-method-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAoB,wBAAwB,EAAC,MAAM,qBAAqB,CAAC;AAKhF;;GAEG;AAEH,IAAa,0CAA0C,GAAvD,MAAa,0CAA0C;IACnD;;;OAGG;IACH,YAAmG,iCAAwF;QAAxF,sCAAiC,GAAjC,iCAAiC,CAAuD;IAC3L,CAAC;IAGD;;;;;;OAMG;IACI,OAAO,CAAC,cAA2C,EAC3C,OAAgB,EAChB,eAA0C,EAC1C,QAA4B;QAEvC,KAAK,IAAI,gCAAgC,IAAI,IAAI,CAAC,iCAAiC,EAAE;YACjF,IAAG,gCAAgC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;gBAC1D,OAAO,gCAAgC,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;aACvG;SACJ;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CACJ,CAAA;AA7BY,0CAA0C;IADtD,UAAU,EAAE;IAMI,WAAA,SAAS,CAAC,wBAAwB,CAAC,gCAAgC,CAAC,CAAA;;GALxE,0CAA0C,CA6BtD;SA7BY,0CAA0C"}
@@ -8,11 +8,29 @@ import "reflect-metadata";
8
8
  import { injectable } from "tsyringe";
9
9
  import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
10
10
  import { NetworkingModuleKeyname } from "../networking.module.keyname";
11
+ /**
12
+ * The HeadersParameterDecoratorResolver resolves the value of the headers of the request so that it can be injected it into the
13
+ * parameter of the route of the controller that was annotated with the @headers decorator.
14
+ * It is tagged as an MethodParameterDecoratorResolver so it can be automatically injected with the all the other MethodParameterDecoratorResolvers.
15
+ */
11
16
  let HeadersParameterDecoratorResolver = class HeadersParameterDecoratorResolver {
17
+ /**
18
+ * Resolves the value of the headers of the request.
19
+ * The router than injects that value into the parameter of the controller method.
20
+ * @param methodArgument The method argument created by the decorator.
21
+ * @param request The request
22
+ * @param routeParameters The router parameters
23
+ * @param identity The identity making the request
24
+ */
12
25
  resolve(methodArgument, request, routeParameters, identity) {
13
26
  var _a;
14
27
  return Promise.resolve((_a = request.headers) !== null && _a !== void 0 ? _a : null);
15
28
  }
29
+ /**
30
+ * Returns whether or not the resolver support such a method argument.
31
+ * Usually we will check the methodArgument.type field to determine if it is a supported type.
32
+ * @param methodArgument
33
+ */
16
34
  supports(methodArgument) {
17
35
  return methodArgument && methodArgument.hasOwnProperty("type") && methodArgument.type === "headers";
18
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"headers-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/headers-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,kBAAkB,CAAA;AACzB,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAKrE,IAAa,iCAAiC,GAA9C,MAAa,iCAAiC;IAC1C,OAAO,CAAC,cAAmB,EACnB,OAAgB,EAChB,eAAwC,EACxC,QAA4B;;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAI,CAAC,CAAC;IACpD,CAAC;IAED,QAAQ,CAAC,cAAmB;QACxB,OAAO,cAAc,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,KAAK,SAAS,CAAC;IACxG,CAAC;CACJ,CAAA;AAXY,iCAAiC;IAH7C,YAAY,CAAC,uBAAuB,CAAC;IACrC,GAAG,CAAC,wBAAwB,CAAC,gCAAgC,CAAC;IAC9D,UAAU,EAAE;GACA,iCAAiC,CAW7C;SAXY,iCAAiC"}
1
+ {"version":3,"file":"headers-parameter-decorator.resolver.js","sourceRoot":"","sources":["../../../../src/resolvers/headers-parameter-decorator.resolver.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,kBAAkB,CAAA;AACzB,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAoB,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAIrE;;;;GAIG;AAIH,IAAa,iCAAiC,GAA9C,MAAa,iCAAiC;IAE1C;;;;;;;OAOG;IACH,OAAO,CAAC,cAAkD,EAClD,OAAgB,EAChB,eAAwC,EACxC,QAA4B;;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAI,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,cAA2C;QAChD,OAAO,cAAc,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,IAAI,KAAK,SAAS,CAAC;IACxG,CAAC;CACJ,CAAA;AAzBY,iCAAiC;IAH7C,YAAY,CAAC,uBAAuB,CAAC;IACrC,GAAG,CAAC,wBAAwB,CAAC,gCAAgC,CAAC;IAC9D,UAAU,EAAE;GACA,iCAAiC,CAyB7C;SAzBY,iCAAiC"}