@expressots/core 1.1.0 → 1.2.1

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 (116) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +2 -1
  3. package/lib/CHANGELOG.md +19 -0
  4. package/lib/README.md +2 -1
  5. package/lib/cjs/application/app-container.js +40 -28
  6. package/lib/cjs/application/application.js +108 -73
  7. package/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 -77
  11. package/lib/cjs/console/index.js +5 -5
  12. package/lib/cjs/container-module/container-module.js +56 -42
  13. package/lib/cjs/container-module/index.js +5 -5
  14. package/lib/cjs/controller/base-controller.js +77 -56
  15. package/lib/cjs/controller/index.js +5 -5
  16. package/lib/cjs/environment/env-validator.js +87 -72
  17. package/lib/cjs/environment/index.js +5 -5
  18. package/lib/cjs/error/application-error.js +37 -26
  19. package/lib/cjs/error/error-handler-middleware.js +17 -9
  20. package/lib/cjs/error/index.js +9 -9
  21. package/lib/cjs/error/report.js +27 -20
  22. package/lib/cjs/error/status-code.js +83 -83
  23. package/lib/cjs/index.js +24 -23
  24. package/lib/cjs/logger/general-logger.js +132 -103
  25. package/lib/cjs/logger/index.js +7 -7
  26. package/lib/cjs/types/application/app-container.d.ts +19 -7
  27. package/lib/cjs/types/application/app-container.d.ts.map +1 -1
  28. package/lib/cjs/types/application/application.d.ts +52 -21
  29. package/lib/cjs/types/application/application.d.ts.map +1 -1
  30. package/lib/cjs/types/application/index.d.ts +2 -2
  31. package/lib/cjs/types/common/index.d.ts +2 -0
  32. package/lib/cjs/types/common/index.d.ts.map +1 -0
  33. package/lib/cjs/types/common/project-config.provider.d.ts +22 -0
  34. package/lib/cjs/types/common/project-config.provider.d.ts.map +1 -0
  35. package/lib/cjs/types/console/console.d.ts +27 -9
  36. package/lib/cjs/types/console/console.d.ts.map +1 -1
  37. package/lib/cjs/types/console/index.d.ts +1 -1
  38. package/lib/cjs/types/container-module/container-module.d.ts +22 -8
  39. package/lib/cjs/types/container-module/container-module.d.ts.map +1 -1
  40. package/lib/cjs/types/container-module/index.d.ts +1 -1
  41. package/lib/cjs/types/controller/base-controller.d.ts +29 -8
  42. package/lib/cjs/types/controller/base-controller.d.ts.map +1 -1
  43. package/lib/cjs/types/controller/index.d.ts +1 -1
  44. package/lib/cjs/types/environment/env-validator.d.ts +27 -12
  45. package/lib/cjs/types/environment/env-validator.d.ts.map +1 -1
  46. package/lib/cjs/types/environment/index.d.ts +1 -1
  47. package/lib/cjs/types/error/application-error.d.ts +17 -6
  48. package/lib/cjs/types/error/application-error.d.ts.map +1 -1
  49. package/lib/cjs/types/error/error-handler-middleware.d.ts +12 -4
  50. package/lib/cjs/types/error/error-handler-middleware.d.ts.map +1 -1
  51. package/lib/cjs/types/error/index.d.ts +3 -3
  52. package/lib/cjs/types/error/report.d.ts +12 -5
  53. package/lib/cjs/types/error/report.d.ts.map +1 -1
  54. package/lib/cjs/types/error/status-code.d.ts +136 -136
  55. package/lib/cjs/types/index.d.ts +8 -7
  56. package/lib/cjs/types/index.d.ts.map +1 -1
  57. package/lib/cjs/types/logger/general-logger.d.ts +45 -16
  58. package/lib/cjs/types/logger/general-logger.d.ts.map +1 -1
  59. package/lib/cjs/types/logger/index.d.ts +1 -1
  60. package/lib/esm/application/app-container.js +38 -26
  61. package/lib/esm/application/application.js +103 -68
  62. package/lib/esm/application/index.js +2 -2
  63. package/lib/esm/common/index.js +1 -0
  64. package/lib/esm/common/project-config.provider.js +1 -0
  65. package/lib/esm/console/console.js +76 -58
  66. package/lib/esm/console/index.js +1 -1
  67. package/lib/esm/container-module/container-module.js +53 -39
  68. package/lib/esm/container-module/index.js +1 -1
  69. package/lib/esm/controller/base-controller.js +64 -43
  70. package/lib/esm/controller/index.js +1 -1
  71. package/lib/esm/environment/env-validator.js +80 -65
  72. package/lib/esm/environment/index.js +1 -1
  73. package/lib/esm/error/application-error.js +36 -25
  74. package/lib/esm/error/error-handler-middleware.js +15 -7
  75. package/lib/esm/error/index.js +3 -3
  76. package/lib/esm/error/report.js +24 -17
  77. package/lib/esm/error/status-code.js +80 -80
  78. package/lib/esm/index.mjs +8 -7
  79. package/lib/esm/logger/general-logger.js +125 -96
  80. package/lib/esm/logger/index.js +1 -1
  81. package/lib/esm/types/application/app-container.d.ts +19 -7
  82. package/lib/esm/types/application/app-container.d.ts.map +1 -1
  83. package/lib/esm/types/application/application.d.ts +52 -21
  84. package/lib/esm/types/application/application.d.ts.map +1 -1
  85. package/lib/esm/types/application/index.d.ts +2 -2
  86. package/lib/esm/types/common/index.d.ts +2 -0
  87. package/lib/esm/types/common/index.d.ts.map +1 -0
  88. package/lib/esm/types/common/project-config.provider.d.ts +22 -0
  89. package/lib/esm/types/common/project-config.provider.d.ts.map +1 -0
  90. package/lib/esm/types/console/console.d.ts +27 -9
  91. package/lib/esm/types/console/console.d.ts.map +1 -1
  92. package/lib/esm/types/console/index.d.ts +1 -1
  93. package/lib/esm/types/container-module/container-module.d.ts +22 -8
  94. package/lib/esm/types/container-module/container-module.d.ts.map +1 -1
  95. package/lib/esm/types/container-module/index.d.ts +1 -1
  96. package/lib/esm/types/controller/base-controller.d.ts +29 -8
  97. package/lib/esm/types/controller/base-controller.d.ts.map +1 -1
  98. package/lib/esm/types/controller/index.d.ts +1 -1
  99. package/lib/esm/types/environment/env-validator.d.ts +27 -12
  100. package/lib/esm/types/environment/env-validator.d.ts.map +1 -1
  101. package/lib/esm/types/environment/index.d.ts +1 -1
  102. package/lib/esm/types/error/application-error.d.ts +17 -6
  103. package/lib/esm/types/error/application-error.d.ts.map +1 -1
  104. package/lib/esm/types/error/error-handler-middleware.d.ts +12 -4
  105. package/lib/esm/types/error/error-handler-middleware.d.ts.map +1 -1
  106. package/lib/esm/types/error/index.d.ts +3 -3
  107. package/lib/esm/types/error/report.d.ts +12 -5
  108. package/lib/esm/types/error/report.d.ts.map +1 -1
  109. package/lib/esm/types/error/status-code.d.ts +136 -136
  110. package/lib/esm/types/index.d.ts +8 -7
  111. package/lib/esm/types/index.d.ts.map +1 -1
  112. package/lib/esm/types/logger/general-logger.d.ts +45 -16
  113. package/lib/esm/types/logger/general-logger.d.ts.map +1 -1
  114. package/lib/esm/types/logger/index.d.ts +1 -1
  115. package/lib/package.json +2 -2
  116. package/package.json +2 -2
