@pristine-ts/networking 0.0.276 → 0.0.277

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 (64) hide show
  1. package/dist/lib/cjs/decorators/body.decorator.js +2 -16
  2. package/dist/lib/cjs/decorators/body.decorator.js.map +1 -1
  3. package/dist/lib/cjs/decorators/controller.decorator.js +5 -11
  4. package/dist/lib/cjs/decorators/controller.decorator.js.map +1 -1
  5. package/dist/lib/cjs/decorators/header.decorator.js +3 -16
  6. package/dist/lib/cjs/decorators/header.decorator.js.map +1 -1
  7. package/dist/lib/cjs/decorators/headers.decorator.js +3 -16
  8. package/dist/lib/cjs/decorators/headers.decorator.js.map +1 -1
  9. package/dist/lib/cjs/decorators/identity.decorator.js +3 -16
  10. package/dist/lib/cjs/decorators/identity.decorator.js.map +1 -1
  11. package/dist/lib/cjs/decorators/query-parameter.decorator.js +3 -16
  12. package/dist/lib/cjs/decorators/query-parameter.decorator.js.map +1 -1
  13. package/dist/lib/cjs/decorators/query-parameters.decorator.js +3 -16
  14. package/dist/lib/cjs/decorators/query-parameters.decorator.js.map +1 -1
  15. package/dist/lib/cjs/decorators/request.decorator.js +3 -16
  16. package/dist/lib/cjs/decorators/request.decorator.js.map +1 -1
  17. package/dist/lib/cjs/decorators/response-header.decorator.js +9 -38
  18. package/dist/lib/cjs/decorators/response-header.decorator.js.map +1 -1
  19. package/dist/lib/cjs/decorators/route-parameter.decorator.js +3 -16
  20. package/dist/lib/cjs/decorators/route-parameter.decorator.js.map +1 -1
  21. package/dist/lib/cjs/decorators/route.decorator.js +5 -12
  22. package/dist/lib/cjs/decorators/route.decorator.js.map +1 -1
  23. package/dist/lib/cjs/interceptors/response-headers.interceptor.js +3 -2
  24. package/dist/lib/cjs/interceptors/response-headers.interceptor.js.map +1 -1
  25. package/dist/lib/cjs/router.js +27 -21
  26. package/dist/lib/cjs/router.js.map +1 -1
  27. package/dist/lib/esm/decorators/body.decorator.js +2 -16
  28. package/dist/lib/esm/decorators/body.decorator.js.map +1 -1
  29. package/dist/lib/esm/decorators/controller.decorator.js +5 -11
  30. package/dist/lib/esm/decorators/controller.decorator.js.map +1 -1
  31. package/dist/lib/esm/decorators/header.decorator.js +3 -16
  32. package/dist/lib/esm/decorators/header.decorator.js.map +1 -1
  33. package/dist/lib/esm/decorators/headers.decorator.js +3 -16
  34. package/dist/lib/esm/decorators/headers.decorator.js.map +1 -1
  35. package/dist/lib/esm/decorators/identity.decorator.js +3 -16
  36. package/dist/lib/esm/decorators/identity.decorator.js.map +1 -1
  37. package/dist/lib/esm/decorators/query-parameter.decorator.js +3 -16
  38. package/dist/lib/esm/decorators/query-parameter.decorator.js.map +1 -1
  39. package/dist/lib/esm/decorators/query-parameters.decorator.js +3 -16
  40. package/dist/lib/esm/decorators/query-parameters.decorator.js.map +1 -1
  41. package/dist/lib/esm/decorators/request.decorator.js +3 -16
  42. package/dist/lib/esm/decorators/request.decorator.js.map +1 -1
  43. package/dist/lib/esm/decorators/response-header.decorator.js +8 -37
  44. package/dist/lib/esm/decorators/response-header.decorator.js.map +1 -1
  45. package/dist/lib/esm/decorators/route-parameter.decorator.js +3 -16
  46. package/dist/lib/esm/decorators/route-parameter.decorator.js.map +1 -1
  47. package/dist/lib/esm/decorators/route.decorator.js +5 -12
  48. package/dist/lib/esm/decorators/route.decorator.js.map +1 -1
  49. package/dist/lib/esm/interceptors/response-headers.interceptor.js +3 -2
  50. package/dist/lib/esm/interceptors/response-headers.interceptor.js.map +1 -1
  51. package/dist/lib/esm/router.js +28 -22
  52. package/dist/lib/esm/router.js.map +1 -1
  53. package/dist/types/decorators/controller.decorator.d.ts +1 -0
  54. package/dist/types/decorators/header.decorator.d.ts +1 -0
  55. package/dist/types/decorators/headers.decorator.d.ts +1 -0
  56. package/dist/types/decorators/identity.decorator.d.ts +1 -0
  57. package/dist/types/decorators/query-parameter.decorator.d.ts +1 -0
  58. package/dist/types/decorators/query-parameters.decorator.d.ts +1 -0
  59. package/dist/types/decorators/request.decorator.d.ts +1 -0
  60. package/dist/types/decorators/response-header.decorator.d.ts +2 -0
  61. package/dist/types/decorators/route-parameter.decorator.d.ts +1 -0
  62. package/dist/types/decorators/route.decorator.d.ts +1 -0
  63. package/dist/types/router.d.ts +1 -0
  64. package/package.json +7 -6
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.body = void 0;
4
+ const common_1 = require("@pristine-ts/common");
4
5
  /**
5
6
  * The body decorator can be used to inject the body of a request in a parameter of a method in a controller.
6
7
  */
