@rsdk/core 5.7.0-next.2 → 6.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/dist/config/index.d.ts +0 -1
  2. package/dist/config/index.js +0 -1
  3. package/dist/config/index.js.map +1 -1
  4. package/dist/config/metadata/decorators/declare-property.decorator.d.ts +2 -1
  5. package/dist/config/metadata/decorators/declare-property.decorator.js.map +1 -1
  6. package/dist/config/metadata/decorators/property.decorator.d.ts +2 -1
  7. package/dist/config/metadata/decorators/property.decorator.js.map +1 -1
  8. package/dist/config/sources/implementations/json-file.source.js +1 -2
  9. package/dist/config/sources/implementations/json-file.source.js.map +1 -1
  10. package/dist/config/sources/implementations/relodable-json-file.source.js +1 -2
  11. package/dist/config/sources/implementations/relodable-json-file.source.js.map +1 -1
  12. package/dist/config/types.d.ts +1 -20
  13. package/dist/config/types.js.map +1 -1
  14. package/dist/exceptions.handling/default.formatter.d.ts +6 -0
  15. package/dist/exceptions.handling/default.formatter.js +12 -0
  16. package/dist/exceptions.handling/default.formatter.js.map +1 -0
  17. package/dist/exceptions.handling/default.sender.d.ts +8 -0
  18. package/dist/exceptions.handling/default.sender.js +13 -0
  19. package/dist/exceptions.handling/default.sender.js.map +1 -0
  20. package/dist/exceptions.handling/global-exceptions.config.js +1 -1
  21. package/dist/exceptions.handling/global-exceptions.config.js.map +1 -1
  22. package/dist/exceptions.handling/global-exceptions.filter.d.ts +8 -11
  23. package/dist/exceptions.handling/global-exceptions.filter.js +38 -56
  24. package/dist/exceptions.handling/global-exceptions.filter.js.map +1 -1
  25. package/dist/exceptions.handling/global-exceptions.interceptor.d.ts +18 -0
  26. package/dist/exceptions.handling/global-exceptions.interceptor.js +57 -0
  27. package/dist/exceptions.handling/global-exceptions.interceptor.js.map +1 -0
  28. package/dist/exceptions.handling/global-exceptions.module.d.ts +2 -23
  29. package/dist/exceptions.handling/global-exceptions.module.js +38 -3
  30. package/dist/exceptions.handling/global-exceptions.module.js.map +1 -1
  31. package/dist/exceptions.handling/types.d.ts +2 -2
  32. package/dist/index.d.ts +31 -2
  33. package/dist/index.js +34 -1
  34. package/dist/index.js.map +1 -1
  35. package/dist/logging/constants.d.ts +1 -0
  36. package/dist/logging/constants.js +5 -0
  37. package/dist/logging/constants.js.map +1 -0
  38. package/dist/logging/decorators/inject-logger.decorator.js +2 -2
  39. package/dist/logging/decorators/inject-logger.decorator.js.map +1 -1
  40. package/dist/logging/formatters/default.formatter.d.ts +7 -0
  41. package/dist/logging/formatters/default.formatter.js +17 -0
  42. package/dist/logging/formatters/default.formatter.js.map +1 -0
  43. package/dist/logging/formatters/index.d.ts +2 -0
  44. package/dist/{config/parsers/array → logging/formatters}/index.js +2 -1
  45. package/dist/logging/formatters/index.js.map +1 -0
  46. package/dist/logging/formatters/interfaces.d.ts +23 -0
  47. package/dist/logging/formatters/interfaces.js +3 -0
  48. package/dist/logging/formatters/interfaces.js.map +1 -0
  49. package/dist/logging/index.d.ts +3 -2
  50. package/dist/logging/index.js +6 -4
  51. package/dist/logging/index.js.map +1 -1
  52. package/dist/logging/logging-core.module.d.ts +10 -0
  53. package/dist/logging/{logger-initializing.module.js → logging-core.module.js} +46 -10
  54. package/dist/logging/logging-core.module.js.map +1 -0
  55. package/dist/logging/{logging.module.d.ts → logging-instances.module.d.ts} +1 -1
  56. package/dist/logging/{logging.module.js → logging-instances.module.js} +8 -9
  57. package/dist/logging/logging-instances.module.js.map +1 -0
  58. package/dist/logging/logging.config.d.ts +3 -0
  59. package/dist/logging/logging.config.js +29 -4
  60. package/dist/logging/logging.config.js.map +1 -1
  61. package/dist/logging/logging.interceptor.d.ts +37 -0
  62. package/dist/logging/logging.interceptor.js +124 -0
  63. package/dist/logging/logging.interceptor.js.map +1 -0
  64. package/dist/metrics/metrics.config.js +3 -2
  65. package/dist/metrics/metrics.config.js.map +1 -1
  66. package/dist/platform.context.d.ts +1 -1
  67. package/dist/platform.context.js +3 -2
  68. package/dist/platform.context.js.map +1 -1
  69. package/dist/platform.module.js +19 -6
  70. package/dist/platform.module.js.map +1 -1
  71. package/dist/tracing/constants.d.ts +4 -5
  72. package/dist/tracing/constants.js +9 -7
  73. package/dist/tracing/constants.js.map +1 -1
  74. package/dist/tracing/index.d.ts +1 -0
  75. package/dist/tracing/index.js +1 -0
  76. package/dist/tracing/index.js.map +1 -1
  77. package/dist/tracing/request-id/index.d.ts +4 -0
  78. package/dist/{config/parsers/enum → tracing/request-id}/index.js +4 -1
  79. package/dist/tracing/request-id/index.js.map +1 -0
  80. package/dist/tracing/request-id/metadata.helpers.d.ts +13 -0
  81. package/dist/tracing/request-id/metadata.helpers.js +23 -0
  82. package/dist/tracing/request-id/metadata.helpers.js.map +1 -0
  83. package/dist/tracing/request-id/request-id-gen.decorator.d.ts +8 -0
  84. package/dist/tracing/request-id/request-id-gen.decorator.js +17 -0
  85. package/dist/tracing/request-id/request-id-gen.decorator.js.map +1 -0
  86. package/dist/tracing/request-id/types.d.ts +2 -0
  87. package/dist/tracing/request-id/types.js +3 -0
  88. package/dist/tracing/request-id/types.js.map +1 -0
  89. package/dist/tracing/request-id/with-prefix.fn.d.ts +30 -0
  90. package/dist/tracing/request-id/with-prefix.fn.js +36 -0
  91. package/dist/tracing/request-id/with-prefix.fn.js.map +1 -0
  92. package/dist/tracing/tracing.config.d.ts +5 -0
  93. package/dist/tracing/tracing.config.js +42 -0
  94. package/dist/tracing/tracing.config.js.map +1 -0
  95. package/dist/tracing/tracing.interceptor.d.ts +7 -9
  96. package/dist/tracing/tracing.interceptor.js +30 -28
  97. package/dist/tracing/tracing.interceptor.js.map +1 -1
  98. package/dist/tracing/tracing.module.d.ts +13 -2
  99. package/dist/tracing/tracing.module.js +60 -17
  100. package/dist/tracing/tracing.module.js.map +1 -1
  101. package/dist/transport/protocol.detector.d.ts +1 -1
  102. package/dist/transport/protocol.detector.js +17 -2
  103. package/dist/transport/protocol.detector.js.map +1 -1
  104. package/dist/transport/transport.module.d.ts +0 -1
  105. package/dist/transport/transport.module.js +0 -20
  106. package/dist/transport/transport.module.js.map +1 -1
  107. package/dist/types/plugins.d.ts +2 -15
  108. package/dist/types/plugins.js.map +1 -1
  109. package/dist/types/transports.d.ts +23 -13
  110. package/dist/types/transports.js.map +1 -1
  111. package/dist/unhandled-rejection.handler.js +8 -13
  112. package/dist/unhandled-rejection.handler.js.map +1 -1
  113. package/package.json +3 -2
  114. package/src/config/index.ts +0 -1
  115. package/src/config/metadata/decorators/declare-property.decorator.ts +3 -1
  116. package/src/config/metadata/decorators/property.decorator.ts +3 -5
  117. package/src/config/sources/implementations/json-file.source.ts +1 -2
  118. package/src/config/sources/implementations/relodable-json-file.source.ts +1 -2
  119. package/src/config/types.ts +2 -23
  120. package/src/exceptions.handling/default.formatter.ts +11 -0
  121. package/src/exceptions.handling/default.sender.ts +15 -0
  122. package/src/exceptions.handling/global-exceptions.config.ts +2 -2
  123. package/src/exceptions.handling/global-exceptions.filter.ts +45 -77
  124. package/src/exceptions.handling/global-exceptions.interceptor.ts +57 -0
  125. package/src/exceptions.handling/global-exceptions.module.ts +46 -33
  126. package/src/exceptions.handling/types.ts +2 -2
  127. package/src/index.ts +53 -2
  128. package/src/logging/constants.ts +1 -0
  129. package/src/logging/decorators/inject-logger.decorator.ts +2 -2
  130. package/src/logging/formatters/default.formatter.ts +17 -0
  131. package/src/logging/formatters/index.ts +2 -0
  132. package/src/logging/formatters/interfaces.ts +34 -0
  133. package/src/logging/index.ts +3 -2
  134. package/src/logging/logging-core.module.ts +102 -0
  135. package/src/logging/{logging.module.ts → logging-instances.module.ts} +2 -4
  136. package/src/logging/logging.config.ts +22 -6
  137. package/src/logging/logging.interceptor.ts +138 -0
  138. package/src/metrics/metrics.config.ts +3 -1
  139. package/src/platform.context.ts +5 -2
  140. package/src/platform.module.ts +28 -7
  141. package/src/tracing/constants.ts +8 -7
  142. package/src/tracing/index.ts +1 -0
  143. package/src/tracing/request-id/index.ts +4 -0
  144. package/src/tracing/request-id/metadata.helpers.ts +24 -0
  145. package/src/tracing/request-id/request-id-gen.decorator.ts +16 -0
  146. package/src/tracing/request-id/types.ts +6 -0
  147. package/src/tracing/request-id/with-prefix.fn.ts +44 -0
  148. package/src/tracing/tracing.config.ts +23 -0
  149. package/src/tracing/tracing.interceptor.ts +36 -31
  150. package/src/tracing/tracing.module.ts +68 -19
  151. package/src/transport/protocol.detector.ts +24 -4
  152. package/src/transport/transport.module.ts +0 -25
  153. package/src/types/plugins.ts +11 -22
  154. package/src/types/transports.ts +32 -16
  155. package/src/unhandled-rejection.handler.ts +10 -18
  156. package/test/logging.interceptor.spec.ts +292 -0
  157. package/dist/config/parsers/array/array.parser.d.ts +0 -11
  158. package/dist/config/parsers/array/array.parser.js +0 -33
  159. package/dist/config/parsers/array/array.parser.js.map +0 -1
  160. package/dist/config/parsers/array/index.d.ts +0 -1
  161. package/dist/config/parsers/array/index.js.map +0 -1
  162. package/dist/config/parsers/boolean/bool.parser.d.ts +0 -6
  163. package/dist/config/parsers/boolean/bool.parser.js +0 -20
  164. package/dist/config/parsers/boolean/bool.parser.js.map +0 -1
  165. package/dist/config/parsers/boolean/index.d.ts +0 -1
  166. package/dist/config/parsers/boolean/index.js +0 -18
  167. package/dist/config/parsers/boolean/index.js.map +0 -1
  168. package/dist/config/parsers/enum/enum.parser.d.ts +0 -9
  169. package/dist/config/parsers/enum/enum.parser.js +0 -24
  170. package/dist/config/parsers/enum/enum.parser.js.map +0 -1
  171. package/dist/config/parsers/enum/index.d.ts +0 -1
  172. package/dist/config/parsers/enum/index.js.map +0 -1
  173. package/dist/config/parsers/index.d.ts +0 -11
  174. package/dist/config/parsers/index.js +0 -28
  175. package/dist/config/parsers/index.js.map +0 -1
  176. package/dist/config/parsers/int/index.d.ts +0 -1
  177. package/dist/config/parsers/int/index.js +0 -18
  178. package/dist/config/parsers/int/index.js.map +0 -1
  179. package/dist/config/parsers/int/int.parser.d.ts +0 -6
  180. package/dist/config/parsers/int/int.parser.js +0 -20
  181. package/dist/config/parsers/int/int.parser.js.map +0 -1
  182. package/dist/config/parsers/json/index.d.ts +0 -1
  183. package/dist/config/parsers/json/index.js +0 -18
  184. package/dist/config/parsers/json/index.js.map +0 -1
  185. package/dist/config/parsers/json/json.parser.d.ts +0 -6
  186. package/dist/config/parsers/json/json.parser.js +0 -16
  187. package/dist/config/parsers/json/json.parser.js.map +0 -1
  188. package/dist/config/parsers/number/index.d.ts +0 -1
  189. package/dist/config/parsers/number/index.js +0 -18
  190. package/dist/config/parsers/number/index.js.map +0 -1
  191. package/dist/config/parsers/number/number.parser.d.ts +0 -6
  192. package/dist/config/parsers/number/number.parser.js +0 -23
  193. package/dist/config/parsers/number/number.parser.js.map +0 -1
  194. package/dist/config/parsers/path/fspath.parser.d.ts +0 -8
  195. package/dist/config/parsers/path/fspath.parser.js +0 -59
  196. package/dist/config/parsers/path/fspath.parser.js.map +0 -1
  197. package/dist/config/parsers/path/index.d.ts +0 -1
  198. package/dist/config/parsers/path/index.js +0 -18
  199. package/dist/config/parsers/path/index.js.map +0 -1
  200. package/dist/config/parsers/size/index.d.ts +0 -1
  201. package/dist/config/parsers/size/index.js +0 -18
  202. package/dist/config/parsers/size/index.js.map +0 -1
  203. package/dist/config/parsers/size/size.parser.d.ts +0 -7
  204. package/dist/config/parsers/size/size.parser.js +0 -21
  205. package/dist/config/parsers/size/size.parser.js.map +0 -1
  206. package/dist/config/parsers/string/index.d.ts +0 -1
  207. package/dist/config/parsers/string/index.js +0 -18
  208. package/dist/config/parsers/string/index.js.map +0 -1
  209. package/dist/config/parsers/string/string.parser.d.ts +0 -8
  210. package/dist/config/parsers/string/string.parser.js +0 -29
  211. package/dist/config/parsers/string/string.parser.js.map +0 -1
  212. package/dist/config/parsers/timespan/index.d.ts +0 -1
  213. package/dist/config/parsers/timespan/index.js +0 -18
  214. package/dist/config/parsers/timespan/index.js.map +0 -1
  215. package/dist/config/parsers/timespan/timespan.parser.d.ts +0 -7
  216. package/dist/config/parsers/timespan/timespan.parser.js +0 -21
  217. package/dist/config/parsers/timespan/timespan.parser.js.map +0 -1
  218. package/dist/config/parsers/url/exception.d.ts +0 -7
  219. package/dist/config/parsers/url/exception.js +0 -25
  220. package/dist/config/parsers/url/exception.js.map +0 -1
  221. package/dist/config/parsers/url/index.d.ts +0 -2
  222. package/dist/config/parsers/url/index.js +0 -21
  223. package/dist/config/parsers/url/index.js.map +0 -1
  224. package/dist/config/parsers/url/url.parser.d.ts +0 -9
  225. package/dist/config/parsers/url/url.parser.js +0 -38
  226. package/dist/config/parsers/url/url.parser.js.map +0 -1
  227. package/dist/logging/logger-initializing.module.d.ts +0 -6
  228. package/dist/logging/logger-initializing.module.js.map +0 -1
  229. package/dist/logging/logging.module.js.map +0 -1
  230. package/src/config/parsers/array/array.parser.ts +0 -34
  231. package/src/config/parsers/array/index.ts +0 -1
  232. package/src/config/parsers/boolean/bool.parser.ts +0 -20
  233. package/src/config/parsers/boolean/bool.spec.ts +0 -4
  234. package/src/config/parsers/boolean/index.ts +0 -1
  235. package/src/config/parsers/enum/enum.parser.ts +0 -23
  236. package/src/config/parsers/enum/enum.spec.ts +0 -5
  237. package/src/config/parsers/enum/index.ts +0 -1
  238. package/src/config/parsers/index.ts +0 -11
  239. package/src/config/parsers/int/index.ts +0 -1
  240. package/src/config/parsers/int/int.parser.ts +0 -20
  241. package/src/config/parsers/int/int.spec.ts +0 -5
  242. package/src/config/parsers/json/index.ts +0 -1
  243. package/src/config/parsers/json/json.parser.ts +0 -15
  244. package/src/config/parsers/number/index.ts +0 -1
  245. package/src/config/parsers/number/number.parser.ts +0 -23
  246. package/src/config/parsers/number/number.spec.ts +0 -5
  247. package/src/config/parsers/path/fspath.parser.ts +0 -64
  248. package/src/config/parsers/path/index.ts +0 -1
  249. package/src/config/parsers/size/index.ts +0 -1
  250. package/src/config/parsers/size/size.parser.ts +0 -22
  251. package/src/config/parsers/size/size.spec.ts +0 -4
  252. package/src/config/parsers/string/index.ts +0 -1
  253. package/src/config/parsers/string/string.parser.ts +0 -26
  254. package/src/config/parsers/string/string.spec.ts +0 -10
  255. package/src/config/parsers/timespan/index.ts +0 -1
  256. package/src/config/parsers/timespan/timespan.parser.ts +0 -22
  257. package/src/config/parsers/timespan/timespan.spec.ts +0 -5
  258. package/src/config/parsers/url/exception.ts +0 -21
  259. package/src/config/parsers/url/index.ts +0 -2
  260. package/src/config/parsers/url/url.parser.ts +0 -44
  261. package/src/logging/logger-initializing.module.ts +0 -55
