@expressots/core 2.16.2 → 3.0.0-beta.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 (185) hide show
  1. package/README.md +2 -2
  2. package/lib/CHANGELOG.md +312 -322
  3. package/lib/README.md +2 -2
  4. package/lib/cjs/application/application-container.js +18 -21
  5. package/lib/cjs/application/application-factory.js +4 -5
  6. package/lib/cjs/{common/server-env.types.js → application/application.types.js} +1 -0
  7. package/lib/cjs/application/index.js +3 -1
  8. package/lib/cjs/console/console.js +8 -20
  9. package/lib/cjs/container-module/container-module.js +10 -18
  10. package/lib/cjs/decorator/scope-binding.js +12 -11
  11. package/lib/cjs/di/annotation/decorator_utils.js +121 -0
  12. package/lib/cjs/di/annotation/inject.js +44 -0
  13. package/lib/cjs/di/annotation/inject_base.js +17 -0
  14. package/lib/cjs/di/annotation/injectable.js +43 -0
  15. package/lib/cjs/di/annotation/lazy_service_identifier.js +12 -0
  16. package/lib/cjs/di/annotation/multi_inject.js +30 -0
  17. package/lib/cjs/di/annotation/named.js +34 -0
  18. package/lib/cjs/di/annotation/optional.js +32 -0
  19. package/lib/cjs/di/annotation/post_construct.js +31 -0
  20. package/lib/cjs/di/annotation/pre_destroy.js +31 -0
  21. package/lib/cjs/di/annotation/property_event_decorator.js +15 -0
  22. package/lib/cjs/di/annotation/tagged.js +9 -0
  23. package/lib/cjs/di/annotation/target_name.js +35 -0
  24. package/lib/cjs/di/annotation/unmanaged.js +35 -0
  25. package/lib/cjs/di/binding-decorator/constants.js +7 -0
  26. package/lib/cjs/di/binding-decorator/decorator/fluent_provide.js +20 -0
  27. package/lib/cjs/di/binding-decorator/decorator/provide.js +37 -0
  28. package/lib/cjs/di/binding-decorator/factory/module_factory.js +17 -0
  29. package/lib/cjs/di/binding-decorator/index.js +14 -0
  30. package/lib/cjs/di/binding-decorator/syntax/provide_done_syntax.js +42 -0
  31. package/lib/cjs/di/binding-decorator/syntax/provide_in_syntax.js +33 -0
  32. package/lib/cjs/di/binding-decorator/syntax/provide_in_when_on_syntax.js +64 -0
  33. package/lib/cjs/di/binding-decorator/syntax/provide_on_syntax.js +22 -0
  34. package/lib/cjs/di/binding-decorator/syntax/provide_when_on_syntax.js +57 -0
  35. package/lib/cjs/di/binding-decorator/syntax/provide_when_syntax.js +89 -0
  36. package/lib/cjs/di/binding-decorator/utils/auto_wire.js +18 -0
  37. package/lib/cjs/di/bindings/binding.js +40 -0
  38. package/lib/cjs/di/bindings/binding_count.js +8 -0
  39. package/lib/cjs/di/constants/error_msgs.js +60 -0
  40. package/lib/cjs/di/constants/literal_types.js +26 -0
  41. package/lib/cjs/di/constants/metadata_keys.js +38 -0
  42. package/lib/cjs/di/container/container.js +521 -0
  43. package/lib/cjs/di/container/container_module.js +18 -0
  44. package/lib/cjs/di/container/container_snapshot.js +15 -0
  45. package/lib/cjs/di/container/lookup.js +132 -0
  46. package/lib/cjs/di/container/module_activation_store.js +49 -0
  47. package/lib/cjs/di/interfaces/interfaces.js +2 -0
  48. package/lib/cjs/di/inversify.js +78 -0
  49. package/lib/cjs/di/planning/context.js +17 -0
  50. package/lib/cjs/di/planning/metadata.js +42 -0
  51. package/lib/cjs/di/planning/metadata_reader.js +45 -0
  52. package/lib/cjs/di/planning/plan.js +10 -0
  53. package/lib/cjs/di/planning/planner.js +186 -0
  54. package/lib/cjs/di/planning/queryable_string.js +27 -0
  55. package/lib/cjs/di/planning/reflection_utils.js +178 -0
  56. package/lib/cjs/di/planning/request.js +23 -0
  57. package/lib/cjs/di/planning/target.js +108 -0
  58. package/lib/cjs/di/resolution/instantiation.js +150 -0
  59. package/lib/cjs/di/resolution/resolver.js +188 -0
  60. package/lib/cjs/di/scope/scope.js +50 -0
  61. package/lib/cjs/di/syntax/binding_in_syntax.js +23 -0
  62. package/lib/cjs/di/syntax/binding_in_when_on_syntax.js +75 -0
  63. package/lib/cjs/di/syntax/binding_on_syntax.js +18 -0
  64. package/lib/cjs/di/syntax/binding_to_syntax.js +111 -0
  65. package/lib/cjs/di/syntax/binding_when_on_syntax.js +64 -0
  66. package/lib/cjs/di/syntax/binding_when_syntax.js +84 -0
  67. package/lib/cjs/di/syntax/constraint_helpers.js +68 -0
  68. package/lib/cjs/di/utils/async.js +15 -0
  69. package/lib/cjs/di/utils/binding_utils.js +77 -0
  70. package/lib/cjs/di/utils/clonable.js +9 -0
  71. package/lib/cjs/di/utils/exceptions.js +46 -0
  72. package/lib/cjs/di/utils/factory_type.js +9 -0
  73. package/lib/cjs/di/utils/id.js +7 -0
  74. package/lib/cjs/di/utils/js.js +15 -0
  75. package/lib/cjs/di/utils/serialization.js +132 -0
  76. package/lib/cjs/error/app-error.js +5 -2
  77. package/lib/cjs/error/report.js +24 -15
  78. package/lib/cjs/index.js +1 -2
  79. package/lib/cjs/middleware/middleware-interface.js +2 -0
  80. package/lib/cjs/middleware/middleware-service.js +9 -24
  81. package/lib/cjs/provider/db-in-memory/base-repo.repository.js +3 -8
  82. package/lib/cjs/provider/db-in-memory/db-in-memory.provider.js +8 -5
  83. package/lib/cjs/provider/dto-validator/dto-validator.provider.js +4 -4
  84. package/lib/cjs/provider/dto-validator/package-resolver.js +56 -0
  85. package/lib/cjs/provider/environment/env-validator.provider.js +14 -12
  86. package/lib/cjs/provider/logger/logger.provider.js +10 -5
  87. package/lib/cjs/provider/provider-manager.js +21 -17
  88. package/lib/cjs/types/application/application-container.d.ts +12 -25
  89. package/lib/cjs/types/application/application-factory.d.ts +10 -7
  90. package/lib/cjs/types/{common/server-env.types.d.ts → application/application.types.d.ts} +1 -0
  91. package/lib/cjs/types/application/index.d.ts +1 -0
  92. package/lib/cjs/types/console/console.d.ts +3 -10
  93. package/lib/cjs/types/console/index.d.ts +2 -1
  94. package/lib/cjs/types/container-module/container-module.d.ts +3 -1
  95. package/lib/cjs/types/decorator/scope-binding.d.ts +9 -9
  96. package/lib/cjs/types/di/annotation/decorator_utils.d.ts +16 -0
  97. package/lib/cjs/types/di/annotation/inject.d.ts +16 -0
  98. package/lib/cjs/types/di/annotation/inject_base.d.ts +3 -0
  99. package/lib/cjs/types/di/annotation/injectable.d.ts +7 -0
  100. package/lib/cjs/types/di/annotation/lazy_service_identifier.d.ts +7 -0
  101. package/lib/cjs/types/di/annotation/multi_inject.d.ts +2 -0
  102. package/lib/cjs/types/di/annotation/named.d.ts +2 -0
  103. package/lib/cjs/types/di/annotation/optional.d.ts +2 -0
  104. package/lib/cjs/types/di/annotation/post_construct.d.ts +4 -0
  105. package/lib/cjs/types/di/annotation/pre_destroy.d.ts +4 -0
  106. package/lib/cjs/types/di/annotation/property_event_decorator.d.ts +4 -0
  107. package/lib/cjs/types/di/annotation/tagged.d.ts +2 -0
  108. package/lib/cjs/types/di/annotation/target_name.d.ts +3 -0
  109. package/lib/cjs/types/di/annotation/unmanaged.d.ts +3 -0
  110. package/lib/cjs/types/di/binding-decorator/constants.d.ts +4 -0
  111. package/lib/cjs/types/di/binding-decorator/decorator/fluent_provide.d.ts +4 -0
  112. package/lib/cjs/types/di/binding-decorator/decorator/provide.d.ts +4 -0
  113. package/lib/cjs/types/di/binding-decorator/factory/module_factory.d.ts +4 -0
  114. package/lib/cjs/types/di/binding-decorator/index.d.ts +8 -0
  115. package/lib/cjs/types/di/binding-decorator/interfaces/interfaces.d.ts +39 -0
  116. package/lib/cjs/types/di/binding-decorator/syntax/provide_done_syntax.d.ts +7 -0
  117. package/lib/cjs/types/di/binding-decorator/syntax/provide_in_syntax.d.ts +11 -0
  118. package/lib/cjs/types/di/binding-decorator/syntax/provide_in_when_on_syntax.d.ts +27 -0
  119. package/lib/cjs/types/di/binding-decorator/syntax/provide_on_syntax.d.ts +10 -0
  120. package/lib/cjs/types/di/binding-decorator/syntax/provide_when_on_syntax.d.ts +24 -0
  121. package/lib/cjs/types/di/binding-decorator/syntax/provide_when_syntax.d.ts +23 -0
  122. package/lib/cjs/types/di/binding-decorator/utils/auto_wire.d.ts +3 -0
  123. package/lib/cjs/types/di/bindings/binding.d.ts +20 -0
  124. package/lib/cjs/types/di/bindings/binding_count.d.ts +5 -0
  125. package/lib/cjs/types/di/constants/error_msgs.d.ts +32 -0
  126. package/lib/cjs/types/di/constants/literal_types.d.ts +5 -0
  127. package/lib/cjs/types/di/constants/metadata_keys.d.ts +13 -0
  128. package/lib/cjs/types/di/container/container.d.ts +73 -0
  129. package/lib/cjs/types/di/container/container_module.d.ts +11 -0
  130. package/lib/cjs/types/di/container/container_snapshot.d.ts +10 -0
  131. package/lib/cjs/types/di/container/lookup.d.ts +16 -0
  132. package/lib/cjs/types/di/container/module_activation_store.d.ts +10 -0
  133. package/lib/cjs/types/di/interfaces/interfaces.d.ts +299 -0
  134. package/lib/cjs/types/di/inversify.d.ts +25 -0
  135. package/lib/cjs/types/di/planning/context.d.ts +11 -0
  136. package/lib/cjs/types/di/planning/metadata.d.ts +8 -0
  137. package/lib/cjs/types/di/planning/metadata_reader.d.ts +6 -0
  138. package/lib/cjs/types/di/planning/plan.d.ts +7 -0
  139. package/lib/cjs/types/di/planning/planner.d.ts +5 -0
  140. package/lib/cjs/types/di/planning/queryable_string.d.ts +11 -0
  141. package/lib/cjs/types/di/planning/reflection_utils.d.ts +5 -0
  142. package/lib/cjs/types/di/planning/request.d.ts +14 -0
  143. package/lib/cjs/types/di/planning/target.d.ts +23 -0
  144. package/lib/cjs/types/di/resolution/instantiation.d.ts +3 -0
  145. package/lib/cjs/types/di/resolution/resolver.d.ts +3 -0
  146. package/lib/cjs/types/di/scope/scope.d.ts +3 -0
  147. package/lib/cjs/types/di/syntax/binding_in_syntax.d.ts +9 -0
  148. package/lib/cjs/types/di/syntax/binding_in_when_on_syntax.d.ts +29 -0
  149. package/lib/cjs/types/di/syntax/binding_on_syntax.d.ts +8 -0
  150. package/lib/cjs/types/di/syntax/binding_to_syntax.d.ts +18 -0
  151. package/lib/cjs/types/di/syntax/binding_when_on_syntax.d.ts +25 -0
  152. package/lib/cjs/types/di/syntax/binding_when_syntax.d.ts +21 -0
  153. package/lib/cjs/types/di/syntax/constraint_helpers.d.ts +6 -0
  154. package/lib/cjs/types/di/utils/async.d.ts +3 -0
  155. package/lib/cjs/types/di/utils/binding_utils.d.ts +4 -0
  156. package/lib/cjs/types/di/utils/clonable.d.ts +3 -0
  157. package/lib/cjs/types/di/utils/exceptions.d.ts +2 -0
  158. package/lib/cjs/types/di/utils/factory_type.d.ts +5 -0
  159. package/lib/cjs/types/di/utils/id.d.ts +2 -0
  160. package/lib/cjs/types/di/utils/js.d.ts +1 -0
  161. package/lib/cjs/types/di/utils/serialization.d.ts +10 -0
  162. package/lib/cjs/types/error/report.d.ts +7 -5
  163. package/lib/cjs/types/index.d.ts +1 -2
  164. package/lib/cjs/types/middleware/index.d.ts +2 -1
  165. package/lib/cjs/types/middleware/middleware-interface.d.ts +185 -0
  166. package/lib/cjs/types/middleware/middleware-service.d.ts +11 -163
  167. package/lib/cjs/types/provider/db-in-memory/db-in-memory.provider.d.ts +4 -0
  168. package/lib/cjs/types/provider/dto-validator/dto-validator.provider.d.ts +2 -3
  169. package/lib/cjs/types/{common → provider/dto-validator}/package-resolver.d.ts +1 -2
  170. package/lib/cjs/types/provider/environment/env-validator.provider.d.ts +7 -3
  171. package/lib/cjs/types/provider/logger/logger.provider.d.ts +5 -0
  172. package/lib/cjs/types/provider/provider-manager.d.ts +22 -2
  173. package/lib/package.json +9 -15
  174. package/package.json +9 -15
  175. package/lib/cjs/common/index.js +0 -5
  176. package/lib/cjs/common/package-resolver.js +0 -34
  177. package/lib/cjs/controller/base-controller.js +0 -63
  178. package/lib/cjs/controller/index.js +0 -5
  179. package/lib/cjs/types/common/index.d.ts +0 -2
  180. package/lib/cjs/types/common/project-config.d.ts +0 -56
  181. package/lib/cjs/types/controller/base-controller.d.ts +0 -32
  182. package/lib/cjs/types/controller/index.d.ts +0 -1
  183. /package/lib/cjs/{common → console}/color-codes.js +0 -0
  184. /package/lib/cjs/{common/project-config.js → di/binding-decorator/interfaces/interfaces.js} +0 -0
  185. /package/lib/cjs/types/{common → console}/color-codes.d.ts +0 -0
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressots/core",
3
- "version": "2.16.2",
3
+ "version": "3.0.0-beta.1",
4
4
  "description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