@@ -18,26 +19,11 @@ const body = () => {
18
19
  * The index of the parameter for which the decorator is used.
19
20
  */
20
21
  parameterIndex) => {
21
- // Verify that the object target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] exists or we create it.
22
- // This object is a convention defined by Pristine on where to save controller method parameter decorator information and is used in the router to retrieve that information.
23
- if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
24
- target.constructor.prototype["__metadata__"] = {};
25
- }
26
- if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
27
- target.constructor.prototype["__metadata__"]["methods"] = {};
28
- }
29
- if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
30
- target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
31
- }
32
- if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("arguments") === false) {
33
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] = [];
34
- }
35
22
  // Set the type of method parameter. Each parameter decorator has it's own type.
36
23
  const methodParameter = {
37
24
  type: "body"
38
25
  };
39
- // Save the method parameter with the proper parameter index (index of the parameter in the list of parameters of a method).
40
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"][parameterIndex] = methodParameter;
26
+ common_1.MetadataUtil.setMethodParameterArgumentMetadata(target, propertyKey, parameterIndex, methodParameter);
41
27
  };
42
28
  };
43
29
  exports.body = body;
@@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C;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,CAAC;AA3CW,QAAA,IAAI,QA2Cf"}
1
+ {"version":3,"file":"body.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/body.decorator.ts"],"names":[],"mappings":";;;AACA,gDAAiD;AAEjD;;GAEG;AACI,MAAM,IAAI,GAAG,GAAG,EAAE;IACrB,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QACA,gFAAgF;QAChF,MAAM,eAAe,GAAoC;YACrD,IAAI,EAAE,MAAM;SACf,CAAC;QAEF,qBAAY,CAAC,kCAAkC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;IAC1G,CAAC,CAAA;AACL,CAAC,CAAC;AAxBW,QAAA,IAAI,QAwBf"}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.controller = exports.controllerRegistry = void 0;
4
+ require("reflect-metadata");
5
+ const metadata_1 = require("@pristine-ts/metadata");
6
+ const common_1 = require("@pristine-ts/common");
4
7
  exports.controllerRegistry = [];
5
8
  /**
6
9
  * The controller decorator can be used on a class to register this class as a controller in the router.
@@ -12,18 +15,9 @@ const controller = (basePath) => {
12
15
  * The constructor of the class
13
16
  */
14
17
  constructor) => {
15
- // Verify that the object constructor.prototype["__metadata__"]["controller"][basePath] exists or we create it.
16
- // This object is a convention defined by Pristine on where to save controller decorator information and is used in the router to retrieve that information.
17
- if (constructor.prototype.hasOwnProperty("__metadata__") === false) {
18
- constructor.prototype["__metadata__"] = {};
19
- }
20
- if (constructor.prototype["__metadata__"].hasOwnProperty("controller") === false) {
21
- constructor.prototype["__metadata__"]["controller"] = {};
22
- }
23
- // Save the base path.
24
- constructor.prototype["__metadata__"]["controller"]["basePath"] = basePath;
18
+ metadata_1.ClassMetadata.defineMetadata(constructor, common_1.MetadataEnum.ControllerBasePath, basePath);
25
19
  // Push the class prototype in the controllerRegistry that is used to instantiate all the controllers for the router.
26
- exports.controllerRegistry.push(constructor.prototype);
20
+ exports.controllerRegistry.push(constructor);
27
21
  };
28
22
  };
29
23
  exports.controller = controller;
