@my-devkit/firebase 1.0.157 → 1.0.159

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/aggregate.js +30 -52
  2. package/dist/aggregate.js.map +1 -1
  3. package/dist/app-factory.js +139 -261
  4. package/dist/app-factory.js.map +1 -1
  5. package/dist/bus.js +44 -101
  6. package/dist/bus.js.map +1 -1
  7. package/dist/context.js +69 -132
  8. package/dist/context.js.map +1 -1
  9. package/dist/decorators/controller/body.js +6 -6
  10. package/dist/decorators/controller/body.js.map +1 -1
  11. package/dist/decorators/controller/body.spec.js +55 -90
  12. package/dist/decorators/controller/body.spec.js.map +1 -1
  13. package/dist/decorators/controller/controller.js +3 -3
  14. package/dist/decorators/controller/controller.js.map +1 -1
  15. package/dist/decorators/controller/controller.spec.js +14 -48
  16. package/dist/decorators/controller/controller.spec.js.map +1 -1
  17. package/dist/decorators/controller/get.js +4 -4
  18. package/dist/decorators/controller/get.js.map +1 -1
  19. package/dist/decorators/controller/get.spec.js +30 -62
  20. package/dist/decorators/controller/get.spec.js.map +1 -1
  21. package/dist/decorators/controller/index.js +5 -1
  22. package/dist/decorators/controller/index.js.map +1 -1
  23. package/dist/decorators/controller/param.js +6 -6
  24. package/dist/decorators/controller/param.js.map +1 -1
  25. package/dist/decorators/controller/param.spec.js +48 -82
  26. package/dist/decorators/controller/param.spec.js.map +1 -1
  27. package/dist/decorators/controller/post.js +4 -4
  28. package/dist/decorators/controller/post.js.map +1 -1
  29. package/dist/decorators/controller/post.spec.js +69 -102
  30. package/dist/decorators/controller/post.spec.js.map +1 -1
  31. package/dist/decorators/controller/query.js +6 -6
  32. package/dist/decorators/controller/query.js.map +1 -1
  33. package/dist/decorators/controller/query.spec.js +48 -82
  34. package/dist/decorators/controller/query.spec.js.map +1 -1
  35. package/dist/decorators/handler/command-handler.js +7 -7
  36. package/dist/decorators/handler/command-handler.js.map +1 -1
  37. package/dist/decorators/handler/command-handler.spec.js +95 -178
  38. package/dist/decorators/handler/command-handler.spec.js.map +1 -1
  39. package/dist/decorators/handler/event-handler.js +7 -7
  40. package/dist/decorators/handler/event-handler.js.map +1 -1
  41. package/dist/decorators/handler/event-handler.spec.js +98 -181
  42. package/dist/decorators/handler/event-handler.spec.js.map +1 -1
  43. package/dist/decorators/handler/index.js +5 -1
  44. package/dist/decorators/handler/index.js.map +1 -1
  45. package/dist/decorators/index.js +5 -1
  46. package/dist/decorators/index.js.map +1 -1
  47. package/dist/decorators/injectable.js +2 -2
  48. package/dist/decorators/injectable.js.map +1 -1
  49. package/dist/decorators/module.js +2 -2
  50. package/dist/decorators/module.js.map +1 -1
  51. package/dist/decorators/transactional-client.js +2 -2
  52. package/dist/decorators/transactional-client.js.map +1 -1
  53. package/dist/execution-mode-enum.js +1 -1
  54. package/dist/execution-mode-enum.js.map +1 -1
  55. package/dist/firestore-client.js +179 -277
  56. package/dist/firestore-client.js.map +1 -1
  57. package/dist/handler-helper.js +57 -140
  58. package/dist/handler-helper.js.map +1 -1
  59. package/dist/index.js +5 -1
  60. package/dist/index.js.map +1 -1
  61. package/dist/injector.js +14 -25
  62. package/dist/injector.js.map +1 -1
  63. package/dist/interfaces/from-array.d.ts +1 -1
  64. package/dist/interfaces/index.js +5 -1
  65. package/dist/interfaces/index.js.map +1 -1
  66. package/dist/interfaces/newable.d.ts +1 -1
  67. package/dist/reflect.d.ts +3 -3
  68. package/dist/reflect.js +51 -57
  69. package/dist/reflect.js.map +1 -1
  70. package/dist/request-method.enum.js +1 -1
  71. package/dist/request-method.enum.js.map +1 -1
  72. package/dist/sanity-check/controller.js +29 -64
  73. package/dist/sanity-check/controller.js.map +1 -1
  74. package/dist/sanity-check/module.js +11 -14
  75. package/dist/sanity-check/module.js.map +1 -1
  76. package/dist/server/index.js +5 -1
  77. package/dist/server/index.js.map +1 -1
  78. package/dist/server/middlewares/authentication-middleware.js +45 -93
  79. package/dist/server/middlewares/authentication-middleware.js.map +1 -1
  80. package/dist/server/middlewares/create-context-middleware.js +8 -39
  81. package/dist/server/middlewares/create-context-middleware.js.map +1 -1
  82. package/dist/server/middlewares/error-middleware.js +30 -62
  83. package/dist/server/middlewares/error-middleware.js.map +1 -1
  84. package/dist/server/middlewares/headers-middleware.js +11 -42
  85. package/dist/server/middlewares/headers-middleware.js.map +1 -1
  86. package/dist/server/middlewares/index.js +5 -1
  87. package/dist/server/middlewares/index.js.map +1 -1
  88. package/dist/server/middlewares/not-found-middleware.js +4 -34
  89. package/dist/server/middlewares/not-found-middleware.js.map +1 -1
  90. package/dist/server/server.d.ts +1 -1
  91. package/dist/server/server.js +73 -103
  92. package/dist/server/server.js.map +1 -1
  93. package/dist/zip-helper.js +32 -12
  94. package/dist/zip-helper.js.map +1 -1
  95. package/package.json +28 -25
  96. package/src/decorators/handler/command-handler.spec.ts +7 -6
  97. package/src/decorators/handler/event-handler.spec.ts +9 -8
  98. package/src/reflect.ts +1 -1
  99. package/src/server/server.ts +2 -2
  100. package/tsconfig.json +11 -17
  101. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -20,101 +20,66 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
