@expressots/core 1.8.0 → 1.8.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 (31) hide show
  1. package/lib/CHANGELOG.md +122 -138
  2. package/lib/cjs/application/application.js +3 -2
  3. package/lib/cjs/error/app-error.js +26 -0
  4. package/lib/cjs/error/error-handler-middleware.js +16 -5
  5. package/lib/cjs/error/index.js +3 -1
  6. package/lib/cjs/error/report.js +4 -20
  7. package/lib/cjs/types/application/application.d.ts.map +1 -1
  8. package/lib/cjs/types/error/app-error.d.ts +30 -0
  9. package/lib/cjs/types/error/app-error.d.ts.map +1 -0
  10. package/lib/cjs/types/error/error-handler-middleware.d.ts +3 -4
  11. package/lib/cjs/types/error/error-handler-middleware.d.ts.map +1 -1
  12. package/lib/cjs/types/error/index.d.ts +1 -0
  13. package/lib/cjs/types/error/index.d.ts.map +1 -1
  14. package/lib/cjs/types/error/report.d.ts +3 -9
  15. package/lib/cjs/types/error/report.d.ts.map +1 -1
  16. package/lib/esm/application/application.js +3 -2
  17. package/lib/esm/error/app-error.js +37 -0
  18. package/lib/esm/error/error-handler-middleware.js +16 -5
  19. package/lib/esm/error/index.js +3 -1
  20. package/lib/esm/error/report.js +4 -19
  21. package/lib/esm/types/application/application.d.ts.map +1 -1
  22. package/lib/esm/types/error/app-error.d.ts +30 -0
  23. package/lib/esm/types/error/app-error.d.ts.map +1 -0
  24. package/lib/esm/types/error/error-handler-middleware.d.ts +3 -4
  25. package/lib/esm/types/error/error-handler-middleware.d.ts.map +1 -1
  26. package/lib/esm/types/error/index.d.ts +1 -0
  27. package/lib/esm/types/error/index.d.ts.map +1 -1
  28. package/lib/esm/types/error/report.d.ts +3 -9
  29. package/lib/esm/types/error/report.d.ts.map +1 -1
  30. package/lib/package.json +7 -5
  31. package/package.json +7 -5
package/lib/CHANGELOG.md CHANGED
@@ -1,169 +1,162 @@
1
1
 
2
2
 