@@ -1 +1 @@
1
- {"version":3,"file":"controller.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/controller.decorator.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAU,EAAE,CAAC;AAE5C;;;GAGG;AACI,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC3C,OAAO;IACH;;OAEG;IACH,WAAqB,EACvB,EAAE;QACA,+GAA+G;QAC/G,4JAA4J;QAC5J,IAAG,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,cAAc,CAAC,KAAK,KAAK,EAAE;YAC/D,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,CAAA;SAC7C;QAGD,IAAG,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,KAAK,EAAE;YAC7E,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,YAAY,CAAC,GAAG,EAAE,CAAA;SAC3D;QAED,sBAAsB;QACtB,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;QAE3E,qHAAqH;QACrH,0BAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;IAClD,CAAC,CAAA;AACL,CAAC,CAAA;AAxBY,QAAA,UAAU,cAwBtB"}
1
+ {"version":3,"file":"controller.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/controller.decorator.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,oDAAoD;AACpD,gDAAgD;AAEnC,QAAA,kBAAkB,GAAU,EAAE,CAAC;AAE5C;;;GAGG;AACI,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC3C,OAAO;IACH;;OAEG;IACH,WAAqB,EACvB,EAAE;QACA,wBAAa,CAAC,cAAc,CAAC,WAAW,EAAE,qBAAY,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAA;QAEpF,qHAAqH;QACrH,0BAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IACxC,CAAC,CAAA;AACL,CAAC,CAAA;AAZY,QAAA,UAAU,cAYtB"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.header = void 0;
4
+ require("reflect-metadata");
5
+ const common_1 = require("@pristine-ts/common");
4
6
  /**
5
7
  * The headerParameter decorator can be used to inject a specific header of a request in a parameter of a method in a controller.
6
8
  * @param name The name of the header to inject.
@@ -19,28 +21,13 @@ const header = (name) => {
19
21
  * The index of the parameter for which the decorator is used.
20
22
  */
21
23
  parameterIndex) => {
22
- // Verify that the object target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] exists or we create it.
23
- // This object is a convention defined by Pristine on where to save controller method parameter decorator information and is used in the router to retrieve that information.
24
- if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
25
- target.constructor.prototype["__metadata__"] = {};
26
- }
27
- if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
28
- target.constructor.prototype["__metadata__"]["methods"] = {};
29
- }
30
- if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
31
- target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
32
- }
33
- if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("arguments") === false) {
34
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] = [];
35
- }
36
24
  // Set the type of method parameter. Each parameter decorator has it's own type.
37
25
  // Set also the name of the header to resolve.
38
26
  const methodParameter = {
39
27
  type: "header",
40
28
  headerName: name,
41
29
  };
42
- // Save the method parameter with the proper parameter index (index of the parameter in the list of parameters of a method).
43
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"][parameterIndex] = methodParameter;
30
+ common_1.MetadataUtil.setMethodParameterArgumentMetadata(target, propertyKey, parameterIndex, methodParameter);
44
31
  };
45
32
  };
46
33
  exports.header = header;
@@ -1 +1 @@
1
- {"version":3,"file":"header.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/header.decorator.ts"],"names":[],"mappings":";;;AAGA;;;GAGG;AACI,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE;IACnC,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;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,8CAA8C;QAC9C,MAAM,eAAe,GAAsC;YACvD,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,IAAI;SACnB,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;AA7CY,QAAA,MAAM,UA6ClB"}
1
+ {"version":3,"file":"header.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/header.decorator.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAG1B,gDAAiD;AAEjD;;;GAGG;AACI,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE;IACnC,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QACA,gFAAgF;QAChF,8CAA8C;QAC9C,MAAM,eAAe,GAAsC;YACvD,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,IAAI;SACnB,CAAC;QAEF,qBAAY,CAAC,kCAAkC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;IAC1G,CAAC,CAAA;AACL,CAAC,CAAA;AA1BY,QAAA,MAAM,UA0BlB"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.headers = void 0;
4
+ require("reflect-metadata");
5
+ const common_1 = require("@pristine-ts/common");
4
6
  /**
5
7
  * The headers decorator can be used to inject the headers of a request in a parameter of a method in a controller.
6
8
  */
@@ -18,26 +20,11 @@ const headers = () => {
18
20
  * The index of the parameter for which the decorator is used.
19
21
  */
20
22
  parameterIndex) => {
21
- // Verify that the object target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] exists or we create it.
22
- // This object is a convention defined by Pristine on where to save controller method parameter decorator information and is used in the router to retrieve that information.
23
- if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
24
- target.constructor.prototype["__metadata__"] = {};
25
- }
26
- if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
27
- target.constructor.prototype["__metadata__"]["methods"] = {};
28
- }
29
- if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
30
- target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
31
- }
32
- if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("arguments") === false) {
33
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] = [];
34
- }
35
23
  // Set the type of method parameter. Each parameter decorator has it's own type.
36
24
  const methodParameter = {
37
25
  type: "headers"
38
26
  };
39
- // Save the method parameter with the proper parameter index (index of the parameter in the list of parameters of a method).
40
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"][parameterIndex] = methodParameter;
27
+ common_1.MetadataUtil.setMethodParameterArgumentMetadata(target, propertyKey, parameterIndex, methodParameter);
41
28
  };
