@expressots/core 1.0.1 → 1.2.0

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 (149) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +33 -122
  3. package/lib/CHANGELOG.md +120 -0
  4. package/lib/README.md +64 -0
  5. package/lib/cjs/application/app-container.js +40 -0
  6. package/{application → lib/cjs/application}/application.js +101 -62
  7. package/{application → lib/cjs/application}/index.js +9 -9
  8. package/lib/cjs/common/index.js +2 -0
  9. package/lib/cjs/common/project-config.provider.js +2 -0
  10. package/lib/cjs/console/console.js +95 -0
  11. package/{console → lib/cjs/console}/index.js +5 -5
  12. package/lib/cjs/container-module/container-module.js +56 -0
  13. package/{container-module → lib/cjs/container-module}/index.js +5 -5
  14. package/lib/cjs/controller/base-controller.js +77 -0
  15. package/{controller → lib/cjs/controller}/index.js +5 -5
  16. package/{environment → lib/cjs/environment}/env-validator.js +87 -64
  17. package/{environment → lib/cjs/environment}/index.js +5 -5
  18. package/lib/cjs/error/application-error.js +37 -0
  19. package/{error → lib/cjs/error}/error-handler-middleware.js +17 -9
  20. package/{error → lib/cjs/error}/index.js +9 -9
  21. package/lib/cjs/error/report.js +27 -0
  22. package/{error → lib/cjs/error}/status-code.js +83 -83
  23. package/lib/cjs/index.js +24 -0
  24. package/{logger → lib/cjs/logger}/general-logger.js +132 -92
  25. package/{logger → lib/cjs/logger}/index.js +7 -7
  26. package/lib/cjs/types/application/app-container.d.ts +20 -0
  27. package/lib/cjs/types/application/app-container.d.ts.map +1 -0
  28. package/lib/cjs/types/application/application.d.ts +53 -0
  29. package/lib/cjs/types/application/application.d.ts.map +1 -0
  30. package/lib/cjs/types/application/index.d.ts +3 -0
  31. package/lib/cjs/types/application/index.d.ts.map +1 -0
  32. package/lib/cjs/types/common/index.d.ts +2 -0
  33. package/lib/cjs/types/common/index.d.ts.map +1 -0
  34. package/lib/cjs/types/common/project-config.provider.d.ts +22 -0
  35. package/lib/cjs/types/common/project-config.provider.d.ts.map +1 -0
  36. package/lib/cjs/types/console/console.d.ts +28 -0
  37. package/lib/cjs/types/console/console.d.ts.map +1 -0
  38. package/{console → lib/cjs/types/console}/index.d.ts +2 -1
  39. package/lib/cjs/types/console/index.d.ts.map +1 -0
  40. package/lib/cjs/types/container-module/container-module.d.ts +23 -0
  41. package/lib/cjs/types/container-module/container-module.d.ts.map +1 -0
  42. package/lib/cjs/types/container-module/index.d.ts +2 -0
  43. package/lib/cjs/types/container-module/index.d.ts.map +1 -0
  44. package/lib/cjs/types/controller/base-controller.d.ts +30 -0
  45. package/lib/cjs/types/controller/base-controller.d.ts.map +1 -0
  46. package/lib/cjs/types/controller/index.d.ts +2 -0
  47. package/lib/cjs/types/controller/index.d.ts.map +1 -0
  48. package/lib/cjs/types/environment/env-validator.d.ts +28 -0
  49. package/lib/cjs/types/environment/env-validator.d.ts.map +1 -0
  50. package/lib/cjs/types/environment/index.d.ts +2 -0
  51. package/lib/cjs/types/environment/index.d.ts.map +1 -0
  52. package/lib/cjs/types/error/application-error.d.ts +18 -0
  53. package/lib/cjs/types/error/application-error.d.ts.map +1 -0
  54. package/lib/cjs/types/error/error-handler-middleware.d.ts +13 -0
  55. package/lib/cjs/types/error/error-handler-middleware.d.ts.map +1 -0
  56. package/lib/cjs/types/error/index.d.ts +4 -0
  57. package/lib/cjs/types/error/index.d.ts.map +1 -0
  58. package/lib/cjs/types/error/report.d.ts +13 -0
  59. package/lib/cjs/types/error/report.d.ts.map +1 -0
  60. package/{error → lib/cjs/types/error}/status-code.d.ts +137 -136
  61. package/lib/cjs/types/error/status-code.d.ts.map +1 -0
  62. package/lib/cjs/types/index.d.ts +9 -0
  63. package/lib/cjs/types/index.d.ts.map +1 -0
  64. package/lib/cjs/types/logger/general-logger.d.ts +46 -0
  65. package/lib/cjs/types/logger/general-logger.d.ts.map +1 -0
  66. package/lib/cjs/types/logger/index.d.ts +2 -0
  67. package/lib/cjs/types/logger/index.d.ts.map +1 -0
  68. package/lib/esm/application/app-container.js +38 -0
  69. package/lib/esm/application/application.js +96 -0
  70. package/{application/index.d.ts → lib/esm/application/index.js} +2 -2
  71. package/lib/esm/common/index.js +1 -0
  72. package/lib/esm/common/project-config.provider.js +1 -0
  73. package/lib/esm/console/console.js +76 -0
  74. package/lib/esm/console/index.js +1 -0
  75. package/lib/esm/container-module/container-module.js +53 -0
  76. package/{container-module/index.d.ts → lib/esm/container-module/index.js} +1 -1
  77. package/lib/esm/controller/base-controller.js +64 -0
  78. package/{controller/index.d.ts → lib/esm/controller/index.js} +1 -1
  79. package/lib/esm/environment/env-validator.js +80 -0
  80. package/{environment/index.d.ts → lib/esm/environment/index.js} +1 -1
  81. package/lib/esm/error/application-error.js +36 -0
  82. package/lib/esm/error/error-handler-middleware.js +15 -0
  83. package/{error/index.d.ts → lib/esm/error/index.js} +3 -3
  84. package/lib/esm/error/report.js +24 -0
  85. package/lib/esm/error/status-code.js +80 -0
  86. package/{index.d.ts → lib/esm/index.mjs} +8 -7
  87. package/lib/esm/logger/general-logger.js +125 -0
  88. package/{logger/index.d.ts → lib/esm/logger/index.js} +1 -1
  89. package/lib/esm/types/application/app-container.d.ts +20 -0
  90. package/lib/esm/types/application/app-container.d.ts.map +1 -0
  91. package/lib/esm/types/application/application.d.ts +53 -0
  92. package/lib/esm/types/application/application.d.ts.map +1 -0
  93. package/lib/esm/types/application/index.d.ts +3 -0
  94. package/lib/esm/types/application/index.d.ts.map +1 -0
  95. package/lib/esm/types/common/index.d.ts +2 -0
  96. package/lib/esm/types/common/index.d.ts.map +1 -0
  97. package/lib/esm/types/common/project-config.provider.d.ts +22 -0
  98. package/lib/esm/types/common/project-config.provider.d.ts.map +1 -0
  99. package/lib/esm/types/console/console.d.ts +28 -0
  100. package/lib/esm/types/console/console.d.ts.map +1 -0
  101. package/lib/esm/types/console/index.d.ts +2 -0
  102. package/lib/esm/types/console/index.d.ts.map +1 -0
  103. package/lib/esm/types/container-module/container-module.d.ts +23 -0
  104. package/lib/esm/types/container-module/container-module.d.ts.map +1 -0
  105. package/lib/esm/types/container-module/index.d.ts +2 -0
  106. package/lib/esm/types/container-module/index.d.ts.map +1 -0
  107. package/lib/esm/types/controller/base-controller.d.ts +30 -0
  108. package/lib/esm/types/controller/base-controller.d.ts.map +1 -0
  109. package/lib/esm/types/controller/index.d.ts +2 -0
  110. package/lib/esm/types/controller/index.d.ts.map +1 -0
  111. package/lib/esm/types/environment/env-validator.d.ts +28 -0
  112. package/lib/esm/types/environment/env-validator.d.ts.map +1 -0
  113. package/lib/esm/types/environment/index.d.ts +2 -0
  114. package/lib/esm/types/environment/index.d.ts.map +1 -0
  115. package/lib/esm/types/error/application-error.d.ts +18 -0
  116. package/lib/esm/types/error/application-error.d.ts.map +1 -0
  117. package/lib/esm/types/error/error-handler-middleware.d.ts +13 -0
  118. package/lib/esm/types/error/error-handler-middleware.d.ts.map +1 -0
  119. package/lib/esm/types/error/index.d.ts +4 -0
  120. package/lib/esm/types/error/index.d.ts.map +1 -0
  121. package/lib/esm/types/error/report.d.ts +13 -0
  122. package/lib/esm/types/error/report.d.ts.map +1 -0
  123. package/lib/esm/types/error/status-code.d.ts +137 -0
  124. package/lib/esm/types/error/status-code.d.ts.map +1 -0
  125. package/lib/esm/types/index.d.ts +9 -0
  126. package/lib/esm/types/index.d.ts.map +1 -0
  127. package/lib/esm/types/logger/general-logger.d.ts +46 -0
  128. package/lib/esm/types/logger/general-logger.d.ts.map +1 -0
  129. package/lib/esm/types/logger/index.d.ts +2 -0
  130. package/lib/esm/types/logger/index.d.ts.map +1 -0
  131. package/lib/package.json +146 -0
  132. package/package.json +109 -12
  133. package/application/app-container.d.ts +0 -7
  134. package/application/app-container.js +0 -20
  135. package/application/application.d.ts +0 -21
  136. package/console/console.d.ts +0 -9
  137. package/console/console.js +0 -56
  138. package/container-module/container-module.d.ts +0 -8
  139. package/container-module/container-module.js +0 -34
  140. package/controller/base-controller.d.ts +0 -8
  141. package/controller/base-controller.js +0 -37
  142. package/environment/env-validator.d.ts +0 -12
  143. package/error/application-error.d.ts +0 -6
  144. package/error/application-error.js +0 -18
  145. package/error/error-handler-middleware.d.ts +0 -4
  146. package/error/report.d.ts +0 -5
  147. package/error/report.js +0 -15
  148. package/index.js +0 -10
  149. package/logger/general-logger.d.ts +0 -16
