@aptana/multichannel-common 2.9.12

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 (202) hide show
  1. package/core/domain/Command.d.ts +3 -0
  2. package/core/domain/Command.js +2 -0
  3. package/core/domain/Entity.d.ts +6 -0
  4. package/core/domain/Entity.js +13 -0
  5. package/core/domain/Identifier.d.ts +5 -0
  6. package/core/domain/Identifier.js +13 -0
  7. package/core/domain/UniqueId.d.ts +4 -0
  8. package/core/domain/UniqueId.js +11 -0
  9. package/core/domain/UseCase.d.ts +3 -0
  10. package/core/domain/UseCase.js +2 -0
  11. package/core/domain/ValueObject.d.ts +4 -0
  12. package/core/domain/ValueObject.js +10 -0
  13. package/core/domain/auth/Auth.d.ts +17 -0
  14. package/core/domain/auth/Auth.js +41 -0
  15. package/core/domain/auth/Authenticable.d.ts +4 -0
  16. package/core/domain/auth/Authenticable.js +2 -0
  17. package/core/domain/auth/Guard.d.ts +20 -0
  18. package/core/domain/auth/Guard.js +2 -0
  19. package/core/domain/auth/TokenGuard.d.ts +33 -0
  20. package/core/domain/auth/TokenGuard.js +94 -0
  21. package/core/domain/auth/UserProvider.d.ts +17 -0
  22. package/core/domain/auth/UserProvider.js +2 -0
  23. package/core/domain/cache/Cache.d.ts +8 -0
  24. package/core/domain/cache/Cache.js +2 -0
  25. package/core/domain/cache/Repo.d.ts +51 -0
  26. package/core/domain/cache/Repo.js +2 -0
  27. package/core/domain/cache/Store.d.ts +26 -0
  28. package/core/domain/cache/Store.js +2 -0
  29. package/core/domain/events/Event.d.ts +8 -0
  30. package/core/domain/events/Event.js +2 -0
  31. package/core/domain/events/Listener.d.ts +4 -0
  32. package/core/domain/events/Listener.js +2 -0
  33. package/core/domain/events/Worker.d.ts +3 -0
  34. package/core/domain/events/Worker.js +2 -0
  35. package/core/domain/loaders/Loader.d.ts +4 -0
  36. package/core/domain/loaders/Loader.js +2 -0
  37. package/core/domain/loaders/Manager.d.ts +3 -0
  38. package/core/domain/loaders/Manager.js +2 -0
  39. package/core/errors/AppError.d.ts +10 -0
  40. package/core/errors/AppError.js +16 -0
  41. package/core/errors/AuthenticationTokenMissingError.d.ts +5 -0
  42. package/core/errors/AuthenticationTokenMissingError.js +11 -0
  43. package/core/errors/BadRequestError.d.ts +5 -0
  44. package/core/errors/BadRequestError.js +11 -0
  45. package/core/errors/NotAuthorizedError.d.ts +5 -0
  46. package/core/errors/NotAuthorizedError.js +11 -0
  47. package/core/errors/NotFoundError.d.ts +5 -0
  48. package/core/errors/NotFoundError.js +11 -0
  49. package/core/errors/RequestValidationError.d.ts +10 -0
  50. package/core/errors/RequestValidationError.js +47 -0
  51. package/core/errors/ValidationError.d.ts +8 -0
  52. package/core/errors/ValidationError.js +19 -0
  53. package/core/errors/WrongAuthenticationTokenError.d.ts +5 -0
  54. package/core/errors/WrongAuthenticationTokenError.js +11 -0
  55. package/core/errors/WrongCredentialsError.d.ts +5 -0
  56. package/core/errors/WrongCredentialsError.js +11 -0
  57. package/core/index.d.ts +48 -0
  58. package/core/index.js +69 -0
  59. package/core/infrastructure/Container.d.ts +1 -0
  60. package/core/infrastructure/Container.js +8 -0
  61. package/core/infrastructure/Controller.d.ts +9 -0
  62. package/core/infrastructure/Controller.js +30 -0
  63. package/core/infrastructure/DatabaseRepository.d.ts +35 -0
  64. package/core/infrastructure/DatabaseRepository.js +2 -0
  65. package/core/infrastructure/Mapper.d.ts +2 -0
  66. package/core/infrastructure/Mapper.js +6 -0
  67. package/core/infrastructure/Repo.d.ts +2 -0
  68. package/core/infrastructure/Repo.js +6 -0
  69. package/core/infrastructure/cache/Cache.d.ts +47 -0
  70. package/core/infrastructure/cache/Cache.js +101 -0
  71. package/core/infrastructure/cache/InMemoryCache.d.ts +20 -0
  72. package/core/infrastructure/cache/InMemoryCache.js +62 -0
  73. package/core/infrastructure/cache/RedisCache.d.ts +15 -0
  74. package/core/infrastructure/cache/RedisCache.js +51 -0
  75. package/core/infrastructure/cache/Repo.d.ts +25 -0
  76. package/core/infrastructure/cache/Repo.js +103 -0
  77. package/core/infrastructure/cache/stores/ArrayStore.d.ts +17 -0
  78. package/core/infrastructure/cache/stores/ArrayStore.js +65 -0
  79. package/core/infrastructure/cache/stores/FileStore.d.ts +14 -0
  80. package/core/infrastructure/cache/stores/FileStore.js +171 -0
  81. package/core/infrastructure/cache/stores/NullStore.d.ts +9 -0
  82. package/core/infrastructure/cache/stores/NullStore.js +24 -0
  83. package/core/infrastructure/cache/stores/RedisStore.d.ts +13 -0
  84. package/core/infrastructure/cache/stores/RedisStore.js +44 -0
  85. package/core/infrastructure/events/ChannelEvent.d.ts +9 -0
  86. package/core/infrastructure/events/ChannelEvent.js +37 -0
  87. package/core/infrastructure/events/Connection.d.ts +8 -0
  88. package/core/infrastructure/events/Connection.js +30 -0
  89. package/core/infrastructure/events/Event.d.ts +16 -0
  90. package/core/infrastructure/events/Event.js +42 -0
  91. package/core/infrastructure/events/Listener.d.ts +23 -0
  92. package/core/infrastructure/events/Listener.js +77 -0
  93. package/core/infrastructure/events/Worker.d.ts +9 -0
  94. package/core/infrastructure/events/Worker.js +34 -0
  95. package/core/infrastructure/events/grpc/Connection.d.ts +9 -0
  96. package/core/infrastructure/events/grpc/Connection.js +34 -0
  97. package/core/infrastructure/events/grpc/Event.d.ts +12 -0
  98. package/core/infrastructure/events/grpc/Event.js +80 -0
  99. package/core/infrastructure/events/grpc/Listener.d.ts +16 -0
  100. package/core/infrastructure/events/grpc/Listener.js +74 -0
  101. package/core/infrastructure/events/rpc/Event.d.ts +13 -0
  102. package/core/infrastructure/events/rpc/Event.js +98 -0
  103. package/core/infrastructure/events/rpc/Listener.d.ts +6 -0
  104. package/core/infrastructure/events/rpc/Listener.js +30 -0
  105. package/core/infrastructure/http/App.d.ts +15 -0
  106. package/core/infrastructure/http/App.js +73 -0
  107. package/core/infrastructure/http/middleware/alwaysAcceptJsonMiddleware.d.ts +2 -0
  108. package/core/infrastructure/http/middleware/alwaysAcceptJsonMiddleware.js +8 -0
  109. package/core/infrastructure/http/middleware/errorMiddleware.d.ts +2 -0
  110. package/core/infrastructure/http/middleware/errorMiddleware.js +18 -0
  111. package/core/infrastructure/http/middleware/loggerMiddleware.d.ts +2 -0
  112. package/core/infrastructure/http/middleware/loggerMiddleware.js +17 -0
  113. package/core/infrastructure/http/middleware/routeNotFoundMiddleware.d.ts +2 -0
  114. package/core/infrastructure/http/middleware/routeNotFoundMiddleware.js +11 -0
  115. package/core/infrastructure/http/middleware/validationMiddleware.d.ts +4 -0
  116. package/core/infrastructure/http/middleware/validationMiddleware.js +35 -0
  117. package/core/infrastructure/loaders/Loader.d.ts +8 -0
  118. package/core/infrastructure/loaders/Loader.js +14 -0
  119. package/core/infrastructure/loaders/Manager.d.ts +7 -0
  120. package/core/infrastructure/loaders/Manager.js +24 -0
  121. package/core/modules/health/errors/ConnectionNotFoundError.d.ts +4 -0
  122. package/core/modules/health/errors/ConnectionNotFoundError.js +10 -0
  123. package/core/modules/health/errors/HealthCheckError.d.ts +3 -0
  124. package/core/modules/health/errors/HealthCheckError.js +10 -0
  125. package/core/modules/health/errors/TimeoutError.d.ts +4 -0
  126. package/core/modules/health/errors/TimeoutError.js +10 -0
  127. package/core/modules/health/useCases/health/HealthController.d.ts +20 -0
  128. package/core/modules/health/useCases/health/HealthController.js +75 -0
  129. package/core/modules/health/useCases/healthCheck/HealthCheck.d.ts +8 -0
  130. package/core/modules/health/useCases/healthCheck/HealthCheck.js +37 -0
  131. package/core/modules/health/useCases/healthCheck/HealthCheckExecutor.d.ts +8 -0
  132. package/core/modules/health/useCases/healthCheck/HealthCheckExecutor.js +48 -0
  133. package/core/modules/health/useCases/healthCheck/HealthCheckResult.d.ts +6 -0
  134. package/core/modules/health/useCases/healthCheck/HealthCheckResult.js +2 -0
  135. package/core/modules/health/useCases/healthIndicator/HealthIndicator.d.ts +7 -0
  136. package/core/modules/health/useCases/healthIndicator/HealthIndicator.js +14 -0
  137. package/core/modules/health/useCases/healthIndicator/HealthIndicatorResult.d.ts +7 -0
  138. package/core/modules/health/useCases/healthIndicator/HealthIndicatorResult.js +2 -0
  139. package/core/modules/health/useCases/healthIndicator/database/mongooseHealthIndicator.d.ts +21 -0
  140. package/core/modules/health/useCases/healthIndicator/database/mongooseHealthIndicator.js +69 -0
  141. package/core/modules/health/useCases/healthIndicator/database/sequelizeHealthIndicator.d.ts +27 -0
  142. package/core/modules/health/useCases/healthIndicator/database/sequelizeHealthIndicator.js +73 -0
  143. package/core/modules/health/useCases/healthIndicator/message-broker/rabbitmqHealthIndicator.d.ts +21 -0
  144. package/core/modules/health/useCases/healthIndicator/message-broker/rabbitmqHealthIndicator.js +66 -0
  145. package/core/modules/health/utils/promise.d.ts +1 -0
  146. package/core/modules/health/utils/promise.js +12 -0
  147. package/core/modules/service/useCases/detail/DetailController.d.ts +6 -0
  148. package/core/modules/service/useCases/detail/DetailController.js +25 -0
  149. package/core/utils/Crypto.d.ts +24 -0
  150. package/core/utils/Crypto.js +93 -0
  151. package/core/utils/Hash.d.ts +6 -0
  152. package/core/utils/Hash.js +23 -0
  153. package/core/utils/cache.d.ts +1 -0
  154. package/core/utils/cache.js +16 -0
  155. package/core/utils/commands.d.ts +2 -0
  156. package/core/utils/commands.js +7 -0
  157. package/core/utils/events.d.ts +3 -0
  158. package/core/utils/events.js +11 -0
  159. package/core/utils/logger.d.ts +2 -0
  160. package/core/utils/logger.js +15 -0
  161. package/core/utils/response.d.ts +4 -0
  162. package/core/utils/response.js +11 -0
  163. package/core/utils/validator.d.ts +4 -0
  164. package/core/utils/validator.js +48 -0
  165. package/domain/BalanceMutation.d.ts +18 -0
  166. package/domain/BalanceMutation.js +8 -0
  167. package/domain/ChannelWhatsapp.d.ts +18 -0
  168. package/domain/ChannelWhatsapp.js +2 -0
  169. package/domain/MessageTemplate.d.ts +26 -0
  170. package/domain/MessageTemplate.js +12 -0
  171. package/domain/MessageTemplateCategoryUpdate.d.ts +8 -0
  172. package/domain/MessageTemplateCategoryUpdate.js +2 -0
  173. package/domain/MessageTemplateStatusUpdate.d.ts +8 -0
  174. package/domain/MessageTemplateStatusUpdate.js +2 -0
  175. package/domain/Payment.d.ts +14 -0
  176. package/domain/Payment.js +8 -0
  177. package/domain/Report.d.ts +33 -0
  178. package/domain/Report.js +15 -0
  179. package/domain/TransactionMessaging.d.ts +33 -0
  180. package/domain/TransactionMessaging.js +11 -0
  181. package/domain/TransactionMessagingStatusUpdate.d.ts +6 -0
  182. package/domain/TransactionMessagingStatusUpdate.js +2 -0
  183. package/domain/User.d.ts +25 -0
  184. package/domain/User.js +19 -0
  185. package/domain/index.d.ts +10 -0
  186. package/domain/index.js +26 -0
  187. package/index.d.ts +3 -0
  188. package/index.js +19 -0
  189. package/package.json +57 -0
  190. package/readme.md +4 -0
  191. package/shared/index.d.ts +5 -0
  192. package/shared/index.js +21 -0
  193. package/shared/plugins/axios-logger-mongo.d.ts +5 -0
  194. package/shared/plugins/axios-logger-mongo.js +113 -0
  195. package/shared/plugins/axios.d.ts +1 -0
  196. package/shared/plugins/axios.js +31 -0
  197. package/shared/plugins/cursor.d.ts +29 -0
  198. package/shared/plugins/cursor.js +231 -0
  199. package/shared/plugins/mongoose.d.ts +31 -0
  200. package/shared/plugins/mongoose.js +125 -0
  201. package/shared/resources/JsonResource.d.ts +16 -0
  202. package/shared/resources/JsonResource.js +59 -0