42
29
  };
43
30
  exports.headers = headers;
@@ -1 +1 @@
1
- {"version":3,"file":"headers.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/headers.decorator.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACI,MAAM,OAAO,GAAG,GAAG,EAAE;IACxB,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QAC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file":"headers.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/headers.decorator.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAE1B,gDAAiD;AAEjD;;GAEG;AACI,MAAM,OAAO,GAAG,GAAG,EAAE;IACxB,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QACA,gFAAgF;QAChF,MAAM,eAAe,GAAuC;YACxD,IAAI,EAAE,SAAS;SAClB,CAAC;QAEF,qBAAY,CAAC,kCAAkC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;IAC1G,CAAC,CAAA;AACL,CAAC,CAAC;AAxBW,QAAA,OAAO,WAwBlB"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.identity = void 0;
4
+ require("reflect-metadata");
5
+ const common_1 = require("@pristine-ts/common");
4
6
  /**
5
7
  * The identity decorator can be used to inject the identity making the request in a parameter of a method in a controller.
6
8
  */
@@ -18,26 +20,11 @@ const identity = () => {
18
20
  * The index of the parameter for which the decorator is used.
19
21
  */
20
22
  parameterIndex) => {
21
- // Verify that the object target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] exists or we create it.
22
- // This object is a convention defined by Pristine on where to save controller method parameter decorator information and is used in the router to retrieve that information.
23
- if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
24
- target.constructor.prototype["__metadata__"] = {};
25
- }
26
- if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
27
- target.constructor.prototype["__metadata__"]["methods"] = {};
28
- }
29
- if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
30
- target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
31
- }
32
- if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("arguments") === false) {
33
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] = [];
34
- }
35
23
  // Set the type of method parameter. Each parameter decorator has it's own type.
36
24
  const methodParameter = {
37
25
  type: "identity"
38
26
  };
39
- // Save the method parameter with the proper parameter index (index of the parameter in the list of parameters of a method).
40
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"][parameterIndex] = methodParameter;
27
+ common_1.MetadataUtil.setMethodParameterArgumentMetadata(target, propertyKey, parameterIndex, methodParameter);
41
28
  };
42
29
  };
43
30
  exports.identity = identity;
@@ -1 +1 @@
1
- {"version":3,"file":"identity.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/identity.decorator.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACI,MAAM,QAAQ,GAAG,GAAG,EAAE;IACzB,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QACA,mIAAmI;QACnI,6KAA6K;QAC7K,IAAI,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,cAAc,CAAC,KAAK,KAAK,EAAE;YACvE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,CAAA;SACpD;QAED,IAAI,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,KAAK,EAAE;YAClF,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAA;SAC/D;QAED,IAAI,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,KAAK,EAAE;YAC/F,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAA;SAC5E;QAED,IAAI,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,KAAK,EAAE;YAC5G,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,GAAwC;YACzD,IAAI,EAAE,UAAU;SACnB,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,CAAC;AA3CW,QAAA,QAAQ,YA2CnB"}
1
+ {"version":3,"file":"identity.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/identity.decorator.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAE1B,gDAAiD;AAEjD;;GAEG;AACI,MAAM,QAAQ,GAAG,GAAG,EAAE;IACzB,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QACA,gFAAgF;QAChF,MAAM,eAAe,GAAwC;YACzD,IAAI,EAAE,UAAU;SACnB,CAAC;QAEF,qBAAY,CAAC,kCAAkC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;IAC1G,CAAC,CAAA;AACL,CAAC,CAAC;AAxBW,QAAA,QAAQ,YAwBnB"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.queryParameter = void 0;
4
+ require("reflect-metadata");
5
+ const common_1 = require("@pristine-ts/common");
4
6
  /**
5
7
  * The queryParameter decorator can be used to inject a specific query parameter of a request in a parameter of a method in a controller.
6
8
  * @param name The name of the query parameter to inject.
@@ -19,28 +21,13 @@ const queryParameter = (name) => {
19
21
  * The index of the parameter for which the decorator is used.
20
22
  */
21
23
  parameterIndex) => {
22
- // Verify that the object target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] exists or we create it.
23
- // This object is a convention defined by Pristine on where to save controller method parameter decorator information and is used in the router to retrieve that information.
24
- if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
25
- target.constructor.prototype["__metadata__"] = {};
26
- }
27
- if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
28
- target.constructor.prototype["__metadata__"]["methods"] = {};
29
- }
30
- if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
31
- target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
32
- }
33
- if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("arguments") === false) {
34
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] = [];
35
- }
36
24
  // Set the type of method parameter. Each parameter decorator has it's own type.
