@fluyappgocore/commons-backend 1.0.202

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 (137) hide show
  1. package/build/classes/BacklogManager.d.ts +129 -0
  2. package/build/classes/BacklogManager.js +417 -0
  3. package/build/classes/BacklogMonitor.d.ts +102 -0
  4. package/build/classes/BacklogMonitor.js +222 -0
  5. package/build/classes/HttpResponse.d.ts +7 -0
  6. package/build/classes/HttpResponse.js +13 -0
  7. package/build/classes/index.d.ts +3 -0
  8. package/build/classes/index.js +15 -0
  9. package/build/dtos/file.dto.d.ts +5 -0
  10. package/build/dtos/file.dto.js +25 -0
  11. package/build/dtos/index.d.ts +1 -0
  12. package/build/dtos/index.js +13 -0
  13. package/build/events/BatchEnhancedListener.d.ts +106 -0
  14. package/build/events/BatchEnhancedListener.js +307 -0
  15. package/build/events/EnhancedListener.d.ts +75 -0
  16. package/build/events/EnhancedListener.js +185 -0
  17. package/build/events/baseListener.d.ts +19 -0
  18. package/build/events/baseListener.js +90 -0
  19. package/build/events/basePublisher.d.ts +14 -0
  20. package/build/events/basePublisher.js +84 -0
  21. package/build/events/config.d.ts +7 -0
  22. package/build/events/config.js +14 -0
  23. package/build/events/createClient.d.ts +38 -0
  24. package/build/events/createClient.js +416 -0
  25. package/build/events/index.d.ts +6 -0
  26. package/build/events/index.js +18 -0
  27. package/build/events/interfaces/agent.event.d.ts +7 -0
  28. package/build/events/interfaces/agent.event.js +2 -0
  29. package/build/events/interfaces/agentCrud.event.d.ts +7 -0
  30. package/build/events/interfaces/agentCrud.event.js +2 -0
  31. package/build/events/interfaces/agentTracking.event.d.ts +7 -0
  32. package/build/events/interfaces/agentTracking.event.js +2 -0
  33. package/build/events/interfaces/audit.event.d.ts +7 -0
  34. package/build/events/interfaces/audit.event.js +2 -0
  35. package/build/events/interfaces/branch.event.d.ts +7 -0
  36. package/build/events/interfaces/branch.event.js +2 -0
  37. package/build/events/interfaces/deleteTracking.event.d.ts +7 -0
  38. package/build/events/interfaces/deleteTracking.event.js +2 -0
  39. package/build/events/interfaces/department.event.d.ts +7 -0
  40. package/build/events/interfaces/department.event.js +2 -0
  41. package/build/events/interfaces/entity.event.d.ts +7 -0
  42. package/build/events/interfaces/entity.event.js +2 -0
  43. package/build/events/interfaces/index.d.ts +23 -0
  44. package/build/events/interfaces/index.js +35 -0
  45. package/build/events/interfaces/manualMatch.event.d.ts +7 -0
  46. package/build/events/interfaces/manualMatch.event.js +2 -0
  47. package/build/events/interfaces/match.event.d.ts +7 -0
  48. package/build/events/interfaces/match.event.js +2 -0
  49. package/build/events/interfaces/monitor.event.d.ts +7 -0
  50. package/build/events/interfaces/monitor.event.js +2 -0
  51. package/build/events/interfaces/notification.event.d.ts +7 -0
  52. package/build/events/interfaces/notification.event.js +2 -0
  53. package/build/events/interfaces/object.event.d.ts +7 -0
  54. package/build/events/interfaces/object.event.js +2 -0
  55. package/build/events/interfaces/payments.event.d.ts +7 -0
  56. package/build/events/interfaces/payments.event.js +2 -0
  57. package/build/events/interfaces/planning.event.d.ts +7 -0
  58. package/build/events/interfaces/planning.event.js +2 -0
  59. package/build/events/interfaces/service.event.d.ts +7 -0
  60. package/build/events/interfaces/service.event.js +2 -0
  61. package/build/events/interfaces/subscription.event.d.ts +7 -0
  62. package/build/events/interfaces/subscription.event.js +2 -0
  63. package/build/events/interfaces/ticket.event.d.ts +7 -0
  64. package/build/events/interfaces/ticket.event.js +2 -0
  65. package/build/events/interfaces/ticketNote.event.d.ts +7 -0
  66. package/build/events/interfaces/ticketNote.event.js +2 -0
  67. package/build/events/interfaces/ticketTracking.event.d.ts +7 -0
  68. package/build/events/interfaces/ticketTracking.event.js +2 -0
  69. package/build/events/interfaces/ticketxTopics.event.d.ts +7 -0
  70. package/build/events/interfaces/ticketxTopics.event.js +2 -0
  71. package/build/events/interfaces/topics.event.d.ts +7 -0
  72. package/build/events/interfaces/topics.event.js +2 -0
  73. package/build/events/interfaces/waitingList.event.d.ts +7 -0
  74. package/build/events/interfaces/waitingList.event.js +2 -0
  75. package/build/exceptions/AuthenticationTokenMissingException.d.ts +5 -0
  76. package/build/exceptions/AuthenticationTokenMissingException.js +27 -0
  77. package/build/exceptions/HttpException.d.ts +5 -0
  78. package/build/exceptions/HttpException.js +27 -0
  79. package/build/exceptions/MongoErrorException.d.ts +4 -0
  80. package/build/exceptions/MongoErrorException.js +27 -0
  81. package/build/exceptions/MulterException.d.ts +4 -0
  82. package/build/exceptions/MulterException.js +27 -0
  83. package/build/exceptions/QwizardException.d.ts +5 -0
  84. package/build/exceptions/QwizardException.js +27 -0
  85. package/build/exceptions/RecordingServerException.d.ts +5 -0
  86. package/build/exceptions/RecordingServerException.js +27 -0
  87. package/build/exceptions/UserNotFoundException.d.ts +4 -0
  88. package/build/exceptions/UserNotFoundException.js +27 -0
  89. package/build/exceptions/UserWithThatEmailAlreadyExistsException.d.ts +4 -0
  90. package/build/exceptions/UserWithThatEmailAlreadyExistsException.js +27 -0
  91. package/build/exceptions/WrongAnonymousAuthException.d.ts +5 -0
  92. package/build/exceptions/WrongAnonymousAuthException.js +27 -0
  93. package/build/exceptions/WrongAuthenticationTokenException.d.ts +5 -0
  94. package/build/exceptions/WrongAuthenticationTokenException.js +27 -0
  95. package/build/exceptions/WrongBusinessAuthException.d.ts +5 -0
  96. package/build/exceptions/WrongBusinessAuthException.js +27 -0
  97. package/build/exceptions/WrongCredentialsException.d.ts +4 -0
  98. package/build/exceptions/WrongCredentialsException.js +27 -0
  99. package/build/exceptions/WrongRoomException.d.ts +4 -0
  100. package/build/exceptions/WrongRoomException.js +27 -0
  101. package/build/exceptions/index.d.ts +16 -0
  102. package/build/exceptions/index.js +28 -0
  103. package/build/exceptions/invalidToken.exception.d.ts +4 -0
  104. package/build/exceptions/invalidToken.exception.js +27 -0
  105. package/build/exceptions/missingToken.exception.d.ts +4 -0
  106. package/build/exceptions/missingToken.exception.js +27 -0
  107. package/build/exceptions/wrongAuth.exception.d.ts +5 -0
  108. package/build/exceptions/wrongAuth.exception.js +27 -0
  109. package/build/index.d.ts +12 -0
  110. package/build/index.js +32 -0
  111. package/build/interfaces/controller.interface.d.ts +5 -0
  112. package/build/interfaces/controller.interface.js +2 -0
  113. package/build/interfaces/index.d.ts +3 -0
  114. package/build/interfaces/index.js +15 -0
  115. package/build/interfaces/requesWithUser.interface.d.ts +11 -0
  116. package/build/interfaces/requesWithUser.interface.js +2 -0
  117. package/build/interfaces/token.interface.d.ts +12 -0
  118. package/build/interfaces/token.interface.js +2 -0
  119. package/build/lib/ensureDatabase.d.ts +11 -0
  120. package/build/lib/ensureDatabase.js +97 -0
  121. package/build/lib/functions.d.ts +89 -0
  122. package/build/lib/functions.js +214 -0
  123. package/build/lib/helpers.d.ts +29 -0
  124. package/build/lib/helpers.js +33 -0
  125. package/build/lib/index.d.ts +4 -0
  126. package/build/lib/index.js +16 -0
  127. package/build/lib/logger.d.ts +2 -0
  128. package/build/lib/logger.js +41 -0
  129. package/build/middlewares/auth.middleware.d.ts +6 -0
  130. package/build/middlewares/auth.middleware.js +287 -0
  131. package/build/middlewares/error.middleware.d.ts +3 -0
  132. package/build/middlewares/error.middleware.js +14 -0
  133. package/build/middlewares/index.d.ts +3 -0
  134. package/build/middlewares/index.js +15 -0
  135. package/build/middlewares/validation.middleware.d.ts +2 -0
  136. package/build/middlewares/validation.middleware.js +22 -0
  137. package/package.json +45 -0
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.UserNotFoundException = void 0;
17
+ var HttpException_1 = require("./HttpException");
18
+ var UserNotFoundException = /** @class */ (function (_super) {
19
+ __extends(UserNotFoundException, _super);
20
+ function UserNotFoundException(message) {
21
+ var _this = _super.call(this, 404, message) || this;
22
+ _this.message = "code-mdb-404: user not found, " + message;
23
+ return _this;
24
+ }
25
+ return UserNotFoundException;
26
+ }(HttpException_1.HttpException));
27
+ exports.UserNotFoundException = UserNotFoundException;
@@ -0,0 +1,4 @@
1
+ import { HttpException } from "./HttpException";
2
+ export declare class UserWithThatEmailAlreadyExistsException extends HttpException {
3
+ constructor(message: string);
4
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.UserWithThatEmailAlreadyExistsException = void 0;
17
+ var HttpException_1 = require("./HttpException");
18
+ var UserWithThatEmailAlreadyExistsException = /** @class */ (function (_super) {
19
+ __extends(UserWithThatEmailAlreadyExistsException, _super);
20
+ function UserWithThatEmailAlreadyExistsException(message) {
21
+ var _this = _super.call(this, 500, message) || this;
22
+ _this.message = "code-vflu-500: This email already exist, " + message;
23
+ return _this;
24
+ }
25
+ return UserWithThatEmailAlreadyExistsException;
26
+ }(HttpException_1.HttpException));
27
+ exports.UserWithThatEmailAlreadyExistsException = UserWithThatEmailAlreadyExistsException;
@@ -0,0 +1,5 @@
1
+ export declare class WrongAnonymousAuthException extends Error {
2
+ status: number;
3
+ message: string;
4
+ constructor();
5
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.WrongAnonymousAuthException = void 0;
17
+ var WrongAnonymousAuthException = /** @class */ (function (_super) {
18
+ __extends(WrongAnonymousAuthException, _super);
19
+ function WrongAnonymousAuthException() {
20
+ var _this = _super.call(this) || this;
21
+ _this.status = 401;
22
+ _this.message = "code-vflu-401: Anonymous token wrong, did not pass verification.";
23
+ return _this;
24
+ }
25
+ return WrongAnonymousAuthException;
26
+ }(Error));
27
+ exports.WrongAnonymousAuthException = WrongAnonymousAuthException;
@@ -0,0 +1,5 @@
1
+ export declare class WrongAuthenticationTokenException extends Error {
2
+ status: number;
3
+ message: string;
4
+ constructor();
5
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.WrongAuthenticationTokenException = void 0;
17
+ var WrongAuthenticationTokenException = /** @class */ (function (_super) {
18
+ __extends(WrongAuthenticationTokenException, _super);
19
+ function WrongAuthenticationTokenException() {
20
+ var _this = _super.call(this) || this;
21
+ _this.status = 401;
22
+ _this.message = "code-vflu-401: Token wrong, did not pass verification.";
23
+ return _this;
24
+ }
25
+ return WrongAuthenticationTokenException;
26
+ }(Error));
27
+ exports.WrongAuthenticationTokenException = WrongAuthenticationTokenException;
@@ -0,0 +1,5 @@
1
+ export declare class WrongBusinessAuthException extends Error {
2
+ status: number;
3
+ message: string;
4
+ constructor(msg: string);
5
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.WrongBusinessAuthException = void 0;
17
+ var WrongBusinessAuthException = /** @class */ (function (_super) {
18
+ __extends(WrongBusinessAuthException, _super);
19
+ function WrongBusinessAuthException(msg) {
20
+ var _this = _super.call(this) || this;
21
+ _this.status = 401;
22
+ _this.message = "code-vflu-401: Business token wrong, did not pass verification. " + msg;
23
+ return _this;
24
+ }
25
+ return WrongBusinessAuthException;
26
+ }(Error));
27
+ exports.WrongBusinessAuthException = WrongBusinessAuthException;
@@ -0,0 +1,4 @@
1
+ import { HttpException } from "./HttpException";
2
+ export declare class WrongCredentialsException extends HttpException {
3
+ constructor(message: string);
4
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.WrongCredentialsException = void 0;
17
+ var HttpException_1 = require("./HttpException");
18
+ var WrongCredentialsException = /** @class */ (function (_super) {
19
+ __extends(WrongCredentialsException, _super);
20
+ function WrongCredentialsException(message) {
21
+ var _this = _super.call(this, 401, message) || this;
22
+ _this.message = "code-vflu-401: " + message;
23
+ return _this;
24
+ }
25
+ return WrongCredentialsException;
26
+ }(HttpException_1.HttpException));
27
+ exports.WrongCredentialsException = WrongCredentialsException;
@@ -0,0 +1,4 @@
1
+ import { HttpException } from "./HttpException";
2
+ export declare class WrongRoomException extends HttpException {
3
+ constructor(message: string);
4
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.WrongRoomException = void 0;
17
+ var HttpException_1 = require("./HttpException");
18
+ var WrongRoomException = /** @class */ (function (_super) {
19
+ __extends(WrongRoomException, _super);
20
+ function WrongRoomException(message) {
21
+ var _this = _super.call(this, 404, message) || this;
22
+ _this.message = "code-mdb-404: " + message;
23
+ return _this;
24
+ }
25
+ return WrongRoomException;
26
+ }(HttpException_1.HttpException));
27
+ exports.WrongRoomException = WrongRoomException;
@@ -0,0 +1,16 @@
1
+ export * from './AuthenticationTokenMissingException';
2
+ export * from './HttpException';
3
+ export * from './MongoErrorException';
4
+ export * from './MulterException';
5
+ export * from './QwizardException';
6
+ export * from './RecordingServerException';
7
+ export * from './UserNotFoundException';
8
+ export * from './UserWithThatEmailAlreadyExistsException';
9
+ export * from './WrongAnonymousAuthException';
10
+ export * from './WrongAuthenticationTokenException';
11
+ export * from './WrongBusinessAuthException';
12
+ export * from './WrongCredentialsException';
13
+ export * from './WrongRoomException';
14
+ export * from './missingToken.exception';
15
+ export * from './wrongAuth.exception';
16
+ export * from './invalidToken.exception';
@@ -0,0 +1,28 @@
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("./AuthenticationTokenMissingException"), exports);
14
+ __exportStar(require("./HttpException"), exports);
15
+ __exportStar(require("./MongoErrorException"), exports);
16
+ __exportStar(require("./MulterException"), exports);
17
+ __exportStar(require("./QwizardException"), exports);
18
+ __exportStar(require("./RecordingServerException"), exports);
19
+ __exportStar(require("./UserNotFoundException"), exports);
20
+ __exportStar(require("./UserWithThatEmailAlreadyExistsException"), exports);
21
+ __exportStar(require("./WrongAnonymousAuthException"), exports);
22
+ __exportStar(require("./WrongAuthenticationTokenException"), exports);
23
+ __exportStar(require("./WrongBusinessAuthException"), exports);
24
+ __exportStar(require("./WrongCredentialsException"), exports);
25
+ __exportStar(require("./WrongRoomException"), exports);
26
+ __exportStar(require("./missingToken.exception"), exports);
27
+ __exportStar(require("./wrongAuth.exception"), exports);
28
+ __exportStar(require("./invalidToken.exception"), exports);
@@ -0,0 +1,4 @@
1
+ import { HttpException } from "./HttpException";
2
+ export declare class InvalidTokenException extends HttpException {
3
+ constructor(message: string);
4
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.InvalidTokenException = void 0;
17
+ var HttpException_1 = require("./HttpException");
18
+ var InvalidTokenException = /** @class */ (function (_super) {
19
+ __extends(InvalidTokenException, _super);
20
+ function InvalidTokenException(message) {
21
+ var _this = _super.call(this, 401, message) || this;
22
+ _this.message = message;
23
+ return _this;
24
+ }
25
+ return InvalidTokenException;
26
+ }(HttpException_1.HttpException));
27
+ exports.InvalidTokenException = InvalidTokenException;
@@ -0,0 +1,4 @@
1
+ import { HttpException } from "./HttpException";
2
+ export declare class MissingTokenException extends HttpException {
3
+ constructor(message: string);
4
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.MissingTokenException = void 0;
17
+ var HttpException_1 = require("./HttpException");
18
+ var MissingTokenException = /** @class */ (function (_super) {
19
+ __extends(MissingTokenException, _super);
20
+ function MissingTokenException(message) {
21
+ var _this = _super.call(this, 401, message) || this;
22
+ _this.message = "code-mdb-500: " + message;
23
+ return _this;
24
+ }
25
+ return MissingTokenException;
26
+ }(HttpException_1.HttpException));
27
+ exports.MissingTokenException = MissingTokenException;
@@ -0,0 +1,5 @@
1
+ export declare class WrongAuthException extends Error {
2
+ status: number;
3
+ message: string;
4
+ constructor();
5
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.WrongAuthException = void 0;
17
+ var WrongAuthException = /** @class */ (function (_super) {
18
+ __extends(WrongAuthException, _super);
19
+ function WrongAuthException() {
20
+ var _this = _super.call(this) || this;
21
+ _this.status = 401;
22
+ _this.message = "code-vflu-401: Anonymous token wrong, did not pass verification.";
23
+ return _this;
24
+ }
25
+ return WrongAuthException;
26
+ }(Error));
27
+ exports.WrongAuthException = WrongAuthException;
@@ -0,0 +1,12 @@
1
+ export * from "./interfaces";
2
+ export * from "./classes";
3
+ export * from "./exceptions";
4
+ export * from "./middlewares";
5
+ export * from "./events";
6
+ export * from "./dtos";
7
+ export * from "./lib";
8
+ export { BacklogManager } from './classes/BacklogManager';
9
+ export { BacklogMonitor } from './classes/BacklogMonitor';
10
+ export { Listener } from './events/baseListener';
11
+ export { EnhancedListener } from './events/EnhancedListener';
12
+ export { BatchEnhancedListener } from './events/BatchEnhancedListener';
package/build/index.js ADDED
@@ -0,0 +1,32 @@
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
+ exports.BatchEnhancedListener = exports.EnhancedListener = exports.Listener = exports.BacklogMonitor = exports.BacklogManager = void 0;
14
+ __exportStar(require("./interfaces"), exports);
15
+ __exportStar(require("./classes"), exports);
16
+ __exportStar(require("./exceptions"), exports);
17
+ __exportStar(require("./middlewares"), exports);
18
+ __exportStar(require("./events"), exports);
19
+ __exportStar(require("./dtos"), exports);
20
+ __exportStar(require("./lib"), exports);
21
+ // Classes
22
+ var BacklogManager_1 = require("./classes/BacklogManager");
23
+ Object.defineProperty(exports, "BacklogManager", { enumerable: true, get: function () { return BacklogManager_1.BacklogManager; } });
24
+ var BacklogMonitor_1 = require("./classes/BacklogMonitor");
25
+ Object.defineProperty(exports, "BacklogMonitor", { enumerable: true, get: function () { return BacklogMonitor_1.BacklogMonitor; } });
26
+ // Events
27
+ var baseListener_1 = require("./events/baseListener");
28
+ Object.defineProperty(exports, "Listener", { enumerable: true, get: function () { return baseListener_1.Listener; } });
29
+ var EnhancedListener_1 = require("./events/EnhancedListener");
30
+ Object.defineProperty(exports, "EnhancedListener", { enumerable: true, get: function () { return EnhancedListener_1.EnhancedListener; } });
31
+ var BatchEnhancedListener_1 = require("./events/BatchEnhancedListener");
32
+ Object.defineProperty(exports, "BatchEnhancedListener", { enumerable: true, get: function () { return BatchEnhancedListener_1.BatchEnhancedListener; } });
@@ -0,0 +1,5 @@
1
+ import { Router } from 'express';
2
+ export interface Controller {
3
+ path: string;
4
+ router: Router;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from './controller.interface';
2
+ export * from './requesWithUser.interface';
3
+ export * from './token.interface';
@@ -0,0 +1,15 @@
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.interface"), exports);
14
+ __exportStar(require("./requesWithUser.interface"), exports);
15
+ __exportStar(require("./token.interface"), exports);
@@ -0,0 +1,11 @@
1
+ import { Request } from 'express';
2
+ import { Ticket, User, UserFB } from '@fluyappgo/commons';
3
+ export interface RequestWithUser extends Request {
4
+ user: User;
5
+ }
6
+ export interface RequestWithUserFB extends Request {
7
+ user: UserFB;
8
+ }
9
+ export interface RequestWithTicket extends Request {
10
+ ticket: Ticket;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import { User, UserFB } from "@fluyappgo/commons";
2
+ export interface DataStoredInToken extends User {
3
+ }
4
+ export interface DataStoredInTokenFB extends UserFB {
5
+ }
6
+ export interface TokenData {
7
+ token: string;
8
+ expiresIn: number;
9
+ }
10
+ export interface DataStoredInTokenToken {
11
+ type: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Ensures a PostgreSQL database exists before connecting.
3
+ * Uses dynamic require of 'sequelize' which is available in each MS.
4
+ */
5
+ export declare function ensureDatabase(opts: {
6
+ dbName: string;
7
+ dbUser: string;
8
+ dbPassword: string;
9
+ dbHost: string;
10
+ ssl?: boolean;
11
+ }): Promise<void>;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ 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;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.ensureDatabase = void 0;
40
+ /**
41
+ * Ensures a PostgreSQL database exists before connecting.
42
+ * Uses dynamic require of 'sequelize' which is available in each MS.
43
+ */
44
+ function ensureDatabase(opts) {
45
+ var _a;
46
+ return __awaiter(this, void 0, void 0, function () {
47
+ var dbName, dbUser, dbPassword, dbHost, ssl, Sequelize, adminConnection, results, error_1, _b;
48
+ return __generator(this, function (_c) {
49
+ switch (_c.label) {
50
+ case 0:
51
+ dbName = opts.dbName, dbUser = opts.dbUser, dbPassword = opts.dbPassword, dbHost = opts.dbHost, ssl = opts.ssl;
52
+ _c.label = 1;
53
+ case 1:
54
+ _c.trys.push([1, 10, , 11]);
55
+ Sequelize = require("sequelize").Sequelize;
56
+ adminConnection = new Sequelize("postgres", dbUser, dbPassword, {
57
+ host: dbHost,
58
+ dialect: "postgres",
59
+ logging: false,
60
+ dialectOptions: ssl
61
+ ? { ssl: { require: true, rejectUnauthorized: false } }
62
+ : {},
63
+ });
64
+ _c.label = 2;
65
+ case 2:
66
+ _c.trys.push([2, 6, 7, 9]);
67
+ return [4 /*yield*/, adminConnection.query("SELECT 1 FROM pg_database WHERE datname = '" + dbName + "'")];
68
+ case 3:
69
+ results = (_c.sent())[0];
70
+ if (!(results.length === 0)) return [3 /*break*/, 5];
71
+ return [4 /*yield*/, adminConnection.query("CREATE DATABASE \"" + dbName + "\"")];
72
+ case 4:
73
+ _c.sent();
74
+ console.log("[DB] Database \"" + dbName + "\" created successfully");
75
+ _c.label = 5;
76
+ case 5: return [3 /*break*/, 9];
77
+ case 6:
78
+ error_1 = _c.sent();
79
+ // 42P04 = database already exists (race condition safe)
80
+ if (((_a = error_1 === null || error_1 === void 0 ? void 0 : error_1.original) === null || _a === void 0 ? void 0 : _a.code) !== "42P04") {
81
+ console.error("[DB] Error ensuring database \"" + dbName + "\":", error_1.message);
82
+ }
83
+ return [3 /*break*/, 9];
84
+ case 7: return [4 /*yield*/, adminConnection.close()];
85
+ case 8:
86
+ _c.sent();
87
+ return [7 /*endfinally*/];
88
+ case 9: return [3 /*break*/, 11];
89
+ case 10:
90
+ _b = _c.sent();
91
+ return [3 /*break*/, 11];
92
+ case 11: return [2 /*return*/];
93
+ }
94
+ });
95
+ });
96
+ }
97
+ exports.ensureDatabase = ensureDatabase;