@@ -0,0 +1,22 @@
1
+ declare const enum Pattern {
2
+ LOWER_CASE = "lowercase",
3
+ KEBAB_CASE = "kebab-case",
4
+ PASCAL_CASE = "PascalCase",
5
+ CAMEL_CASE = "camelCase"
6
+ }
7
+ /**
8
+ * The configuration object for the Expresso CLI.
9
+ *
10
+ * @property {Pattern} scaffoldPattern - The pattern to use when scaffolding files.
11
+ * @property {string} sourceRoot - The root directory for the source files.
12
+ * @property {boolean} opinionated - Whether or not to use the opinionated configuration.
13
+ *
14
+ * @see [ExpressoConfig](https://expresso-ts.com/docs)
15
+ */
16
+ interface ExpressoConfig {
17
+ scaffoldPattern: Pattern;
18
+ sourceRoot: string;
19
+ opinionated: boolean;
20
+ }
21
+ export { ExpressoConfig, Pattern };
22
+ //# sourceMappingURL=project-config.provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-config.provider.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/common/project-config.provider.ts"],"names":[],"mappings":"AAAA,mBAAW,OAAO;IACjB,UAAU,cAAc;IACxB,UAAU,eAAe;IACzB,WAAW,eAAe;IAC1B,UAAU,cAAc;CACxB;AAED;;;;;;;;GAQG;AACH,UAAU,cAAc;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACrB;AAED,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC"}
@@ -1,10 +1,28 @@
1
- interface IApplicationMessageToConsole {
2
- appName: string;
3
- appVersion: string;
4
- }
5
- declare class Console {
6
- private printColor;
7
- messageServer(port: any, environment: string, consoleMessage?: IApplicationMessageToConsole): Promise<void>;
8
- }
9
- export { Console, IApplicationMessageToConsole };
1
+ /**
2
+ * Interface representing application message details for console output.
3
+ */
4
+ interface IApplicationMessageToConsole {
5
+ appName: string;
6
+ appVersion: string;
7
+ }
8
+ /**
9
+ * The Console class provides methods for displaying styled messages in the console.
10
+ * @provide Console
11
+ */
12
+ declare class Console {
13
+ /**
14
+ * Print a message to the console with the specified color style.
15
+ * @param message - The message to be printed.
16
+ * @param colorStyle - The color style for the message.
17
+ */
18
+ private printColor;
19
+ /**
20
+ * Display a message in the console with details about the running server.
21
+ * @param port - The port number the server is running on.
22
+ * @param environment - The server environment.
23
+ * @param consoleMessage - Optional application message details for console output.
24
+ */
25
+ messageServer(port: any, environment: string, consoleMessage?: IApplicationMessageToConsole): Promise<void>;
26
+ }
27
+ export { Console, IApplicationMessageToConsole };
10
28
  //# sourceMappingURL=console.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/console/console.ts"],"names":[],"mappings":"AAWA,UAAU,4BAA4B;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,cACM,OAAO;YAEK,UAAU;IAcX,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC;CA+B3H;AAED,OAAO,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