20
20
  step((generator = generator.apply(thisArg, _arguments || [])).next());
21
21
  });
22
22
  };
23
- var __generator = (this && this.__generator) || function (thisArg, body) {
24
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
- function verb(n) { return function (v) { return step([n, v]); }; }
27
- function step(op) {
28
- if (f) throw new TypeError("Generator is already executing.");
29
- while (_) try {
30
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
- if (y = 0, t) op = [op[0] & 2, t.value];
32
- switch (op[0]) {
33
- case 0: case 1: t = op; break;
34
- case 4: _.label++; return { value: op[1], done: false };
35
- case 5: _.label++; y = op[1]; op = [0]; continue;
36
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
- default:
38
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
- if (t[2]) _.ops.pop();
43
- _.trys.pop(); continue;
44
- }
45
- op = body.call(thisArg, _);
46
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
- }
49
- };
50
23
  Object.defineProperty(exports, "__esModule", { value: true });
51
- var core_1 = require("@my-devkit/core");
52
- var chai_1 = require("chai");
53
- var reflect_1 = require("../../reflect");
54
- var body_1 = require("./body");
55
- var controller_1 = require("./controller");
56
- describe('Given a Body decorator', function () {
57
- var Command = /** @class */ (function () {
58
- function Command() {
24
+ const core_1 = require("@my-devkit/core");
25
+ const chai_1 = require("chai");
26
+ const reflect_1 = require("../../reflect");
27
+ const body_1 = require("./body");
28
+ const controller_1 = require("./controller");
29
+ describe('Given a Body decorator', () => {
30
+ class Command {
31
+ constructor() {
59
32
  this.testString = null;
60
33
  this.testDate = null;
61
34
  }
62
- __decorate([
63
- (0, core_1.autoserializeAs)(String),
64
- __metadata("design:type", String)
65
- ], Command.prototype, "testString", void 0);
66
- __decorate([
67
- (0, core_1.autoserializeAs)(Date),
68
- __metadata("design:type", Date)
69
- ], Command.prototype, "testDate", void 0);
70
- return Command;
71
- }());
72
- var TestClass = /** @class */ (function () {
73
- function TestClass() {
35
+ }
36
+ __decorate([
37
+ (0, core_1.autoserializeAs)(String),
38
+ __metadata("design:type", String)
39
+ ], Command.prototype, "testString", void 0);
40
+ __decorate([
41
+ (0, core_1.autoserializeAs)(Date),
42
+ __metadata("design:type", Date)
43
+ ], Command.prototype, "testDate", void 0);
44
+ let TestClass = class TestClass {
45
+ testDate(param1) {
46
+ return `testDate: ${param1}`;
47
+ }
48
+ testCommand(param1) {
49
+ return `testCommand: ${param1}`;
74
50
  }
75
- TestClass.prototype.testDate = function (param1) {
76
- return "testDate: ".concat(param1);
77
- };
78
- TestClass.prototype.testCommand = function (param1) {
79
- return "testCommand: ".concat(param1);
80
- };
81
- __decorate([
82
- __param(0, (0, body_1.Body)()),
83
- __metadata("design:type", Function),
84
- __metadata("design:paramtypes", [Date]),
85
- __metadata("design:returntype", String)
86
- ], TestClass.prototype, "testDate", null);
87
- __decorate([
88
- __param(0, (0, body_1.Body)()),
89
- __metadata("design:type", Function),
90
- __metadata("design:paramtypes", [Command]),
91
- __metadata("design:returntype", String)
92
- ], TestClass.prototype, "testCommand", null);
93
- TestClass = __decorate([
94
- (0, controller_1.Controller)('test')
95
- ], TestClass);
96
- return TestClass;
97
- }());
98
- describe('When decorator is called', function () {
99
- it('Then we should retrieve information via reflect', function () { return __awaiter(void 0, void 0, void 0, function () {
100
- var config, request1, request2, expectedBody2;
101
- return __generator(this, function (_a) {
102
- config = (0, reflect_1.reflect)(TestClass).getControllerConfiguration();
103
- (0, chai_1.expect)(config.routes.length).equal(2, 'Wrong route count detected');
104
- request1 = { body: '2021-02-08T11:14:23.318Z' };
105
- (0, chai_1.expect)(config.routes[0].argumentInjectors.length).equal(1, 'Wrong argumentInjectors length');
106
- (0, chai_1.expect)(config.routes[0].argumentInjectors[0](request1)).to.be.a('Date');
107
- (0, chai_1.expect)(config.routes[0].argumentInjectors[0](request1).toISOString()).equals((new Date('2021-02-08T11:14:23.318Z')).toISOString());
108
- request2 = { body: { testString: 'test' } };
109
- expectedBody2 = new Command();
110
- expectedBody2.testString = 'test';
111
- expectedBody2.testDate = null;
112
- (0, chai_1.expect)(config.routes[1].argumentInjectors.length).equal(1, 'Wrong argumentInjectors length');
113
- (0, chai_1.expect)(config.routes[1].argumentInjectors[0](request2)).to.be.instanceOf(Command);
114
- (0, chai_1.expect)(config.routes[1].argumentInjectors[0](request2)).deep.equal(expectedBody2);
115
- return [2 /*return*/];
116
- });
117
- }); });
51
+ };
52
+ __decorate([
53
+ __param(0, (0, body_1.Body)()),
54
+ __metadata("design:type", Function),
55
+ __metadata("design:paramtypes", [Date]),
56
+ __metadata("design:returntype", String)
57
+ ], TestClass.prototype, "testDate", null);
58
+ __decorate([
59
+ __param(0, (0, body_1.Body)()),
60
+ __metadata("design:type", Function),
61
+ __metadata("design:paramtypes", [Command]),
62
+ __metadata("design:returntype", String)
63
+ ], TestClass.prototype, "testCommand", null);
64
+ TestClass = __decorate([
65
+ (0, controller_1.Controller)('test')
66
+ ], TestClass);
67
+ describe('When decorator is called', () => {
68
+ it('Then we should retrieve information via reflect', () => __awaiter(void 0, void 0, void 0, function* () {
69
+ const config = (0, reflect_1.reflect)(TestClass).getControllerConfiguration();
70
+ (0, chai_1.expect)(config.routes.length).equal(2, 'Wrong route count detected');
71
+ const request1 = { body: '2021-02-08T11:14:23.318Z' };
72
+ (0, chai_1.expect)(config.routes[0].argumentInjectors.length).equal(1, 'Wrong argumentInjectors length');
73
+ (0, chai_1.expect)(config.routes[0].argumentInjectors[0](request1)).to.be.a('Date');
74
+ (0, chai_1.expect)(config.routes[0].argumentInjectors[0](request1).toISOString()).equals((new Date('2021-02-08T11:14:23.318Z')).toISOString());
75
+ const request2 = { body: { testString: 'test' } };
76
+ const expectedBody2 = new Command();
77
+ expectedBody2.testString = 'test';
78
+ expectedBody2.testDate = null;
79
+ (0, chai_1.expect)(config.routes[1].argumentInjectors.length).equal(1, 'Wrong argumentInjectors length');
80
+ (0, chai_1.expect)(config.routes[1].argumentInjectors[0](request2)).to.be.instanceOf(Command);
81
+ (0, chai_1.expect)(config.routes[1].argumentInjectors[0](request2)).deep.equal(expectedBody2);
82
+ }));
118
83
  });
119
84
  });
120
85
  //# sourceMappingURL=body.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"body.spec.js","sourceRoot":"","sources":["../../../src/decorators/controller/body.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAkD;AAClD,6BAA8B;AAE9B,yCAAwC;AACxC,+BAA8B;AAC9B,2CAA0C;AAE1C,QAAQ,CAAC,wBAAwB,EAAE;IAE/B;QAAA;YAEW,eAAU,GAAW,IAAI,CAAC;YAG1B,aAAQ,GAAS,IAAI,CAAC;QACjC,CAAC;QAJG;YADC,IAAA,sBAAe,EAAC,MAAM,CAAC;;mDACS;QAGjC;YADC,IAAA,sBAAe,EAAC,IAAI,CAAC;sCACL,IAAI;iDAAQ;QACjC,cAAC;KAAA,AAND,IAMC;IAID;QAAA;QAQA,CAAC;QAPU,4BAAQ,GAAf,UAAwB,MAAY;YAChC,OAAO,oBAAa,MAAM,CAAE,CAAC;QACjC,CAAC;QAEM,+BAAW,GAAlB,UAA2B,MAAe;YACtC,OAAO,uBAAgB,MAAM,CAAE,CAAC;QACpC,CAAC;QAND;YAAiB,WAAA,IAAA,WAAI,GAAE,CAAA;;6CAAS,IAAI;;iDAEnC;QAED;YAAoB,WAAA,IAAA,WAAI,GAAE,CAAA;;6CAAS,OAAO;;oDAEzC;QAPC,SAAS;YADd,IAAA,uBAAU,EAAC,MAAM,CAAC;WACb,SAAS,CAQd;QAAD,gBAAC;KAAA,AARD,IAQC;IAED,QAAQ,CAAC,0BAA0B,EAAE;QACjC,EAAE,CAAC,iDAAiD,EAAE;;;gBAC5C,MAAM,GAAG,IAAA,iBAAO,EAAC,SAAS,CAAC,CAAC,0BAA0B,EAAE,CAAC;gBAC/D,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,4BAA4B,CAAC,CAAC;gBAE9D,QAAQ,GAA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AAC,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACtF,CAAC,CAAA,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Controller = void 0;
4
- var reflect_1 = require("../../reflect");
5
- var injectable_1 = require("./../injectable");
4
+ const reflect_1 = require("../../reflect");
5
+ const injectable_1 = require("./../injectable");
6
6
  function Controller(basePath) {
7
- return function (target) {
7
+ return target => {
8
8
  (0, reflect_1.reflect)(target).registerController(basePath);
9
9
  // Register controller as injectable ressource
10
10
  (0, injectable_1.Injectable)()(target);
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/decorators/controller/controller.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AACxC,8CAA6C;AAE7C,SAAgB,UAAU,CAAC,QAAgB;IACvC,OAAO,UAAA,MAAM;QACT,IAAA,iBAAO,EAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAC7C,8CAA8C;QAC9C,IAAA,uBAAU,GAAE,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CAAC;AACN,CAAC;AAND,gCAMC"}
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/decorators/controller/controller.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,gDAA6C;AAE7C,SAAgB,UAAU,CAAC,QAAgB;IACvC,OAAO,MAAM,CAAC,EAAE;QACZ,IAAA,iBAAO,EAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAC7C,8CAA8C;QAC9C,IAAA,uBAAU,GAAE,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CAAC;AACN,CAAC;AAND,gCAMC"}
@@ -14,55 +14,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
14
14
  step((generator = generator.apply(thisArg, _arguments || [])).next());
15
15
  });
16
16
  };
17
- var __generator = (this && this.__generator) || function (thisArg, body) {
18
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
19
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
20
- function verb(n) { return function (v) { return step([n, v]); }; }
21
- function step(op) {
22
- if (f) throw new TypeError("Generator is already executing.");
23
- while (_) try {
24
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
25
- if (y = 0, t) op = [op[0] & 2, t.value];
26
- switch (op[0]) {
27
- case 0: case 1: t = op; break;
28
- case 4: _.label++; return { value: op[1], done: false };
29
- case 5: _.label++; y = op[1]; op = [0]; continue;
30
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
31
- default:
32
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
33
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
34
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
35
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
36
- if (t[2]) _.ops.pop();
37
- _.trys.pop(); continue;
38
- }
39
- op = body.call(thisArg, _);
40
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
41
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
42
- }
43
- };
44
17
  Object.defineProperty(exports, "__esModule", { value: true });
45
- var chai_1 = require("chai");
46
- var reflect_1 = require("../../reflect");
47
- var controller_1 = require("./controller");
48
- describe('Given a Controller decorator', function () {
49
- var TestClass = /** @class */ (function () {
50
- function TestClass() {
51
- }
52
- TestClass = __decorate([
53
- (0, controller_1.Controller)('test')
54
- ], TestClass);
55
- return TestClass;
56
- }());
57
- describe('When decorator is called', function () {
58
- it('Then we should retrieve information via reflect', function () { return __awaiter(void 0, void 0, void 0, function () {
59
- var config;
60
- return __generator(this, function (_a) {
61
- config = (0, reflect_1.reflect)(TestClass).getControllerConfiguration();
62
- (0, chai_1.expect)(config.basePath).equals('test');
63
- return [2 /*return*/];
64
- });
65
- }); });
18
+ const chai_1 = require("chai");
19
+ const reflect_1 = require("../../reflect");
20
+ const controller_1 = require("./controller");
21
+ describe('Given a Controller decorator', () => {
22
+ let TestClass = class TestClass {
23
+ };
24
+ TestClass = __decorate([
25
+ (0, controller_1.Controller)('test')
26
+ ], TestClass);
27
+ describe('When decorator is called', () => {
28
+ it('Then we should retrieve information via reflect', () => __awaiter(void 0, void 0, void 0, function* () {
29
+ const config = (0, reflect_1.reflect)(TestClass).getControllerConfiguration();
30
+ (0, chai_1.expect)(config.basePath).equals('test');
31
+ }));
66
32
  });
67
33
  });
68
34
  //# sourceMappingURL=controller.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"controller.spec.js","sourceRoot":"","sources":["../../../src/decorators/controller/controller.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA8B;AAE9B,yCAAwC;AACxC,2CAA0C;AAE1C,QAAQ,CAAC,8BAA8B,EAAE;IAGrC;QAAA;QACA,CAAC;QADK,SAAS;YADd,IAAA,uBAAU,EAAC,MAAM,CAAC;WACb,SAAS,CACd;QAAD,gBAAC;KAAA,AADD,IACC;IAED,QAAQ,CAAC,0BAA0B,EAAE;QACjC,EAAE,CAAC,iDAAiD,EAAE;;;gBAC5C,MAAM,GAAG,IAAA,iBAAO,EAAC,SAAS,CAAC,CAAC,0BAA0B,EAAE,CAAC;gBAE/D,IAAA,aAAM,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;;;aAC1C,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"controller.spec.js","sourceRoot":"","sources":["../../../src/decorators/controller/controller.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+BAA8B;AAE9B,2CAAwC;AACxC,6CAA0C;AAE1C,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAG1C,IAAM,SAAS,GAAf,MAAM,SAAS;KACd,CAAA;IADK,SAAS;QADd,IAAA,uBAAU,EAAC,MAAM,CAAC;OACb,SAAS,CACd;IAED,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACtC,EAAE,CAAC,iDAAiD,EAAE,GAAS,EAAE;YAC7D,MAAM,MAAM,GAAG,IAAA,iBAAO,EAAC,SAAS,CAAC,CAAC,0BAA0B,EAAE,CAAC;YAE/D,IAAA,aAAM,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC,CAAA,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Get = void 0;
4
- var reflect_1 = require("../../reflect");
5
- var request_method_enum_1 = require("../../request-method.enum");
4
+ const reflect_1 = require("../../reflect");
5
+ const request_method_enum_1 = require("../../request-method.enum");
6
6
  function Get(path) {
7
- return function (target, propertyKey) {
8
- (0, reflect_1.reflect)(target.constructor, propertyKey).registerControllerRoute({ path: path, requestMethod: request_method_enum_1.RequestMethod.GET });
7
+ return (target, propertyKey) => {
8
+ (0, reflect_1.reflect)(target.constructor, propertyKey).registerControllerRoute({ path, requestMethod: request_method_enum_1.RequestMethod.GET });
9
9
  };
10
10
  }
11
11
  exports.Get = Get;
@@ -1 +1 @@
1
- {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/decorators/controller/get.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AACxC,iEAA0D;AAE1D,SAAgB,GAAG,CAAC,IAAY;IAC5B,OAAO,UAAC,MAAM,EAAE,WAAW;QACvB,IAAA,iBAAO,EAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,uBAAuB,CAAC,EAAE,IAAI,MAAA,EAAE,aAAa,EAAE,mCAAa,CAAC,GAAG,EAAE,CAAC,CAAC;IACjH,CAAC,CAAA;AACL,CAAC;AAJD,kBAIC"}
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/decorators/controller/get.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,mEAA0D;AAE1D,SAAgB,GAAG,CAAC,IAAY;IAC5B,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC3B,IAAA,iBAAO,EAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,uBAAuB,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,mCAAa,CAAC,GAAG,EAAE,CAAC,CAAC;IACjH,CAAC,CAAA;AACL,CAAC;AAJD,kBAIC"}
@@ -17,71 +17,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
- var __generator = (this && this.__generator) || function (thisArg, body) {
21
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
22
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
23
- function verb(n) { return function (v) { return step([n, v]); }; }
24
- function step(op) {
25
- if (f) throw new TypeError("Generator is already executing.");
26
- while (_) try {
27
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
28
- if (y = 0, t) op = [op[0] & 2, t.value];
29
- switch (op[0]) {
30
- case 0: case 1: t = op; break;
31
- case 4: _.label++; return { value: op[1], done: false };
32
- case 5: _.label++; y = op[1]; op = [0]; continue;
33
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
34
- default:
35
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
36
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
37
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
38
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
39
- if (t[2]) _.ops.pop();
40
- _.trys.pop(); continue;
41
- }
42
- op = body.call(thisArg, _);
43
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
44
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
45
- }
46
- };
47
20
  Object.defineProperty(exports, "__esModule", { value: true });
48
- var core_1 = require("@my-devkit/core");
49
- var chai_1 = require("chai");
50
- var _1 = require(".");
51
- var reflect_1 = require("../../reflect");
52
- var request_method_enum_1 = require("../../request-method.enum");
53
- var controller_1 = require("./controller");
54
- describe('Given a Get decorator', function () {
55
- var TestClass = /** @class */ (function () {
56
- function TestClass() {
21
+ const core_1 = require("@my-devkit/core");
22
+ const chai_1 = require("chai");
23
+ const _1 = require(".");
24
+ const reflect_1 = require("../../reflect");
25
+ const request_method_enum_1 = require("../../request-method.enum");
26
+ const controller_1 = require("./controller");
27
+ describe('Given a Get decorator', () => {
28
+ let TestClass = class TestClass {
29
+ constructor() {
57
30
  this.test = (0, core_1.guid)();
58
31
  }
59
- TestClass.prototype.get = function () {
60
- return "create";
61
- };
62
- __decorate([
63
- (0, _1.Get)('create'),
64
- __metadata("design:type", Function),
65
- __metadata("design:paramtypes", []),
66
- __metadata("design:returntype", String)
67
- ], TestClass.prototype, "get", null);
68
- TestClass = __decorate([
69
- (0, controller_1.Controller)('test')
70
- ], TestClass);
71
- return TestClass;
72
- }());
73
- describe('When decorator is called', function () {
74
- it('Then we should retrieve information via reflect', function () { return __awaiter(void 0, void 0, void 0, function () {
75
- var config;
76
- return __generator(this, function (_a) {
77
- config = (0, reflect_1.reflect)(TestClass).getControllerConfiguration();
78
- (0, chai_1.expect)(config.routes.length).equal(1, 'Wrong route count detected');
79
- (0, chai_1.expect)(config.routes[0].path).equal('create');
80
- (0, chai_1.expect)(config.routes[0].methodName).equal('get');
81
- (0, chai_1.expect)(config.routes[0].requestMethod).equal(request_method_enum_1.RequestMethod.GET);
82
- return [2 /*return*/];
83
- });
84
- }); });
32
+ get() {
33
+ return `create`;
34
+ }
35
+ };
36
+ __decorate([
37
+ (0, _1.Get)('create'),
38
+ __metadata("design:type", Function),
39
+ __metadata("design:paramtypes", []),
40
+ __metadata("design:returntype", String)
41
+ ], TestClass.prototype, "get", null);
42
+ TestClass = __decorate([
43
+ (0, controller_1.Controller)('test')
44
+ ], TestClass);
45
+ describe('When decorator is called', () => {
46
+ it('Then we should retrieve information via reflect', () => __awaiter(void 0, void 0, void 0, function* () {
47
+ const config = (0, reflect_1.reflect)(TestClass).getControllerConfiguration();
48
+ (0, chai_1.expect)(config.routes.length).equal(1, 'Wrong route count detected');
49
+ (0, chai_1.expect)(config.routes[0].path).equal('create');
50
+ (0, chai_1.expect)(config.routes[0].methodName).equal('get');
51
+ (0, chai_1.expect)(config.routes[0].requestMethod).equal(request_method_enum_1.RequestMethod.GET);
52
+ }));
85
53
  });
86
54
  });
87
55
  //# sourceMappingURL=get.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get.spec.js","sourceRoot":"","sources":["../../../src/decorators/controller/get.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAuC;AACvC,6BAA8B;AAE9B,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6CAA0C;AAE1C,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IAGnC,IAAM,SAAS,GAAf,MAAM,SAAS;QAAf;YACW,SAAI,GAAG,IAAA,WAAI,GAAE,CAAC;QAMzB,CAAC;QAHU,GAAG;YACN,OAAO,QAAQ,CAAC;QACpB,CAAC;KACJ,CAAA;IAHU;QADN,IAAA,MAAG,EAAC,QAAQ,CAAC;;;;wCAGb;IANC,SAAS;QADd,IAAA,uBAAU,EAAC,MAAM,CAAC;OACb,SAAS,CAOd;IAED,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACtC,EAAE,CAAC,iDAAiD,EAAE,GAAS,EAAE;YAC7D,MAAM,MAAM,GAAG,IAAA,iBAAO,EAAC,SAAS,CAAC,CAAC,0BAA0B,EAAE,CAAC;YAE/D,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,4BAA4B,CAAC,CAAC;YAEpE,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC9C,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACjD,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,mCAAa,CAAC,GAAG,CAAC,CAAC;QACpE,CAAC,CAAA,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/controller/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA6B;AAE7B,yCAAuB;AACvB,0CAAwB;AACxB,0CAAwB;AAExB,wCAAsB;AACtB,yCAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/controller/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAE7B,yCAAuB;AACvB,0CAAwB;AACxB,0CAAwB;AAExB,wCAAsB;AACtB,yCAAuB"}
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Param = void 0;
4
- var core_1 = require("@my-devkit/core");
5
- var reflect_1 = require("../../reflect");
4
+ const core_1 = require("@my-devkit/core");
5
+ const reflect_1 = require("../../reflect");
6
6
  function Param(key) {
7
- return function (target, propertyKey, parameterIndex) {
8
- var methodArguments = (0, reflect_1.reflect)(target, propertyKey).getParameters();
7
+ return (target, propertyKey, parameterIndex) => {
8
+ const methodArguments = (0, reflect_1.reflect)(target, propertyKey).getParameters();
9
9
  if (!methodArguments.hasOwnProperty(parameterIndex)) {
10
- throw new Error("Param: can't find argument ".concat(parameterIndex, " on ").concat(target.constructor.name, ".").concat(propertyKey.toString()));
10
+ throw new Error(`Param: can't find argument ${parameterIndex} on ${target.constructor.name}.${propertyKey.toString()}`);
11
11
  }
12
- var injector = function (req) {
12
+ const injector = (req) => {
13
13
  if (req.params.hasOwnProperty(key)) {
14
14
  return (0, core_1.deserialize)(req.params[key], methodArguments[parameterIndex]);
15
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"param.js","sourceRoot":"","sources":["../../../src/decorators/controller/param.ts"],"names":[],"mappings":";;;AAAA,wCAA8C;AAE9C,yCAAiE;AAGjE,SAAgB,KAAK,CAAC,GAAW;IAC7B,OAAO,UAAC,MAAM,EAAE,WAAW,EAAE,cAAc;QACvC,IAAM,eAAe,GAAG,IAAA,iBAAO,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC,aAAa,EAAE,CAAC;QACrE,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE;YACjD,MAAM,IAAI,KAAK,CAAC,qCAA8B,cAAc,iBAAO,MAAM,CAAC,WAAW,CAAC,IAAI,cAAI,WAAW,CAAC,QAAQ,EAAE,CAAE,CAAC,CAAC;SAC3H;QAED,IAAM,QAAQ,GAA4B,UAAC,GAAmB;YAC1D,IAAI,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;gBAChC,OAAO,IAAA,kBAAW,EAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC,CAAC;aACxE;QACL,CAAC,CAAC;QAEF,IAAA,iBAAO,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC,uCAAuC,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IACnG,CAAC,CAAA;AACL,CAAC;AAfD,sBAeC"}
1
+ {"version":3,"file":"param.js","sourceRoot":"","sources":["../../../src/decorators/controller/param.ts"],"names":[],"mappings":";;;AAAA,0CAA8C;AAE9C,2CAAiE;AAGjE,SAAgB,KAAK,CAAC,GAAW;IAC7B,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE;QAC3C,MAAM,eAAe,GAAG,IAAA,iBAAO,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC,aAAa,EAAE,CAAC;QACrE,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE;YACjD,MAAM,IAAI,KAAK,CAAC,8BAA8B,cAAc,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;SAC3H;QAED,MAAM,QAAQ,GAA4B,CAAC,GAAmB,EAAE,EAAE;YAC9D,IAAI,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;gBAChC,OAAO,IAAA,kBAAW,EAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC,CAAC;aACxE;QACL,CAAC,CAAC;QAEF,IAAA,iBAAO,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC,uCAAuC,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IACnG,CAAC,CAAA;AACL,CAAC;AAfD,sBAeC"}
@@ -20,94 +20,60 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
20
20
  step((generator = generator.apply(thisArg, _arguments || [])).next());
21
21
  });
22
22
  };
23
- var __generator = (this && this.__generator) || function (thisArg, body) {
24
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
- function verb(n) { return function (v) { return step([n, v]); }; }
27
- function step(op) {
28
- if (f) throw new TypeError("Generator is already executing.");
29
- while (_) try {
30
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
- if (y = 0, t) op = [op[0] & 2, t.value];
32
- switch (op[0]) {
33
- case 0: case 1: t = op; break;
34
- case 4: _.label++; return { value: op[1], done: false };
35
- case 5: _.label++; y = op[1]; op = [0]; continue;
36
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
- default:
38
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
- if (t[2]) _.ops.pop();
43
- _.trys.pop(); continue;
44
- }
45
- op = body.call(thisArg, _);
46
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
- }
49
- };
50
23
  Object.defineProperty(exports, "__esModule", { value: true });
51
- var chai_1 = require("chai");
52
- var reflect_1 = require("../../reflect");
53
- var controller_1 = require("./controller");
54
- var get_1 = require("./get");
55
- var param_1 = require("./param");
56
- describe('Given a Param decorator', function () {
57
- var Gender;
24
+ const chai_1 = require("chai");
25
+ const reflect_1 = require("../../reflect");
26
+ const controller_1 = require("./controller");
27
+ const get_1 = require("./get");
28
+ const param_1 = require("./param");
29
+ describe('Given a Param decorator', () => {
30
+ let Gender;
58
31
  (function (Gender) {
59
32
  Gender[Gender["Male"] = 0] = "Male";
60
33
  Gender["Female"] = "Female";
61
34
  })(Gender || (Gender = {}));
62
- var TestClass = /** @class */ (function () {
63
- function TestClass() {
35
+ let TestClass = class TestClass {
36
+ getById(id) {
37
+ return `getById: ${id}`;
38
+ }
39
+ getByGenderOlderThan(minDate, gender) {
40
+ return `getByGenderOlderThan: ${gender} ${minDate.toISOString()}`;
64
41
  }
65
- TestClass.prototype.getById = function (id) {
66
- return "getById: ".concat(id);
67
- };
68
- TestClass.prototype.getByGenderOlderThan = function (minDate, gender) {
69
- return "getByGenderOlderThan: ".concat(gender, " ").concat(minDate.toISOString());
70
- };
71
- __decorate([
72
- (0, get_1.Get)(':id'),
73
- __param(0, (0, param_1.Param)('id')),
74
- __metadata("design:type", Function),
75
- __metadata("design:paramtypes", [String]),
76
- __metadata("design:returntype", String)
77
- ], TestClass.prototype, "getById", null);
78
- __decorate([
79
- (0, get_1.Get)(':gender/:minDate'),
80
- __param(0, (0, param_1.Param)('minDate')),
81
- __param(1, (0, param_1.Param)('gender')),
82
- __metadata("design:type", Function),
83
- __metadata("design:paramtypes", [Date, Object]),
84
- __metadata("design:returntype", String)
85
- ], TestClass.prototype, "getByGenderOlderThan", null);
86
- TestClass = __decorate([
87
- (0, controller_1.Controller)('test')
88
- ], TestClass);
89
- return TestClass;
90
- }());
91
- describe('When decorator is called', function () {
92
- it('Then we should retrieve information via reflect', function () { return __awaiter(void 0, void 0, void 0, function () {
93
- var config, request1, request2;
94
- return __generator(this, function (_a) {
95
- config = (0, reflect_1.reflect)(TestClass).getControllerConfiguration();
96
- (0, chai_1.expect)(config.routes.length).equal(2, 'Wrong route count detected');
97
- request1 = { params: { id: 'guid 1' } };
98
- (0, chai_1.expect)(config.routes[0].argumentInjectors.length).equal(1, 'Wrong argumentInjectors length for getById');
99
- (0, chai_1.expect)(config.routes[0].argumentInjectors[0](request1)).to.be.a('string');
100
- (0, chai_1.expect)(config.routes[0].argumentInjectors[0](request1)).equals('guid 1');
101
- request2 = { params: { gender: 0, minDate: '2021-02-15T14:23:00.318Z' } };
102
- (0, chai_1.expect)(config.routes[1].argumentInjectors.length).equal(2, 'Wrong argumentInjectors length for getByGenderOlderThan');
103
- (0, chai_1.expect)(config.routes[1].argumentInjectors[0](request2)).to.be.a('Date');
104
- (0, chai_1.expect)(config.routes[1].argumentInjectors[0](request2).toISOString()).equals((new Date('2021-02-15T14:23:00.318Z')).toISOString());
105
- (0, chai_1.expect)(config.routes[1].argumentInjectors[1](request2)).equals(Gender.Male);
106
- request2.params.gender = 'Female';
107
- (0, chai_1.expect)(config.routes[1].argumentInjectors[1](request2)).equals(Gender.Female);
108
- return [2 /*return*/];
109
- });
110
- }); });
42
+ };
43
+ __decorate([
44
+ (0, get_1.Get)(':id'),
45
+ __param(0, (0, param_1.Param)('id')),
46
+ __metadata("design:type", Function),
47
+ __metadata("design:paramtypes", [String]),
48
+ __metadata("design:returntype", String)
49
+ ], TestClass.prototype, "getById", null);
50
+ __decorate([
51
+ (0, get_1.Get)(':gender/:minDate'),
52
+ __param(0, (0, param_1.Param)('minDate')),
53
+ __param(1, (0, param_1.Param)('gender')),
54
+ __metadata("design:type", Function),
55
+ __metadata("design:paramtypes", [Date, Object]),
56
+ __metadata("design:returntype", String)
57
+ ], TestClass.prototype, "getByGenderOlderThan", null);
58
+ TestClass = __decorate([
59
+ (0, controller_1.Controller)('test')
60
+ ], TestClass);
61
+ describe('When decorator is called', () => {
62
+ it('Then we should retrieve information via reflect', () => __awaiter(void 0, void 0, void 0, function* () {
63
+ const config = (0, reflect_1.reflect)(TestClass).getControllerConfiguration();
64
+ (0, chai_1.expect)(config.routes.length).equal(2, 'Wrong route count detected');
65
+ const request1 = { params: { id: 'guid 1' } };
66
+ (0, chai_1.expect)(config.routes[0].argumentInjectors.length).equal(1, 'Wrong argumentInjectors length for getById');
67
+ (0, chai_1.expect)(config.routes[0].argumentInjectors[0](request1)).to.be.a('string');
68
+ (0, chai_1.expect)(config.routes[0].argumentInjectors[0](request1)).equals('guid 1');
69
+ const request2 = { params: { gender: 0, minDate: '2021-02-15T14:23:00.318Z' } };
70
+ (0, chai_1.expect)(config.routes[1].argumentInjectors.length).equal(2, 'Wrong argumentInjectors length for getByGenderOlderThan');
71
+ (0, chai_1.expect)(config.routes[1].argumentInjectors[0](request2)).to.be.a('Date');
72
+ (0, chai_1.expect)(config.routes[1].argumentInjectors[0](request2).toISOString()).equals((new Date('2021-02-15T14:23:00.318Z')).toISOString());
73
+ (0, chai_1.expect)(config.routes[1].argumentInjectors[1](request2)).equals(Gender.Male);
74
+ request2.params.gender = 'Female';
75
+ (0, chai_1.expect)(config.routes[1].argumentInjectors[1](request2)).equals(Gender.Female);
76
+ }));
111
77
  });
112
78
  });
113
79
  //# sourceMappingURL=param.spec.js.map