37
25
  // Set also the name of the query parameter to resolve.
38
26
  const methodParameter = {
39
27
  type: "queryParameter",
40
28
  queryParameterName: name,
41
29
  };
42
- // Save the method parameter with the proper parameter index (index of the parameter in the list of parameters of a method).
43
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"][parameterIndex] = methodParameter;
30
+ common_1.MetadataUtil.setMethodParameterArgumentMetadata(target, propertyKey, parameterIndex, methodParameter);
44
31
  };
45
32
  };
46
33
  exports.queryParameter = queryParameter;
@@ -1 +1 @@
1
- {"version":3,"file":"query-parameter.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/query-parameter.decorator.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACI,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE;IAC3C,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,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AC,CAAA;AA7CY,QAAA,cAAc,kBA6C1B"}
1
+ {"version":3,"file":"query-parameter.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/query-parameter.decorator.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAE1B,gDAAiD;AAEjD;;;GAGG;AACI,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE;IAC3C,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QACA,gFAAgF;QAChF,uDAAuD;QACvD,MAAM,eAAe,GAAqC;YACtD,IAAI,EAAE,gBAAgB;YACtB,kBAAkB,EAAE,IAAI;SAC3B,CAAC;QAEF,qBAAY,CAAC,kCAAkC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;IAC1G,CAAC,CAAA;AACL,CAAC,CAAA;AA1BY,QAAA,cAAc,kBA0B1B"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.queryParameters = void 0;
4
+ require("reflect-metadata");
5
+ const common_1 = require("@pristine-ts/common");
4
6
  /**
5
7
  * The queryParameters decorator can be used to inject all the query parameters of a request in a parameter of a method in a controller.
6
8
  */
@@ -18,26 +20,11 @@ const queryParameters = () => {
18
20
  * The index of the parameter for which the decorator is used.
19
21
  */
20
22
  parameterIndex) => {
21
- // Verify that the object target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] exists or we create it.
22
- // This object is a convention defined by Pristine on where to save controller method parameter decorator information and is used in the router to retrieve that information.
23
- if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
24
- target.constructor.prototype["__metadata__"] = {};
25
- }
26
- if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
27
- target.constructor.prototype["__metadata__"]["methods"] = {};
28
- }
29
- if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
30
- target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
31
- }
32
- if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("arguments") === false) {
33
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] = [];
34
- }
35
23
  // Set the type of method parameter. Each parameter decorator has it's own type.
36
24
  const methodParameter = {
37
25
  type: "queryParameters",
38
26
  };
39
- // Save the method parameter with the proper parameter index (index of the parameter in the list of parameters of a method).
40
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"][parameterIndex] = methodParameter;
27
+ common_1.MetadataUtil.setMethodParameterArgumentMetadata(target, propertyKey, parameterIndex, methodParameter);
41
28
  };
42
29
  };
43
30
  exports.queryParameters = queryParameters;
@@ -1 +1 @@
1
- {"version":3,"file":"query-parameters.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/query-parameters.decorator.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACI,MAAM,eAAe,GAAG,GAAG,EAAE;IAChC,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;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,GAAsC;YACvD,IAAI,EAAE,iBAAiB;SAC1B,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;AA3CY,QAAA,eAAe,mBA2C3B"}
1
+ {"version":3,"file":"query-parameters.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/query-parameters.decorator.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAE1B,gDAAiD;AAEjD;;GAEG;AACI,MAAM,eAAe,GAAG,GAAG,EAAE;IAChC,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QACA,gFAAgF;QAChF,MAAM,eAAe,GAAsC;YACvD,IAAI,EAAE,iBAAiB;SAC1B,CAAC;QAEF,qBAAY,CAAC,kCAAkC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;IAC1G,CAAC,CAAA;AACL,CAAC,CAAA;AAxBY,QAAA,eAAe,mBAwB3B"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.request = void 0;
4
+ require("reflect-metadata");
5
+ const common_1 = require("@pristine-ts/common");
4
6
  /**
5
7
  * The request decorator can be used to inject the whole request in a parameter of a method in a controller.
6
8
  */
@@ -18,26 +20,11 @@ const request = () => {
18
20
  * The index of the parameter for which the decorator is used.
19
21
  */
20
22
  parameterIndex) => {
21
- // Verify that the object target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] exists or we create it.
22
- // This object is a convention defined by Pristine on where to save controller method parameter decorator information and is used in the router to retrieve that information.
23
- if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
24
- target.constructor.prototype["__metadata__"] = {};
25
- }
26
- if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
27
- target.constructor.prototype["__metadata__"]["methods"] = {};
28
- }
29
- if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
30
- target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
31
- }
32
- if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("arguments") === false) {
33
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] = [];
34
- }
35
23
  // Set the type of method parameter. Each parameter decorator has it's own type.
