@my-devkit/firebase 1.0.98 → 1.0.102

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 (146) hide show
  1. package/package.json +10 -11
  2. package/dist/aggregate.d.ts +0 -13
  3. package/dist/aggregate.js +0 -85
  4. package/dist/aggregate.js.map +0 -1
  5. package/dist/app-factory.d.ts +0 -31
  6. package/dist/app-factory.js +0 -331
  7. package/dist/app-factory.js.map +0 -1
  8. package/dist/bus.d.ts +0 -17
  9. package/dist/bus.js +0 -128
  10. package/dist/bus.js.map +0 -1
  11. package/dist/constants.d.ts +0 -5
  12. package/dist/constants.js +0 -9
  13. package/dist/constants.js.map +0 -1
  14. package/dist/context.d.ts +0 -28
  15. package/dist/context.js +0 -102
  16. package/dist/context.js.map +0 -1
  17. package/dist/decorators/controller/body.d.ts +0 -1
  18. package/dist/decorators/controller/body.js +0 -17
  19. package/dist/decorators/controller/body.js.map +0 -1
  20. package/dist/decorators/controller/body.spec.d.ts +0 -1
  21. package/dist/decorators/controller/body.spec.js +0 -120
  22. package/dist/decorators/controller/body.spec.js.map +0 -1
  23. package/dist/decorators/controller/controller.d.ts +0 -1
  24. package/dist/decorators/controller/controller.js +0 -14
  25. package/dist/decorators/controller/controller.js.map +0 -1
  26. package/dist/decorators/controller/controller.spec.d.ts +0 -1
  27. package/dist/decorators/controller/controller.spec.js +0 -68
  28. package/dist/decorators/controller/controller.spec.js.map +0 -1
  29. package/dist/decorators/controller/get.d.ts +0 -1
  30. package/dist/decorators/controller/get.js +0 -12
  31. package/dist/decorators/controller/get.js.map +0 -1
  32. package/dist/decorators/controller/get.spec.d.ts +0 -1
  33. package/dist/decorators/controller/get.spec.js +0 -87
  34. package/dist/decorators/controller/get.spec.js.map +0 -1
  35. package/dist/decorators/controller/index.d.ts +0 -6
  36. package/dist/decorators/controller/index.js +0 -19
  37. package/dist/decorators/controller/index.js.map +0 -1
  38. package/dist/decorators/controller/param.d.ts +0 -1
  39. package/dist/decorators/controller/param.js +0 -21
  40. package/dist/decorators/controller/param.js.map +0 -1
  41. package/dist/decorators/controller/param.spec.d.ts +0 -1
  42. package/dist/decorators/controller/param.spec.js +0 -113
  43. package/dist/decorators/controller/param.spec.js.map +0 -1
  44. package/dist/decorators/controller/post.d.ts +0 -1
  45. package/dist/decorators/controller/post.js +0 -12
  46. package/dist/decorators/controller/post.js.map +0 -1
  47. package/dist/decorators/controller/post.spec.d.ts +0 -1
  48. package/dist/decorators/controller/post.spec.js +0 -133
  49. package/dist/decorators/controller/post.spec.js.map +0 -1
  50. package/dist/decorators/controller/query.d.ts +0 -1
  51. package/dist/decorators/controller/query.js +0 -21
  52. package/dist/decorators/controller/query.js.map +0 -1
  53. package/dist/decorators/controller/query.spec.d.ts +0 -1
  54. package/dist/decorators/controller/query.spec.js +0 -113
  55. package/dist/decorators/controller/query.spec.js.map +0 -1
  56. package/dist/decorators/handler/command-handler.d.ts +0 -1
  57. package/dist/decorators/handler/command-handler.js +0 -22
  58. package/dist/decorators/handler/command-handler.js.map +0 -1
  59. package/dist/decorators/handler/command-handler.spec.d.ts +0 -1
  60. package/dist/decorators/handler/command-handler.spec.js +0 -211
  61. package/dist/decorators/handler/command-handler.spec.js.map +0 -1
  62. package/dist/decorators/handler/event-handler.d.ts +0 -2
  63. package/dist/decorators/handler/event-handler.js +0 -22
  64. package/dist/decorators/handler/event-handler.js.map +0 -1
  65. package/dist/decorators/handler/event-handler.spec.d.ts +0 -1
  66. package/dist/decorators/handler/event-handler.spec.js +0 -214
  67. package/dist/decorators/handler/event-handler.spec.js.map +0 -1
  68. package/dist/decorators/handler/index.d.ts +0 -2
  69. package/dist/decorators/handler/index.js +0 -15
  70. package/dist/decorators/handler/index.js.map +0 -1
  71. package/dist/decorators/index.d.ts +0 -5
  72. package/dist/decorators/index.js +0 -18
  73. package/dist/decorators/index.js.map +0 -1
  74. package/dist/decorators/injectable.d.ts +0 -1
  75. package/dist/decorators/injectable.js +0 -11
  76. package/dist/decorators/injectable.js.map +0 -1
  77. package/dist/decorators/module.d.ts +0 -18
  78. package/dist/decorators/module.js +0 -14
  79. package/dist/decorators/module.js.map +0 -1
  80. package/dist/decorators/transactional-client.d.ts +0 -1
  81. package/dist/decorators/transactional-client.js +0 -11
  82. package/dist/decorators/transactional-client.js.map +0 -1
  83. package/dist/execution-mode-enum.d.ts +0 -4
  84. package/dist/execution-mode-enum.js +0 -9
  85. package/dist/execution-mode-enum.js.map +0 -1
  86. package/dist/firestore-client.d.ts +0 -29
  87. package/dist/firestore-client.js +0 -236
  88. package/dist/firestore-client.js.map +0 -1
  89. package/dist/handler-helper.d.ts +0 -9
  90. package/dist/handler-helper.js +0 -159
  91. package/dist/handler-helper.js.map +0 -1
  92. package/dist/index.d.ts +0 -7
  93. package/dist/index.js +0 -20
  94. package/dist/index.js.map +0 -1
  95. package/dist/injector.d.ts +0 -7
  96. package/dist/injector.js +0 -42
  97. package/dist/injector.js.map +0 -1
  98. package/dist/interfaces/app-config.d.ts +0 -0
  99. package/dist/interfaces/app-config.js +0 -1
  100. package/dist/interfaces/app-config.js.map +0 -1
  101. package/dist/interfaces/from-array.d.ts +0 -1
  102. package/dist/interfaces/from-array.js +0 -3
  103. package/dist/interfaces/from-array.js.map +0 -1
  104. package/dist/interfaces/index.d.ts +0 -4
  105. package/dist/interfaces/index.js +0 -17
  106. package/dist/interfaces/index.js.map +0 -1
  107. package/dist/interfaces/newable.d.ts +0 -1
  108. package/dist/interfaces/newable.js +0 -3
  109. package/dist/interfaces/newable.js.map +0 -1
  110. package/dist/interfaces/transactional-client.d.ts +0 -3
  111. package/dist/interfaces/transactional-client.js +0 -3
  112. package/dist/interfaces/transactional-client.js.map +0 -1
  113. package/dist/interfaces/type.d.ts +0 -3
  114. package/dist/interfaces/type.js +0 -3
  115. package/dist/interfaces/type.js.map +0 -1
  116. package/dist/reflect.d.ts +0 -62
  117. package/dist/reflect.js +0 -113
  118. package/dist/reflect.js.map +0 -1
  119. package/dist/request-method.enum.d.ts +0 -4
  120. package/dist/request-method.enum.js +0 -9
  121. package/dist/request-method.enum.js.map +0 -1
  122. package/dist/server/index.d.ts +0 -1
  123. package/dist/server/index.js +0 -14
  124. package/dist/server/index.js.map +0 -1
  125. package/dist/server/middlewares/authentication-middleware.d.ts +0 -3
  126. package/dist/server/middlewares/authentication-middleware.js +0 -110
  127. package/dist/server/middlewares/authentication-middleware.js.map +0 -1
  128. package/dist/server/middlewares/create-context-middleware.d.ts +0 -3
  129. package/dist/server/middlewares/create-context-middleware.js +0 -55
  130. package/dist/server/middlewares/create-context-middleware.js.map +0 -1
  131. package/dist/server/middlewares/error-middleware.d.ts +0 -2
  132. package/dist/server/middlewares/error-middleware.js +0 -78
  133. package/dist/server/middlewares/error-middleware.js.map +0 -1
  134. package/dist/server/middlewares/headers-middleware.d.ts +0 -2
  135. package/dist/server/middlewares/headers-middleware.js +0 -58
  136. package/dist/server/middlewares/headers-middleware.js.map +0 -1
  137. package/dist/server/middlewares/index.d.ts +0 -5
  138. package/dist/server/middlewares/index.js +0 -18
  139. package/dist/server/middlewares/index.js.map +0 -1
  140. package/dist/server/middlewares/not-found-middleware.d.ts +0 -2
  141. package/dist/server/middlewares/not-found-middleware.js +0 -50
  142. package/dist/server/middlewares/not-found-middleware.js.map +0 -1
  143. package/dist/server/server.d.ts +0 -33
  144. package/dist/server/server.js +0 -139
  145. package/dist/server/server.js.map +0 -1
  146. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,87 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