5
5
  "author": "Richard Zampieri",
6
6
  "main": "./lib/cjs/index.js",
@@ -46,9 +46,6 @@
46
46
  "framework",
47
47
  "server-side"
48
48
  ],
49
- "engines": {
50
- "node": ">=18.18.0"
51
- },
52
49
  "scripts": {
53
50
  "prepare": "husky",
54
51
  "clean": "node scripts/rm.js lib",
@@ -60,38 +57,35 @@
60
57
  "build:cjs": "tsc -p tsconfig.cjs.json",
61
58
  "prepublish": "npm run build && npm pack",
62
59
  "release": "release-it",
63
- "coverage": "vitest run --coverage",
64
- "test": "vitest run --reporter default",
65
- "test:watch": "vitest",
60
+ "test": "jest",
61
+ "test:watch": "jest --watch",
62
+ "coverage": "jest --coverage",
66
63
  "format": "prettier --write \"packages/**/*.ts\" --cache",
67
64
  "lint": "eslint \"packages/**/*.ts\"",
68
65
  "lint:fix": "eslint \"packages/**/*.ts\" --fix"
69
66
  },
70
67
  "dependencies": {
71
- "inversify": "6.0.2",
72
- "inversify-binding-decorators": "4.0.0",
73
68
  "reflect-metadata": "0.2.2"
74
69
  },