@@ -0,0 +1,3 @@
1
+ export interface Command {
2
+ execute(): void;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { UniqueId } from '../../core/domain/UniqueId';
2
+ export declare abstract class Entity<T> {
3
+ protected readonly _id: UniqueId;
4
+ protected readonly props: T;
5
+ constructor(props: T, id?: UniqueId);
6
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Entity = void 0;
4
+ const UniqueId_1 = require("../../core/domain/UniqueId");
5
+ class Entity {
6
+ _id;
7
+ props;
8
+ constructor(props, id) {
9
+ this._id = id ?? new UniqueId_1.UniqueId();
10
+ this.props = props;
11
+ }
12
+ }
13
+ exports.Entity = Entity;
@@ -0,0 +1,5 @@
1
+ export declare class Identifier<T> {
2
+ private value;
3
+ constructor(value: T);
4
+ toString(): string;
5
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Identifier = void 0;
4
+ class Identifier {
5
+ value;
6
+ constructor(value) {
7
+ this.value = value;
8
+ }
9
+ toString() {
10
+ return String(this.value);
11
+ }
12
+ }
13
+ exports.Identifier = Identifier;
@@ -0,0 +1,4 @@
1
+ import { Identifier } from '../../core/domain/Identifier';
2
+ export declare class UniqueId extends Identifier<string> {
3
+ constructor(id?: string);
4
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UniqueId = void 0;
4
+ const node_crypto_1 = require("node:crypto");
5
+ const Identifier_1 = require("../../core/domain/Identifier");
6
+ class UniqueId extends Identifier_1.Identifier {
7
+ constructor(id) {
8
+ super(id ?? (0, node_crypto_1.randomUUID)());
9
+ }
10
+ }
11
+ exports.UniqueId = UniqueId;
@@ -0,0 +1,3 @@
1
+ export interface UseCase<Request, Response> {
2
+ execute(req?: Request): Response;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export declare abstract class ValueObject<T> {
2
+ readonly props: T;
3
+ constructor(props: T);
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValueObject = void 0;
4
+ class ValueObject {
5
+ props;
6
+ constructor(props) {
7
+ this.props = props;
8
+ }
9
+ }
10
+ exports.ValueObject = ValueObject;
@@ -0,0 +1,17 @@
1
+ import TokenGuard from './TokenGuard';
2
+ import UserProvider from './UserProvider';
3
+ /**
4
+ * @deprecated
5
+ */
6
+ export declare class Auth {
7
+ private static _instance;
8
+ private _provider;
9
+ private _request;
10
+ private constructor();
11
+ static getInstance(): Auth;
12
+ static guard(): TokenGuard;
13
+ setUserProvider(provider: UserProvider): this;
14
+ setRequest(request: any): this;
15
+ private tokenGuard;
16
+ }
17
+ export default Auth;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Auth = void 0;
7
+ const TokenGuard_1 = __importDefault(require("./TokenGuard"));
8
+ /**
9
+ * @deprecated
10
+ */
11
+ class Auth {
12
+ static _instance;
13
+ _provider;
14
+ _request;
15
+ constructor() {
16
+ //
17
+ }
18
+ static getInstance() {
19
+ if (!this._instance) {
20
+ this._instance = new Auth();
21
+ }
22
+ return this._instance;
23
+ }
24
+ static guard() {
25
+ return Auth.getInstance()
26
+ .tokenGuard();
27
+ }
28
+ setUserProvider(provider) {
29
+ this._provider = provider;
30
+ return this;
31
+ }
32
+ setRequest(request) {
33
+ this._request = request;
34
+ return this;
35
+ }
36
+ tokenGuard() {
37
+ return new TokenGuard_1.default(this._provider, this._request);
38
+ }
39
+ }
40
+ exports.Auth = Auth;
41
+ exports.default = Auth;
@@ -0,0 +1,4 @@
1
+ import User from "../../../domain/User";
2
+ export interface Authenticable extends User {
3
+ }
4
+ export default Authenticable;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ import Authenticable from './Authenticable';
2
+ export interface Guard {
3
+ /**
4
+ * Determine if the current user is authenticated.
5
+ */
6
+ check(): Promise<boolean>;
7
+ /**
8
+ * Determine if the current user is a guest.
9
+ */
10
+ guest(): Promise<boolean>;
11
+ /**
12
+ * Set the current user.
13
+ */
14
+ setUser(user: Authenticable): Promise<void>;
15
+ /**
16
+ * Get the currently authenticated user.
17
+ */
18
+ user(): Promise<Authenticable | null>;
19
+ }
20
+ export default Guard;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,33 @@
1
+ import Authenticable from './Authenticable';
2
+ import Guard from './Guard';
3
+ import UserProvider from './UserProvider';
4
+ export declare class TokenGuard implements Guard {
5
+ /**
6
+ * The request instance.
7
+ */
8
+ private _req;
9
+ /**
10
+ * The user provider implementation.
11
+ */
12
+ private _provider;
13
+ /**
14
+ * The currently authenticated user.
15
+ */
16
+ private _user;
17
+ /**
18
+ * Create a new authtentication guard.
19
+ */
20
+ constructor(provider: UserProvider, req: any);
21
+ /**
22
+ * Determine if the current user is authenticated. If not, throw an error.
23
+ */
24
+ authenticate(): Promise<Authenticable>;
25
+ check(): Promise<boolean>;
26
+ guest(): Promise<boolean>;
27
+ setUser(user: Authenticable): Promise<void>;
28
+ setRequest(req: any): Promise<void>;
29
+ user(): Promise<Authenticable | null>;
30
+ private getTokenFromRequest;
31
+ private getUserKeyTokenFromRequest;
32
+ }
33
+ export default TokenGuard;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TokenGuard = void 0;
7
+ const WrongCredentialsError_1 = __importDefault(require("../../../core/errors/WrongCredentialsError"));
8
+ class TokenGuard {
9
+ /**
10
+ * The request instance.
11
+ */
12
+ _req;
13
+ /**
14
+ * The user provider implementation.
15
+ */
16
+ _provider;
17
+ /**
18
+ * The currently authenticated user.
19
+ */
20
+ _user;
21
+ /**
22
+ * Create a new authtentication guard.
23
+ */
24
+ constructor(provider, req) {
25
+ this._provider = provider;
26
+ this._req = req;
27
+ }
28
+ /**
29
+ * Determine if the current user is authenticated. If not, throw an error.
30
+ */
31
+ async authenticate() {
32
+ const user = await this.user();
33
+ if (user) {
34
+ return user;
35
+ }
36
+ throw new WrongCredentialsError_1.default();
37
+ }
38
+ async check() {
39
+ return !!(await this.user());
40
+ }
41
+ async guest() {
42
+ return !(await this.check);
43
+ }
44
+ async setUser(user) {
45
+ // this._user = user;
46
+ }
47
+ async setRequest(req) {
48
+ this._req = req;
49
+ }
50
+ async user() {
51
+ // if (this._user) {
52
+ // return this._user;
53
+ // }
54
+ let user = null;
55
+ let token = this.getTokenFromRequest();
56
+ let { userKey, userToken } = this.getUserKeyTokenFromRequest();
57
+ if (token) {
58
+ user = await this._provider.getByToken(token);
59
+ }
60
+ if (userKey && userToken) {
61
+ user = await this._provider.getByUserKeyAndUserToken(userKey, userToken);
62
+ }
63
+ return user;
64
+ // return this._user = user!;
65
+ }
66
+ getTokenFromRequest() {
67
+ let token = this._req.query['api_token'];
68
+ if (!token) {
69
+ token = this._req.body['api_token'];
70
+ }
71
+ if (!token && this._req.header('API-Token')) {
72
+ token = this._req.header('API-Token');
73
+ }
74
+ if (!token && this._req.header('Authorization')) {
75
+ const authorization = this._req.header('Authorization');
76
+ let [_, bearerToken] = authorization.split(' ');
77
+ token = bearerToken;
78
+ }
79
+ return token;
80
+ }
81
+ getUserKeyTokenFromRequest() {
82
+ let userKey = this._req.query['userkey'];
83
+ let userToken = this._req.query['usertoken'];
84
+ if (!userKey) {
85
+ userKey = this._req.body['userkey'];
86
+ }
87
+ if (!userToken) {
88
+ userToken = this._req.body['usertoken'];
89
+ }
90
+ return { userKey, userToken };
91
+ }
92
+ }
93
+ exports.TokenGuard = TokenGuard;
94
+ exports.default = TokenGuard;
@@ -0,0 +1,17 @@
1
+ import Authenticable from './Authenticable';
2
+ export interface UserProvider {
3
+ /**
4
+ * Get user by their unique identifier.
5
+ */
6
+ getById(id: any): Promise<Authenticable | null>;
7
+ /**
8
+ * Get user by their api token.
9
+ */
10
+ getByToken(token: string): Promise<Authenticable | null>;
11
+ /**
12
+ * Get user by the given credentials.
13
+ */
14
+ getByCredentials(credentials: object): Promise<Authenticable | null>;
15
+ getByUserKeyAndUserToken(userKey: string, userToken: string): Promise<Authenticable | null>;
16
+ }
17
+ export default UserProvider;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @deprecated
3
+ */
4
+ export interface Cache {
5
+ get<T>(key: string): Promise<T | null>;
6
+ set(key: string, data: unknown, ttl?: number): Promise<void>;
7
+ invalidate(key: string): Promise<void>;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,51 @@
1
+ import { Store } from '../../../core/domain/cache/Store';
2
+ export interface Repo {
3
+ /**
4
+ * Determine if an item exists in the cache.
5
+ */
6
+ has(key: string): Promise<boolean>;
7
+ /**
8
+ * Determine if an item doesn't exist in the cache.
9
+ */
10
+ missing(key: string): Promise<boolean>;
11
+ /**
12
+ * Retrieve an item from the cache by key.
13
+ */
14
+ get<T>(key: string, _default?: unknown): Promise<T | null>;
15
+ /**
16
+ * Retrieve an item from the cache and delete it.
17
+ */
18
+ pull<T>(key: string, _default?: unknown): Promise<T | null>;
19
+ /**
20
+ * Store an item in the cache.
21
+ */
22
+ put(key: string, value: unknown, ttl?: number): Promise<boolean>;
23
+ /**
24
+ * Store an item in the cache if the key does not exist.
25
+ */
26
+ add(key: string, value: unknown, ttl?: number): Promise<boolean>;
27
+ /**
28
+ * Store an item in the cache indefinitely.
29
+ */
30
+ forever(key: string, value: unknown): Promise<boolean>;
31
+ /**
32
+ * Get an item from the cache, or execute the given Closure and store the result.
33
+ */
34
+ remember<T>(key: string, callback: Function, ttl?: number): Promise<T>;
35
+ /**
36
+ * Get an item from the cache, or execute the given Closure and store the result forever.
37
+ */
38
+ rememberForever<T>(key: string, callback: Function): Promise<T>;
39
+ /**
40
+ * Remove an item from the cache.
41
+ */
42
+ forget(key: string): Promise<boolean>;
43
+ /**
44
+ * Remove all items from the cache.
45
+ */
46
+ flush(): Promise<boolean>;
47
+ /**
48
+ * Get the cache store implementation.
49
+ */
50
+ getStore(): Store;
51
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,26 @@
1
+ export interface Store {
2
+ /**
3
+ * Fetches a value from the cache.
4
+ */
5
+ get<T>(key: string): Promise<T | null>;
6
+ /**
7
+ * Store an item in the cache for a given number of seconds.
8
+ */
9
+ put(key: string, value: unknown, ttl: number): Promise<boolean>;
10
+ /**
11
+ * Store an item in the cache indefinitely.
12
+ */
13
+ forever(key: string, value: unknown): Promise<boolean>;
14
+ /**
15
+ * Remove an item from the cache.
16
+ */
17
+ forget(key: string): Promise<boolean>;
18
+ /**
19
+ * Remove all items from the cache.
20
+ */
21
+ flush(): Promise<boolean>;
22
+ /**
23
+ * Get the cache key prefix.
24
+ */
25
+ getPrefix(): string;
26
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ export interface EventOptions {
2
+ [key: string]: unknown;
3
+ }
4
+ export interface Event {
5
+ init(): Event;
6
+ publish(options?: EventOptions): any;
7
+ publishWithoutPersistence?(options?: EventOptions): any;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export interface Listener {
2
+ init(): Listener;
3
+ listen(): any;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface Worker {
2
+ start(): void;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export interface Loader {
2
+ load(): void;
3
+ register(): void;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface Manager {
2
+ load(): void;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ export interface ErrorMessage {
2
+ message: string;
3
+ field?: string;
4
+ }
5
+ export declare class AppError extends Error {
6
+ status: number;
7
+ message: string;
8
+ constructor(message: string, status?: number);
9
+ serializeErrors(): ErrorMessage[];
10
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppError = void 0;
4
+ class AppError extends Error {
5
+ status;
6
+ message;
7
+ constructor(message, status = 500) {
8
+ super(message);
9
+ this.message = message;
10
+ this.status = status;
11
+ }
12
+ serializeErrors() {
13
+ return [{ message: this.message }];
14
+ }
15
+ }
16
+ exports.AppError = AppError;
@@ -0,0 +1,5 @@
1
+ import { AppError } from '../../core/errors/AppError';
2
+ export declare class AuthenticationTokenMissingError extends AppError {
3
+ constructor();
4
+ }
5
+ export default AuthenticationTokenMissingError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthenticationTokenMissingError = void 0;
4
+ const AppError_1 = require("../../core/errors/AppError");
5
+ class AuthenticationTokenMissingError extends AppError_1.AppError {
6
+ constructor() {
7
+ super('Authentication token missing', 401);
8
+ }
9
+ }
10
+ exports.AuthenticationTokenMissingError = AuthenticationTokenMissingError;
11
+ exports.default = AuthenticationTokenMissingError;
@@ -0,0 +1,5 @@
1
+ import { AppError } from '../../core/errors/AppError';
2
+ export declare class BadRequestError extends AppError {
3
+ constructor(message?: string);
4
+ }
5
+ export default BadRequestError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BadRequestError = void 0;
4
+ const AppError_1 = require("../../core/errors/AppError");
5
+ class BadRequestError extends AppError_1.AppError {
6
+ constructor(message = 'Bad Request') {
7
+ super(message, 400);
8
+ }
9
+ }
10
+ exports.BadRequestError = BadRequestError;
11
+ exports.default = BadRequestError;
@@ -0,0 +1,5 @@
1
+ import { AppError } from '../../core/errors/AppError';
2
+ export declare class NotAuthorizedError extends AppError {
3
+ constructor();
4
+ }
5
+ export default NotAuthorizedError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotAuthorizedError = void 0;
4
+ const AppError_1 = require("../../core/errors/AppError");
5
+ class NotAuthorizedError extends AppError_1.AppError {
6
+ constructor() {
7
+ super('You\'re not authorized', 403);
8
+ }
9
+ }
10
+ exports.NotAuthorizedError = NotAuthorizedError;
11
+ exports.default = NotAuthorizedError;
@@ -0,0 +1,5 @@
1
+ import { AppError } from '../../core/errors/AppError';
2
+ export declare class NotFoundError extends AppError {
3
+ constructor(message?: string);
4
+ }
5
+ export default NotFoundError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotFoundError = void 0;
4
+ const AppError_1 = require("../../core/errors/AppError");
5
+ class NotFoundError extends AppError_1.AppError {
6
+ constructor(message = 'Not Found') {
7
+ super(message, 404);
8
+ }
9
+ }
10
+ exports.NotFoundError = NotFoundError;
11
+ exports.default = NotFoundError;
@@ -0,0 +1,10 @@
1
+ import { ValidationError } from 'class-validator';
2
+ import { AppError, ErrorMessage } from '../../core/errors/AppError';
3
+ export declare class RequestValidationError extends AppError {
4
+ protected errors: ValidationError[];
5
+ constructor(errors: ValidationError[]);
6
+ serializeErrors(): ErrorMessage[];
7
+ private mapChildrenToValidationErrors;
8
+ private prependConstraintsWithParentProp;
9
+ }
10
+ export default RequestValidationError;