@@ -0,0 +1,23 @@
1
+ import { ContainerModule } from "inversify";
2
+ /**
3
+ * The BaseModule class provides methods for creating InversifyJS container modules.
4
+ * @provide BaseModule
5
+ */
6
+ declare class BaseModule {
7
+ constructor();
8
+ /**
9
+ * Create a map of symbols for the provided controllers.
10
+ * @param controllers - An array of controller classes.
11
+ * @returns A map of symbols mapped to controller constructor functions.
12
+ */
13
+ private static createSymbols;
14
+ /**
15
+ * Create an InversifyJS ContainerModule for the provided controllers.
16
+ * @param controllers - An array of controller classes.
17
+ * @returns A ContainerModule with the controller bindings.
18
+ */
19
+ static createContainerModule(controllers: any[]): ContainerModule;
20
+ }
21
+ declare const CreateModule: typeof BaseModule.createContainerModule;
22
+ export { CreateModule };
23
+ //# sourceMappingURL=container-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container-module.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/container-module/container-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAQ5C;;;GAGG;AACH,cACM,UAAU;;IAIZ;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAa3B;;;;MAIE;WACW,qBAAqB,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,eAAe;CAY3E;AAED,QAAA,MAAM,YAAY,yCAAmC,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { CreateModule } from "./container-module";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/container-module/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { interfaces } from 'inversify-express-utils';
2
+ /**
3
+ * The BaseController class is an abstract base class for controllers.
4
+ * It provides methods for handling use case calls and sending appropriate responses.
5
+ * @provide BaseController
6
+ */
7
+ declare abstract class BaseController implements interfaces.Controller {
8
+ private serviceName;
9
+ /**
10
+ * Constructs a new BaseController instance with a specified service name.
11
+ * @param serviceName - The name of the service associated with the controller.
12
+ */
13
+ constructor(serviceName: string);
14
+ /**
15
+ * Calls an asynchronous use case and sends an appropriate response based on the result.
16
+ * @param useCase - A promise representing the asynchronous use case to call.
17
+ * @param res - The Express response object.
18
+ * @param successStatusCode - The HTTP status code to return upon successful execution.
19
+ */
20
+ protected callUseCaseAsync(useCase: Promise<any>, res: any, successStatusCode: number): Promise<any>;
21
+ /**
22
+ * Calls a use case and sends an appropriate response based on the result.
23
+ * @param useCase - The use case to call.
24
+ * @param res - The Express response object.
25
+ * @param successStatusCode - The HTTP status code to return upon successful execution.
26
+ */
27
+ protected callUseCase(useCase: any, res: any, successStatusCode: number): any;
28
+ }
29
+ export { BaseController };
30
+ //# sourceMappingURL=base-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-controller.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/controller/base-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD;;;;GAIG;AACH,uBACe,cAAe,YAAW,UAAU,CAAC,UAAU;IAE1D,OAAO,CAAC,WAAW,CAAS;IAE5B;;;OAGG;gBACS,WAAW,EAAE,MAAM;IAI/B;;;;;OAKG;cACa,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM;IAa3F;;;;;OAKG;IACH,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM;CAc1E;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { BaseController } from './base-controller';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/controller/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The EnvValidatorProvider class provides utility methods for working with environment variables.
3
+ * It validates, loads, and retrieves environment variables from the .env file.
4
+ * @provide EnvValidatorProvider
5
+ */
6
+ declare class EnvValidatorProvider {
7
+ /**
8
+ * Retrieves the value of an environment variable, or a default value if the variable is not set.
9
+ * @param key - The key of the environment variable.
10
+ * @param defaultValue - The default value to return if the environment variable is not set.
11
+ * @returns The value of the environment variable, or the default value if not set.
12
+ */
13
+ static get(key: string, defaultValue?: any): any;
14
+ /**
15
+ * Validates and loads all environment variables from the .env file.
16
+ * If the .env file does not exist or any environment variables are not set, the process will exit with an error.
17
+ */
18
+ static checkAll(): void;
19
+ }
20
+ declare global {
21
+ interface String {
22
+ AsBoolean(): boolean | undefined;
23
+ AsNumber(): number | undefined;
24
+ AsString(): string | undefined;
25
+ }
26
+ }
27
+ export { EnvValidatorProvider as Environments };
28
+ //# sourceMappingURL=env-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-validator.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/environment/env-validator.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,cACM,oBAAoB;IAEtB;;;;;OAKG;WACW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,GAAE,GAAe,GAAG,GAAG;IAIlE;;;OAGG;WACW,QAAQ,IAAI,IAAI;CA+BjC;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,SAAS,IAAI,OAAO,GAAG,SAAS,CAAC;QACjC,QAAQ,IAAI,MAAM,GAAG,SAAS,CAAC;QAC/B,QAAQ,IAAI,MAAM,GAAG,SAAS,CAAC;KAClC;CACJ;AAyBD,OAAO,EAAE,oBAAoB,IAAI,YAAY,EAAE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { Environments } from './env-validator';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/environment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The AppError class extends the built-in Error class, adding a status code and service property.
3
+ * It is designed for handling application-specific errors with more detailed information.
4
+ * @provide AppError
5
+ */
6
+ declare class AppError extends Error {
7
+ statusCode: number;
8
+ service: string;
9
+ /**
10
+ * Constructs a new AppError instance.
11
+ * @param statusCode - The status code associated with the error.
12
+ * @param message - The error message.
13
+ * @param service - An optional service name related to the error.
14
+ */
15
+ constructor(statusCode: number, message: string, service?: string);
16
+ }
17
+ export { AppError };
18
+ //# sourceMappingURL=application-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-error.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/error/application-error.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,cACM,QAAS,SAAQ,KAAK;IAEjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;gBACS,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAMpE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+ import { AppError } from "./application-error";
3
+ /**
4
+ * errorHandler is a custom Express error-handling middleware function.
5
+ * It logs the error, sets the status code, and sends a JSON response containing the status code and error message.
6
+ * @param error - An instance of AppError containing error details.
7
+ * @param req - The Express request object.
8
+ * @param res - The Express response object.
9
+ * @param next - The Express next function for passing control to the next middleware function.
10
+ */
11
+ declare function errorHandler(error: AppError, req: Request, res: Response, next: NextFunction): void;
12
+ export default errorHandler;
13
+ //# sourceMappingURL=error-handler-middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handler-middleware.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/error/error-handler-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAI/C;;;;;;;GAOG;AACH,iBAAS,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAI5F;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { StatusCode } from './status-code';
2
+ export { AppError } from './application-error';
3
+ export { Report } from './report';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/error/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { AppError } from "./application-error";
2
+ /**
3
+ * Report class is a utility class to manage and throw application-specific errors.
4
+ */
5
+ declare class Report {
6
+ /**
7
+ * Error method takes an instance of AppError and throws it.
8
+ * @param error - An instance of AppError containing error details.
9
+ */
10
+ static Error(error: AppError): void;
11
+ }
12
+ export { Report };
13
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/error/report.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C;;GAEG;AACH,cACM,MAAM;IAER;;;OAGG;WACW,KAAK,CAAC,KAAK,EAAE,QAAQ;CAItC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -1,136 +1,137 @@
1
- declare enum InformationResponse {
2
- Continue = 100,
3
- SwitchingProtocols = 101,
4
- Processing = 102,
5
- eEarlyHints = 103
6
- }
7
- declare enum SuccessfulResponse {
8
- OK = 200,
9
- Created = 201,
10
- Accepted = 202,
11
- NonAuthoritativeInformation = 203,
12
- NoContent = 204,
13
- ResetContent = 205,
14
- PartialContent = 206,
15
- MultiStatus = 207,
16
- AlreadyReported = 208,
17
- IMUsed = 226
18
- }
19
- declare enum RedirectionMessage {
20
- MultipleChoices = 300,
21
- MovedPermanently = 301,
22
- Found = 302,
23
- SeeOther = 303,
24
- NotModified = 304,
25
- TemporaryRedirect = 307,
26
- PermanentRedirect = 308
27
- }
28
- declare enum ClientErrorResponse {
29
- BadRequest = 400,
30
- Unauthorized = 401,
31
- PaymentRequired = 402,
32
- Forbidden = 403,
33
- NotFound = 404,
34
- MethodNotAllowed = 405,
35
- NotAcceptable = 406,
36
- ProxyAuthenticationRequired = 407,
37
- RequestTimeout = 408,
38
- Conflict = 409,
39
- Gone = 410,
40
- LengthRequired = 411,
41
- PreconditionFailed = 412,
42
- PayloadTooLarge = 413,
43
- URITooLong = 414,
44
- UnsupportedMediaType = 415,
45
- RangeNotSatisfiable = 416,
46
- ExpectationFailed = 417,
47
- ImATeapot = 418,
48
- MisdirectedRequest = 421,
49
- UnprocessableEntity = 422,
50
- Locked = 423,
51
- FailedDependency = 424,
52
- TooEarly = 425,
53
- UpgradeRequired = 426,
54
- PreconditionRequired = 428,
55
- TooManyRequests = 429,
56
- RequestHeaderFieldsTooLarge = 431,
57
- UnavailableForLegalReasons = 451
58
- }
59
- declare enum ServerErrorResponse {
60
- InternalServerError = 500,
61
- NotImplemented = 501,
62
- BadGateway = 502,
63
- ServiceUnavailable = 503,
64
- GatewayTimeout = 504,
65
- HTTPVersionNotSupported = 505,
66
- VariantAlsoNegotiates = 506,
67
- InsufficientStorage = 507,
68
- LoopDetected = 508,
69
- NotExtended = 510,
70
- NetworkAuthenticationRequired = 511
71
- }
72
- declare const StatusCode: {
73
- [x: number]: string;
74
- InternalServerError: ServerErrorResponse.InternalServerError;
75
- NotImplemented: ServerErrorResponse.NotImplemented;
76
- BadGateway: ServerErrorResponse.BadGateway;
77
- ServiceUnavailable: ServerErrorResponse.ServiceUnavailable;
78
- GatewayTimeout: ServerErrorResponse.GatewayTimeout;
79
- HTTPVersionNotSupported: ServerErrorResponse.HTTPVersionNotSupported;
80
- VariantAlsoNegotiates: ServerErrorResponse.VariantAlsoNegotiates;
81
- InsufficientStorage: ServerErrorResponse.InsufficientStorage;
82
- LoopDetected: ServerErrorResponse.LoopDetected;
83
- NotExtended: ServerErrorResponse.NotExtended;
84
- NetworkAuthenticationRequired: ServerErrorResponse.NetworkAuthenticationRequired;
85
- BadRequest: ClientErrorResponse.BadRequest;
86
- Unauthorized: ClientErrorResponse.Unauthorized;
87
- PaymentRequired: ClientErrorResponse.PaymentRequired;
88
- Forbidden: ClientErrorResponse.Forbidden;
89
- NotFound: ClientErrorResponse.NotFound;
90
- MethodNotAllowed: ClientErrorResponse.MethodNotAllowed;
91
- NotAcceptable: ClientErrorResponse.NotAcceptable;
92
- ProxyAuthenticationRequired: ClientErrorResponse.ProxyAuthenticationRequired;
93
- RequestTimeout: ClientErrorResponse.RequestTimeout;
94
- Conflict: ClientErrorResponse.Conflict;
95
- Gone: ClientErrorResponse.Gone;
96
- LengthRequired: ClientErrorResponse.LengthRequired;
97
- PreconditionFailed: ClientErrorResponse.PreconditionFailed;
98
- PayloadTooLarge: ClientErrorResponse.PayloadTooLarge;
99
- URITooLong: ClientErrorResponse.URITooLong;
100
- UnsupportedMediaType: ClientErrorResponse.UnsupportedMediaType;
101
- RangeNotSatisfiable: ClientErrorResponse.RangeNotSatisfiable;
102
- ExpectationFailed: ClientErrorResponse.ExpectationFailed;
103
- ImATeapot: ClientErrorResponse.ImATeapot;
104
- MisdirectedRequest: ClientErrorResponse.MisdirectedRequest;
105
- UnprocessableEntity: ClientErrorResponse.UnprocessableEntity;
106
- Locked: ClientErrorResponse.Locked;
107
- FailedDependency: ClientErrorResponse.FailedDependency;
108
- TooEarly: ClientErrorResponse.TooEarly;
109
- UpgradeRequired: ClientErrorResponse.UpgradeRequired;
110
- PreconditionRequired: ClientErrorResponse.PreconditionRequired;
111
- TooManyRequests: ClientErrorResponse.TooManyRequests;
112
- RequestHeaderFieldsTooLarge: ClientErrorResponse.RequestHeaderFieldsTooLarge;
113
- UnavailableForLegalReasons: ClientErrorResponse.UnavailableForLegalReasons;
114
- MultipleChoices: RedirectionMessage.MultipleChoices;
115
- MovedPermanently: RedirectionMessage.MovedPermanently;
116
- Found: RedirectionMessage.Found;
117
- SeeOther: RedirectionMessage.SeeOther;
118
- NotModified: RedirectionMessage.NotModified;
119
- TemporaryRedirect: RedirectionMessage.TemporaryRedirect;
120
- PermanentRedirect: RedirectionMessage.PermanentRedirect;
121
- OK: SuccessfulResponse.OK;
122
- Created: SuccessfulResponse.Created;
123
- Accepted: SuccessfulResponse.Accepted;
124
- NonAuthoritativeInformation: SuccessfulResponse.NonAuthoritativeInformation;
125
- NoContent: SuccessfulResponse.NoContent;
126
- ResetContent: SuccessfulResponse.ResetContent;
127
- PartialContent: SuccessfulResponse.PartialContent;
128
- MultiStatus: SuccessfulResponse.MultiStatus;
129
- AlreadyReported: SuccessfulResponse.AlreadyReported;
130
- IMUsed: SuccessfulResponse.IMUsed;
131
- Continue: InformationResponse.Continue;
132
- SwitchingProtocols: InformationResponse.SwitchingProtocols;
133
- Processing: InformationResponse.Processing;
134
- eEarlyHints: InformationResponse.eEarlyHints;
135
- };
136
- export { StatusCode };
1
+ declare enum InformationResponse {
2
+ Continue = 100,
3
+ SwitchingProtocols = 101,
4
+ Processing = 102,
5
+ eEarlyHints = 103
6
+ }
7
+ declare enum SuccessfulResponse {
8
+ OK = 200,
9
+ Created = 201,
10
+ Accepted = 202,
11
+ NonAuthoritativeInformation = 203,
12
+ NoContent = 204,
13
+ ResetContent = 205,
14
+ PartialContent = 206,
15
+ MultiStatus = 207,
16
+ AlreadyReported = 208,
17
+ IMUsed = 226
18
+ }
19
+ declare enum RedirectionMessage {
20
+ MultipleChoices = 300,
21
+ MovedPermanently = 301,
22
+ Found = 302,
23
+ SeeOther = 303,
24
+ NotModified = 304,
25
+ TemporaryRedirect = 307,
26
+ PermanentRedirect = 308
27
+ }
28
+ declare enum ClientErrorResponse {
29
+ BadRequest = 400,
30
+ Unauthorized = 401,
31
+ PaymentRequired = 402,
32
+ Forbidden = 403,
33
+ NotFound = 404,
34
+ MethodNotAllowed = 405,
35
+ NotAcceptable = 406,
36
+ ProxyAuthenticationRequired = 407,
37
+ RequestTimeout = 408,
38
+ Conflict = 409,
39
+ Gone = 410,
40
+ LengthRequired = 411,
41
+ PreconditionFailed = 412,
42
+ PayloadTooLarge = 413,
43
+ URITooLong = 414,
44
+ UnsupportedMediaType = 415,
45
+ RangeNotSatisfiable = 416,
46
+ ExpectationFailed = 417,
47
+ ImATeapot = 418,
48
+ MisdirectedRequest = 421,
49
+ UnprocessableEntity = 422,
50
+ Locked = 423,
51
+ FailedDependency = 424,
52
+ TooEarly = 425,
53
+ UpgradeRequired = 426,
54
+ PreconditionRequired = 428,
55
+ TooManyRequests = 429,
56
+ RequestHeaderFieldsTooLarge = 431,
57
+ UnavailableForLegalReasons = 451
58
+ }
59
+ declare enum ServerErrorResponse {
60
+ InternalServerError = 500,
61
+ NotImplemented = 501,
62
+ BadGateway = 502,
63
+ ServiceUnavailable = 503,
64
+ GatewayTimeout = 504,
65
+ HTTPVersionNotSupported = 505,
66
+ VariantAlsoNegotiates = 506,
67
+ InsufficientStorage = 507,
68
+ LoopDetected = 508,
69
+ NotExtended = 510,
70
+ NetworkAuthenticationRequired = 511
71
+ }
72
+ declare const StatusCode: {
73
+ [x: number]: string;
74
+ InternalServerError: ServerErrorResponse.InternalServerError;
75
+ NotImplemented: ServerErrorResponse.NotImplemented;
76
+ BadGateway: ServerErrorResponse.BadGateway;
77
+ ServiceUnavailable: ServerErrorResponse.ServiceUnavailable;
78
+ GatewayTimeout: ServerErrorResponse.GatewayTimeout;
79
+ HTTPVersionNotSupported: ServerErrorResponse.HTTPVersionNotSupported;
80
+ VariantAlsoNegotiates: ServerErrorResponse.VariantAlsoNegotiates;
81
+ InsufficientStorage: ServerErrorResponse.InsufficientStorage;
82
+ LoopDetected: ServerErrorResponse.LoopDetected;
83
+ NotExtended: ServerErrorResponse.NotExtended;
84
+ NetworkAuthenticationRequired: ServerErrorResponse.NetworkAuthenticationRequired;
85
+ BadRequest: ClientErrorResponse.BadRequest;
86
+ Unauthorized: ClientErrorResponse.Unauthorized;
87
+ PaymentRequired: ClientErrorResponse.PaymentRequired;
88
+ Forbidden: ClientErrorResponse.Forbidden;
89
+ NotFound: ClientErrorResponse.NotFound;
90
+ MethodNotAllowed: ClientErrorResponse.MethodNotAllowed;
91
+ NotAcceptable: ClientErrorResponse.NotAcceptable;
92
+ ProxyAuthenticationRequired: ClientErrorResponse.ProxyAuthenticationRequired;
93
+ RequestTimeout: ClientErrorResponse.RequestTimeout;
94
+ Conflict: ClientErrorResponse.Conflict;
95
+ Gone: ClientErrorResponse.Gone;
96
+ LengthRequired: ClientErrorResponse.LengthRequired;
97
+ PreconditionFailed: ClientErrorResponse.PreconditionFailed;
98
+ PayloadTooLarge: ClientErrorResponse.PayloadTooLarge;
99
+ URITooLong: ClientErrorResponse.URITooLong;
100
+ UnsupportedMediaType: ClientErrorResponse.UnsupportedMediaType;
101
+ RangeNotSatisfiable: ClientErrorResponse.RangeNotSatisfiable;
102
+ ExpectationFailed: ClientErrorResponse.ExpectationFailed;
103
+ ImATeapot: ClientErrorResponse.ImATeapot;
104
+ MisdirectedRequest: ClientErrorResponse.MisdirectedRequest;
105
+ UnprocessableEntity: ClientErrorResponse.UnprocessableEntity;
106
+ Locked: ClientErrorResponse.Locked;
107
+ FailedDependency: ClientErrorResponse.FailedDependency;
108
+ TooEarly: ClientErrorResponse.TooEarly;
109
+ UpgradeRequired: ClientErrorResponse.UpgradeRequired;
110
+ PreconditionRequired: ClientErrorResponse.PreconditionRequired;
111
+ TooManyRequests: ClientErrorResponse.TooManyRequests;
112
+ RequestHeaderFieldsTooLarge: ClientErrorResponse.RequestHeaderFieldsTooLarge;
113
+ UnavailableForLegalReasons: ClientErrorResponse.UnavailableForLegalReasons;
114
+ MultipleChoices: RedirectionMessage.MultipleChoices;
115
+ MovedPermanently: RedirectionMessage.MovedPermanently;
116
+ Found: RedirectionMessage.Found;
117
+ SeeOther: RedirectionMessage.SeeOther;
118
+ NotModified: RedirectionMessage.NotModified;
119
+ TemporaryRedirect: RedirectionMessage.TemporaryRedirect;
120
+ PermanentRedirect: RedirectionMessage.PermanentRedirect;
121
+ OK: SuccessfulResponse.OK;
122
+ Created: SuccessfulResponse.Created;
123
+ Accepted: SuccessfulResponse.Accepted;
124
+ NonAuthoritativeInformation: SuccessfulResponse.NonAuthoritativeInformation;
125
+ NoContent: SuccessfulResponse.NoContent;
126
+ ResetContent: SuccessfulResponse.ResetContent;
127
+ PartialContent: SuccessfulResponse.PartialContent;
128
+ MultiStatus: SuccessfulResponse.MultiStatus;
129
+ AlreadyReported: SuccessfulResponse.AlreadyReported;
130
+ IMUsed: SuccessfulResponse.IMUsed;
131
+ Continue: InformationResponse.Continue;
132
+ SwitchingProtocols: InformationResponse.SwitchingProtocols;
133
+ Processing: InformationResponse.Processing;
134
+ eEarlyHints: InformationResponse.eEarlyHints;
135
+ };
136
+ export { StatusCode };
137
+ //# sourceMappingURL=status-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-code.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/error/status-code.ts"],"names":[],"mappings":"AAGA,aAAK,mBAAmB;IACpB,QAAQ,MAAM;IACd,kBAAkB,MAAM;IACxB,UAAU,MAAM;IAChB,WAAW,MAAM;CACpB;AAED,aAAK,kBAAkB;IACnB,EAAE,MAAM;IACR,OAAO,MAAM;IACb,QAAQ,MAAM;IACd,2BAA2B,MAAM;IACjC,SAAS,MAAM;IACf,YAAY,MAAM;IAClB,cAAc,MAAM;IACpB,WAAW,MAAM;IACjB,eAAe,MAAM;IACrB,MAAM,MAAM;CACf;AAED,aAAK,kBAAkB;IACnB,eAAe,MAAM;IACrB,gBAAgB,MAAM;IACtB,KAAK,MAAM;IACX,QAAQ,MAAM;IACd,WAAW,MAAM;IACjB,iBAAiB,MAAM;IACvB,iBAAiB,MAAM;CAC1B;AAED,aAAK,mBAAmB;IACpB,UAAU,MAAM;IAChB,YAAY,MAAM;IAClB,eAAe,MAAM;IACrB,SAAS,MAAM;IACf,QAAQ,MAAM;IACd,gBAAgB,MAAM;IACtB,aAAa,MAAM;IACnB,2BAA2B,MAAM;IACjC,cAAc,MAAM;IACpB,QAAQ,MAAM;IACd,IAAI,MAAM;IACV,cAAc,MAAM;IACpB,kBAAkB,MAAM;IACxB,eAAe,MAAM;IACrB,UAAU,MAAM;IAChB,oBAAoB,MAAM;IAC1B,mBAAmB,MAAM;IACzB,iBAAiB,MAAM;IACvB,SAAS,MAAM;IACf,kBAAkB,MAAM;IACxB,mBAAmB,MAAM;IACzB,MAAM,MAAM;IACZ,gBAAgB,MAAM;IACtB,QAAQ,MAAM;IACd,eAAe,MAAM;IACrB,oBAAoB,MAAM;IAC1B,eAAe,MAAM;IACrB,2BAA2B,MAAM;IACjC,0BAA0B,MAAM;CACnC;AAED,aAAK,mBAAmB;IACpB,mBAAmB,MAAM;IACzB,cAAc,MAAM;IACpB,UAAU,MAAM;IAChB,kBAAkB,MAAM;IACxB,cAAc,MAAM;IACpB,uBAAuB,MAAM;IAC7B,qBAAqB,MAAM;IAC3B,mBAAmB,MAAM;IACzB,YAAY,MAAM;IAClB,WAAW,MAAM;IACjB,6BAA6B,MAAM;CACtC;AAGD,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAA6B,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from "./application";
2
+ export * from "./common";
3
+ export * from "./console";
4
+ export * from "./container-module";
5
+ export * from "./controller";
6
+ export * from "./environment";
7
+ export * from "./error";
8
+ export * from "./logger";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/core/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * LogLevel enumeration defines the available log levels.
3
+ */
4
+ declare enum LogLevel {
5
+ Debug = 0,
6
+ Error = 1,
7
+ Info = 2
8
+ }
9
+ /**
10
+ * GeneralLogger class is a utility class to manage logging within the application.
11
+ */
12
+ declare class GeneralLogger {
13
+ private logger;
14
+ constructor();
15
+ /**
16
+ * Creates a console transport for logging.
17
+ * @returns {transports.ConsoleTransportInstance} A Winston console transport instance.
18
+ */
19
+ private createConsoleTransport;
20
+ /**
21
+ * Creates a rotational file transport for logging.
22
+ * @returns {DailyRotateFile} A Winston daily rotate file transport instance.
23
+ */
24
+ private createRotationalFileTransport;
25
+ /**
26
+ * Creates a logger options object for Winston.
27
+ * @returns {LoggerOptions} A Winston logger options object.
28
+ */
29
+ private createLoggerOptions;
30
+ /**
31
+ * Retrieves the path and line number of the error.
32
+ * @param error - An Error object containing error details.
33
+ * @returns {string} A string containing the path and line number of the error.
34
+ */
35
+ private getPathAndLine;
36
+ /**
37
+ * Logs a message or error with the specified log level and service.
38
+ * @param logLevel - The log level to use (Debug, Error, or Info).
39
+ * @param content - The message or Error object to log.
40
+ * @param service - The service name (optional) associated with the log.
41
+ */
42
+ log(logLevel: LogLevel, content: Error | string, service?: string): void;
43
+ }
44
+ declare const log: (logLevel: LogLevel, content: Error | string, service?: string) => void;
45
+ export { LogLevel, GeneralLogger, log };
46
+ //# sourceMappingURL=general-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"general-logger.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/logger/general-logger.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,aAAK,QAAQ;IACT,KAAK,IAAA;IACL,KAAK,IAAA;IACL,IAAI,IAAA;CACP;AAED;;GAEG;AACH,cACM,aAAa;IAEf,OAAO,CAAC,MAAM,CAAS;;IAMvB;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAW9B;;;OAGG;IACH,OAAO,CAAC,6BAA6B;IAerC;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAqB3B;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAYtB;;;;;OAKG;IACI,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAwB3E;AAGD,QAAA,MAAM,GAAG,aA3BgB,QAAQ,WAAW,KAAK,GAAG,MAAM,YAAY,MAAM,SA2B9C,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { GeneralLogger, LogLevel, log } from './general-logger';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,38 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var AppContainer_1;
11
+ import { Container } from "inversify";
12
+ import { buildProviderModule, provide } from "inversify-binding-decorators";
13
+ /**
14
+ * The AppContainer class provides a container for managing dependency injection.
15
+ * @provide AppContainer
16
+ */
17
+ let AppContainer = AppContainer_1 = class AppContainer {
18
+ container;
19
+ /**
20
+ * Constructs a new instance of the AppContainer class.
21
+ */
22
+ constructor() { }
23
+ /**
24
+ * Creates and configures a new dependency injection container.
25
+ * @param modules - An array of ContainerModule instances to load into the container.
26
+ * @returns The configured dependency injection container.
27
+ */
28
+ create(modules) {
29
+ this.container = new Container();
30
+ this.container.load(buildProviderModule(), ...modules);
31
+ return this.container;
32
+ }
33
+ };
34
+ AppContainer = AppContainer_1 = __decorate([
35
+ provide(AppContainer_1),
36
+ __metadata("design:paramtypes", [])
37
+ ], AppContainer);
38
+ export { AppContainer };