75
70
  "devDependencies": {
76
71
  "@codecov/vite-plugin": "^0.0.1-beta.5",
77
72
  "@commitlint/cli": "19.2.1",
78
73
  "@commitlint/config-conventional": "19.1.0",
79
- "@expressots/adapter-express": "latest",
74
+ "@expressots/shared": "0.2.0",
80
75
  "@release-it/conventional-changelog": "8.0.1",
81
76
  "@types/express": "4.17.21",
77
+ "@types/jest": "^29.5.14",
82
78
  "@types/node": "20.14.10",
83
79
  "@typescript-eslint/eslint-plugin": "7.16.0",
84
80
  "@typescript-eslint/parser": "7.16.0",
85
- "@vitest/coverage-v8": "2.0.2",
86
81
  "eslint": "8.57.0",
87
82
  "eslint-config-prettier": "9.1.0",
88
83
  "husky": "9.0.11",
84
+ "jest": "^29.7.0",
89
85
  "prettier": "3.3.3",
90
86
  "release-it": "17.6.0",
91
- "typescript": "5.5.3",
92
- "vite": "5.3.3",
93
- "vite-tsconfig-paths": "4.3.2",
94
- "vitest": "2.0.2"
87
+ "ts-jest": "^29.2.5",
88
+ "typescript": "5.5.3"
95
89
  },