3
- ## [1.8.0](https://github.com/expressots/expressots/compare/1.7.0...1.8.0) (2023-09-05)
4
-
5
-
6
- ### Features
7
-
8
- * add benchmark folder ([#83](https://github.com/expressots/expressots/issues/83)) ([30cb1f9](https://github.com/expressots/expressots/commit/30cb1f922f980de23b0e8e896b552a0708075201))
9
- * bump prettier from 3.0.1 to 3.0.2 ([#74](https://github.com/expressots/expressots/issues/74)) ([a66f80d](https://github.com/expressots/expressots/commit/a66f80d36967cc6112a30f422ec34a8dcb3efd66))
10
- * bump prettier from 3.0.2 to 3.0.3 ([#80](https://github.com/expressots/expressots/issues/80)) ([59af991](https://github.com/expressots/expressots/commit/59af99177edc371c5608761c6b3f438806aba898))
3
+ ## [1.8.1](https://github.com/expressots/expressots/compare/1.8.0...1.8.1) (2023-09-10)
11
4
 
12
5
 
13
6
  ### Bug Fixes
14
7
 
15
- * increase the event range for graceful shutdown ([#76](https://github.com/expressots/expressots/issues/76)) ([8e88c7e](https://github.com/expressots/expressots/commit/8e88c7e2f1f0b2091c013885a823bbda533de62b))
16
- * remove verb should from unit tests labels ([#78](https://github.com/expressots/expressots/issues/78)) ([f37d028](https://github.com/expressots/expressots/commit/f37d02878cbf2587028d7c61ecc35c4981721eab))
17
- * update readme ([c1f0bcd](https://github.com/expressots/expressots/commit/c1f0bcd341284b4259454b579ccaf35091b1e2e1))
18
-
19
- ## [1.7.0](https://github.com/expressots/expressots/compare/1.6.0...1.7.0) (2023-08-14)
20
-
21
-
22
- ### Features
8
+ * add generic in memory db and virtual table analysis ([#86](https://github.com/expressots/expressots/issues/86)) ([29541f9](https://github.com/expressots/expressots/commit/29541f997e47c8ac5f8cafbb0195c34c904454f4))
23
9
 
24
- * bump @release-it/conventional-changelog from 5.1.1 to 6.0.0 ([#61](https://github.com/expressots/expressots/issues/61)) ([634304b](https://github.com/expressots/expressots/commit/634304b8228a0c6f4a4e8298961f46e4bd5c9b7c))
25
- * bump @types/node from 18.17.4 to 20.4.9 ([#72](https://github.com/expressots/expressots/issues/72)) ([31a887d](https://github.com/expressots/expressots/commit/31a887d3a33923dba4c8d952ec60046e21f08361))
26
10
 
11
+ ### Continuous Integrations
27
12
 
28
- ### Bug Fixes
29
-
30
- * add `options` parameter to `AppContainer` ([#73](https://github.com/expressots/expressots/issues/73)) ([804d5cd](https://github.com/expressots/expressots/commit/804d5cd568830584322d877b91dffaed8c952e56))
13
+ * config test workflow and setup vitest ([#88](https://github.com/expressots/expressots/issues/88)) ([67316ce](https://github.com/expressots/expressots/commit/67316cece977f04f9750a5a5af6cd88dfc695e0d))
31
14
 
32
- ## [1.6.0](https://github.com/expressots/expressots/compare/1.5.1...1.6.0) (2023-08-07)
33
-
34
-
35
- ### Features
36
-
37
- * add community ideas form ([#43](https://github.com/expressots/expressots/issues/43)) ([e23c936](https://github.com/expressots/expressots/commit/e23c9360cec22f21a8f44e04b290cf6aa23aef17))
38
- * add dependabot for fetch new version of dependencies ([#60](https://github.com/expressots/expressots/issues/60)) ([9ea1033](https://github.com/expressots/expressots/commit/9ea1033809eb19f50ae779824e5e428710c4480d))
39
- * add prisma provider configuration types in ExpressoConfig ([#71](https://github.com/expressots/expressots/issues/71)) ([4a189a2](https://github.com/expressots/expressots/commit/4a189a2d85aed320d97fff4aebc48dcb0e125adf))
40
- * bump prettier from 3.0.0 to 3.0.1 ([#68](https://github.com/expressots/expressots/issues/68)) ([b555e19](https://github.com/expressots/expressots/commit/b555e19698fd102c681b50a96e99ad37b399bae7))
41
- * **prettier:** add a prettier config and run it in the core package ([#58](https://github.com/expressots/expressots/issues/58)) ([2ac367b](https://github.com/expressots/expressots/commit/2ac367b3c5911216a1ffb9b542ae4bb418227eba))
42
-
43
-
44
- ### Bug Fixes
45
-
46
- * add workflow for auto project and label ([#44](https://github.com/expressots/expressots/issues/44)) ([1306d18](https://github.com/expressots/expressots/commit/1306d181bc904384a3edea0be219bba891b865cf))
15
+ ## [1.8.0](https://github.com/expressots/expressots/compare/1.7.0...1.8.0) (2023-09-05)
47
16
 
48
- ## [1.5.1](https://github.com/expressots/expressots/compare/1.5.0...1.5.1) (2023-07-16)
49
-
50
-
51
- ### Bug Fixes
52
-
53
- * add 404 on opinionated template user usecases ([#41](https://github.com/expressots/expressots/issues/41)) ([e2920cc](https://github.com/expressots/expressots/commit/e2920cce79eaad3fc5f031f45375312cba790103))
17
+ ### Features
54
18
 
55
- ## [1.5.0](https://github.com/expressots/expressots/compare/1.5.0-dev...1.5.0) (2023-07-12)
19
+ - add benchmark folder ([#83](https://github.com/expressots/expressots/issues/83)) ([30cb1f9](https://github.com/expressots/expressots/commit/30cb1f922f980de23b0e8e896b552a0708075201))
20
+ - bump prettier from 3.0.1 to 3.0.2 ([#74](https://github.com/expressots/expressots/issues/74)) ([a66f80d](https://github.com/expressots/expressots/commit/a66f80d36967cc6112a30f422ec34a8dcb3efd66))
21
+ - bump prettier from 3.0.2 to 3.0.3 ([#80](https://github.com/expressots/expressots/issues/80)) ([59af991](https://github.com/expressots/expressots/commit/59af99177edc371c5608761c6b3f438806aba898))
22
+
23
+ ### Bug Fixes
24
+
25
+ - increase the event range for graceful shutdown ([#76](https://github.com/expressots/expressots/issues/76)) ([8e88c7e](https://github.com/expressots/expressots/commit/8e88c7e2f1f0b2091c013885a823bbda533de62b))
26
+ - remove verb should from unit tests labels ([#78](https://github.com/expressots/expressots/issues/78)) ([f37d028](https://github.com/expressots/expressots/commit/f37d02878cbf2587028d7c61ecc35c4981721eab))
27
+ - update readme ([c1f0bcd](https://github.com/expressots/expressots/commit/c1f0bcd341284b4259454b579ccaf35091b1e2e1))
56
28
 
29
+ ## [1.7.0](https://github.com/expressots/expressots/compare/1.6.0...1.7.0) (2023-08-14)
57
30
 
58
31
  ### Features
59
32
 
60
- * add render engine for handlebars ([1257fe0](https://github.com/expressots/expressots/commit/1257fe08ec0bf9096af1927caddf6fa2a8d481e8))
33
+ - bump @release-it/conventional-changelog from 5.1.1 to 6.0.0 ([#61](https://github.com/expressots/expressots/issues/61)) ([634304b](https://github.com/expressots/expressots/commit/634304b8228a0c6f4a4e8298961f46e4bd5c9b7c))
34
+ - bump @types/node from 18.17.4 to 20.4.9 ([#72](https://github.com/expressots/expressots/issues/72)) ([31a887d](https://github.com/expressots/expressots/commit/31a887d3a33923dba4c8d952ec60046e21f08361))
61
35
 
62
- ## [1.5.0](https://github.com/expressots/expressots/compare/v1.4.2...v1.5.0) (2023-07-11)
36
+ ### Bug Fixes
63
37
 
38
+ - add `options` parameter to `AppContainer` ([#73](https://github.com/expressots/expressots/issues/73)) ([804d5cd](https://github.com/expressots/expressots/commit/804d5cd568830584322d877b91dffaed8c952e56))
39
+
40
+ ## [1.6.0](https://github.com/expressots/expressots/compare/1.5.1...1.6.0) (2023-08-07)
64
41
 
65
42
  ### Features
66
43
 
67
- * add render engine mechanic and handlebars sup ([#37](https://github.com/expressots/expressots/issues/37)) ([c9f1c61](https://github.com/expressots/expressots/commit/c9f1c616c3480575c013e1e3e6b397e9b6870fb2))
44
+ - add community ideas form ([#43](https://github.com/expressots/expressots/issues/43)) ([e23c936](https://github.com/expressots/expressots/commit/e23c9360cec22f21a8f44e04b290cf6aa23aef17))
45
+ - add dependabot for fetch new version of dependencies ([#60](https://github.com/expressots/expressots/issues/60)) ([9ea1033](https://github.com/expressots/expressots/commit/9ea1033809eb19f50ae779824e5e428710c4480d))
46
+ - add prisma provider configuration types in ExpressoConfig ([#71](https://github.com/expressots/expressots/issues/71)) ([4a189a2](https://github.com/expressots/expressots/commit/4a189a2d85aed320d97fff4aebc48dcb0e125adf))
47
+ - bump prettier from 3.0.0 to 3.0.1 ([#68](https://github.com/expressots/expressots/issues/68)) ([b555e19](https://github.com/expressots/expressots/commit/b555e19698fd102c681b50a96e99ad37b399bae7))
48
+ - **prettier:** add a prettier config and run it in the core package ([#58](https://github.com/expressots/expressots/issues/58)) ([2ac367b](https://github.com/expressots/expressots/commit/2ac367b3c5911216a1ffb9b542ae4bb418227eba))
68
49
 
50
+ ### Bug Fixes
51
+
52
+ - add workflow for auto project and label ([#44](https://github.com/expressots/expressots/issues/44)) ([1306d18](https://github.com/expressots/expressots/commit/1306d181bc904384a3edea0be219bba891b865cf))
53
+
54
+ ## [1.5.1](https://github.com/expressots/expressots/compare/1.5.0...1.5.1) (2023-07-16)
69
55
 
70
56
  ### Bug Fixes
71
57
 
72
- * remove npm auto publish from ci ([#35](https://github.com/expressots/expressots/issues/35)) ([c7145aa](https://github.com/expressots/expressots/commit/c7145aa5b7e99ee774141824437c30df9e3f4882))
58
+ - add 404 on opinionated template user usecases ([#41](https://github.com/expressots/expressots/issues/41)) ([e2920cc](https://github.com/expressots/expressots/commit/e2920cce79eaad3fc5f031f45375312cba790103))
73
59
 
74
- ## [1.4.2](https://github.com/expressots/expressots/compare/v1.4.1...v1.4.2) (2023-06-19)
60
+ ## [1.5.0](https://github.com/expressots/expressots/compare/1.5.0-dev...1.5.0) (2023-07-12)
61
+
62
+ ### Features
63
+
64
+ - add render engine for handlebars ([1257fe0](https://github.com/expressots/expressots/commit/1257fe08ec0bf9096af1927caddf6fa2a8d481e8))
65
+
66
+ ## [1.5.0](https://github.com/expressots/expressots/compare/v1.4.2...v1.5.0) (2023-07-11)
67
+
68
+ ### Features
75
69
 
70
+ - add render engine mechanic and handlebars sup ([#37](https://github.com/expressots/expressots/issues/37)) ([c9f1c61](https://github.com/expressots/expressots/commit/c9f1c616c3480575c013e1e3e6b397e9b6870fb2))
76
71
 
77
72
  ### Bug Fixes
78
73
 
79
- * error handling ([#34](https://github.com/expressots/expressots/issues/34)) ([0c8bdc8](https://github.com/expressots/expressots/commit/0c8bdc8b933f64b76299396429162c0acae24feb))
80
- * remove exclude pattern ([#33](https://github.com/expressots/expressots/issues/33)) ([9f5461b](https://github.com/expressots/expressots/commit/9f5461be50eaf4c0aa60952eef7e120228740287))
81
- * update cicd ([#32](https://github.com/expressots/expressots/issues/32)) ([c6e4820](https://github.com/expressots/expressots/commit/c6e4820bd20b8c1fc43cbc80ddb609031d893f36))
82
- * update usecases to the new error handling ([1471e25](https://github.com/expressots/expressots/commit/1471e252f9e05f4a1f034a95d248c27cdbb306cd))
74
+ - remove npm auto publish from ci ([#35](https://github.com/expressots/expressots/issues/35)) ([c7145aa](https://github.com/expressots/expressots/commit/c7145aa5b7e99ee774141824437c30df9e3f4882))
83
75
 
84
- ## [1.4.1](https://github.com/expressots/expressots/compare/v1.4.0...v1.4.1) (2023-06-14)
76
+ ## [1.4.2](https://github.com/expressots/expressots/compare/v1.4.1...v1.4.2) (2023-06-19)
77
+
78
+ ### Bug Fixes
85
79
 
80
+ - error handling ([#34](https://github.com/expressots/expressots/issues/34)) ([0c8bdc8](https://github.com/expressots/expressots/commit/0c8bdc8b933f64b76299396429162c0acae24feb))
81
+ - remove exclude pattern ([#33](https://github.com/expressots/expressots/issues/33)) ([9f5461b](https://github.com/expressots/expressots/commit/9f5461be50eaf4c0aa60952eef7e120228740287))
82
+ - update cicd ([#32](https://github.com/expressots/expressots/issues/32)) ([c6e4820](https://github.com/expressots/expressots/commit/c6e4820bd20b8c1fc43cbc80ddb609031d893f36))
83
+ - update usecases to the new error handling ([1471e25](https://github.com/expressots/expressots/commit/1471e252f9e05f4a1f034a95d248c27cdbb306cd))
84
+
85
+ ## [1.4.1](https://github.com/expressots/expressots/compare/v1.4.0...v1.4.1) (2023-06-14)
86
86
 
87
87
  ### Bug Fixes
88
88
 
89
- * add user crud, remove ping, app.container ([befb447](https://github.com/expressots/expressots/commit/befb44720185d95fab2d275f79d5d5152cba2836))
90
- * correct bootstrap function name ([1b99dcc](https://github.com/expressots/expressots/commit/1b99dcc0a3910fcc490a19db169f3799e95ca175))
91
- * report known error in middleware ([#31](https://github.com/expressots/expressots/issues/31)) ([3790e24](https://github.com/expressots/expressots/commit/3790e24e9c30f3823a5b88eb4525cc892d5866df))
92
- * update .env.example ([90c0375](https://github.com/expressots/expressots/commit/90c0375763d5d942332a6217fa23c17d4f2d7260))
93
- * update changelog ([4e117b9](https://github.com/expressots/expressots/commit/4e117b9e4463374705fee83707444e0a112b656b))
94
- * update core and template readme ([b2cc461](https://github.com/expressots/expressots/commit/b2cc461e730a24e7cadd323266fa1c862af7cf65))
95
- * update non-op template app.container ([11a3938](https://github.com/expressots/expressots/commit/11a3938a8e1fa24e95da33cad0761967c9d6cd8e))
96
- * update response type on controllers ([8ca9f5e](https://github.com/expressots/expressots/commit/8ca9f5eac99a3a921c7b6c39fb8129cee4670889))
97
- * update singleton decorator in dbInmemory ([61bd590](https://github.com/expressots/expressots/commit/61bd590d06b96d297e6da8f92638df1ee8edce6b))
89
+ - add user crud, remove ping, app.container ([befb447](https://github.com/expressots/expressots/commit/befb44720185d95fab2d275f79d5d5152cba2836))
90
+ - correct bootstrap function name ([1b99dcc](https://github.com/expressots/expressots/commit/1b99dcc0a3910fcc490a19db169f3799e95ca175))
91
+ - report known error in middleware ([#31](https://github.com/expressots/expressots/issues/31)) ([3790e24](https://github.com/expressots/expressots/commit/3790e24e9c30f3823a5b88eb4525cc892d5866df))
92
+ - update .env.example ([90c0375](https://github.com/expressots/expressots/commit/90c0375763d5d942332a6217fa23c17d4f2d7260))
93
+ - update changelog ([4e117b9](https://github.com/expressots/expressots/commit/4e117b9e4463374705fee83707444e0a112b656b))
94
+ - update core and template readme ([b2cc461](https://github.com/expressots/expressots/commit/b2cc461e730a24e7cadd323266fa1c862af7cf65))
95
+ - update non-op template app.container ([11a3938](https://github.com/expressots/expressots/commit/11a3938a8e1fa24e95da33cad0761967c9d6cd8e))
96
+ - update response type on controllers ([8ca9f5e](https://github.com/expressots/expressots/commit/8ca9f5eac99a3a921c7b6c39fb8129cee4670889))
97
+ - update singleton decorator in dbInmemory ([61bd590](https://github.com/expressots/expressots/commit/61bd590d06b96d297e6da8f92638df1ee8edce6b))
98
98
 
99
99
  ## [1.4.0](https://github.com/expressots/expressots/compare/v1.3.0...v1.4.0) (2023-05-14)
100
100
 
101
- * add DI (dependency injection) singleton, transient, scope to container, providers, entities, etc
101
+ - add DI (dependency injection) singleton, transient, scope to container, providers, entities, etc
102
102
 
103
103
  ### Bug Fixes
104
104
 
105
- * update sponsor link on package
106
- * add example with controller only ([11b4ce3](https://github.com/expressots/expressots/commit/11b4ce3124482122a4f47fb27b7a1b1e02731621))
107
- * opinionated template ientity id ([dd50ca0](https://github.com/expressots/expressots/commit/dd50ca0926c98890cbe1342f804ca34152c4a9f9))
105
+ - update sponsor link on package
106
+ - add example with controller only ([11b4ce3](https://github.com/expressots/expressots/commit/11b4ce3124482122a4f47fb27b7a1b1e02731621))
107
+ - opinionated template ientity id ([dd50ca0](https://github.com/expressots/expressots/commit/dd50ca0926c98890cbe1342f804ca34152c4a9f9))
108
108
 
109
109
  ## [1.3.0](https://github.com/expressots/expressots/compare/v1.2.1...v1.3.0) (2023-04-21)
110
110
 
111
-
112
111
  ### Features
113
112
 
114
- * add user repository as singleton provider in opinionated template ([#24](https://github.com/expressots/expressots/issues/24)) ([3b5bded](https://github.com/expressots/expressots/commit/3b5bded07769d51f69b481e4b5e9b45c27d13a69))
115
-
113
+ - add user repository as singleton provider in opinionated template ([#24](https://github.com/expressots/expressots/issues/24)) ([3b5bded](https://github.com/expressots/expressots/commit/3b5bded07769d51f69b481e4b5e9b45c27d13a69))
116
114
 
117
115
  ### Bug Fixes
118
116
 
119
- * add gitignore on opinionated template ([315d355](https://github.com/expressots/expressots/commit/315d355ed87eb6be85daddc250289d5e0d41cd21))
120
- * findall use case query db in memory ([ff8feea](https://github.com/expressots/expressots/commit/ff8feeaf36d0b74eebd9ab4e22f1910cff0a4df8))
121
- * the number of constructor arguments ([ccf2a48](https://github.com/expressots/expressots/commit/ccf2a4878e795e0182608546eae8cd83e3bea775))
122
- * update core pkg templates to always download latest ([ca443eb](https://github.com/expressots/expressots/commit/ca443eb6be103725c73442f49e2fec14d797bba1))
117
+ - add gitignore on opinionated template ([315d355](https://github.com/expressots/expressots/commit/315d355ed87eb6be85daddc250289d5e0d41cd21))
118
+ - findall use case query db in memory ([ff8feea](https://github.com/expressots/expressots/commit/ff8feeaf36d0b74eebd9ab4e22f1910cff0a4df8))
119
+ - the number of constructor arguments ([ccf2a48](https://github.com/expressots/expressots/commit/ccf2a4878e795e0182608546eae8cd83e3bea775))
120
+ - update core pkg templates to always download latest ([ca443eb](https://github.com/expressots/expressots/commit/ca443eb6be103725c73442f49e2fec14d797bba1))
123
121
 
124
122
  ## [1.2.1](https://github.com/expressots/expressots/compare/v1.2.0...v1.2.1) (2023-04-18)
125
123
 
126
-
127
124
  ### Features
128
125
 
129
- * add bug report template ([8a160c4](https://github.com/expressots/expressots/commit/8a160c4b0b53be39a0fa42315936291be6694c8c))
130
- * add feature request template ([9d264c6](https://github.com/expressots/expressots/commit/9d264c68e44fee754c906846aaa7a7c89cb6b571))
131
-
126
+ - add bug report template ([8a160c4](https://github.com/expressots/expressots/commit/8a160c4b0b53be39a0fa42315936291be6694c8c))
127
+ - add feature request template ([9d264c6](https://github.com/expressots/expressots/commit/9d264c68e44fee754c906846aaa7a7c89cb6b571))
132
128
 
133
129
  ### Bug Fixes
134
130
 
135
- * add expresso config ([086ba59](https://github.com/expressots/expressots/commit/086ba59aba1d430877c3807eb77df9460413dbce))
136
- * add PR template ([1ce4b65](https://github.com/expressots/expressots/commit/1ce4b651a16d602ed459049eeac4200bb80e7651))
137
- * config-path for build ([72d8086](https://github.com/expressots/expressots/commit/72d8086cc1067add1a3d69c8c13bc5b5d6b7e024))
138
- * expose express.json() config ([717f677](https://github.com/expressots/expressots/commit/717f6779e033d0e616f7fd464b81edb6bf95c1a9))
139
- * template import errors from dtos ([#25](https://github.com/expressots/expressots/issues/25)) ([471e311](https://github.com/expressots/expressots/commit/471e3114a4afa9a9dc4af16b872e75f6ef436ae3))
140
- * update doc contributor ([75cc0cc](https://github.com/expressots/expressots/commit/75cc0cc6f7a0b0527b566c5a4e842c9d13c68ee9))
141
- * update expressots version ([e170a1f](https://github.com/expressots/expressots/commit/e170a1fd1aab61fd2403707a54c8b027139eb26c))
142
- * update jest config ([6b33fd6](https://github.com/expressots/expressots/commit/6b33fd6117d32a29d2516831b3a8e7ecd16dfb65))
143
- * update non-opinionated config ([1b10e0e](https://github.com/expressots/expressots/commit/1b10e0e3ba9f679b2cc59d4c3ec75a8c2e238d43))
144
- * update opinionated template ([b7bde50](https://github.com/expressots/expressots/commit/b7bde50ec10b9ad9c2d855d1189ad3ccf4e68108))
145
- * update opinionated template ([cae55a0](https://github.com/expressots/expressots/commit/cae55a04d1282c08668ee5ef12b9976400e2acfd))
146
- * update templates ([e58af09](https://github.com/expressots/expressots/commit/e58af0995c8f71ad104d1cc4cab79e74ba257bb1))
147
- * update test coverage path ([0804c5c](https://github.com/expressots/expressots/commit/0804c5c4b6fd4437a69330a40621408273ffdfac))
131
+ - add expresso config ([086ba59](https://github.com/expressots/expressots/commit/086ba59aba1d430877c3807eb77df9460413dbce))
132
+ - add PR template ([1ce4b65](https://github.com/expressots/expressots/commit/1ce4b651a16d602ed459049eeac4200bb80e7651))
133
+ - config-path for build ([72d8086](https://github.com/expressots/expressots/commit/72d8086cc1067add1a3d69c8c13bc5b5d6b7e024))
134
+ - expose express.json() config ([717f677](https://github.com/expressots/expressots/commit/717f6779e033d0e616f7fd464b81edb6bf95c1a9))
135
+ - template import errors from dtos ([#25](https://github.com/expressots/expressots/issues/25)) ([471e311](https://github.com/expressots/expressots/commit/471e3114a4afa9a9dc4af16b872e75f6ef436ae3))
136
+ - update doc contributor ([75cc0cc](https://github.com/expressots/expressots/commit/75cc0cc6f7a0b0527b566c5a4e842c9d13c68ee9))
137
+ - update expressots version ([e170a1f](https://github.com/expressots/expressots/commit/e170a1fd1aab61fd2403707a54c8b027139eb26c))
138
+ - update jest config ([6b33fd6](https://github.com/expressots/expressots/commit/6b33fd6117d32a29d2516831b3a8e7ecd16dfb65))
139
+ - update non-opinionated config ([1b10e0e](https://github.com/expressots/expressots/commit/1b10e0e3ba9f679b2cc59d4c3ec75a8c2e238d43))
140
+ - update opinionated template ([b7bde50](https://github.com/expressots/expressots/commit/b7bde50ec10b9ad9c2d855d1189ad3ccf4e68108))
141
+ - update opinionated template ([cae55a0](https://github.com/expressots/expressots/commit/cae55a04d1282c08668ee5ef12b9976400e2acfd))
142
+ - update templates ([e58af09](https://github.com/expressots/expressots/commit/e58af0995c8f71ad104d1cc4cab79e74ba257bb1))
143
+ - update test coverage path ([0804c5c](https://github.com/expressots/expressots/commit/0804c5c4b6fd4437a69330a40621408273ffdfac))
148
144
 
149
145
  ## [1.2.0](https://github.com/expressots/expressots/compare/v1.1.0...v1.2.0) (2023-04-08)
150
146
 
151
-
152
147
  ### Features
153
148
 
154
- * add doc & config types for cli ([a72db25](https://github.com/expressots/expressots/commit/a72db25088a8c2d0a18cd8fc71dde40e01cd4c22))
155
-
149
+ - add doc & config types for cli ([a72db25](https://github.com/expressots/expressots/commit/a72db25088a8c2d0a18cd8fc71dde40e01cd4c22))
156
150
 
157
151
  ### Bug Fixes
158
152
 
159
- * template folder path issue ([babdce9](https://github.com/expressots/expressots/commit/babdce9367f85ddd2075c4bed854ab83ee339add))
153
+ - template folder path issue ([babdce9](https://github.com/expressots/expressots/commit/babdce9367f85ddd2075c4bed854ab83ee339add))
160
154
 
161
155
  ## [1.1.1](https://github.com/expressots/expressots/compare/v1.1.0...v1.1.1) (2023-04-04)
162
156
 
163
-
164
157
  ### Bug Fixes
165
158
 
166
- * template folder path issue ([babdce9](https://github.com/expressots/expressots/commit/babdce9367f85ddd2075c4bed854ab83ee339add))
159
+ - template folder path issue ([babdce9](https://github.com/expressots/expressots/commit/babdce9367f85ddd2075c4bed854ab83ee339add))
167
160
 
168
161
  ## [1.1.0](https://github.com/expressots/expressots/compare/v1.1.0-42-gc6f184868daa1b6862337621c69b5370b70a2772...v1.1.0) (2023-03-31)
169
162
 
@@ -175,7 +168,7 @@
175
168
 
176
169
  ## [1.2.0](https://github.com/expressots/expressots/compare/v1.1.0-35-g27548a8d24a0891d1d04fca1ba131ad585fba5ef...v1.2.0) (2023-03-31)
177
170
 
178
- * feat: add cjs/esm (92f858f)
171
+ - feat: add cjs/esm (92f858f)
179
172
 
180
173
  ## [1.1.0](https://github.com/expressots/expressots/compare/v1.1.0-32-gd0aa36eefab521c3be83d72c873e3d34d4ea88eb...v1.1.0) (2023-03-31)
181
174
 
@@ -183,84 +176,75 @@
183
176
 
184
177
  ## [1.1.0](https://github.com/expressots/expressots/compare/v0.0.2...v1.1.0) (2023-02-19)
185
178
 
186
-
187
179
  ### Features
188
180
 
189
- * add eslint prettier config ([906cdcc](https://github.com/expressots/expressots/commit/906cdcc0ebf00bee55c8cab66e95dd74c9296cb8))
190
- * add opinionated template ([d1eb222](https://github.com/expressots/expressots/commit/d1eb222016c809a1a4576cce5b51660d55ad7c19))
191
- * add readme ([557e1ff](https://github.com/expressots/expressots/commit/557e1ffcd41d1e482372183a0ea72820531740d7))
192
- * update 01_base template ([d289c57](https://github.com/expressots/expressots/commit/d289c5752bb78ad6bce7f35fcdb7019e7cc38b6a))
193
-
181
+ - add eslint prettier config ([906cdcc](https://github.com/expressots/expressots/commit/906cdcc0ebf00bee55c8cab66e95dd74c9296cb8))
182
+ - add opinionated template ([d1eb222](https://github.com/expressots/expressots/commit/d1eb222016c809a1a4576cce5b51660d55ad7c19))
183
+ - add readme ([557e1ff](https://github.com/expressots/expressots/commit/557e1ffcd41d1e482372183a0ea72820531740d7))
184
+ - update 01_base template ([d289c57](https://github.com/expressots/expressots/commit/d289c5752bb78ad6bce7f35fcdb7019e7cc38b6a))
194
185
 
195
186
  ### Bug Fixes
196
187
 
197
- * add ping controller ([ca7b005](https://github.com/expressots/expressots/commit/ca7b005be099eadc35b5e6b96aaf82c0e3840c81))
198
- * fix index.js main on package ([26596b7](https://github.com/expressots/expressots/commit/26596b7982143e63186461bde1324a81a8901446))
199
- * fix jest compilation error ([9c5be2e](https://github.com/expressots/expressots/commit/9c5be2e8a1dc062618d048183dfeef08d67d8e70))
200
- * fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
201
- * logo update on doc ([b2fe55b](https://github.com/expressots/expressots/commit/b2fe55b54fcac09bf261b5ea5cab4ebdbe20dee1))
202
- * logo update on doc, build update ([b36889d](https://github.com/expressots/expressots/commit/b36889d513ed07678b43f7107ef9cd49ab5f8afa))
203
- * non opinionated folder and prettier ([61d1e1b](https://github.com/expressots/expressots/commit/61d1e1b45e9bd240d4a6fd12a71f814e0426a436))
204
- * prettier eslint jest setup ([0f29452](https://github.com/expressots/expressots/commit/0f29452c796abefe205ece8b943efda24b383905))
205
- * remove test-app ([767c7a5](https://github.com/expressots/expressots/commit/767c7a54ea65c228a94ba3d63e5b6739c474a96e))
206
- * set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
207
- * update main remove index.js ([8b40b11](https://github.com/expressots/expressots/commit/8b40b11c51da728db4f8760e75fee1e2724e98e0))
208
- * update readme ([a2ef784](https://github.com/expressots/expressots/commit/a2ef7849a1c1466f8737f263ad1728f5d30b25ec))
188
+ - add ping controller ([ca7b005](https://github.com/expressots/expressots/commit/ca7b005be099eadc35b5e6b96aaf82c0e3840c81))
189
+ - fix index.js main on package ([26596b7](https://github.com/expressots/expressots/commit/26596b7982143e63186461bde1324a81a8901446))
190
+ - fix jest compilation error ([9c5be2e](https://github.com/expressots/expressots/commit/9c5be2e8a1dc062618d048183dfeef08d67d8e70))
191
+ - fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
192
+ - logo update on doc ([b2fe55b](https://github.com/expressots/expressots/commit/b2fe55b54fcac09bf261b5ea5cab4ebdbe20dee1))
193
+ - logo update on doc, build update ([b36889d](https://github.com/expressots/expressots/commit/b36889d513ed07678b43f7107ef9cd49ab5f8afa))
194
+ - non opinionated folder and prettier ([61d1e1b](https://github.com/expressots/expressots/commit/61d1e1b45e9bd240d4a6fd12a71f814e0426a436))
195
+ - prettier eslint jest setup ([0f29452](https://github.com/expressots/expressots/commit/0f29452c796abefe205ece8b943efda24b383905))
196
+ - remove test-app ([767c7a5](https://github.com/expressots/expressots/commit/767c7a54ea65c228a94ba3d63e5b6739c474a96e))
197
+ - set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
198
+ - update main remove index.js ([8b40b11](https://github.com/expressots/expressots/commit/8b40b11c51da728db4f8760e75fee1e2724e98e0))
199
+ - update readme ([a2ef784](https://github.com/expressots/expressots/commit/a2ef7849a1c1466f8737f263ad1728f5d30b25ec))
209
200
 
210
201
  ## [0.0.7](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.7) (2023-02-18)
211
202
 
212
-
213
203
  ### Bug Fixes
214
204
 
215
- * fix release step ([6e4d7b9](https://github.com/expressots/expressots/commit/6e4d7b956833cf9f956c4dbb0e063d9e50f92e3e))
216
- * fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
217
- * set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
205
+ - fix release step ([6e4d7b9](https://github.com/expressots/expressots/commit/6e4d7b956833cf9f956c4dbb0e063d9e50f92e3e))
206
+ - fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
207
+ - set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
218
208
 
219
209
  ## [0.0.6](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.6) (2023-02-17)
220
210
 
221
-
222
211
  ### Bug Fixes
223
212
 
224
- * fix pipeline release ([69e3fc4](https://github.com/expressots/expressots/commit/69e3fc497b8b4c79556663a768c1aab417c5bca6))
225
- * fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
226
- * set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
213
+ - fix pipeline release ([69e3fc4](https://github.com/expressots/expressots/commit/69e3fc497b8b4c79556663a768c1aab417c5bca6))
214
+ - fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
215
+ - set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
227
216
 
228
217
  ## [0.0.5](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.5) (2023-02-17)
229
218
 
230
-
231
219
  ### Bug Fixes
232
220
 
233
- * fix pipeline on push ([da20e93](https://github.com/expressots/expressots/commit/da20e93665a7fd51f449f0c6ae71cd485028d1f4))
234
- * fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
235
- * set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
221
+ - fix pipeline on push ([da20e93](https://github.com/expressots/expressots/commit/da20e93665a7fd51f449f0c6ae71cd485028d1f4))
222
+ - fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
223
+ - set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
236
224
 
237
225
  ## [0.0.4](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.4) (2023-02-17)
238
226
 
239
-
240
227
  ### Bug Fixes
241
228
 
242
- * fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
243
- * set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
244
- * update pipeline ([27dd961](https://github.com/expressots/expressots/commit/27dd961230f5cd2b1b02937f8c77ead9e983e537))
229
+ - fix release tag pipeline ([#12](https://github.com/expressots/expressots/issues/12)) ([d2a5491](https://github.com/expressots/expressots/commit/d2a5491dce149feb2a7b143d57ba1e08d8a2d68b))
230
+ - set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
231
+ - update pipeline ([27dd961](https://github.com/expressots/expressots/commit/27dd961230f5cd2b1b02937f8c77ead9e983e537))
245
232
 
246
233
  ## [0.0.3](https://github.com/expressots/expressots/compare/v0.0.2...v0.0.3) (2023-02-17)
247
234
 
248
-
249
235
  ### Bug Fixes
250
236
 
251
- * fix release tag pipeline ([ed03d24](https://github.com/expressots/expressots/commit/ed03d24e2696279aa04c8988e2c52ba7209a7bbd))
252
- * set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
237
+ - fix release tag pipeline ([ed03d24](https://github.com/expressots/expressots/commit/ed03d24e2696279aa04c8988e2c52ba7209a7bbd))
238
+ - set pipeline only pr merge ([2936442](https://github.com/expressots/expressots/commit/293644285f4dd611ab6b600c462a6559f9625605))
253
239
 
254
240
  ## [0.0.2](https://github.com/expressots/expressots/compare/v0.1.1...v0.0.2) (2023-02-17)
255
241
 
256
-
257
242
  ### Bug Fixes
258
243
 
259
- * fix pipeline for tag name ([b9ec52d](https://github.com/expressots/expressots/commit/b9ec52dc065763185f69364d8f083b1a95fa37e0))
244
+ - fix pipeline for tag name ([b9ec52d](https://github.com/expressots/expressots/commit/b9ec52dc065763185f69364d8f083b1a95fa37e0))
260
245
 
261
246
  ## [0.0.1](https://github.com/expressots/expressots/compare/v0.1.1...v0.0.1) (2023-02-17)
262
247
 
263
-
264
248
  ### Bug Fixes
265
249
 
266
- * fix pipeline for tag name ([b9ec52d](https://github.com/expressots/expressots/commit/b9ec52dc065763185f69364d8f083b1a95fa37e0))
250
+ - fix pipeline for tag name ([b9ec52d](https://github.com/expressots/expressots/commit/b9ec52dc065763185f69364d8f083b1a95fa37e0))
@@ -83,9 +83,10 @@ let Application = Application_1 = class Application {
83
83
  app.use(middleware);
84
84
  });
85
85
  });
86
+ expressServer.setErrorConfig((app) => {
87
+ app.use(error_handler_middleware_1.default);
88
+ });
86
89
  this.app = expressServer.build();
87
- /* Add the error handler middleware */
88
- this.app.use(error_handler_middleware_1.default);
89
90
  return this;
90
91
  }
91
92
  /**
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppError = void 0;
4
+ /**
5
+ * The AppError class extends the built-in Error class in JavaScript,
6
+ * providing additional properties to manage custom application errors.
7
+ * It captures detailed information about the error, including a status code
8
+ * and an optional service identifier, which can be useful for error handling
9
+ * and logging within the application.
10
+ *
11
+ * @extends {Error}
12
+ */
13
+ class AppError extends Error {
14
+ /**
15
+ * @param {string} message - The error message to be displayed.
16
+ * @param {number} [statusCode=500] - The HTTP status code associated with the error (default: 500).
17
+ * @param {string} [service] - The service identifier associated with the error.
18
+ */
19
+ constructor(message, statusCode = 500, service) {
20
+ super(message);
21
+ this.statusCode = statusCode;
22
+ this.service = service;
23
+ Error.captureStackTrace(this, this.constructor);
24
+ }
25
+ }
26
+ exports.AppError = AppError;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const app_error_1 = require("./app-error");
3
4
  const status_code_1 = require("./status-code");
4
5
  /**
5
6
  * errorHandler is a custom Express error-handling middleware function.
@@ -9,9 +10,19 @@ const status_code_1 = require("./status-code");
9
10
  * @param res - The Express response object.
10
11
  * @param next - The Express next function for passing control to the next middleware function.
11
12
  */
12
- function errorHandler(error, req, res) {
13
- res
14
- .status(error.statusCode || status_code_1.StatusCode.InternalServerError)
15
- .json({ statusCode: error.statusCode, error: error.message });
13
+ function defaultErrorHandler(error, req, res,
14
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
+ next) {
16
+ if (error instanceof app_error_1.AppError) {
17
+ res
18
+ .status(error.statusCode)
19
+ .json({ statusCode: error.statusCode, error: error.message });
20
+ }
21
+ else {
22
+ res.status(status_code_1.StatusCode.InternalServerError).json({
23
+ statusCode: status_code_1.StatusCode.InternalServerError,
24
+ error: "An unexpected error occurred.",
25
+ });
26
+ }
16
27
  }
17
- exports.default = errorHandler;
28
+ exports.default = defaultErrorHandler;
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Report = exports.StatusCode = void 0;
3
+ exports.AppError = exports.Report = exports.StatusCode = void 0;
4
4
  var status_code_1 = require("./status-code");
5
5
  Object.defineProperty(exports, "StatusCode", { enumerable: true, get: function () { return status_code_1.StatusCode; } });
6
6
  var report_1 = require("./report");
7
7
  Object.defineProperty(exports, "Report", { enumerable: true, get: function () { return report_1.Report; } });
8
+ var app_error_1 = require("./app-error");
9
+ Object.defineProperty(exports, "AppError", { enumerable: true, get: function () { return app_error_1.AppError; } });
@@ -9,7 +9,7 @@ var Report_1;
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.Report = void 0;
11
11
  const inversify_binding_decorators_1 = require("inversify-binding-decorators");
12
- const logger_1 = require("../logger");
12
+ const app_error_1 = require("./app-error");
13
13
  /**
14
14
  * Report class is a utility class to manage and log errors within the application.
15
15
  * It is responsible for creating a standardized error object, logging it,
@@ -28,30 +28,14 @@ let Report = Report_1 = class Report {
28
28
  *
29
29
  * @throws An object of the custom type IAppError, which includes details about the error.
30
30
  */
31
- static Error(error, statusCode, service) {
32
- var _a, _b;
31
+ Error(error, statusCode, service) {
33
32
  let appError = {};
34
- Error.captureStackTrace(this, this.Error);
35
- const callerName = (_b = (_a = this.stack.split("\n")[1]) === null || _a === void 0 ? void 0 : _a.trim()) === null || _b === void 0 ? void 0 : _b.split(" ")[1];
36
33
  if (error instanceof Error) {
37
- appError = {
38
- statusCode: statusCode !== null && statusCode !== void 0 ? statusCode : 500,
39
- message: error.message,
40
- service: service !== null && service !== void 0 ? service : callerName,
41
- name: error.name,
42
- stack: error.stack,
43
- };
34
+ appError = new app_error_1.AppError(error.message, statusCode, service);
44
35
  }
45
36
  else {
46
- appError = {
47
- statusCode: statusCode !== null && statusCode !== void 0 ? statusCode : 500,
48
- message: error,
49
- service: service !== null && service !== void 0 ? service : callerName,
50
- name: this.Error.name,
51
- stack: this.stack,
52
- };
37
+ appError = new app_error_1.AppError(error, statusCode, service);
53
38
  }
54
- (0, logger_1.log)(logger_1.LogLevel.Error, appError, appError.service || "service-undefined");
55
39
  throw appError;
56
40
  }
57
41
  };
@@ -1 +1 @@
1
- {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/application/application.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAW,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAe,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAE/D;;GAEG;AACH,aAAK,iBAAiB;IACpB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;AAED;;;GAGG;AACH,cACM,WAAW;IACf,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,WAAW,CAAoB;IAEvC;;OAEG;;IAGH;;OAEG;IACH,SAAS,CAAC,iBAAiB,IAAI,IAAI;IAEnC;;OAEG;IACH,SAAS,CAAC,wBAAwB,IAAI,IAAI;IAE1C;;OAEG;IACH,SAAS,CAAC,cAAc,IAAI,IAAI;IAEhC;;OAEG;IACH,OAAO,CAAC,UAAU;IAKlB;;;;;OAKG;IACI,MAAM,CACX,SAAS,EAAE,SAAS,EACpB,WAAW,GAAE,KAAK,CAAC,OAAO,CAAC,cAAc,CAAM,GAC9C,WAAW;IAoCd;;;;;OAKG;IACI,MAAM,CACX,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,iBAAiB,EAC9B,cAAc,CAAC,EAAE,4BAA4B,GAC5C,IAAI;IAuBP;;;;;;;;;;OAUG;IACI,SAAS,CAAC,CAAC,SAAS,qBAAqB,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI;CAQpE;AAED,QAAA,MAAM,iBAAiB,EAAE,WAA+B,CAAC;AAEzD,OAAO,EAAE,iBAAiB,IAAI,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/application/application.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAW,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAe,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAE/D;;GAEG;AACH,aAAK,iBAAiB;IACpB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;AAED;;;GAGG;AACH,cACM,WAAW;IACf,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,WAAW,CAAoB;IAEvC;;OAEG;;IAGH;;OAEG;IACH,SAAS,CAAC,iBAAiB,IAAI,IAAI;IAEnC;;OAEG;IACH,SAAS,CAAC,wBAAwB,IAAI,IAAI;IAE1C;;OAEG;IACH,SAAS,CAAC,cAAc,IAAI,IAAI;IAEhC;;OAEG;IACH,OAAO,CAAC,UAAU;IAKlB;;;;;OAKG;IACI,MAAM,CACX,SAAS,EAAE,SAAS,EACpB,WAAW,GAAE,KAAK,CAAC,OAAO,CAAC,cAAc,CAAM,GAC9C,WAAW;IAqCd;;;;;OAKG;IACI,MAAM,CACX,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,iBAAiB,EAC9B,cAAc,CAAC,EAAE,4BAA4B,GAC5C,IAAI;IAuBP;;;;;;;;;;OAUG;IACI,SAAS,CAAC,CAAC,SAAS,qBAAqB,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI;CAQpE;AAED,QAAA,MAAM,iBAAiB,EAAE,WAA+B,CAAC;AAEzD,OAAO,EAAE,iBAAiB,IAAI,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The AppError class extends the built-in Error class in JavaScript,
3
+ * providing additional properties to manage custom application errors.
4
+ * It captures detailed information about the error, including a status code
5
+ * and an optional service identifier, which can be useful for error handling
6
+ * and logging within the application.
7
+ *
8
+ * @extends {Error}
9
+ */
10
+ declare class AppError extends Error {
11
+ /**
12
+ * The HTTP status code associated with the error.
13
+ * Commonly used to define the HTTP response status code.
14
+ */
15
+ statusCode: number;
16
+ /**
17
+ * The service identifier associated with the error.
18
+ * This property can be used to trace the origin of the error in the application.
19
+ * It is optional and can be left undefined.
20
+ */
21
+ service?: string;
22
+ /**
23
+ * @param {string} message - The error message to be displayed.
24
+ * @param {number} [statusCode=500] - The HTTP status code associated with the error (default: 500).
25
+ * @param {string} [service] - The service identifier associated with the error.
26
+ */
27
+ constructor(message: string, statusCode?: number, service?: string);
28
+ }
29
+ export { AppError };
30
+ //# sourceMappingURL=app-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-error.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/error/app-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAM,QAAS,SAAQ,KAAK;IAC1B;;;OAGG;IACI,UAAU,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACI,OAAO,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,MAAY,EAAE,OAAO,CAAC,EAAE,MAAM;CAMxE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -1,5 +1,4 @@
1
- import { Request, Response } from "express";
2
- import { IAppError } from "./report";
1
+ import { NextFunction, Request, Response } from "express";
3
2
  /**
4
3
  * errorHandler is a custom Express error-handling middleware function.
5
4
  * It logs the error, sets the status code, and sends a JSON response containing the status code and error message.
@@ -8,6 +7,6 @@ import { IAppError } from "./report";
8
7
  * @param res - The Express response object.
9
8
  * @param next - The Express next function for passing control to the next middleware function.
10
9
  */
11
- declare function errorHandler(error: IAppError, req: Request, res: Response): void;
12
- export default errorHandler;
10
+ declare function defaultErrorHandler(error: Error, req: Request, res: Response, next: NextFunction): void;
11
+ export default defaultErrorHandler;
13
12
  //# 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,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC;;;;;;;GAOG;AACH,iBAAS,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,IAAI,CAIzE;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;AAI1D;;;;;;;GAOG;AACH,iBAAS,mBAAmB,CAC1B,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EAEb,IAAI,EAAE,YAAY,GACjB,IAAI,CAWN;AAED,eAAe,mBAAmB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { StatusCode } from "./status-code";
2
2
  export { Report } from "./report";
3
+ export { AppError } from "./app-error";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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,MAAM,EAAE,MAAM,UAAU,CAAC"}
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,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}
@@ -1,10 +1,4 @@
1
- interface IAppError {
2
- statusCode: number;
3
- message: string;
4
- service?: string;
5
- name: string;
6
- stack?: string;
7
- }
1
+ import { AppError } from "./app-error";
8
2
  /**
9
3
  * Report class is a utility class to manage and log errors within the application.
10
4
  * It is responsible for creating a standardized error object, logging it,
@@ -24,7 +18,7 @@ declare class Report {
24
18
  *
25
19
  * @throws An object of the custom type IAppError, which includes details about the error.
26
20
  */
27
- static Error(error: Error | string, statusCode?: number, service?: string): void;
21
+ Error(error: Error | string, statusCode?: number, service?: string): AppError;
28
22
  }
29
- export { Report, IAppError };
23
+ export { Report };
30
24
  //# sourceMappingURL=report.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/error/report.ts"],"names":[],"mappings":"AAGA,UAAU,SAAS;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,cACM,MAAM;IACV,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;OAWG;WACW,KAAK,CACjB,KAAK,EAAE,KAAK,GAAG,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,GACf,IAAI;CA6BR;AAED,OAAO,EAAE,MAAM,EAAE,SAAS,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,aAAa,CAAC;AAEvC;;;;GAIG;AACH,cACM,MAAM;IACV,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;OAWG;IACI,KAAK,CACV,KAAK,EAAE,KAAK,GAAG,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,GACf,QAAQ;CAWZ;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -86,9 +86,10 @@ let Application = Application_1 = class Application {
86
86
  app.use(middleware);
87
87
  });
88
88
  });
89
+ expressServer.setErrorConfig((app) => {
90
+ app.use(error_handler_middleware_1.default);
91
+ });
89
92
  this.app = expressServer.build();
90
- /* Add the error handler middleware */
91
- this.app.use(error_handler_middleware_1.default);
92
93
  return this;
93
94
  }
94
95
  /**
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppError = void 0;
4
+ /**
5
+ * The AppError class extends the built-in Error class in JavaScript,
6
+ * providing additional properties to manage custom application errors.
7
+ * It captures detailed information about the error, including a status code
8
+ * and an optional service identifier, which can be useful for error handling
9
+ * and logging within the application.
10
+ *
11
+ * @extends {Error}
12
+ */
13
+ class AppError extends Error {
14
+ /**
15
+ * The HTTP status code associated with the error.
16
+ * Commonly used to define the HTTP response status code.
17
+ */
18
+ statusCode;
19
+ /**
20
+ * The service identifier associated with the error.
21
+ * This property can be used to trace the origin of the error in the application.
22
+ * It is optional and can be left undefined.
23
+ */
24
+ service;
25
+ /**
26
+ * @param {string} message - The error message to be displayed.
27
+ * @param {number} [statusCode=500] - The HTTP status code associated with the error (default: 500).
28
+ * @param {string} [service] - The service identifier associated with the error.
29
+ */
30
+ constructor(message, statusCode = 500, service) {
31
+ super(message);
32
+ this.statusCode = statusCode;
33
+ this.service = service;
34
+ Error.captureStackTrace(this, this.constructor);
35
+ }
36
+ }
37
+ exports.AppError = AppError;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const app_error_1 = require("./app-error");
3
4
  const status_code_1 = require("./status-code");
4
5
  /**
5
6
  * errorHandler is a custom Express error-handling middleware function.
@@ -9,9 +10,19 @@ const status_code_1 = require("./status-code");
9
10
  * @param res - The Express response object.
10
11
  * @param next - The Express next function for passing control to the next middleware function.
11
12
  */
12
- function errorHandler(error, req, res) {
13
- res
14
- .status(error.statusCode || status_code_1.StatusCode.InternalServerError)
15
- .json({ statusCode: error.statusCode, error: error.message });
13
+ function defaultErrorHandler(error, req, res,
14
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
+ next) {
16
+ if (error instanceof app_error_1.AppError) {
17
+ res
18
+ .status(error.statusCode)
19
+ .json({ statusCode: error.statusCode, error: error.message });
20
+ }
21
+ else {
22
+ res.status(status_code_1.StatusCode.InternalServerError).json({
23
+ statusCode: status_code_1.StatusCode.InternalServerError,
24
+ error: "An unexpected error occurred.",
25
+ });
26
+ }
16
27
  }
17
- exports.default = errorHandler;
28
+ exports.default = defaultErrorHandler;
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Report = exports.StatusCode = void 0;
3
+ exports.AppError = exports.Report = exports.StatusCode = void 0;
4
4
  var status_code_1 = require("./status-code");
5
5
  Object.defineProperty(exports, "StatusCode", { enumerable: true, get: function () { return status_code_1.StatusCode; } });
6
6
  var report_1 = require("./report");
7
7
  Object.defineProperty(exports, "Report", { enumerable: true, get: function () { return report_1.Report; } });
8
+ var app_error_1 = require("./app-error");
9
+ Object.defineProperty(exports, "AppError", { enumerable: true, get: function () { return app_error_1.AppError; } });
@@ -9,7 +9,7 @@ var Report_1;
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.Report = void 0;
11
11
  const inversify_binding_decorators_1 = require("inversify-binding-decorators");
12
- const logger_1 = require("../logger");
12
+ const app_error_1 = require("./app-error");
13
13
  /**
14
14
  * Report class is a utility class to manage and log errors within the application.
15
15
  * It is responsible for creating a standardized error object, logging it,
@@ -30,29 +30,14 @@ let Report = class Report {
30
30
  *
31
31
  * @throws An object of the custom type IAppError, which includes details about the error.
32
32
  */
33
- static Error(error, statusCode, service) {
33
+ Error(error, statusCode, service) {
34
34
  let appError = {};
35
- Error.captureStackTrace(this, this.Error);
36
- const callerName = this.stack.split("\n")[1]?.trim()?.split(" ")[1];
37
35
  if (error instanceof Error) {
38
- appError = {
39
- statusCode: statusCode ?? 500,
40
- message: error.message,
41
- service: service ?? callerName,
42
- name: error.name,
43
- stack: error.stack,
44
- };
36
+ appError = new app_error_1.AppError(error.message, statusCode, service);
45
37
  }
46
38
  else {
47
- appError = {
48
- statusCode: statusCode ?? 500,
49
- message: error,
50
- service: service ?? callerName,
51
- name: this.Error.name,
52
- stack: this.stack,
53
- };
39
+ appError = new app_error_1.AppError(error, statusCode, service);
54
40
  }
55
- (0, logger_1.log)(logger_1.LogLevel.Error, appError, appError.service || "service-undefined");
56
41
  throw appError;
57
42
  }
58
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/application/application.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAW,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAe,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAE/D;;GAEG;AACH,aAAK,iBAAiB;IACpB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;AAED;;;GAGG;AACH,cACM,WAAW;IACf,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,WAAW,CAAoB;IAEvC;;OAEG;;IAGH;;OAEG;IACH,SAAS,CAAC,iBAAiB,IAAI,IAAI;IAEnC;;OAEG;IACH,SAAS,CAAC,wBAAwB,IAAI,IAAI;IAE1C;;OAEG;IACH,SAAS,CAAC,cAAc,IAAI,IAAI;IAEhC;;OAEG;IACH,OAAO,CAAC,UAAU;IAKlB;;;;;OAKG;IACI,MAAM,CACX,SAAS,EAAE,SAAS,EACpB,WAAW,GAAE,KAAK,CAAC,OAAO,CAAC,cAAc,CAAM,GAC9C,WAAW;IAoCd;;;;;OAKG;IACI,MAAM,CACX,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,iBAAiB,EAC9B,cAAc,CAAC,EAAE,4BAA4B,GAC5C,IAAI;IAuBP;;;;;;;;;;OAUG;IACI,SAAS,CAAC,CAAC,SAAS,qBAAqB,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI;CAQpE;AAED,QAAA,MAAM,iBAAiB,EAAE,WAA+B,CAAC;AAEzD,OAAO,EAAE,iBAAiB,IAAI,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/application/application.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAW,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAe,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAE/D;;GAEG;AACH,aAAK,iBAAiB;IACpB,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B;AAED;;;GAGG;AACH,cACM,WAAW;IACf,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,WAAW,CAAoB;IAEvC;;OAEG;;IAGH;;OAEG;IACH,SAAS,CAAC,iBAAiB,IAAI,IAAI;IAEnC;;OAEG;IACH,SAAS,CAAC,wBAAwB,IAAI,IAAI;IAE1C;;OAEG;IACH,SAAS,CAAC,cAAc,IAAI,IAAI;IAEhC;;OAEG;IACH,OAAO,CAAC,UAAU;IAKlB;;;;;OAKG;IACI,MAAM,CACX,SAAS,EAAE,SAAS,EACpB,WAAW,GAAE,KAAK,CAAC,OAAO,CAAC,cAAc,CAAM,GAC9C,WAAW;IAqCd;;;;;OAKG;IACI,MAAM,CACX,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,iBAAiB,EAC9B,cAAc,CAAC,EAAE,4BAA4B,GAC5C,IAAI;IAuBP;;;;;;;;;;OAUG;IACI,SAAS,CAAC,CAAC,SAAS,qBAAqB,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI;CAQpE;AAED,QAAA,MAAM,iBAAiB,EAAE,WAA+B,CAAC;AAEzD,OAAO,EAAE,iBAAiB,IAAI,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The AppError class extends the built-in Error class in JavaScript,
3
+ * providing additional properties to manage custom application errors.
4
+ * It captures detailed information about the error, including a status code
5
+ * and an optional service identifier, which can be useful for error handling
6
+ * and logging within the application.
7
+ *
8
+ * @extends {Error}
9
+ */
10
+ declare class AppError extends Error {
11
+ /**
12
+ * The HTTP status code associated with the error.
13
+ * Commonly used to define the HTTP response status code.
14
+ */
15
+ statusCode: number;
16
+ /**
17
+ * The service identifier associated with the error.
18
+ * This property can be used to trace the origin of the error in the application.
19
+ * It is optional and can be left undefined.
20
+ */
21
+ service?: string;
22
+ /**
23
+ * @param {string} message - The error message to be displayed.
24
+ * @param {number} [statusCode=500] - The HTTP status code associated with the error (default: 500).
25
+ * @param {string} [service] - The service identifier associated with the error.
26
+ */
27
+ constructor(message: string, statusCode?: number, service?: string);
28
+ }
29
+ export { AppError };
30
+ //# sourceMappingURL=app-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-error.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/error/app-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAM,QAAS,SAAQ,KAAK;IAC1B;;;OAGG;IACI,UAAU,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACI,OAAO,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,MAAY,EAAE,OAAO,CAAC,EAAE,MAAM;CAMxE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -1,5 +1,4 @@
1
- import { Request, Response } from "express";
2
- import { IAppError } from "./report";
1
+ import { NextFunction, Request, Response } from "express";
3
2
  /**
4
3
  * errorHandler is a custom Express error-handling middleware function.
5
4
  * It logs the error, sets the status code, and sends a JSON response containing the status code and error message.
@@ -8,6 +7,6 @@ import { IAppError } from "./report";
8
7
  * @param res - The Express response object.
9
8
  * @param next - The Express next function for passing control to the next middleware function.
10
9
  */
11
- declare function errorHandler(error: IAppError, req: Request, res: Response): void;
12
- export default errorHandler;
10
+ declare function defaultErrorHandler(error: Error, req: Request, res: Response, next: NextFunction): void;
11
+ export default defaultErrorHandler;
13
12
  //# 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,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC;;;;;;;GAOG;AACH,iBAAS,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,IAAI,CAIzE;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;AAI1D;;;;;;;GAOG;AACH,iBAAS,mBAAmB,CAC1B,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EAEb,IAAI,EAAE,YAAY,GACjB,IAAI,CAWN;AAED,eAAe,mBAAmB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { StatusCode } from "./status-code";
2
2
  export { Report } from "./report";
3
+ export { AppError } from "./app-error";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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,MAAM,EAAE,MAAM,UAAU,CAAC"}
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,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}
@@ -1,10 +1,4 @@
1
- interface IAppError {
2
- statusCode: number;
3
- message: string;
4
- service?: string;
5
- name: string;
6
- stack?: string;
7
- }
1
+ import { AppError } from "./app-error";
8
2
  /**
9
3
  * Report class is a utility class to manage and log errors within the application.
10
4
  * It is responsible for creating a standardized error object, logging it,
@@ -24,7 +18,7 @@ declare class Report {
24
18
  *
25
19
  * @throws An object of the custom type IAppError, which includes details about the error.
26
20
  */
27
- static Error(error: Error | string, statusCode?: number, service?: string): void;
21
+ Error(error: Error | string, statusCode?: number, service?: string): AppError;
28
22
  }
29
- export { Report, IAppError };
23
+ export { Report };
30
24
  //# sourceMappingURL=report.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/error/report.ts"],"names":[],"mappings":"AAGA,UAAU,SAAS;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,cACM,MAAM;IACV,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;OAWG;WACW,KAAK,CACjB,KAAK,EAAE,KAAK,GAAG,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,GACf,IAAI;CA6BR;AAED,OAAO,EAAE,MAAM,EAAE,SAAS,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,aAAa,CAAC;AAEvC;;;;GAIG;AACH,cACM,MAAM;IACV,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;OAWG;IACI,KAAK,CACV,KAAK,EAAE,KAAK,GAAG,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,GACf,QAAQ;CAWZ;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressots/core",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
5
5
  "author": "Richard Zampieri",
6
6
  "main": "./lib/cjs/index.js",
@@ -60,7 +60,9 @@
60
60
  "build:esm": "tsc -p tsconfig.esm.json && mv lib/esm/index.js lib/esm/index.mjs ",
61
61
  "build:cjs": "tsc -p tsconfig.cjs.json",
62
62
  "release": "release-it",
63
- "test": "jest",
63
+ "coverage": "vitest run --coverage",
64
+ "test": "vitest run",
65
+ "test:watch": "vitest",
64
66
  "format:write": "prettier --write \"packages/**/*.ts\" --cache",
65
67
  "lint": "eslint \"packages/**/*.ts\"",
66
68
  "lint:fix": "eslint \"packages/**/*.ts\" --fix"
@@ -72,7 +74,6 @@
72
74
  "inversify": "^6.0.1",
73
75
  "inversify-binding-decorators": "^4.0.0",
74
76
  "inversify-express-utils": "^6.4.3",
75
- "jest": "^29.5.0",
76
77
  "reflect-metadata": "^0.1.13",
77
78
  "winston": "^3.8.2",
78
79
  "winston-daily-rotate-file": "^4.7.1"
@@ -82,7 +83,6 @@
82
83
  "@commitlint/config-conventional": "^17.7.0",
83
84
  "@release-it/conventional-changelog": "^7.0.1",
84
85
  "@types/express": "^4.17.17",
85
- "@types/jest": "^29.5.0",
86
86
  "@types/node": "^20.4.9",
87
87
  "@typescript-eslint/eslint-plugin": "^6.6.0",
88
88
  "@typescript-eslint/parser": "^6.6.0",
@@ -92,7 +92,9 @@
92
92
  "prettier": "3.0.3",
93
93
  "release-it": "^16.1.5",
94
94
  "ts-jest": "^29.0.5",
95
- "typescript": "^5.0.3"
95
+ "typescript": "^5.0.3",
96
+ "vite": "4.4.9",
97
+ "vitest": "0.34.3"
96
98
  },
97
99
  "release-it": {
98
100
  "git": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressots/core",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
5
5
  "author": "Richard Zampieri",
6
6
  "main": "./lib/cjs/index.js",
@@ -60,7 +60,9 @@
60
60
  "build:esm": "tsc -p tsconfig.esm.json && mv lib/esm/index.js lib/esm/index.mjs ",
61
61
  "build:cjs": "tsc -p tsconfig.cjs.json",
62
62
  "release": "release-it",
63
- "test": "jest",
63
+ "coverage": "vitest run --coverage",
64
+ "test": "vitest run",
65
+ "test:watch": "vitest",
64
66
  "format:write": "prettier --write \"packages/**/*.ts\" --cache",
65
67
  "lint": "eslint \"packages/**/*.ts\"",
66
68
  "lint:fix": "eslint \"packages/**/*.ts\" --fix"
@@ -72,7 +74,6 @@
72
74
  "inversify": "^6.0.1",
73
75
  "inversify-binding-decorators": "^4.0.0",
74
76
  "inversify-express-utils": "^6.4.3",
75
- "jest": "^29.5.0",
76
77
  "reflect-metadata": "^0.1.13",
77
78
  "winston": "^3.8.2",
78
79
  "winston-daily-rotate-file": "^4.7.1"
@@ -82,7 +83,6 @@
82
83
  "@commitlint/config-conventional": "^17.7.0",
83
84
  "@release-it/conventional-changelog": "^7.0.1",
84
85
  "@types/express": "^4.17.17",
85
- "@types/jest": "^29.5.0",
86
86
  "@types/node": "^20.4.9",
87
87
  "@typescript-eslint/eslint-plugin": "^6.6.0",
88
88
  "@typescript-eslint/parser": "^6.6.0",
@@ -92,7 +92,9 @@
92
92
  "prettier": "3.0.3",
93
93
  "release-it": "^16.1.5",
94
94
  "ts-jest": "^29.0.5",
95
- "typescript": "^5.0.3"
95
+ "typescript": "^5.0.3",
96
+ "vite": "4.4.9",
97
+ "vitest": "0.34.3"
96
98
  },
97
99
  "release-it": {
98
100
  "git": {