- return new (P || (P = Promise))(function (resolve, reject) {
14
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18
- });
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
- 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() {
57
- this.test = (0, core_1.guid)();
58
- }
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
- }); });
85
- });
86
- });
87
- //# sourceMappingURL=get.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get.spec.js","sourceRoot":"","sources":["../../../src/decorators/controller/get.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAuC;AACvC,6BAA8B;AAE9B,sBAAwB;AACxB,yCAAwC;AACxC,iEAA0D;AAC1D,2CAA0C;AAE1C,QAAQ,CAAC,uBAAuB,EAAE;IAG9B;QAAA;YACW,SAAI,GAAG,IAAA,WAAI,GAAE,CAAC;QAMzB,CAAC;QAHU,uBAAG,GAAV;YACI,OAAO,QAAQ,CAAC;QACpB,CAAC;QAFD;YADC,IAAA,MAAG,EAAC,QAAQ,CAAC;;;;4CAGb;QANC,SAAS;YADd,IAAA,uBAAU,EAAC,MAAM,CAAC;WACb,SAAS,CAOd;QAAD,gBAAC;KAAA,AAPD,IAOC;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,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,4BAA4B,CAAC,CAAC;gBAEpE,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBAC9C,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACjD,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,mCAAa,CAAC,GAAG,CAAC,CAAC;;;aACnE,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- export * from './controller';
2
- export * from './body';
3
- export * from './param';
4
- export * from './query';
5
- export * from './get';
6
- export * from './post';
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./controller"), exports);
14
- __exportStar(require("./body"), exports);
15
- __exportStar(require("./param"), exports);
16
- __exportStar(require("./query"), exports);
17
- __exportStar(require("./get"), exports);
18
- __exportStar(require("./post"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- export declare function Param(key: string): ParameterDecorator;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Param = void 0;
4
- var core_1 = require("@my-devkit/core");
5
- var reflect_1 = require("../../reflect");
6
- function Param(key) {
7
- return function (target, propertyKey, parameterIndex) {
8
- var methodArguments = (0, reflect_1.reflect)(target, propertyKey).getParameters();
9
- if (!methodArguments.hasOwnProperty(parameterIndex)) {
10
- throw new Error("Param: can't find argument ".concat(parameterIndex, " on ").concat(target.constructor.name, ".").concat(propertyKey.toString()));
11
- }
12
- var injector = function (req) {
13
- if (req.params.hasOwnProperty(key)) {
14
- return (0, core_1.deserialize)(req.params[key], methodArguments[parameterIndex]);
15
- }
16
- };
17
- (0, reflect_1.reflect)(target, propertyKey).registerControllerRouteArgumentInjector(injector, parameterIndex);
18
- };
19
- }
20
- exports.Param = Param;
21
- //# sourceMappingURL=param.js.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- export {};
@@ -1,113 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
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
- 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;
58
- (function (Gender) {
59
- Gender[Gender["Male"] = 0] = "Male";
60
- Gender["Female"] = "Female";
61
- })(Gender || (Gender = {}));
62
- var TestClass = /** @class */ (function () {
63
- function TestClass() {
64
- }
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
- }); });
111
- });
112
- });
113
- //# sourceMappingURL=param.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"param.spec.js","sourceRoot":"","sources":["../../../src/decorators/controller/param.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA8B;AAE9B,yCAAwC;AACxC,2CAA0C;AAC1C,6BAA4B;AAC5B,iCAAgC;AAEhC,QAAQ,CAAC,yBAAyB,EAAE;IAEhC,IAAK,MAGJ;IAHD,WAAK,MAAM;QACP,mCAAQ,CAAA;QACR,2BAAiB,CAAA;IACrB,CAAC,EAHI,MAAM,KAAN,MAAM,QAGV;IAGD;QAAA;Q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C;;;aACjF,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare function Post(path: string): MethodDecorator;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Post = void 0;
4
- var reflect_1 = require("../../reflect");
5
- var request_method_enum_1 = require("../../request-method.enum");
6
- function Post(path) {
7
- return function (target, propertyKey) {
8
- (0, reflect_1.reflect)(target.constructor, propertyKey).registerControllerRoute({ path: path, requestMethod: request_method_enum_1.RequestMethod.POST });
9
- };
10
- }
11
- exports.Post = Post;
12
- //# sourceMappingURL=post.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"post.js","sourceRoot":"","sources":["../../../src/decorators/controller/post.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AACxC,iEAA0D;AAE1D,SAAgB,IAAI,CAAC,IAAY;IAC7B,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,IAAI,EAAE,CAAC,CAAC;IAClH,CAAC,CAAA;AACL,CAAC;AAJD,oBAIC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,133 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
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
- 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 request_method_enum_1 = require("../../request-method.enum");
55
- var body_1 = require("./body");
56
- var controller_1 = require("./controller");
57
- var post_1 = require("./post");
58
- describe('Given a Post decorator', function () {
59
- var Command = /** @class */ (function () {
60
- function Command() {
61
- this.testString = null;
62
- this.testDate = null;
63
- }
64
- __decorate([
65
- (0, core_1.autoserializeAs)(String),
66
- __metadata("design:type", String)
67
- ], Command.prototype, "testString", void 0);
68
- __decorate([
69
- (0, core_1.autoserializeAs)(Date),
70
- __metadata("design:type", Date)
71
- ], Command.prototype, "testDate", void 0);
72
- return Command;
73
- }());
74
- var TestClass = /** @class */ (function () {
75
- function TestClass() {
76
- this.test = (0, core_1.guid)();
77
- }
78
- TestClass.prototype.createMethod = function (param1) {
79
- return "createMethod: ".concat(param1);
80
- };
81
- TestClass.prototype.updateMethod = function (param1) {
82
- return "updateMethod: ".concat(param1);
83
- };
84
- TestClass.prototype.deleteMethod = function (param1) {
85
- return "deleteMethod: ".concat(param1);
86
- };
87
- __decorate([
88
- (0, post_1.Post)('create'),
89
- __param(0, (0, body_1.Body)()),
90
- __metadata("design:type", Function),
91
- __metadata("design:paramtypes", [Date]),
92
- __metadata("design:returntype", String)
93
- ], TestClass.prototype, "createMethod", null);
94
- __decorate([
95
- (0, post_1.Post)('update'),
96
- __param(0, (0, body_1.Body)()),
97
- __metadata("design:type", Function),
98
- __metadata("design:paramtypes", [Command]),
99
- __metadata("design:returntype", String)
100
- ], TestClass.prototype, "updateMethod", null);
101
- __decorate([
102
- (0, post_1.Post)('delete'),
103
- __param(0, (0, body_1.Body)()),
104
- __metadata("design:type", Function),
105
- __metadata("design:paramtypes", [Command]),
106
- __metadata("design:returntype", String)
107
- ], TestClass.prototype, "deleteMethod", null);
108
- TestClass = __decorate([
109
- (0, controller_1.Controller)('test')
110
- ], TestClass);
111
- return TestClass;
112
- }());
113
- describe('When decorator is called', function () {
114
- it('Then we should retrieve information via reflect', function () { return __awaiter(void 0, void 0, void 0, function () {
115
- var config;
116
- return __generator(this, function (_a) {
117
- config = (0, reflect_1.reflect)(TestClass).getControllerConfiguration();
118
- (0, chai_1.expect)(config.routes.length).equal(3, 'Wrong route count detected');
119
- (0, chai_1.expect)(config.routes[0].path).equal('create');
120
- (0, chai_1.expect)(config.routes[0].methodName).equal('createMethod');
121
- (0, chai_1.expect)(config.routes[0].requestMethod).equal(request_method_enum_1.RequestMethod.POST);
122
- (0, chai_1.expect)(config.routes[1].path).equal('update');
123
- (0, chai_1.expect)(config.routes[1].methodName).equal('updateMethod');
124
- (0, chai_1.expect)(config.routes[1].requestMethod).equal(request_method_enum_1.RequestMethod.POST);
125
- (0, chai_1.expect)(config.routes[2].path).equal('delete');
126
- (0, chai_1.expect)(config.routes[2].methodName).equal('deleteMethod');
127
- (0, chai_1.expect)(config.routes[2].requestMethod).equal(request_method_enum_1.RequestMethod.POST);
128
- return [2 /*return*/];
129
- });
130
- }); });
131
- });
132
- });
133
- //# sourceMappingURL=post.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"post.spec.js","sourceRoot":"","sources":["../../../src/decorators/controller/post.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAwD;AACxD,6BAA8B;AAE9B,yCAAwC;AACxC,iEAA0D;AAC1D,+BAA8B;AAC9B,2CAA0C;AAC1C,+BAA8B;AAE9B,QAAQ,CAAC,wBAAwB,EAAE;IAE/B;QAAA;YAEW,eAAU,GAAW,IAA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,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBAC9C,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;gBAC1D,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,mCAAa,CAAC,IAAI,CAAC,CAAC;gBAEjE,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBAC9C,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;gBAC1D,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,mCAAa,CAAC,IAAI,CAAC,CAAC;gBAEjE,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBAC9C,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;gBAC1D,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,mCAAa,CAAC,IAAI,CAAC,CAAC;;;aACpE,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare function Query(key: string): ParameterDecorator;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Query = void 0;
4
- var core_1 = require("@my-devkit/core");
5
- var reflect_1 = require("../../reflect");
6
- function Query(key) {
7
- return function (target, propertyKey, parameterIndex) {
8
- var methodArguments = (0, reflect_1.reflect)(target, propertyKey).getParameters();
9
- if (!methodArguments.hasOwnProperty(parameterIndex)) {
10
- throw new Error("Query: can't find argument ".concat(parameterIndex, " on ").concat(target.constructor.name, ".").concat(propertyKey.toString()));
11
- }
12
- var injector = function (req) {
13
- if (req.query.hasOwnProperty(key)) {
14
- return (0, core_1.deserialize)(req.query[key], methodArguments[parameterIndex]);
15
- }
16
- };
17
- (0, reflect_1.reflect)(target, propertyKey).registerControllerRouteArgumentInjector(injector, parameterIndex);
18
- };
19
- }
20
- exports.Query = Query;
21
- //# sourceMappingURL=query.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/decorators/controller/query.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,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;gBAC/B,OAAO,IAAA,kBAAW,EAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC,CAAC;aACvE;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 +0,0 @@
1
- export {};
@@ -1,113 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
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
- 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 query_1 = require("./query");
56
- describe('Given a Query decorator', function () {
57
- var Gender;
58
- (function (Gender) {
59
- Gender[Gender["Male"] = 0] = "Male";
60
- Gender["Female"] = "Female";
61
- })(Gender || (Gender = {}));
62
- var TestClass = /** @class */ (function () {
63
- function TestClass() {
64
- }
65
- TestClass.prototype.getById = function (id) {
66
- return "getById: ".concat(id);
67
- };
68
- TestClass.prototype.all = function (minDate, gender) {
69
- return "getByGenderOlderThan: ".concat(gender, " ").concat(minDate.toISOString());
70
- };
71
- __decorate([
72
- (0, get_1.Get)('by-id'),
73
- __param(0, (0, query_1.Query)('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)('all'),
80
- __param(0, (0, query_1.Query)('minDate')),
81
- __param(1, (0, query_1.Query)('gender')),
82
- __metadata("design:type", Function),
83
- __metadata("design:paramtypes", [Date, Object]),
84
- __metadata("design:returntype", String)
85
- ], TestClass.prototype, "all", 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 = { query: { 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 = { query: { 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.query.gender = 'Female';
107
- (0, chai_1.expect)(config.routes[1].argumentInjectors[1](request2)).equals(Gender.Female);
108
- return [2 /*return*/];
109
- });
110
- }); });
111
- });
112
- });
113
- //# sourceMappingURL=query.spec.js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AAC;gBAEnI,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAE5E,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC;gBACjC,IAAA,aAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;;;aACjF,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare function CommandHandler(): MethodDecorator;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandHandler = void 0;
4
- var core_1 = require("@my-devkit/core");
5
- var reflect_1 = require("../../reflect");
6
- function CommandHandler() {
7
- return function (target, propertyKey) {
8
- var paramTypes = (0, reflect_1.reflect)(target, propertyKey).getParameters();
9
- if (paramTypes.length === 0) {
10
- throw new Error("".concat(target.constructor.name, ".").concat(propertyKey.toString(), " should have one argument!"));
11
- }
12
- if (paramTypes.length > 1) {
13
- throw new Error("".concat(target.constructor.name, ".").concat(propertyKey.toString(), " should have only one argument!"));
14
- }
15
- if (!(paramTypes[0].prototype instanceof core_1.Command)) {
16
- throw new Error("".concat(target.constructor.name, ".").concat(propertyKey.toString(), " should have a command as argument!"));
17
- }
18
- (0, reflect_1.reflect)(target, propertyKey).registerCommandHandler(paramTypes[0].prototype);
19
- };
20
- }
21
- exports.CommandHandler = CommandHandler;
22
- //# sourceMappingURL=command-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command-handler.js","sourceRoot":"","sources":["../../../src/decorators/handler/command-handler.ts"],"names":[],"mappings":";;;AAAA,wCAA0C;AAE1C,yCAAwC;AAExC,SAAgB,cAAc;IAC1B,OAAO,UAAC,MAAM,EAAE,WAAW;QACvB,IAAM,UAAU,GAAG,IAAA,iBAAO,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC,aAAa,EAAE,CAAC;QAEhE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,MAAM,IAAI,KAAK,CAAC,UAAG,MAAM,CAAC,WAAW,CAAC,IAAI,cAAI,WAAW,CAAC,QAAQ,EAAE,+BAA4B,CAAC,CAAC;SACrG;QAED,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,UAAG,MAAM,CAAC,WAAW,CAAC,IAAI,cAAI,WAAW,CAAC,QAAQ,EAAE,oCAAiC,CAAC,CAAC;SAC1G;QAED,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,YAAY,cAAO,CAAC,EAAE;YAC/C,MAAM,IAAI,KAAK,CAAC,UAAG,MAAM,CAAC,WAAW,CAAC,IAAI,cAAI,WAAW,CAAC,QAAQ,EAAE,wCAAqC,CAAC,CAAC;SAC9G;QAED,IAAA,iBAAO,EAAC,MAAM,EAAE,WAAW,CAAC,CAAC,sBAAsB,CAAM,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACtF,CAAC,CAAA;AACL,CAAC;AAlBD,wCAkBC"}