96
90
  "release-it": {
97
91
  "git": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressots/core",
3
- "version": "2.16.2",
3
+ "version": "3.0.0-beta.1",
4
4
  "description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
5
5
  "author": "Richard Zampieri",
6
6
  "main": "./lib/cjs/index.js",
@@ -46,9 +46,6 @@
46
46
  "framework",
47
47
  "server-side"
48
48
  ],
49
- "engines": {
50
- "node": ">=18.18.0"
51
- },
52
49
  "scripts": {
53
50
  "prepare": "husky",
54
51
  "clean": "node scripts/rm.js lib",
@@ -60,38 +57,35 @@
60
57
  "build:cjs": "tsc -p tsconfig.cjs.json",
61
58
  "prepublish": "npm run build && npm pack",
62
59
  "release": "release-it",
63
- "coverage": "vitest run --coverage",
64
- "test": "vitest run --reporter default",
65
- "test:watch": "vitest",
60
+ "test": "jest",
61
+ "test:watch": "jest --watch",
62
+ "coverage": "jest --coverage",
66
63
  "format": "prettier --write \"packages/**/*.ts\" --cache",
67
64
  "lint": "eslint \"packages/**/*.ts\"",
68
65
  "lint:fix": "eslint \"packages/**/*.ts\" --fix"
69
66
  },