36
24
  const methodParameter = {
37
25
  type: "request"
38
26
  };
39
- // Save the method parameter with the proper parameter index (index of the parameter in the list of parameters of a method).
40
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"][parameterIndex] = methodParameter;
27
+ common_1.MetadataUtil.setMethodParameterArgumentMetadata(target, propertyKey, parameterIndex, methodParameter);
41
28
  };
42
29
  };
43
30
  exports.request = request;
@@ -1 +1 @@
1
- {"version":3,"file":"request.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/request.decorator.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACI,MAAM,OAAO,GAAG,GAAG,EAAE;IACxB,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,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AAC;AA3CW,QAAA,OAAO,WA2ClB"}
1
+ {"version":3,"file":"request.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/request.decorator.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAE1B,gDAAiD;AAEjD;;GAEG;AACI,MAAM,OAAO,GAAG,GAAG,EAAE;IACxB,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QACA,gFAAgF;QAChF,MAAM,eAAe,GAAuC;YACxD,IAAI,EAAE,SAAS;SAClB,CAAC;QAEF,qBAAY,CAAC,kCAAkC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;IAC1G,CAAC,CAAA;AACL,CAAC,CAAC;AAxBW,QAAA,OAAO,WAwBlB"}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.responseHeader = void 0;
3
+ exports.responseHeader = exports.responseHeaderMetadataKeyname = void 0;
4
+ require("reflect-metadata");
5
+ const common_1 = require("@pristine-ts/common");
6
+ exports.responseHeaderMetadataKeyname = "@responseHeader";
4
7
  /**
5
8
  * The responseHeader decorator can be used to specify a header that needs to be added to the response before sending it back.
6
9
  * This decorator can be used with either method (route) or a class (controller).
@@ -22,43 +25,11 @@ const responseHeader = (key, value) => {
22
25
  * The descriptor of the property
23
26
  */
24
27
  descriptor) => {
25
- // If there's a descriptor and a property key, then it's not a controller decorator, but a method decorator
26
- if (descriptor && propertyKey) {
27
- // Verify that the object target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"]["responseHeaders"] exists or we create it.
28
- // This object is a convention defined by Pristine on where to save controller method parameter decorator information and is used in the router to retrieve that information.
29
- if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
30
- target.constructor.prototype["__metadata__"] = {};
31
- }
32
- if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
33
- target.constructor.prototype["__metadata__"]["methods"] = {};
34
- }
35
- if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
36
- target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
37
- }
38
- if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("__routeContext__") === false) {
39
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"] = {};
40
- }
41
- if (target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"].hasOwnProperty("responseHeaders") === false) {
42
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"]["responseHeaders"] = {};
43
- }
44
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["__routeContext__"]["responseHeaders"][key] = value;
45
- }
46
- else {
47
- // It is a controller decorator
48
- if (target.prototype.hasOwnProperty("__metadata__") === false) {
49
- target.prototype["__metadata__"] = {};
50
- }
51
- if (target.prototype["__metadata__"].hasOwnProperty("controller") === false) {
52
- target.prototype["__metadata__"]["controller"] = {};
53
- }
54
- if (target.prototype["__metadata__"]["controller"].hasOwnProperty("__routeContext__") === false) {
55
- target.prototype["__metadata__"]["controller"]["__routeContext__"] = {};
56
- }
57
- if (target.prototype["__metadata__"]["controller"]["__routeContext__"].hasOwnProperty("responseHeaders") === false) {
58
- target.prototype["__metadata__"]["controller"]["__routeContext__"]["responseHeaders"] = {};
59
- }
60
- target.prototype["__metadata__"]["controller"]["__routeContext__"]["responseHeaders"][key] = value;
61
- }
28
+ var _a;
29
+ const routeContext = common_1.MetadataUtil.getRouteContext(target, propertyKey);
30
+ const headers = (_a = routeContext[exports.responseHeaderMetadataKeyname]) !== null && _a !== void 0 ? _a : {};
31
+ headers[key] = value;
32
+ common_1.MetadataUtil.setToRouteContext(exports.responseHeaderMetadataKeyname, headers, target, propertyKey);
62
33
  };
63
34
  };
64
35
  exports.responseHeader = responseHeader;