@@ -1,4 +1,3 @@
1
- export * from './parsers';
2
1
  export * from './config.module';
3
2
  export * from './sources';
4
3
  export * from './config.abstract';
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.ConfigContext = exports.ConfigPropertyMetadataNotFound = exports.AdditionalSourceModule = void 0;
18
- __exportStar(require("./parsers"), exports);
19
18
  __exportStar(require("./config.module"), exports);
20
19
  __exportStar(require("./sources"), exports);
21
20
  __exportStar(require("./config.abstract"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,kDAAgC;AAChC,4CAA0B;AAC1B,oDAAkC;AAClC,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,yFAAsF;AAA7E,kIAAA,sBAAsB,OAAA;AAE/B,2CAA8D;AAArD,4HAAA,8BAA8B,OAAA;AACvC,2DAAyD;AAAhD,+GAAA,aAAa,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,4CAA0B;AAC1B,oDAAkC;AAClC,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,yFAAsF;AAA7E,kIAAA,sBAAsB,OAAA;AAE/B,2CAA8D;AAArD,4HAAA,8BAA8B,OAAA;AACvC,2DAAyD;AAAhD,+GAAA,aAAa,OAAA"}
@@ -1,4 +1,5 @@
1
- import type { PropertyOptions, PropertyParser } from '../../types';
1
+ import type { PropertyParser } from '@rsdk/common';
2
+ import type { PropertyOptions } from '../../types';
2
3
  /**
3
4
  * Declares standalone property. Properties declared in this way,
4
5
  * can be injected with @InjectProperty() decorator.
@@ -1 +1 @@
1
- {"version":3,"file":"declare-property.decorator.js","sourceRoot":"","sources":["../../../../src/config/metadata/decorators/declare-property.decorator.ts"],"names":[],"mappings":";;;AACA,0EAAqE;AAErE;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,eAAe,GAAG,CAC7B,KAAa,EACb,MAAyB,EACzB,OAA2B,EACX,EAAE;IAClB,OAAO,UAAU,MAAM;QACrB,iDAAsB,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE;YACrD,aAAa,EAAE,IAAI;YACnB,GAAG,OAAO;YACV,GAAG,EAAE,KAAK;YACV,MAAM;SACP,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,eAAe,mBAa1B"}
1
+ {"version":3,"file":"declare-property.decorator.js","sourceRoot":"","sources":["../../../../src/config/metadata/decorators/declare-property.decorator.ts"],"names":[],"mappings":";;;AAGA,0EAAqE;AAErE;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,eAAe,GAAG,CAC7B,KAAa,EACb,MAAyB,EACzB,OAA2B,EACX,EAAE;IAClB,OAAO,UAAU,MAAM;QACrB,iDAAsB,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE;YACrD,aAAa,EAAE,IAAI;YACnB,GAAG,OAAO;YACV,GAAG,EAAE,KAAK;YACV,MAAM;SACP,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,eAAe,mBAa1B"}
@@ -1,4 +1,5 @@
1
- import type { PropertyOptions, PropertyParser } from '../../types';
1
+ import type { PropertyParser } from '@rsdk/common';
2
+ import type { PropertyOptions } from '../../types';
2
3
  export declare const CONFIG_METADATA_KEY = "CONFIG_METADATA";
3
4
  /**
4
5
  * Sets metadata that will be used to populate the field
@@ -1 +1 @@
1
- {"version":3,"file":"property.decorator.js","sourceRoot":"","sources":["../../../../src/config/metadata/decorators/property.decorator.ts"],"names":[],"mappings":";;;AAMa,QAAA,mBAAmB,GAAG,iBAAiB,CAAC;AAErD;;;;;;;;GAQG;AACI,MAAM,QAAQ,GAAG,CACtB,GAAW,EACX,MAAyB,EACzB,OAA2B,EACsB,EAAE,CACnD,UAAU,MAAc,EAAE,WAAmB;IAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;IAEhC,MAAM,QAAQ,GAAI,OAAO,CAAC,WAAW,CACnC,2BAAmB,EACnB,IAAI,CACe,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IAE5C,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG;QACjC,aAAa,EAAE,KAAK;QACpB,GAAG;QACH,MAAM;QACN,GAAG,OAAO;KACX,CAAC;IAEF,OAAO,CAAC,cAAc,CAAC,2BAAmB,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC9D,CAAC,CAAC;AArBS,QAAA,QAAQ,YAqBjB;AAEJ,6GAA6G"}
1
+ {"version":3,"file":"property.decorator.js","sourceRoot":"","sources":["../../../../src/config/metadata/decorators/property.decorator.ts"],"names":[],"mappings":";;;AAIa,QAAA,mBAAmB,GAAG,iBAAiB,CAAC;AAErD;;;;;;;;GAQG;AACI,MAAM,QAAQ,GAAG,CACtB,GAAW,EACX,MAAyB,EACzB,OAA2B,EACsB,EAAE,CACnD,UAAU,MAAc,EAAE,WAAmB;IAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;IAEhC,MAAM,QAAQ,GAAI,OAAO,CAAC,WAAW,CACnC,2BAAmB,EACnB,IAAI,CACe,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IAE5C,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG;QACjC,aAAa,EAAE,KAAK;QACpB,GAAG;QACH,MAAM;QACN,GAAG,OAAO;KACX,CAAC;IAEF,OAAO,CAAC,cAAc,CAAC,2BAAmB,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC9D,CAAC,CAAC;AArBS,QAAA,QAAQ,YAqBjB;AAEJ,6GAA6G"}
@@ -15,7 +15,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.StaticFileSource = void 0;
16
16
  const common_node_1 = require("@rsdk/common.node");
17
17
  const metadata_1 = require("../../metadata");
18
- const parsers_1 = require("../../parsers");
19
18
  const base_1 = require("../base");
20
19
  const config_source_decorator_1 = require("../config-source.decorator");
21
20
  let StaticFileSource = class StaticFileSource extends base_1.ConfigSource {
@@ -37,7 +36,7 @@ let StaticFileSource = class StaticFileSource extends base_1.ConfigSource {
37
36
  exports.StaticFileSource = StaticFileSource;
38
37
  exports.StaticFileSource = StaticFileSource = __decorate([
39
38
  (0, config_source_decorator_1.Source)('static'),
40
- (0, metadata_1.DeclareProperty)(`CONFIG_PATH`, new parsers_1.FsPathParser('file'), {
39
+ (0, metadata_1.DeclareProperty)(`CONFIG_PATH`, new common_node_1.FsPathParser('file'), {
41
40
  description: 'Path to some configuration file',
42
41
  }),
43
42
  __param(0, (0, metadata_1.InjectProperty)('CONFIG_PATH')),
@@ -1 +1 @@
1
- {"version":3,"file":"json-file.source.js","sourceRoot":"","sources":["../../../../src/config/sources/implementations/json-file.source.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAA4C;AAE5C,6CAAiE;AACjE,2CAA6C;AAE7C,kCAAuC;AACvC,wEAAoD;AAM7C,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,mBAAY;IACY;IAA5D,YAA4D,IAAY;QACtE,KAAK,EAAE,CAAC;QADkD,SAAI,GAAJ,IAAI,CAAQ;IAExE,CAAC;IAEQ,IAAI;QACX,OAAO,QA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A;;GAD/B,gBAAgB,CAgB5B"}
@@ -18,7 +18,6 @@ const common_node_1 = require("@rsdk/common.node");
18
18
  const logging_1 = require("@rsdk/logging");
19
19
  const node_fs_1 = require("node:fs");
20
20
  const metadata_1 = require("../../metadata");
21
- const parsers_1 = require("../../parsers");
22
21
  const reload_1 = require("../../reload");
23
22
  const base_1 = require("../base");
24
23
  const config_source_decorator_1 = require("../config-source.decorator");
@@ -47,7 +46,7 @@ let ReloadableFileSource = ReloadableFileSource_1 = class ReloadableFileSource e
47
46
  exports.ReloadableFileSource = ReloadableFileSource;
48
47
  exports.ReloadableFileSource = ReloadableFileSource = ReloadableFileSource_1 = __decorate([
49
48
  (0, config_source_decorator_1.Source)('reloadable'),
50
- (0, metadata_1.DeclareProperty)('CONFIG_PATH', new parsers_1.FsPathParser('file'), {
49
+ (0, metadata_1.DeclareProperty)('CONFIG_PATH', new common_node_1.FsPathParser('file'), {
51
50
  description: 'Path to some configuration file',
52
51
  }),
53
52
  __param(0, (0, metadata_1.InjectProperty)('CONFIG_PATH')),
@@ -1 +1 @@
1
- {"version":3,"file":"relodable-json-file.source.js","sourceRoot":"","sources":["../../../../src/config/sources/implementations/relodable-json-file.source.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAA4C;AAC5C,2CAA8C;AAC9C,qCAAgC;AAEhC,6CAAiE;AACjE,2CAA6C;AAC7C,yCAA4C;AAC5C,kCAAiD;AACjD,wEAAoD;AAM7C,IAAM,oBAAoB,4BAA1B,MAAM,oBAAqB,SAAQ,6BAAsB;IAEZ;IADlD,YACkD,IAAY,EAC5D,YAA0B;QAE1B,KAAK,CAAC,uBAAa,CAAC,MAAM,CAAC,sBAAoB,CAAC,EAAE,YAAY,CAAC,CAAC;QAHhB,SAAI,GAAJ,IAAI,CAAQ;IAI9D,CAAC;IAEQ,IAAI;QACX,OAAO,uBAAuB,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5C,CAAC;IAEQ,OAAO;QACd,OAAO,IAAA,qBAAO,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAEQ,IAAI;QACX,IAAA,eAAK,EAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;YACzB,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACvB,OAAO;YACT,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YAE5D,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA3BY,oDAAoB;+BAApB,oBAAoB;IAJhC,IAAA,gCAAM,EAAC,YAAY,CAAC;IACpB,IAAA,0BAAe,EAAC,aAAa,EAAE,IAAI,sBAAY,CAAC,MAAM,CAAC,EAAE;QACxD,WAAW,EAAE,iCAAiC;KAC/C,CAAC;IAGG,WAAA,IAAA,yBAAc,EAAC,aAAa,CAAC,CAAA;6CAChB,qBAAY;GAHjB,oBAAoB,CA2BhC"}
1
+ {"version":3,"file":"relodable-json-file.source.js","sourceRoot":"","sources":["../../../../src/config/sources/implementations/relodable-json-file.source.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAA0D;AAC1D,2CAA8C;AAC9C,qCAAgC;AAEhC,6CAAiE;AACjE,yCAA4C;AAC5C,kCAAiD;AACjD,wEAAoD;AAM7C,IAAM,oBAAoB,4BAA1B,MAAM,oBAAqB,SAAQ,6BAAsB;IAEZ;IADlD,YACkD,IAAY,EAC5D,YAA0B;QAE1B,KAAK,CAAC,uBAAa,CAAC,MAAM,CAAC,sBAAoB,CAAC,EAAE,YAAY,CAAC,CAAC;QAHhB,SAAI,GAAJ,IAAI,CAAQ;IAI9D,CAAC;IAEQ,IAAI;QACX,OAAO,uBAAuB,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5C,CAAC;IAEQ,OAAO;QACd,OAAO,IAAA,qBAAO,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAEQ,IAAI;QACX,IAAA,eAAK,EAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;YACzB,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACvB,OAAO;YACT,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YAE5D,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA3BY,oDAAoB;+BAApB,oBAAoB;IAJhC,IAAA,gCAAM,EAAC,YAAY,CAAC;IACpB,IAAA,0BAAe,EAAC,aAAa,EAAE,IAAI,0BAAY,CAAC,MAAM,CAAC,EAAE;QACxD,WAAW,EAAE,iCAAiC;KAC/C,CAAC;IAGG,WAAA,IAAA,yBAAc,EAAC,aAAa,CAAC,CAAA;6CAChB,qBAAY;GAHjB,oBAAoB,CA2BhC"}
@@ -1,3 +1,4 @@
1
+ import type { PropertyParser } from '@rsdk/common';
1
2
  export type SourceType = 'static' | 'reloadable';
2
3
  export interface Changes {
3
4
  createdKeys: string[];
@@ -44,26 +45,6 @@ export interface ParserMetadata {
44
45
  type: string;
45
46
  description: string;
46
47
  }
47
- /**
48
- * Implement this interface to create more parsers.
49
- * For example: email, BigInt, guid etc.
50
- *
51
- * NOTE: In other modules it is more common to define metadata
52
- * via decorators. But this case is a bit different.
53
- *
54
- * 1. Parser implementations can have constructors with parameters
55
- * which will affect it's behaviour. It's will be nice to have it
56
- * in metadata, and decorators won't provide this.
57
- *
58
- * 2. Metadata will be extracted via type() and description() methods
59
- * mostly during decorator factories (such as @Property()) code is
60
- * executed. Thus output **can** be used in autodoc
61
- */
62
- export interface PropertyParser<T = any> {
63
- type(): string;
64
- description(): string;
65
- parse(value: unknown): T;
66
- }
67
48
  export type RawValues = Map<string, unknown>;
68
49
  export declare enum AppNameStrategyType {
69
50
  LEGACY = "LEGACY",
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":";;;AAiFA,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,wCAAiB,CAAA;IACjB,4CAAqB,CAAA;AACvB,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":";;;AA4DA,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,wCAAiB,CAAA;IACjB,4CAAqB,CAAA;AACvB,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B"}
@@ -0,0 +1,6 @@
1
+ import type { IErrorsFormatter } from './types';
2
+ export declare class DefaultFormatter implements IErrorsFormatter {
3
+ readonly protocol = "default";
4
+ format(ex: unknown, verbose: boolean): unknown;
5
+ }
6
+ export declare const DEFAULT_FORMATTER: DefaultFormatter;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_FORMATTER = exports.DefaultFormatter = void 0;
4
+ class DefaultFormatter {
5
+ protocol = 'default';
6
+ format(ex, verbose) {
7
+ return verbose ? ex : { message: 'NO FORMATTER' };
8
+ }
9
+ }
10
+ exports.DefaultFormatter = DefaultFormatter;
11
+ exports.DEFAULT_FORMATTER = new DefaultFormatter();
12
+ //# sourceMappingURL=default.formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.formatter.js","sourceRoot":"","sources":["../../src/exceptions.handling/default.formatter.ts"],"names":[],"mappings":";;;AAEA,MAAa,gBAAgB;IAClB,QAAQ,GAAG,SAAS,CAAC;IAE9B,MAAM,CAAC,EAAW,EAAE,OAAgB;QAClC,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IACpD,CAAC;CACF;AAND,4CAMC;AAEY,QAAA,iBAAiB,GAAG,IAAI,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ArgumentsHost } from '@nestjs/common';
2
+ import type { Observable } from 'rxjs';
3
+ import type { IErrorsSender } from './types';
4
+ export declare class DefaultSender implements IErrorsSender {
5
+ readonly protocol = "default";
6
+ send(_: ArgumentsHost, ex: unknown): Observable<any>;
7
+ }
8
+ export declare const DEFAULT_SENDER: DefaultSender;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_SENDER = exports.DefaultSender = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ class DefaultSender {
6
+ protocol = 'default';
7
+ send(_, ex) {
8
+ return (0, rxjs_1.throwError)(() => ex);
9
+ }
10
+ }
11
+ exports.DefaultSender = DefaultSender;
12
+ exports.DEFAULT_SENDER = new DefaultSender();
13
+ //# sourceMappingURL=default.sender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.sender.js","sourceRoot":"","sources":["../../src/exceptions.handling/default.sender.ts"],"names":[],"mappings":";;;AAEA,+BAAkC;AAIlC,MAAa,aAAa;IACf,QAAQ,GAAG,SAAS,CAAC;IAE9B,IAAI,CAAC,CAAgB,EAAE,EAAW;QAChC,OAAO,IAAA,iBAAU,EAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;CACF;AAND,sCAMC;AAEY,QAAA,cAAc,GAAG,IAAI,aAAa,EAAE,CAAC"}
@@ -18,7 +18,7 @@ let GlobalExceptionsConfig = class GlobalExceptionsConfig extends config_1.Confi
18
18
  };
19
19
  exports.GlobalExceptionsConfig = GlobalExceptionsConfig;
20
20
  __decorate([
21
- (0, config_1.Property)('VERBOSE_ERRORS', new config_1.BoolParser(), {
21
+ (0, config_1.Property)('VERBOSE_ERRORS', new common_1.BoolParser(), {
22
22
  defaultValue: true,
23
23
  description: (0, common_1.text) `
24
24
  If set "true" all exception messages will be returned to client.
@@ -1 +1 @@
1
- {"version":3,"file":"global-exceptions.config.js","sourceRoot":"","sources":["../../src/exceptions.handling/global-exceptions.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAoC;AAEpC,sCAAwE;AACxE,yDAAmD;AAK5C,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,eAAM;IAQvC,OAAO,CAAW;CAC5B,CAAA;AATY,wDAAsB;AAQxB;IAPR,IAAA,iBAAQ,EAAC,gBAAgB,EAAE,IAAI,mBAAU,EAAE,EAAE;QAC5C,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,IAAA,aAAI,EAAA;;;KAGhB;KACF,CAAC;;uDACyB;iCARhB,sBAAsB;IAHlC,IAAA,sBAAa,EAAC;QACb,IAAI,EAAE,CAAC,wBAAS,CAAC,cAAc,EAAE,wBAAS,CAAC,aAAa,CAAC;KAC1D,CAAC;GACW,sBAAsB,CASlC"}
1
+ {"version":3,"file":"global-exceptions.config.js","sourceRoot":"","sources":["../../src/exceptions.handling/global-exceptions.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAgD;AAEhD,sCAA4D;AAC5D,yDAAmD;AAK5C,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,eAAM;IAQvC,OAAO,CAAW;CAC5B,CAAA;AATY,wDAAsB;AAQxB;IAPR,IAAA,iBAAQ,EAAC,gBAAgB,EAAE,IAAI,mBAAU,EAAE,EAAE;QAC5C,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,IAAA,aAAI,EAAA;;;KAGhB;KACF,CAAC;;uDACyB;iCARhB,sBAAsB;IAHlC,IAAA,sBAAa,EAAC;QACb,IAAI,EAAE,CAAC,wBAAS,CAAC,cAAc,EAAE,wBAAS,CAAC,aAAa,CAAC;KAC1D,CAAC;GACW,sBAAsB,CASlC"}
@@ -1,21 +1,18 @@
1
1
  import type { ArgumentsHost, ExceptionFilter } from '@nestjs/common';
2
- import { ILogger } from '@rsdk/logging';
3
2
  import type { Observable } from 'rxjs';
3
+ import { PipelineException } from '../exceptions';
4
+ import { ILogger } from '../logging';
4
5
  import { ProtocolDetector } from '../transport/protocol.detector';
5
6
  import { GlobalExceptionsConfig } from './global-exceptions.config';
6
- import type { IErrorsFormatter, IErrorsSender, IErrorsTransformer } from './types';
7
+ import type { IErrorsFormatter, IErrorsSender } from './types';
7
8
  export declare class GlobalExceptionsFilter implements ExceptionFilter {
8
- private readonly formatters;
9
- private readonly transformers;
10
9
  private readonly senders;
10
+ private readonly formatters;
11
11
  private readonly logger;
12
- private readonly config;
13
12
  private readonly detector;
14
- constructor(formatters: IErrorsFormatter[], transformers: IErrorsTransformer[], senders: IErrorsSender[], logger: ILogger, config: GlobalExceptionsConfig, detector: ProtocolDetector);
15
- catch(ex: any, host: ArgumentsHost): Observable<any>;
16
- private transform;
17
- private format;
18
- private getFormatter;
19
- private send;
13
+ private readonly config;
14
+ constructor(senders: Map<string, IErrorsSender>, formatters: Map<string, IErrorsFormatter>, logger: ILogger, detector: ProtocolDetector, config: GlobalExceptionsConfig);
15
+ catch(ex: PipelineException, host: ArgumentsHost): Observable<any>;
20
16
  private getSender;
17
+ private getFormatter;
21
18
  }
@@ -15,85 +15,67 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.GlobalExceptionsFilter = void 0;
16
16
  const common_1 = require("@nestjs/common");
17
17
  const common_2 = require("@rsdk/common");
18
- const rxjs_1 = require("rxjs");
19
- const exceptions_1 = require("../exceptions");
20
18
  const logging_1 = require("../logging");
21
19
  const protocol_detector_1 = require("../transport/protocol.detector");
22
20
  const constants_1 = require("./constants");
21
+ const default_formatter_1 = require("./default.formatter");
22
+ const default_sender_1 = require("./default.sender");
23
23
  const global_exceptions_config_1 = require("./global-exceptions.config");
24
24
  let GlobalExceptionsFilter = class GlobalExceptionsFilter {
25
- formatters;
26
- transformers;
27
25
  senders;
26
+ formatters;
28
27
  logger;
29
- config;
30
28
  detector;
31
- constructor(formatters, transformers, senders, logger, config, detector) {
32
- this.formatters = formatters;
33
- this.transformers = transformers;
29
+ config;
30
+ constructor(senders, formatters, logger, detector, config) {
34
31
  this.senders = senders;
32
+ this.formatters = formatters;
35
33
  this.logger = logger;
36
- this.config = config;
37
34
  this.detector = detector;
35
+ this.config = config;
38
36
  }
39
37
  catch(ex, host) {
40
- const transformed = ex instanceof exceptions_1.PipelineException ? ex : this.transform(ex);
41
- // Error is transformed to standard PipelineException
42
- this.logger.error(transformed);
43
- const formatted = this.format(host, transformed);
44
- return this.send(host, formatted);
45
- }
46
- transform(ex) {
47
- const transformer = this.transformers.find((x) => x.match(ex));
48
- if (transformer) {
49
- return transformer.transform(ex);
50
- }
51
- const err = new exceptions_1.InternalException(ex.message ?? 'UNKNOWN ERROR', ex);
52
- err.stack = ex.stack;
53
- return err;
54
- }
55
- format(host, ex) {
56
38
  const protocol = this.detector.getProtocol(host);
39
+ const sender = this.getSender(host, protocol);
57
40
  const formatter = this.getFormatter(host, protocol);
58
- if (formatter) {
59
- this.logger.trace(`Found formatter: ${formatter.constructor.name}`);
60
- return formatter.format(ex, this.config.verbose);
61
- }
62
- this.logger.trace('No formatter for error!');
63
- if (this.config.verbose) {
64
- return (0, common_2.normalizer)()(ex, {
65
- // This means stacktrace will never be sent to user
66
- filterKeys: ['stack'],
67
- sortKeys: common_2.sortErrorKeys,
68
- });
41
+ const formatted = formatter.format(ex, this.config.verbose);
42
+ const normalized = (0, common_2.normalizer)()(formatted, {
43
+ filterKeys: ['stack'],
44
+ sortKeys: common_2.sortErrorKeys,
45
+ });
46
+ return sender.send(host, normalized);
47
+ }
48
+ getSender(host, protocol) {
49
+ const sender = this.senders.get(protocol) ?? this.senders.get(host.getType());
50
+ if (sender) {
51
+ this.logger.trace(`Found sender: ${sender.constructor.name}`);
52
+ return sender;
69
53
  }
70
- return { message: 'NO FORMATTER' };
54
+ this.logger.warn((0, common_2.text) `
55
+ No sender for protocol = ${protocol}
56
+ (hostType = ${host.getType()})`);
57
+ return default_sender_1.DEFAULT_SENDER;
71
58
  }
72
59
  getFormatter(host, protocol) {
73
- return (this.formatters.find((x) => x.protocol === protocol) ??
74
- this.formatters.find((x) => x.protocol === host.getType()));
75
- }
76
- send(host, ex) {
77
- const protocol = this.detector.getProtocol(host);
78
- const sender = this.getSender(host, protocol);
79
- return sender?.send(host, ex) ?? (0, rxjs_1.throwError)(() => ex);
80
- }
81
- getSender(host, protocol) {
82
- const s = this.senders.find((x) => x.protocol === protocol);
83
- if (!s) {
84
- return this.senders.find((x) => x.protocol === host.getType());
60
+ const formatter = this.formatters.get(protocol) ?? this.formatters.get(host.getType());
61
+ if (formatter) {
62
+ this.logger.trace(`Found formatter: ${formatter.constructor.name}`);
63
+ return formatter;
85
64
  }
86
- return s;
65
+ this.logger.warn((0, common_2.text) `
66
+ No formatter for protocol = ${protocol}
67
+ (hostType = ${host.getType()})`);
68
+ return default_formatter_1.DEFAULT_FORMATTER;
87
69
  }
88
70
  };
89
71
  exports.GlobalExceptionsFilter = GlobalExceptionsFilter;
90
72
  exports.GlobalExceptionsFilter = GlobalExceptionsFilter = __decorate([
91
73
  (0, common_1.Catch)(),
92
- __param(0, (0, common_1.Inject)(constants_1.FORMATTERS)),
93
- __param(1, (0, common_1.Inject)(constants_1.TRANSFORMERS)),
94
- __param(2, (0, common_1.Inject)(constants_1.SENDERS)),
95
- __param(3, (0, logging_1.InjectLogger)(GlobalExceptionsFilter)),
96
- __metadata("design:paramtypes", [Array, Array, Array, Object, global_exceptions_config_1.GlobalExceptionsConfig,
97
- protocol_detector_1.ProtocolDetector])
74
+ __param(0, (0, common_1.Inject)(constants_1.SENDERS)),
75
+ __param(1, (0, common_1.Inject)(constants_1.FORMATTERS)),
76
+ __param(2, (0, logging_1.InjectLogger)(GlobalExceptionsFilter)),
77
+ __metadata("design:paramtypes", [Map,
78
+ Map, Object, protocol_detector_1.ProtocolDetector,
79
+ global_exceptions_config_1.GlobalExceptionsConfig])
98
80
  ], GlobalExceptionsFilter);
99
81
  //# sourceMappingURL=global-exceptions.filter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"global-exceptions.filter.js","sourceRoot":"","sources":["../../src/exceptions.handling/global-exceptions.filter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,2CAA+C;AAC/C,yCAAyD;AAGzD,+BAAkC;AAElC,8CAAqE;AACrE,wCAA0C;AAC1C,sEAAkE;AAElE,2CAAgE;AAChE,yEAAoE;AAQ7D,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAEM;IACE;IACL;IAEjB;IACA;IACA;IAPnB,YACuC,UAA8B,EAC5B,YAAkC,EACvC,OAAwB,EAEzC,MAAe,EACf,MAA8B,EAC9B,QAA0B;QANN,eAAU,GAAV,UAAU,CAAoB;QAC5B,iBAAY,GAAZ,YAAY,CAAsB;QACvC,YAAO,GAAP,OAAO,CAAiB;QAEzC,WAAM,GAAN,MAAM,CAAS;QACf,WAAM,GAAN,MAAM,CAAwB;QAC9B,aAAQ,GAAR,QAAQ,CAAkB;IAC1C,CAAC;IAEJ,KAAK,CAAC,EAAO,EAAE,IAAmB;QAChC,MAAM,WAAW,GACf,EAAE,YAAY,8BAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAE5D,qDAAqD;QACrD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAE/B,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAEjD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACpC,CAAC;IAEO,SAAS,CAAC,EAAO;QACvB,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE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@
1
+ import type { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
2
+ import type { Observable } from 'rxjs';
3
+ import type { IErrorsTransformer } from './types';
4
+ /**
5
+ * Обработка ошибки состоит из трёх этапов:
6
+ * 1. Трансформация ошибки в PipelineException
7
+ * 2. Логирование ошибки
8
+ * 3. Отправка ошибки клиенту, в зависимости от транспорта.
9
+ *
10
+ * Этот интерцептор отвечает за 1-й этап. Важно, что в пайплайне обработки
11
+ * он должен стоять перед LoggingInterceptor, который обеспечивает логирование
12
+ */
13
+ export declare class GlobalExceptionsInterceptor implements NestInterceptor {
14
+ private readonly transformers;
15
+ constructor(transformers: IErrorsTransformer[]);
16
+ intercept(_: ExecutionContext, next: CallHandler<any>): Observable<any> | Promise<Observable<any>>;
17
+ private transform;
18
+ }
@@ -0,0 +1,57 @@
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
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.GlobalExceptionsInterceptor = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const rxjs_1 = require("rxjs");
18
+ const exceptions_1 = require("../exceptions");
19
+ const constants_1 = require("./constants");
20
+ /**
21
+ * Обработка ошибки состоит из трёх этапов:
22
+ * 1. Трансформация ошибки в PipelineException
23
+ * 2. Логирование ошибки
24
+ * 3. Отправка ошибки клиенту, в зависимости от транспорта.
25
+ *
26
+ * Этот интерцептор отвечает за 1-й этап. Важно, что в пайплайне обработки
27
+ * он должен стоять перед LoggingInterceptor, который обеспечивает логирование
28
+ */
29
+ let GlobalExceptionsInterceptor = class GlobalExceptionsInterceptor {
30
+ transformers;
31
+ constructor(transformers) {
32
+ this.transformers = transformers;
33
+ }
34
+ intercept(_, next) {
35
+ return next.handle().pipe((0, rxjs_1.catchError)((error) => {
36
+ // Error is transformed to standard PipelineException
37
+ const transformed = error instanceof exceptions_1.PipelineException ? error : this.transform(error);
38
+ return (0, rxjs_1.throwError)(() => transformed);
39
+ }));
40
+ }
41
+ transform(ex) {
42
+ const transformer = this.transformers.find((x) => x.match(ex));
43
+ if (transformer) {
44
+ return transformer.transform(ex);
45
+ }
46
+ const err = new exceptions_1.InternalException(ex.message ?? 'UNKNOWN ERROR', ex);
47
+ err.stack = ex.stack;
48
+ return err;
49
+ }
50
+ };
51
+ exports.GlobalExceptionsInterceptor = GlobalExceptionsInterceptor;
52
+ exports.GlobalExceptionsInterceptor = GlobalExceptionsInterceptor = __decorate([
53
+ (0, common_1.Injectable)(),
54
+ __param(0, (0, common_1.Inject)(constants_1.TRANSFORMERS)),
55
+ __metadata("design:paramtypes", [Array])
56
+ ], GlobalExceptionsInterceptor);
57
+ //# sourceMappingURL=global-exceptions.interceptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-exceptions.interceptor.js","sourceRoot":"","sources":["../../src/exceptions.handling/global-exceptions.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,2CAAoD;AAEpD,+BAA8C;AAE9C,8CAAqE;AAErE,2CAA2C;AAG3C;;;;;;;;GAQG;AAEI,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAEG;IADzC,YACyC,YAAkC;QAAlC,iBAAY,GAAZ,YAAY,CAAsB;IACxE,CAAC;IAEJ,SAAS,CACP,CAAmB,EACnB,IAAsB;QAEtB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACvB,IAAA,iBAAU,EAAC,CAAC,KAAK,EAAE,EAAE;YACnB,qDAAqD;YACrD,MAAM,WAAW,GACf,KAAK,YAAY,8BAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAErE,OAAO,IAAA,iBAAU,EAAC,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC;QACvC,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAEO,SAAS,CAAC,EAAO;QACvB,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/D,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACnC,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,8BAAiB,CAAC,EAAE,CAAC,OAAO,IAAI,eAAe,EAAE,EAAE,CAAC,CAAC;QAErE,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;QAErB,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AAhCY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,wBAAY,CAAC,CAAA;;GAFZ,2BAA2B,CAgCvC"}
@@ -1,26 +1,5 @@
1
1
  import type { DynamicModule } from '@nestjs/common';
2
- import type { IErrorsFormatter, IErrorsSender, IErrorsTransformer } from './types';
3
- export interface GlobalExceptionModuleOptions {
4
- /**
5
- * Formatters are used to transform exceptions to transport specific
6
- * final implementations. Usually formatter expects transport agnostic
7
- * subclasses of BaseException.
8
- */
9
- formatters: IErrorsFormatter[];
10
- /**
11
- * Senders are used to actually respond to client (algorithm
12
- * is transport specific)
13
- */
14
- senders: IErrorsSender[];
15
- /**
16
- * Sometimes application throws a lot of unconventional
17
- * (not inheriting BaseExceptions). Usually they are throw by
18
- * libraries: typeorm, axios, etc. Transformers are used to
19
- * catch them and convert to any subtype of BaseException which
20
- * will be processed further by transport specific formatters.
21
- */
22
- transformers?: IErrorsTransformer[];
23
- }
2
+ import { PlatformExtendedOptions } from '../types';
24
3
  export declare class GlobalExceptionsModule {
25
- static forRoot(options: GlobalExceptionModuleOptions): DynamicModule;
4
+ static forRoot(options: PlatformExtendedOptions): DynamicModule;
26
5
  }
@@ -12,26 +12,61 @@ const common_1 = require("@nestjs/common");
12
12
  const core_1 = require("@nestjs/core");
13
13
  const constants_1 = require("./constants");
14
14
  const global_exceptions_filter_1 = require("./global-exceptions.filter");
15
+ const global_exceptions_interceptor_1 = require("./global-exceptions.interceptor");
15
16
  let GlobalExceptionsModule = GlobalExceptionsModule_1 = class GlobalExceptionsModule {
16
17
  static forRoot(options) {
18
+ const entities = [
19
+ ...(options.transports || []),
20
+ ...(options.plugins || []),
21
+ ];
22
+ /**
23
+ * Formatters are used to transform exceptions to transport specific
24
+ * final implementations. Usually formatter expects transport agnostic
25
+ * subclasses of BaseException.
26
+ */
27
+ const formatters = entities
28
+ .flatMap((x) => x.errorFormatter?.() || [])
29
+ .reduce((acc, x) => acc.set(x.protocol, x), new Map());
30
+ /**
31
+ * Senders are used to actually respond to client (algorithm
32
+ * is transport specific)
33
+ */
34
+ const senders = entities
35
+ .flatMap((x) => x.errorSender?.() || [])
36
+ .reduce((acc, x) => acc.set(x.protocol, x), new Map());
37
+ /**
38
+ * Sometimes application throws a lot of unconventional
39
+ * (not inheriting BaseExceptions). Usually they are throw by
40
+ * libraries: typeorm, axios, etc. Transformers are used to
41
+ * catch them and convert to any subtype of BaseException which
42
+ * will be processed further by transport specific formatters.
43
+ *
44
+ * NOTE: Unlike formatters and senders, transformers can't be grouped
45
+ * by protocol, because their matchers are a bit more complex.
46
+ */
47
+ const transformers = entities.flatMap((x) => x.errorTransformers?.() || []);
17
48
  return {
18
49
  module: GlobalExceptionsModule_1,
19
50
  providers: [
51
+ {
52
+ provide: core_1.APP_INTERCEPTOR,
53
+ useClass: global_exceptions_interceptor_1.GlobalExceptionsInterceptor,
54
+ },
20
55
  {
21
56
  provide: core_1.APP_FILTER,
22
57
  useClass: global_exceptions_filter_1.GlobalExceptionsFilter,
23
58
  },
24
59
  {
25
60
  provide: constants_1.FORMATTERS,
26
- useValue: options.formatters,
61
+ useValue: formatters,
27
62
  },
28
63
  {
29
64
  provide: constants_1.SENDERS,
30
- useValue: options.senders,
65
+ useValue: senders,
31
66
  },
32
67
  {
33
68
  provide: constants_1.TRANSFORMERS,
34
- useValue: options.transformers || [],
69
+ useValue: transformers,
35
70
  },
36
71
  ],
37
72
  };
@@ -1 +1 @@
1
- {"version":3,"file":"global-exceptions.module.js","sourceRoot":"","sources":["../../src/exceptions.handling/global-exceptions.module.ts"],"names":[],"mappings":";;;;;;;;;;AACA,2CAAwC;AACxC,uCAA0C;AAE1C,2CAAgE;AAChE,yEAAoE;AAgC7D,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IACjC,MAAM,CAAC,OAAO,CAAC,OAAqC;QAClD,OAAO;YACL,MAAM,EAAE,wBAAsB;YAC9B,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,iBAAU;oBACnB,QAAQ,EAAE,iDAAsB;iBACjC;gBACD;oBACE,OAAO,EAAE,sBAAU;oBACnB,QAAQ,EAAE,OAAO,CAAC,UAAU;iBAC7B;gBACD;oBACE,OAAO,EAAE,mBAAO;oBAChB,QAAQ,EAAE,OAAO,CAAC,OAAO;iBAC1B;gBACD;oBACE,OAAO,EAAE,wBAAY;oBACrB,QAAQ,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;iBACrC;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAxBY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,eA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AAE,wBAAsB;YAC9B,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,sBAAe;oBACxB,QAAQ,EAAE,2DAA2B;iBACtC;gBACD;oBACE,OAAO,EAAE,iBAAU;oBACnB,QAAQ,EAAE,iDAAsB;iBACjC;gBACD;oBACE,OAAO,EAAE,sBAAU;oBACnB,QAAQ,EAAE,UAAU;iBACrB;gBACD;oBACE,OAAO,EAAE,mBAAO;oBAChB,QAAQ,EAAE,OAAO;iBAClB;gBACD;oBACE,OAAO,EAAE,wBAAY;oBACrB,QAAQ,EAAE,YAAY;iBACvB;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA9DY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,sBAAsB,CA8DlC"}
@@ -3,7 +3,7 @@ import type { EMPTY, Observable } from 'rxjs';
3
3
  import type { PipelineException } from '../exceptions/base';
4
4
  /**
5
5
  * Errors formatter is used to map transport-agnostic
6
- * buisiness exception to transport-specific on (with appropriate
6
+ * business exception to transport-specific on (with appropriate
7
7
  * status code and other attributes)
8
8
  *
9
9
  * @implementme Implement this interface if you need to create a
@@ -66,7 +66,7 @@ export interface IErrorsTransformer {
66
66
  */
67
67
  match(ex: any): boolean;
68
68
  /**
69
- * Transformating algorithm
69
+ * Transformation algorithm
70
70
  *
71
71
  * @param ex Exception itself
72
72
  */