70
67
  "dependencies": {
71
- "inversify": "6.0.2",
72
- "inversify-binding-decorators": "4.0.0",
73
68
  "reflect-metadata": "0.2.2"
74
69
  },
75
70
  "devDependencies": {
76
71
  "@codecov/vite-plugin": "^0.0.1-beta.5",
77
72
  "@commitlint/cli": "19.2.1",
78
73
  "@commitlint/config-conventional": "19.1.0",
79
- "@expressots/adapter-express": "latest",
74
+ "@expressots/shared": "0.2.0",
80
75
  "@release-it/conventional-changelog": "8.0.1",
81
76
  "@types/express": "4.17.21",
77
+ "@types/jest": "^29.5.14",
82
78
  "@types/node": "20.14.10",
83
79
  "@typescript-eslint/eslint-plugin": "7.16.0",
84
80
  "@typescript-eslint/parser": "7.16.0",
85
- "@vitest/coverage-v8": "2.0.2",
86
81
  "eslint": "8.57.0",
87
82
  "eslint-config-prettier": "9.1.0",
88
83
  "husky": "9.0.11",
84
+ "jest": "^29.7.0",
89
85
  "prettier": "3.3.3",
90
86
  "release-it": "17.6.0",
91
- "typescript": "5.5.3",
92
- "vite": "5.3.3",
93
- "vite-tsconfig-paths": "4.3.2",
94
- "vitest": "2.0.2"
87
+ "ts-jest": "^29.2.5",
88
+ "typescript": "5.5.3"
95
89
  },