@@ -1 +1 @@
1
- {"version":3,"file":"response-header.decorator.js","sourceRoot":"","s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CAAC,CAAC,kBAAkB,CAAC,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAA;aAC7F;YAED,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,YAAY,CAAC,CAAC,kBAAkB,CAAC,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SACtG;IACL,CAAC,CAAA;AACL,CAAC,CAAA;AAjEY,QAAA,cAAc,kBAiE1B"}
1
+ {"version":3,"file":"response-header.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/response-header.decorator.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,gDAAiD;AAEpC,QAAA,6BAA6B,GAAG,iBAAiB,CAAC;AAE/D;;;;;;GAMG;AACI,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,KAAa,EAAE,EAAE;IACzD,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAAoB;IAEpB;;OAEG;IACH,UAA+B,EACjC,EAAE;;QACA,MAAM,YAAY,GAAG,qBAAY,CAAC,eAAe,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAEvE,MAAM,OAAO,GAAG,MAAA,YAAY,CAAC,qCAA6B,CAAC,mCAAI,EAAE,CAAC;QAElE,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAErB,qBAAY,CAAC,iBAAiB,CAAC,qCAA6B,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IAChG,CAAC,CAAA;AACL,CAAC,CAAA;AAzBY,QAAA,cAAc,kBAyB1B"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.routeParameter = void 0;
4
+ require("reflect-metadata");
5
+ const common_1 = require("@pristine-ts/common");
4
6
  /**
5
7
  * The routeParameter decorator can be used to inject a specific route parameter of a request in a parameter of a method in a controller.
6
8
  * @param name The name of the route(path) parameter to inject.
@@ -19,27 +21,12 @@ const routeParameter = (name) => {
19
21
  * The index of the parameter for which the decorator is used.
20
22
  */
21
23
  parameterIndex) => {
22
- // Verify that the object target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] exists or we create it.
23
- // This object is a convention defined by Pristine on where to save controller method parameter decorator information and is used in the router to retrieve that information.
24
- if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
25
- target.constructor.prototype["__metadata__"] = {};
26
- }
27
- if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
28
- target.constructor.prototype["__metadata__"]["methods"] = {};
29
- }
30
- if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
31
- target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
32
- }
33
- if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("arguments") === false) {
34
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] = [];
35
- }
36
24
  // Set the type of method parameter. Each parameter decorator has it's own type.
37
25
  const methodParameter = {
38
26
  type: "routeParameter",
39
27
  routeParameterName: name,
40
28
  };
41
- // Save the method parameter with the proper parameter index (index of the parameter in the list of parameters of a method).
42
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"][parameterIndex] = methodParameter;
29
+ common_1.MetadataUtil.setMethodParameterArgumentMetadata(target, propertyKey, parameterIndex, methodParameter);
43
30
  };
44
31
  };
45
32
  exports.routeParameter = routeParameter;
@@ -1 +1 @@
1
- {"version":3,"file":"route-parameter.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/route-parameter.decorator.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACI,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE;IAC3C,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QACA,mIAAmI;QACnI,6KAA6K;QAC7K,IAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CA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.decorator.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAE1B,gDAAgD;AAEhD;;;GAGG;AACI,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE;IAC3C,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QACA,gFAAgF;QAChF,MAAM,eAAe,GAAqC;YACtD,IAAI,EAAE,gBAAgB;YACtB,kBAAkB,EAAE,IAAI;SAC3B,CAAC;QAEF,qBAAY,CAAC,kCAAkC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;IAC1G,CAAC,CAAA;AACL,CAAC,CAAA;AAzBY,QAAA,cAAc,kBAyB1B"}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.route = void 0;
4
+ require("reflect-metadata");
5
+ const common_1 = require("@pristine-ts/common");
6
+ const metadata_1 = require("@pristine-ts/metadata");
4
7
  /**
5
8
  * The route decorator can be used on a method to register this method as a route of the controller in the router.
6
9
  * @param httpMethod The http method of the route
@@ -20,24 +23,14 @@ const route = (httpMethod, path) => {
20
23
  * The descriptor of the property.
21
24
  */
22
25
  descriptor) => {
23
- // Verify that the object target.constructor.prototype["__metadata__"]["methods"][propertyKey]["route"] exists or we create it.
24
- // 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.
25
- if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
26
- target.constructor.prototype["__metadata__"] = {};
27
- }
28
- if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
29
- target.constructor.prototype["__metadata__"]["methods"] = {};
30
- }
31
- if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
32
- target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
33
- }
34
26
  // Set the route.
35
27
  const route = {
36
28
  httpMethod,
37
29
  methodKeyname: propertyKey,
38
30
  path
39
31
  };
40
- target.constructor.prototype["__metadata__"]["methods"][propertyKey]["route"] = route;
32
+ metadata_1.MethodMetadata.defineMetadata(target, propertyKey, common_1.MetadataEnum.Route, route);
33
+ metadata_1.ClassMetadata.appendToMetadata(target.constructor, common_1.MetadataEnum.ControllerRoutes, propertyKey);
41
34
  };
42
35
  };
43
36
  exports.route = route;