1
+ {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/console/console.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,UAAU,4BAA4B;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,cACM,OAAO;IAET;;;;OAIG;YACW,UAAU;IAcxB;;;;;OAKG;IACU,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC;CA+B3H;AAED,OAAO,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
@@ -1,2 +1,2 @@
1
- export { Console, IApplicationMessageToConsole } from "./console";
1
+ export { Console, IApplicationMessageToConsole } from "./console";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,9 +1,23 @@
1
- import { ContainerModule } from "inversify";
2
- declare class BaseModule {
3
- constructor();
4
- private static createSymbols;
5
- static createContainerModule(controllers: any[]): ContainerModule;
6
- }
7
- declare const CreateModule: typeof BaseModule.createContainerModule;
8
- export { CreateModule };
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 };
9
23
  //# sourceMappingURL=container-module.d.ts.map
@@ -1 +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;AAK5C,cACM,UAAU;;IAIZ,OAAO,CAAC,MAAM,CAAC,aAAa;WAad,qBAAqB,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,eAAe;CAY3E;AAED,QAAA,MAAM,YAAY,yCAAmC,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,CAAC"}
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"}
@@ -1,2 +1,2 @@
1
- export { CreateModule } from "./container-module";
1
+ export { CreateModule } from "./container-module";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,9 +1,30 @@
1
- import { interfaces } from 'inversify-express-utils';
2
- declare abstract class BaseController implements interfaces.Controller {
3
- private serviceName;
4
- constructor(serviceName: string);
5
- protected callUseCaseAsync(useCase: Promise<any>, res: any, successStatusCode: number): Promise<any>;
6
- protected callUseCase(useCase: any, res: any, successStatusCode: number): any;
7
- }
8
- export { BaseController };
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 };
9
30
  //# sourceMappingURL=base-controller.d.ts.map