96
90
  "release-it": {
97
91
  "git": {
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ServerEnvironment = void 0;
4
- var server_env_types_1 = require("./server-env.types");
5
- Object.defineProperty(exports, "ServerEnvironment", { enumerable: true, get: function () { return server_env_types_1.ServerEnvironment; } });
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.packageResolver = packageResolver;
4
- /* eslint-disable @typescript-eslint/no-explicit-any */
5
- const logger_provider_1 = require("../provider/logger/logger.provider");
6
- /**
7
- * Resolve package from the current working directory.
8
- * @param packageName
9
- * @param options
10
- * @returns
11
- */
12
- function packageResolver(packageName, ...options) {
13
- const logger = new logger_provider_1.Logger();
14
- try {
15
- const hasPackage = require.resolve(packageName, {
16
- paths: [process.cwd()],
17
- });
18
- if (hasPackage) {
19
- // eslint-disable-next-line @typescript-eslint/no-var-requires
20
- const packageResolved = require(hasPackage);
21
- if (typeof packageResolved === "function") {
22
- return packageResolved(...options);
23
- }
24
- if (packageResolved.default &&
25
- typeof packageResolved.default === "function") {
26
- return packageResolved.default(...options);
27
- }
28
- return packageResolved;
29
- }
30
- }
31
- catch (error) {
32
- logger.warn(`Package [${packageName}] not installed. Please install it using your package manager.`, "package-resolver");
33
- }
34
- }
@@ -1,63 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.BaseController = void 0;
10
- const inversify_binding_decorators_1 = require("inversify-binding-decorators");
11
- /**
12
- * The BaseController class is an abstract base class for controllers.
13
- * It provides methods for handling use case calls and sending appropriate responses.
14
- * @provide BaseController
15
- */
16
- let BaseController = class BaseController {
17
- /**
18
- * Calls an asynchronous use case and sends an appropriate response based on the result.
19
- * @param useCase - A promise representing the asynchronous use case to call.
20
- * @param res - The Express response object.
21
- * @param successStatusCode - The HTTP status code to return upon successful execution.
22
- */
23
- async callUseCaseAsync(useCase, res, successStatusCode = 200) {
24
- try {
25
- const result = await useCase;
26
- res.status(successStatusCode).json(result);
27
- }
28
- catch (error) {
29
- this.handleError(res, error);
30
- }
31
- }
32
- /**
33
- * Calls a use case and sends an appropriate response based on the result.
34
- * @param useCase - The use case to call.
35
- * @param res - The Express response object.
36
- * @param successStatusCode - The HTTP status code to return upon successful execution.
37
- */
38
- callUseCase(useCase, res, successStatusCode = 200) {
39
- try {
40
- res.status(successStatusCode).json(useCase);
41
- }
42
- catch (error) {
43
- this.handleError(res, error);
44
- }
45
- }
46
- /**
47
- * Handles errors by sending a 500 status with an error message.
48
- * This method can be extended to provide more detailed error handling.
49
- *
50
- * @param res - The Express response object.
51
- * @param error - The error that occurred during the execution of the use case.
52
- */
53
- handleError(res, error) {
54
- res.status(500).json({
55
- message: "An unexpected error occurred.",
56
- error: error instanceof Error ? error.message : error,
57
- });
58
- }
59
- };
60
- exports.BaseController = BaseController;
61
- exports.BaseController = BaseController = __decorate([
62
- (0, inversify_binding_decorators_1.provide)(BaseController)
63
- ], BaseController);
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseController = void 0;
4
- var base_controller_1 = require("./base-controller");
5
- Object.defineProperty(exports, "BaseController", { enumerable: true, get: function () { return base_controller_1.BaseController; } });
@@ -1,2 +0,0 @@
1
- export { Pattern, ExpressoConfig } from "./project-config";
2
- export { ServerEnvironment } from "./server-env.types";
@@ -1,56 +0,0 @@
1
- /**
2
- * Enum representing different string patterns.
3
- *
4
- * - LOWER_CASE: Represents strings in all lowercase letters. E.g. "hello"
5
- * - KEBAB_CASE: Represents strings separated by hyphens. E.g. "hello-world"
6
- * - PASCAL_CASE: Represents strings where the first letter of each word is capitalized. E.g. "HelloWorld"
7
- * - CAMEL_CASE: Represents strings where the first letter of the first word is lowercase and the first letter of subsequent words are capitalized. E.g. "helloWorld"
8
- */
9
- declare const enum Pattern {
10
- LOWER_CASE = "lowercase",
11
- KEBAB_CASE = "kebab-case",
12
- PASCAL_CASE = "PascalCase",
13
- CAMEL_CASE = "camelCase"
14
- }
15
- /**
16
- * Interface describing configuration specific to Prisma provider.
17
- *
18
- * @property {string} schemaName - The name of the Prisma schema.
19
- * @property {string} schemaPath - The path to the Prisma schema file.
20
- * @property {string} entitiesPath - The path to the directory containing entities.
21
- * @property {string} entityNamePattern - The naming convention to use for entity names.
22
- */
23
- interface IProviders {
24
- prisma?: {
25
- schemaName: string;
26
- schemaPath: string;
27
- entitiesPath: string;
28
- entityNamePattern: string;
29
- };
30
- }
31
- /**
32
- * The configuration object for the Expresso CLI.
33
- *
34
- * @property {Pattern} scaffoldPattern - The pattern to use when scaffolding files.
35
- * @property {string} sourceRoot - The root directory for the source files.
36
- * @property {boolean} opinionated - Whether or not to use the opinionated configuration.
37
- * @property {IProviders} providers - Specific configuration for each provider added.
38
- *
39
- * @see [Doc](https://doc.expresso-ts.com/)
40
- */
41
- interface ExpressoConfig {
42
- scaffoldPattern: Pattern;
43
- sourceRoot: string;
44
- opinionated: boolean;
45
- providers?: IProviders;
46
- scaffoldSchematics?: {
47
- entity?: string;
48
- controller?: string;
49
- usecase?: string;
50
- dto?: string;
51
- module?: string;
52
- provider?: string;
53
- middleware?: string;
54
- };
55
- }
56
- export { ExpressoConfig, Pattern };
@@ -1,32 +0,0 @@
1
- import { Response } from "express";
2
- import { Controller } from "@expressots/adapter-express";
3
- /**
4
- * The BaseController class is an abstract base class for controllers.
5
- * It provides methods for handling use case calls and sending appropriate responses.
6
- * @provide BaseController
7
- */
8
- declare abstract class BaseController implements Controller {
9
- /**
10
- * Calls an asynchronous use case and sends an appropriate response based on the result.
11
- * @param useCase - A promise representing the asynchronous use case to call.
12
- * @param res - The Express response object.
13
- * @param successStatusCode - The HTTP status code to return upon successful execution.
14
- */
15
- protected callUseCaseAsync<T>(useCase: Promise<T>, res: Response, successStatusCode?: number): Promise<void>;
16
- /**
17
- * Calls a use case and sends an appropriate response based on the result.
18
- * @param useCase - The use case to call.
19
- * @param res - The Express response object.
20
- * @param successStatusCode - The HTTP status code to return upon successful execution.
21
- */
22
- protected callUseCase<T>(useCase: T, res: Response, successStatusCode?: number): void;
23
- /**
24
- * Handles errors by sending a 500 status with an error message.
25
- * This method can be extended to provide more detailed error handling.
26
- *
27
- * @param res - The Express response object.
28
- * @param error - The error that occurred during the execution of the use case.
29
- */
30
- private handleError;
31
- }
32
- export { BaseController };
@@ -1 +0,0 @@
1
- export { BaseController } from "./base-controller";
File without changes