@@ -1 +1 @@
1
- {"version":3,"file":"route.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/route.decorator.ts"],"names":[],"mappings":";;;AAGA;;;;GAIG;AACI,MAAM,KAAK,GAAG,CAAC,UAA+B,EAAE,IAAY,EAAE,EAAE;IACnE,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;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;AAxCY,QAAA,KAAK,SAwCjB"}
1
+ {"version":3,"file":"route.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/route.decorator.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,gDAA2E;AAE3E,oDAAoE;AAEpE;;;;GAIG;AACI,MAAM,KAAK,GAAG,CAAC,UAA+B,EAAE,IAAY,EAAE,EAAE;IACnE,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAAmB;IAEnB;;OAEG;IACH,UAA8B,EAChC,EAAE;QACA,iBAAiB;QACjB,MAAM,KAAK,GAAyB;YAChC,UAAU;YACV,aAAa,EAAE,WAAW;YAC1B,IAAI;SACP,CAAA;QAED,yBAAc,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,qBAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAE9E,wBAAa,CAAC,gBAAgB,CAAC,MAAM,CAAC,WAAW,EAAE,qBAAY,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;IACnG,CAAC,CAAC;AACN,CAAC,CAAA;AA5BY,QAAA,KAAK,SA4BjB"}
@@ -19,6 +19,7 @@ exports.ResponseHeadersInterceptor = void 0;
19
19
  const common_1 = require("@pristine-ts/common");
20
20
  const networking_module_keyname_1 = require("../networking.module.keyname");
21
21
  const tsyringe_1 = require("tsyringe");
22
+ const response_header_decorator_1 = require("../decorators/response-header.decorator");
22
23
  /**
23
24
  * The Response Interceptor intercepts the response of the router by adding the response headers specified by the response header decorator.
24
25
  * It is tagged as a RequestInterceptor so it can be automatically injected with the all the other RequestInterceptor.
@@ -32,8 +33,8 @@ let ResponseHeadersInterceptor = class ResponseHeadersInterceptor {
32
33
  */
33
34
  interceptResponse(response, request, methodNode) {
34
35
  return __awaiter(this, void 0, void 0, function* () {
35
- if (methodNode && methodNode.route.context && methodNode.route.context.hasOwnProperty("responseHeaders")) {
36
- response.setHeaders(Object.assign(Object.assign({}, response.headers), methodNode.route.context.responseHeaders));
36
+ if (methodNode && methodNode.route.context && methodNode.route.context.hasOwnProperty(response_header_decorator_1.responseHeaderMetadataKeyname)) {
37
+ response.setHeaders(Object.assign(Object.assign({}, response.headers), methodNode.route.context[response_header_decorator_1.responseHeaderMetadataKeyname]));
37
38
  }
38
39
  return response;
39
40
  });
@@ -1 +1 @@
1
- {"version":3,"file":"response-headers.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/response-headers.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAAmG;AACnG,4EAAqE;AAGrE,uCAAoC;AACpC;;;GAGG;AAII,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAEnC;;;;;OAKG;IACG,iBAAiB,CAAC,QAAkB,EAAE,OAAgB,EAAE,UAA6B;;YACvF,IAAG,UAAU,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAC;gBACpG,QAAQ,CAAC,UAAU,iCAAK,QAAQ,CAAC,OAAO,GAAK,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;aAC3F;YAED,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CACJ,CAAA;AAfY,gEAA0B;qCAA1B,0BAA0B;IAHtC,IAAA,YAAG,EAAC,iCAAwB,CAAC,kBAAkB,CAAC;IAChD,IAAA,qBAAY,EAAC,mDAAuB,CAAC;IACrC,IAAA,qBAAU,GAAE;GACA,0BAA0B,CAetC"}
1
+ {"version":3,"file":"response-headers.interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/response-headers.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAAmG;AACnG,4EAAqE;AAGrE,uCAAoC;AACpC,uFAAsF;AACtF;;;GAGG;AAII,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAEnC;;;;;OAKG;IACG,iBAAiB,CAAC,QAAkB,EAAE,OAAgB,EAAE,UAA6B;;YACvF,IAAG,UAAU,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,yDAA6B,CAAC,EAAC;gBAChH,QAAQ,CAAC,UAAU,iCAAK,QAAQ,CAAC,OAAO,GAAK,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,yDAA6B,CAAC,EAAE,CAAC;aAC1G;YAED,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CACJ,CAAA;AAfY,gEAA0B;qCAA1B,0BAA0B;IAHtC,IAAA,YAAG,EAAC,iCAAwB,CAAC,kBAAkB,CAAC;IAChD,IAAA,qBAAY,EAAC,mDAAuB,CAAC;IACrC,IAAA,qBAAU,GAAE;GACA,0BAA0B,CAetC"}