@@ -1 +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,uBACe,cAAe,YAAW,UAAU,CAAC,UAAU;IAE1D,OAAO,CAAC,WAAW,CAAS;gBAEhB,WAAW,EAAE,MAAM;cAIf,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM;IAa3F,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM;CAc1E;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
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"}
@@ -1,2 +1,2 @@
1
- export { BaseController } from './base-controller';
1
+ export { BaseController } from './base-controller';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,13 +1,28 @@
1
- declare class EnvValidatorProvider {
2
- static get(key: string, defaultValue?: any): any;
3
- static checkAll(): void;
4
- }
5
- declare global {
6
- interface String {
7
- AsBoolean(): boolean | undefined;
8
- AsNumber(): number | undefined;
9
- AsString(): string | undefined;
10
- }
11
- }
12
- export { EnvValidatorProvider as Environments };
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 };
13
28
  //# sourceMappingURL=env-validator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"env-validator.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/environment/env-validator.ts"],"names":[],"mappings":"AAOA,cACM,oBAAoB;WAER,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,GAAE,GAAe,GAAG,GAAG;WAIpD,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"}
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"}
@@ -1,2 +1,2 @@
1
- export { Environments } from './env-validator';
1
+ export { Environments } from './env-validator';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,18 @@
1
- declare class AppError extends Error {
2
- statusCode: number;
3
- service: string;
4
- constructor(statusCode: number, message: string, service?: string);
5
- }
6
- export { AppError };
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 };
7
18
  //# sourceMappingURL=application-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"application-error.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/error/application-error.ts"],"names":[],"mappings":"AAEA,cACM,QAAS,SAAQ,KAAK;IAEjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;gBAEX,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAMpE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
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"}
@@ -1,5 +1,13 @@
1
- import { NextFunction, Request, Response } from "express";
2
- import { AppError } from "./application-error";
3
- declare function errorHandler(error: AppError, req: Request, res: Response, next: NextFunction): void;
4
- export default errorHandler;
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;
5
13
  //# sourceMappingURL=error-handler-middleware.d.ts.map
@@ -1 +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,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"}
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"}
@@ -1,4 +1,4 @@
1
- export { StatusCode } from './status-code';
2
- export { AppError } from './application-error';
3
- export { Report } from './report';
1
+ export { StatusCode } from './status-code';
2
+ export { AppError } from './application-error';
3
+ export { Report } from './report';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,13 @@
1
- import { AppError } from "./application-error";
2
- declare class Report {
3
- static Error(error: AppError): void;
4
- }
5
- export { Report };
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 };
6
13
  //# sourceMappingURL=report.d.ts.map
@@ -1 +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,cACM,MAAM;WAEM,KAAK,CAAC,KAAK,EAAE,QAAQ;CAItC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
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,137 +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
137
  //# sourceMappingURL=status-code.d.ts.map
@@ -1,8 +1,9 @@
1
- export * from "./application";
2
- export * from "./console";
3
- export * from "./container-module";
4
- export * from "./controller";
5
- export * from "./environment";
6
- export * from "./error";
7
- export * from "./logger";
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";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/core/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
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"}