@zorionapp/gg-core 4.14.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 (239) hide show
  1. package/README.md +11 -0
  2. package/package.json +58 -0
  3. package/src/gg-auth/decorators/protected.decorator.d.ts +9 -0
  4. package/src/gg-auth/decorators/protected.decorator.js +8 -0
  5. package/src/gg-auth/decorators/protected.decorator.js.map +1 -0
  6. package/src/gg-auth/exceptions/merchant-ip-mismatch.exception.d.ts +7 -0
  7. package/src/gg-auth/exceptions/merchant-ip-mismatch.exception.js +15 -0
  8. package/src/gg-auth/exceptions/merchant-ip-mismatch.exception.js.map +1 -0
  9. package/src/gg-auth/exceptions/user-blocked.exception.d.ts +9 -0
  10. package/src/gg-auth/exceptions/user-blocked.exception.js +17 -0
  11. package/src/gg-auth/exceptions/user-blocked.exception.js.map +1 -0
  12. package/src/gg-auth/exceptions/user-inactive.exception.d.ts +9 -0
  13. package/src/gg-auth/exceptions/user-inactive.exception.js +17 -0
  14. package/src/gg-auth/exceptions/user-inactive.exception.js.map +1 -0
  15. package/src/gg-auth/exceptions/user-otp-blocked.exception.d.ts +9 -0
  16. package/src/gg-auth/exceptions/user-otp-blocked.exception.js +17 -0
  17. package/src/gg-auth/exceptions/user-otp-blocked.exception.js.map +1 -0
  18. package/src/gg-auth/exceptions/user-password-blocked.exception.d.ts +9 -0
  19. package/src/gg-auth/exceptions/user-password-blocked.exception.js +17 -0
  20. package/src/gg-auth/exceptions/user-password-blocked.exception.js.map +1 -0
  21. package/src/gg-auth/exceptions/user-password-recovery-blocked.exception.d.ts +9 -0
  22. package/src/gg-auth/exceptions/user-password-recovery-blocked.exception.js +17 -0
  23. package/src/gg-auth/exceptions/user-password-recovery-blocked.exception.js.map +1 -0
  24. package/src/gg-auth/gg-auth.module-options.d.ts +41 -0
  25. package/src/gg-auth/gg-auth.module-options.js +16 -0
  26. package/src/gg-auth/gg-auth.module-options.js.map +1 -0
  27. package/src/gg-auth/gg-auth.module.d.ts +5 -0
  28. package/src/gg-auth/gg-auth.module.js +68 -0
  29. package/src/gg-auth/gg-auth.module.js.map +1 -0
  30. package/src/gg-auth/guards/auth.guard.d.ts +69 -0
  31. package/src/gg-auth/guards/auth.guard.js +175 -0
  32. package/src/gg-auth/guards/auth.guard.js.map +1 -0
  33. package/src/gg-auth/index.d.ts +8 -0
  34. package/src/gg-auth/index.js +13 -0
  35. package/src/gg-auth/index.js.map +1 -0
  36. package/src/gg-auth/injectable-proxy/authorized-merchant.d.ts +10 -0
  37. package/src/gg-auth/injectable-proxy/authorized-merchant.js +28 -0
  38. package/src/gg-auth/injectable-proxy/authorized-merchant.js.map +1 -0
  39. package/src/gg-auth/injectable-proxy/authorized-user.d.ts +24 -0
  40. package/src/gg-auth/injectable-proxy/authorized-user.js +56 -0
  41. package/src/gg-auth/injectable-proxy/authorized-user.js.map +1 -0
  42. package/src/gg-auth/interfaces/authorized.interface.d.ts +5 -0
  43. package/src/gg-auth/interfaces/authorized.interface.js +3 -0
  44. package/src/gg-auth/interfaces/authorized.interface.js.map +1 -0
  45. package/src/gg-auth/services/auth-service.interface.d.ts +4 -0
  46. package/src/gg-auth/services/auth-service.interface.js +3 -0
  47. package/src/gg-auth/services/auth-service.interface.js.map +1 -0
  48. package/src/gg-auth/services/gg-bearer-auth.service.d.ts +39 -0
  49. package/src/gg-auth/services/gg-bearer-auth.service.js +84 -0
  50. package/src/gg-auth/services/gg-bearer-auth.service.js.map +1 -0
  51. package/src/gg-auth/services/gg-merchant-auth.service.d.ts +8 -0
  52. package/src/gg-auth/services/gg-merchant-auth.service.js +24 -0
  53. package/src/gg-auth/services/gg-merchant-auth.service.js.map +1 -0
  54. package/src/gg-auth/utils/get-rpc-user.util.d.ts +3 -0
  55. package/src/gg-auth/utils/get-rpc-user.util.js +14 -0
  56. package/src/gg-auth/utils/get-rpc-user.util.js.map +1 -0
  57. package/src/gg-cache/gg-cache.module.d.ts +4 -0
  58. package/src/gg-cache/gg-cache.module.js +55 -0
  59. package/src/gg-cache/gg-cache.module.js.map +1 -0
  60. package/src/gg-cache/gg-cache.service.d.ts +23 -0
  61. package/src/gg-cache/gg-cache.service.js +58 -0
  62. package/src/gg-cache/gg-cache.service.js.map +1 -0
  63. package/src/gg-cache/index.d.ts +2 -0
  64. package/src/gg-cache/index.js +6 -0
  65. package/src/gg-cache/index.js.map +1 -0
  66. package/src/gg-cache/redis.config.d.ts +6 -0
  67. package/src/gg-cache/redis.config.js +23 -0
  68. package/src/gg-cache/redis.config.js.map +1 -0
  69. package/src/gg-cls/gg-cls.module.d.ts +4 -0
  70. package/src/gg-cls/gg-cls.module.js +54 -0
  71. package/src/gg-cls/gg-cls.module.js.map +1 -0
  72. package/src/gg-cls/index.d.ts +1 -0
  73. package/src/gg-cls/index.js +5 -0
  74. package/src/gg-cls/index.js.map +1 -0
  75. package/src/gg-config/app.config.d.ts +16 -0
  76. package/src/gg-config/app.config.js +78 -0
  77. package/src/gg-config/app.config.js.map +1 -0
  78. package/src/gg-config/gg-config.module-options.d.ts +4 -0
  79. package/src/gg-config/gg-config.module-options.js +3 -0
  80. package/src/gg-config/gg-config.module-options.js.map +1 -0
  81. package/src/gg-config/gg-config.module.d.ts +5 -0
  82. package/src/gg-config/gg-config.module.js +22 -0
  83. package/src/gg-config/gg-config.module.js.map +1 -0
  84. package/src/gg-config/index.d.ts +3 -0
  85. package/src/gg-config/index.js +7 -0
  86. package/src/gg-config/index.js.map +1 -0
  87. package/src/gg-config/validate-config.d.ts +2 -0
  88. package/src/gg-config/validate-config.js +31 -0
  89. package/src/gg-config/validate-config.js.map +1 -0
  90. package/src/gg-core/gg-core-module-options.d.ts +12 -0
  91. package/src/gg-core/gg-core-module-options.js +3 -0
  92. package/src/gg-core/gg-core-module-options.js.map +1 -0
  93. package/src/gg-core/gg-core.middleware.d.ts +8 -0
  94. package/src/gg-core/gg-core.middleware.js +31 -0
  95. package/src/gg-core/gg-core.middleware.js.map +1 -0
  96. package/src/gg-core/gg-core.module.d.ts +9 -0
  97. package/src/gg-core/gg-core.module.js +58 -0
  98. package/src/gg-core/gg-core.module.js.map +1 -0
  99. package/src/gg-core/index.d.ts +2 -0
  100. package/src/gg-core/index.js +6 -0
  101. package/src/gg-core/index.js.map +1 -0
  102. package/src/gg-database/config/db-entities.config.d.ts +5 -0
  103. package/src/gg-database/config/db-entities.config.js +7 -0
  104. package/src/gg-database/config/db-entities.config.js.map +1 -0
  105. package/src/gg-database/config/mikroorm.config.d.ts +9 -0
  106. package/src/gg-database/config/mikroorm.config.js +38 -0
  107. package/src/gg-database/config/mikroorm.config.js.map +1 -0
  108. package/src/gg-database/database.adapter.d.ts +24 -0
  109. package/src/gg-database/database.adapter.js +50 -0
  110. package/src/gg-database/database.adapter.js.map +1 -0
  111. package/src/gg-database/database.connector.d.ts +27 -0
  112. package/src/gg-database/database.connector.js +54 -0
  113. package/src/gg-database/database.connector.js.map +1 -0
  114. package/src/gg-database/index.d.ts +3 -0
  115. package/src/gg-database/index.js +7 -0
  116. package/src/gg-database/index.js.map +1 -0
  117. package/src/gg-database/modules/mikroorm.module.d.ts +37 -0
  118. package/src/gg-database/modules/mikroorm.module.js +111 -0
  119. package/src/gg-database/modules/mikroorm.module.js.map +1 -0
  120. package/src/gg-errors/exception.domain-codes.d.ts +12 -0
  121. package/src/gg-errors/exception.domain-codes.js +17 -0
  122. package/src/gg-errors/exception.domain-codes.js.map +1 -0
  123. package/src/gg-errors/exceptions/gg.exception.d.ts +12 -0
  124. package/src/gg-errors/exceptions/gg.exception.js +27 -0
  125. package/src/gg-errors/exceptions/gg.exception.js.map +1 -0
  126. package/src/gg-errors/gcp-error-event.interface.d.ts +18 -0
  127. package/src/gg-errors/gcp-error-event.interface.js +3 -0
  128. package/src/gg-errors/gcp-error-event.interface.js.map +1 -0
  129. package/src/gg-errors/gcp-error-reporting.service.d.ts +11 -0
  130. package/src/gg-errors/gcp-error-reporting.service.js +71 -0
  131. package/src/gg-errors/gcp-error-reporting.service.js.map +1 -0
  132. package/src/gg-errors/gg-errors-exception.filter.d.ts +9 -0
  133. package/src/gg-errors/gg-errors-exception.filter.js +26 -0
  134. package/src/gg-errors/gg-errors-exception.filter.js.map +1 -0
  135. package/src/gg-errors/gg-errors.module-options.d.ts +8 -0
  136. package/src/gg-errors/gg-errors.module-options.js +5 -0
  137. package/src/gg-errors/gg-errors.module-options.js.map +1 -0
  138. package/src/gg-errors/gg-errors.module.d.ts +5 -0
  139. package/src/gg-errors/gg-errors.module.js +35 -0
  140. package/src/gg-errors/gg-errors.module.js.map +1 -0
  141. package/src/gg-errors/gg-exception.service.d.ts +50 -0
  142. package/src/gg-errors/gg-exception.service.js +213 -0
  143. package/src/gg-errors/gg-exception.service.js.map +1 -0
  144. package/src/gg-errors/index.d.ts +1 -0
  145. package/src/gg-errors/index.js +5 -0
  146. package/src/gg-errors/index.js.map +1 -0
  147. package/src/gg-gcp/gcp-trace-and-profiler.d.ts +1 -0
  148. package/src/gg-gcp/gcp-trace-and-profiler.js +52 -0
  149. package/src/gg-gcp/gcp-trace-and-profiler.js.map +1 -0
  150. package/src/gg-gcp/index.d.ts +1 -0
  151. package/src/gg-gcp/index.js +5 -0
  152. package/src/gg-gcp/index.js.map +1 -0
  153. package/src/gg-healthchecks/gg-healthchecks.controller.d.ts +7 -0
  154. package/src/gg-healthchecks/gg-healthchecks.controller.js +31 -0
  155. package/src/gg-healthchecks/gg-healthchecks.controller.js.map +1 -0
  156. package/src/gg-healthchecks/gg-healthchecks.module.d.ts +4 -0
  157. package/src/gg-healthchecks/gg-healthchecks.module.js +17 -0
  158. package/src/gg-healthchecks/gg-healthchecks.module.js.map +1 -0
  159. package/src/gg-kernel/index.d.ts +2 -0
  160. package/src/gg-kernel/index.js +6 -0
  161. package/src/gg-kernel/index.js.map +1 -0
  162. package/src/gg-kernel/kernel.d.ts +36 -0
  163. package/src/gg-kernel/kernel.js +86 -0
  164. package/src/gg-kernel/kernel.js.map +1 -0
  165. package/src/gg-kernel/service-providers/base-service-provider.d.ts +15 -0
  166. package/src/gg-kernel/service-providers/base-service-provider.js +25 -0
  167. package/src/gg-kernel/service-providers/base-service-provider.js.map +1 -0
  168. package/src/gg-kernel/service-providers/global-prefix.service-provider.d.ts +4 -0
  169. package/src/gg-kernel/service-providers/global-prefix.service-provider.js +17 -0
  170. package/src/gg-kernel/service-providers/global-prefix.service-provider.js.map +1 -0
  171. package/src/gg-kernel/service-providers/helmet.service-provider.d.ts +4 -0
  172. package/src/gg-kernel/service-providers/helmet.service-provider.js +12 -0
  173. package/src/gg-kernel/service-providers/helmet.service-provider.js.map +1 -0
  174. package/src/gg-kernel/service-providers/index.d.ts +8 -0
  175. package/src/gg-kernel/service-providers/index.js +12 -0
  176. package/src/gg-kernel/service-providers/index.js.map +1 -0
  177. package/src/gg-kernel/service-providers/logger.service-provider.d.ts +8 -0
  178. package/src/gg-kernel/service-providers/logger.service-provider.js +20 -0
  179. package/src/gg-kernel/service-providers/logger.service-provider.js.map +1 -0
  180. package/src/gg-kernel/service-providers/shutdown-hooks.service-provider.d.ts +7 -0
  181. package/src/gg-kernel/service-providers/shutdown-hooks.service-provider.js +14 -0
  182. package/src/gg-kernel/service-providers/shutdown-hooks.service-provider.js.map +1 -0
  183. package/src/gg-kernel/service-providers/swagger.service-provider.d.ts +13 -0
  184. package/src/gg-kernel/service-providers/swagger.service-provider.js +35 -0
  185. package/src/gg-kernel/service-providers/swagger.service-provider.js.map +1 -0
  186. package/src/gg-kernel/service-providers/validation.service-provider.d.ts +10 -0
  187. package/src/gg-kernel/service-providers/validation.service-provider.js +22 -0
  188. package/src/gg-kernel/service-providers/validation.service-provider.js.map +1 -0
  189. package/src/gg-kernel/service-providers/versioning.service-provider.d.ts +10 -0
  190. package/src/gg-kernel/service-providers/versioning.service-provider.js +17 -0
  191. package/src/gg-kernel/service-providers/versioning.service-provider.js.map +1 -0
  192. package/src/gg-logger/gg-logger.module.d.ts +4 -0
  193. package/src/gg-logger/gg-logger.module.js +48 -0
  194. package/src/gg-logger/gg-logger.module.js.map +1 -0
  195. package/src/gg-metrics/gg-metrics.controller.d.ts +3 -0
  196. package/src/gg-metrics/gg-metrics.controller.js +15 -0
  197. package/src/gg-metrics/gg-metrics.controller.js.map +1 -0
  198. package/src/gg-metrics/gg-metrics.module.d.ts +4 -0
  199. package/src/gg-metrics/gg-metrics.module.js +31 -0
  200. package/src/gg-metrics/gg-metrics.module.js.map +1 -0
  201. package/src/gg-metrics/index.d.ts +1 -0
  202. package/src/gg-metrics/index.js +5 -0
  203. package/src/gg-metrics/index.js.map +1 -0
  204. package/src/gg-micro/gg-micro.module.d.ts +5 -0
  205. package/src/gg-micro/gg-micro.module.js +62 -0
  206. package/src/gg-micro/gg-micro.module.js.map +1 -0
  207. package/src/gg-micro/gg-rmq-service.injector.d.ts +19 -0
  208. package/src/gg-micro/gg-rmq-service.injector.js +29 -0
  209. package/src/gg-micro/gg-rmq-service.injector.js.map +1 -0
  210. package/src/gg-micro/gg-rmq.configurator.d.ts +16 -0
  211. package/src/gg-micro/gg-rmq.configurator.js +34 -0
  212. package/src/gg-micro/gg-rmq.configurator.js.map +1 -0
  213. package/src/gg-micro/index.d.ts +4 -0
  214. package/src/gg-micro/index.js +8 -0
  215. package/src/gg-micro/index.js.map +1 -0
  216. package/src/gg-micro/micro.client.d.ts +62 -0
  217. package/src/gg-micro/micro.client.js +101 -0
  218. package/src/gg-micro/micro.client.js.map +1 -0
  219. package/src/gg-micro/rmq.config.d.ts +10 -0
  220. package/src/gg-micro/rmq.config.js +50 -0
  221. package/src/gg-micro/rmq.config.js.map +1 -0
  222. package/src/gg-micro/rmq.connector.d.ts +12 -0
  223. package/src/gg-micro/rmq.connector.js +25 -0
  224. package/src/gg-micro/rmq.connector.js.map +1 -0
  225. package/src/gg-micro/rmq.queue-map.d.ts +2 -0
  226. package/src/gg-micro/rmq.queue-map.js +24 -0
  227. package/src/gg-micro/rmq.queue-map.js.map +1 -0
  228. package/src/gg-throttler/gg-throttler.module-options.d.ts +4 -0
  229. package/src/gg-throttler/gg-throttler.module-options.js +3 -0
  230. package/src/gg-throttler/gg-throttler.module-options.js.map +1 -0
  231. package/src/gg-throttler/gg-throttler.module.d.ts +5 -0
  232. package/src/gg-throttler/gg-throttler.module.js +24 -0
  233. package/src/gg-throttler/gg-throttler.module.js.map +1 -0
  234. package/src/gg-throttler/throttler.guard.d.ts +13 -0
  235. package/src/gg-throttler/throttler.guard.js +28 -0
  236. package/src/gg-throttler/throttler.guard.js.map +1 -0
  237. package/src/index.d.ts +10 -0
  238. package/src/index.js +14 -0
  239. package/src/index.js.map +1 -0
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GG_ERRORS_MODULE_OPTIONS_TOKEN = void 0;
4
+ exports.GG_ERRORS_MODULE_OPTIONS_TOKEN = 'GG_ERRORS_MODULE_OPTIONS';
5
+ //# sourceMappingURL=gg-errors.module-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gg-errors.module-options.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-errors/gg-errors.module-options.ts"],"names":[],"mappings":";;;AAEa,QAAA,8BAA8B,GAAG,0BAA0B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ import { GgErrorsModuleOptions } from './gg-errors.module-options';
3
+ export declare class GgErrorsModule {
4
+ static asyncForRoot(options?: GgErrorsModuleOptions): DynamicModule;
5
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var GgErrorsModule_1;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.GgErrorsModule = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const common_1 = require("@nestjs/common");
7
+ const core_1 = require("@nestjs/core");
8
+ const gcp_error_reporting_service_1 = require("./gcp-error-reporting.service");
9
+ const gg_errors_exception_filter_1 = require("./gg-errors-exception.filter");
10
+ const gg_errors_module_options_1 = require("./gg-errors.module-options");
11
+ const gg_exception_service_1 = require("./gg-exception.service");
12
+ let GgErrorsModule = GgErrorsModule_1 = class GgErrorsModule {
13
+ static asyncForRoot(options) {
14
+ return {
15
+ global: true,
16
+ module: GgErrorsModule_1,
17
+ providers: [
18
+ gcp_error_reporting_service_1.GCPErrorReportingService,
19
+ gg_exception_service_1.GgExceptionService,
20
+ gg_errors_exception_filter_1.GgErrorsExceptionFilter,
21
+ { provide: core_1.APP_FILTER, useClass: gg_errors_exception_filter_1.GgErrorsExceptionFilter },
22
+ {
23
+ provide: gg_errors_module_options_1.GG_ERRORS_MODULE_OPTIONS_TOKEN,
24
+ useFactory: options.useFactory,
25
+ inject: options.inject,
26
+ },
27
+ ],
28
+ };
29
+ }
30
+ };
31
+ exports.GgErrorsModule = GgErrorsModule;
32
+ exports.GgErrorsModule = GgErrorsModule = GgErrorsModule_1 = tslib_1.__decorate([
33
+ (0, common_1.Module)({})
34
+ ], GgErrorsModule);
35
+ //# sourceMappingURL=gg-errors.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gg-errors.module.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-errors/gg-errors.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuD;AACvD,uCAA0C;AAC1C,+EAAyE;AACzE,6EAAuE;AACvE,yEAAmG;AACnG,iEAA4D;AAGrD,IAAM,cAAc,sBAApB,MAAM,cAAc;IAClB,MAAM,CAAC,YAAY,CAAC,OAA+B;QACxD,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,gBAAc;YACtB,SAAS,EAAE;gBACT,sDAAwB;gBACxB,yCAAkB;gBAClB,oDAAuB;gBACvB,EAAE,OAAO,EAAE,iBAAU,EAAE,QAAQ,EAAE,oDAAuB,EAAE;gBAC1D;oBACE,OAAO,EAAE,yDAA8B;oBACvC,UAAU,EAAE,OAAO,CAAC,UAAU;oBAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;iBACvB;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAlBY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,cAAc,CAkB1B"}
@@ -0,0 +1,50 @@
1
+ import { HttpStatus } from '@nestjs/common';
2
+ import { HttpArgumentsHost, RpcArgumentsHost } from '@nestjs/common/interfaces';
3
+ import { HttpExceptionBody } from '@nestjs/common/interfaces/http/http-exception-body.interface';
4
+ import { RpcException } from '@nestjs/microservices';
5
+ import { Response } from 'express';
6
+ import { AuthorizedUser } from '../gg-auth';
7
+ import { GCPErrorReportingService } from './gcp-error-reporting.service';
8
+ import { GgErrorsOptions } from './gg-errors.module-options';
9
+ type RPCException = {
10
+ response: HttpExceptionBody;
11
+ status: HttpStatus;
12
+ options: Record<string, unknown>;
13
+ };
14
+ export declare class GgExceptionService {
15
+ private readonly errorsOptions;
16
+ private readonly gcpReporting;
17
+ private readonly user;
18
+ private readonly logger;
19
+ constructor(errorsOptions: GgErrorsOptions, gcpReporting: GCPErrorReportingService, user: AuthorizedUser);
20
+ handleHttp(httpArgumentsHost: HttpArgumentsHost, exception: any): Response<any, Record<string, any>>;
21
+ /**
22
+ * RPC exception can be instantiated as HttpException or GgException by default
23
+ * in reason that it uses plain objects for data transfer.
24
+ *
25
+ * @example of BadRequestException in RPC view:
26
+ * error: {
27
+ * "response": {
28
+ * "message": "WalletId is invalid. Expected \"WalletPurpose(GG/GT/GC) + CountryCode(2) + wallet-number(12)\"",
29
+ * "error": "Bad Request",
30
+ * "statusCode": 400
31
+ * },
32
+ * "status": 400,
33
+ * "options": {},
34
+ * "message": "WalletId is invalid. Expected \"WalletPurpose(GG/GT/GC) + CountryCode(2) + wallet-number(12)\"",
35
+ * "name": "BadRequestException"
36
+ * }
37
+ *
38
+ * @param rpcArgumentsHost
39
+ * @param exception
40
+ */
41
+ handleRpc(rpcArgumentsHost: RpcArgumentsHost, exception: RPCException | Error): RpcException;
42
+ private getBodyForInternalError;
43
+ private getBodyForRPCError;
44
+ private getBodyForBaseError;
45
+ private setExceptionDomain;
46
+ private getDomainCode;
47
+ private getRPCDomainCode;
48
+ private isAxiosError;
49
+ }
50
+ export {};
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ var GgExceptionService_1;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.GgExceptionService = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const common_1 = require("@nestjs/common");
7
+ const microservices_1 = require("@nestjs/microservices");
8
+ const lodash_1 = require("lodash");
9
+ const uuid_1 = require("uuid");
10
+ const core_1 = require("@mikro-orm/core");
11
+ const gg_auth_1 = require("../gg-auth");
12
+ const exception_domain_codes_1 = require("./exception.domain-codes");
13
+ const gg_exception_1 = require("./exceptions/gg.exception");
14
+ const gcp_error_reporting_service_1 = require("./gcp-error-reporting.service");
15
+ const gg_errors_module_options_1 = require("./gg-errors.module-options");
16
+ let GgExceptionService = GgExceptionService_1 = class GgExceptionService {
17
+ constructor(errorsOptions, gcpReporting, user) {
18
+ this.errorsOptions = errorsOptions;
19
+ this.gcpReporting = gcpReporting;
20
+ this.user = user;
21
+ this.logger = new common_1.Logger(GgExceptionService_1.name);
22
+ }
23
+ handleHttp(httpArgumentsHost, exception) {
24
+ const response = httpArgumentsHost.getResponse();
25
+ const request = httpArgumentsHost.getRequest();
26
+ let body;
27
+ let statusCode;
28
+ let domainCode;
29
+ if ((0, lodash_1.isPlainObject)(exception)) {
30
+ this.logger.debug({ msg: 'Extracting RPC error...' });
31
+ body = exception.error;
32
+ statusCode = (0, lodash_1.get)(exception, 'error.statusCode', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
33
+ }
34
+ exception = this.setExceptionDomain(exception);
35
+ if (exception instanceof core_1.ServerException) {
36
+ statusCode = 500;
37
+ domainCode = `${this.errorsOptions.domain}-0`;
38
+ body = this.getBodyForInternalError(domainCode, request, statusCode, new common_1.InternalServerErrorException('Internal server error'));
39
+ this.logger.error({ error: exception, msg: exception.message });
40
+ }
41
+ if (exception instanceof common_1.HttpException || exception instanceof gg_exception_1.GgException) {
42
+ statusCode = exception.getStatus();
43
+ domainCode = `${this.errorsOptions.domain}-${this.getDomainCode(exception)}`;
44
+ body = this.getBodyForInternalError(domainCode, request, statusCode, exception);
45
+ this.logger.error({ error: exception, msg: exception.getResponse() });
46
+ }
47
+ if (this.isAxiosError(exception)) {
48
+ statusCode = (0, lodash_1.get)(exception, 'response.status', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
49
+ domainCode = (0, lodash_1.get)(exception, 'response.data.domainCode', 'GGGE');
50
+ body = (0, lodash_1.get)(exception, 'response.data', this.getBodyForBaseError(domainCode, request, statusCode, exception));
51
+ this.logger.error({ error: exception, msg: body });
52
+ }
53
+ if ((!statusCode || !body) && exception instanceof Error && !(0, lodash_1.isPlainObject)(exception)) {
54
+ statusCode = common_1.HttpStatus.INTERNAL_SERVER_ERROR;
55
+ domainCode = `${this.errorsOptions.domain}-${exception_domain_codes_1.ExceptionDomainCodes.General}`;
56
+ body = this.getBodyForBaseError(domainCode, request, statusCode, exception);
57
+ this.logger.error(exception);
58
+ }
59
+ if ((0, lodash_1.isString)(exception)) {
60
+ statusCode = common_1.HttpStatus.FAILED_DEPENDENCY;
61
+ domainCode = `${this.errorsOptions.domain}-${exception_domain_codes_1.ExceptionDomainCodes.General}`;
62
+ body = this.getBodyForBaseError(domainCode, request, statusCode, exception);
63
+ this.logger.error(exception);
64
+ }
65
+ if (!this.errorsOptions.gcpIgnoreCodes?.length || !this.errorsOptions.gcpIgnoreCodes.includes(domainCode)) {
66
+ if (exception?.message)
67
+ exception.message = `[${domainCode}] ${exception.message}`;
68
+ this.gcpReporting.reportError(exception, {
69
+ url: (body?.path ?? request.url),
70
+ httpMethod: request.method,
71
+ referrer: request.headers.referer,
72
+ remoteIp: request.ip,
73
+ userAgent: request.headers['user-agent'],
74
+ responseStatusCode: statusCode,
75
+ user: this.user?.dto?.ggId,
76
+ });
77
+ }
78
+ else {
79
+ this.logger.debug({ msg: 'HTTPError ignored by GCP ignore codes filter', domainCode });
80
+ }
81
+ return response.status(statusCode).json(body);
82
+ }
83
+ /**
84
+ * RPC exception can be instantiated as HttpException or GgException by default
85
+ * in reason that it uses plain objects for data transfer.
86
+ *
87
+ * @example of BadRequestException in RPC view:
88
+ * error: {
89
+ * "response": {
90
+ * "message": "WalletId is invalid. Expected \"WalletPurpose(GG/GT/GC) + CountryCode(2) + wallet-number(12)\"",
91
+ * "error": "Bad Request",
92
+ * "statusCode": 400
93
+ * },
94
+ * "status": 400,
95
+ * "options": {},
96
+ * "message": "WalletId is invalid. Expected \"WalletPurpose(GG/GT/GC) + CountryCode(2) + wallet-number(12)\"",
97
+ * "name": "BadRequestException"
98
+ * }
99
+ *
100
+ * @param rpcArgumentsHost
101
+ * @param exception
102
+ */
103
+ handleRpc(rpcArgumentsHost, exception) {
104
+ const statusCode = (0, lodash_1.get)(exception, 'status', common_1.HttpStatus.INTERNAL_SERVER_ERROR);
105
+ const domainCode = `${this.errorsOptions.domain}-${this.getRPCDomainCode(exception)}`;
106
+ const requestId = (0, lodash_1.get)(rpcArgumentsHost.getContext().getMessage(), 'properties.headers.request-id', (0, uuid_1.v4)());
107
+ const rpcMethod = (0, lodash_1.get)(rpcArgumentsHost.getContext(), 'args[2]', 'RPC');
108
+ this.logger.error({
109
+ msg: 'handleRpc Exception caught',
110
+ exception: JSON.stringify(exception, null, 2),
111
+ });
112
+ // Будуємо body (тепер він містить детальніший message)
113
+ const body = this.getBodyForRPCError(domainCode, statusCode, requestId, rpcMethod, exception);
114
+ if (!this.errorsOptions.gcpIgnoreCodes?.length || !this.errorsOptions.gcpIgnoreCodes.includes(domainCode)) {
115
+ this.gcpReporting.reportEvent({
116
+ message: `[${domainCode}] ${body.message}`,
117
+ url: body.path,
118
+ responseStatusCode: body.statusCode,
119
+ user: this.user?.dto?.ggId,
120
+ });
121
+ }
122
+ else {
123
+ this.logger.debug({ msg: 'RPCError ignored by GCP ignore codes filter', domainCode });
124
+ }
125
+ return new microservices_1.RpcException(body);
126
+ }
127
+ getBodyForInternalError(domainCode, request, statusCode, exception) {
128
+ return {
129
+ domain: this.errorsOptions.domain,
130
+ code: domainCode,
131
+ statusCode,
132
+ path: request.url,
133
+ timestamp: new Date().toISOString(),
134
+ requestId: (0, lodash_1.get)(request, 'id', null),
135
+ message: (0, lodash_1.isString)(exception) ? exception : (0, lodash_1.get)(exception.getResponse(), 'message'),
136
+ parameters: (0, lodash_1.get)(exception, 'parameters', null),
137
+ };
138
+ }
139
+ getBodyForRPCError(domainCode, statusCode, requestId, rpcMethod, exception) {
140
+ let detailedMessage = (0, lodash_1.get)(exception, 'error.response.message') ||
141
+ (0, lodash_1.get)(exception, 'response.message') ||
142
+ (0, lodash_1.get)(exception, 'message') ||
143
+ 'Unknown internal error';
144
+ if (Array.isArray(detailedMessage)) {
145
+ this.logger.error({
146
+ msg: 'Validation errors array',
147
+ errors: detailedMessage,
148
+ });
149
+ detailedMessage = JSON.stringify(detailedMessage);
150
+ }
151
+ // 3. Формуємо й повертаємо body
152
+ return {
153
+ domain: this.errorsOptions.domain,
154
+ code: domainCode,
155
+ statusCode,
156
+ path: rpcMethod,
157
+ timestamp: new Date().toISOString(),
158
+ requestId: requestId,
159
+ message: detailedMessage,
160
+ };
161
+ }
162
+ getBodyForBaseError(domainCode, request, statusCode, exception) {
163
+ return {
164
+ domain: this.errorsOptions.domain,
165
+ code: domainCode,
166
+ statusCode,
167
+ path: request.url,
168
+ timestamp: new Date().toISOString(),
169
+ requestId: (0, lodash_1.get)(request, 'id', null),
170
+ message: (0, lodash_1.isString)(exception) ? exception : (0, lodash_1.get)(exception, 'message'),
171
+ };
172
+ }
173
+ setExceptionDomain(exception) {
174
+ if (exception instanceof common_1.HttpException || exception instanceof gg_exception_1.GgException) {
175
+ (0, lodash_1.set)(exception, 'domain', this.errorsOptions.domain);
176
+ }
177
+ return exception;
178
+ }
179
+ getDomainCode(exception) {
180
+ if (exception instanceof common_1.NotFoundException)
181
+ return exception_domain_codes_1.ExceptionDomainCodes.NotFound;
182
+ if (exception instanceof common_1.UnauthorizedException)
183
+ return exception_domain_codes_1.ExceptionDomainCodes.Unauthorized;
184
+ if (exception instanceof common_1.BadRequestException)
185
+ return exception_domain_codes_1.ExceptionDomainCodes.BadRequest;
186
+ if (exception instanceof gg_exception_1.GgException)
187
+ return exception.getDomainCode();
188
+ return exception_domain_codes_1.ExceptionDomainCodes.General;
189
+ }
190
+ getRPCDomainCode(exception) {
191
+ if (!(0, lodash_1.get)(exception, 'status', false))
192
+ return exception_domain_codes_1.ExceptionDomainCodes.General;
193
+ if ((0, lodash_1.get)(exception, 'status') === common_1.HttpStatus.NOT_FOUND)
194
+ return exception_domain_codes_1.ExceptionDomainCodes.NotFound;
195
+ if ((0, lodash_1.get)(exception, 'status') === common_1.HttpStatus.UNAUTHORIZED)
196
+ return exception_domain_codes_1.ExceptionDomainCodes.Unauthorized;
197
+ if ((0, lodash_1.get)(exception, 'status') === common_1.HttpStatus.BAD_REQUEST)
198
+ return exception_domain_codes_1.ExceptionDomainCodes.BadRequest;
199
+ // if (exception instanceof GgException) return exception.getDomainCode();
200
+ return exception_domain_codes_1.ExceptionDomainCodes.General;
201
+ }
202
+ isAxiosError(error) {
203
+ return error.isAxiosError;
204
+ }
205
+ };
206
+ exports.GgExceptionService = GgExceptionService;
207
+ exports.GgExceptionService = GgExceptionService = GgExceptionService_1 = tslib_1.__decorate([
208
+ (0, common_1.Injectable)(),
209
+ tslib_1.__param(0, (0, common_1.Inject)(gg_errors_module_options_1.GG_ERRORS_MODULE_OPTIONS_TOKEN)),
210
+ tslib_1.__metadata("design:paramtypes", [Object, gcp_error_reporting_service_1.GCPErrorReportingService,
211
+ gg_auth_1.AuthorizedUser])
212
+ ], GgExceptionService);
213
+ //# sourceMappingURL=gg-exception.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gg-exception.service.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-errors/gg-exception.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAUwB;AAGxB,yDAAqD;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B;IAD9B,IAAA,mBAAU,GAAE;IAKR,mBAAA,IAAA,eAAM,EAAC,yDAA8B,CAAC,CAAA;qDACR,sDAAwB;QAChC,wBAAc;GAN5B,kBAAkB,CAiP9B"}
@@ -0,0 +1 @@
1
+ export * from './exceptions/gg.exception';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./exceptions/gg.exception"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-errors/index.ts"],"names":[],"mappings":";;;AAAA,oEAA0C"}
@@ -0,0 +1 @@
1
+ import 'dotenv/config';
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const common_1 = require("@nestjs/common");
4
+ require("dotenv/config");
5
+ const process = require("process");
6
+ const logger = new common_1.Logger('GCP-Trace-And-Profiler');
7
+ const DEFAULT_IGNORE_URLS = ['/health', '/metrics'];
8
+ const isEnableGCP = process.env.GCP_OPS_ENABLED === 'true';
9
+ if (!isEnableGCP) {
10
+ logger.log('GCP ops disabled in env');
11
+ }
12
+ if (isEnableGCP) {
13
+ (async () => {
14
+ try {
15
+ const { start: startGCPTrace } = await Promise.resolve().then(() => require('@google-cloud/trace-agent'));
16
+ const { start: startGCPProfiler } = await Promise.resolve().then(() => require('@google-cloud/profiler'));
17
+ const serviceSuffix = ['production', 'stage'].includes(process.env.NODE_ENV) ? '' : `-${process.env.NODE_ENV}`;
18
+ const serviceName = process.env.APP_NAME;
19
+ const serviceVersion = process.env.APP_VERSION;
20
+ const ignoreUrlsString = process.env.GCP_TRACE_IGNORE_URLS || '';
21
+ const ignoreUrls = ignoreUrlsString.length ? ignoreUrlsString.split(',') : DEFAULT_IGNORE_URLS;
22
+ const baseOpts = {
23
+ serviceContext: {
24
+ service: `${serviceName}${serviceSuffix}`,
25
+ version: serviceVersion,
26
+ },
27
+ };
28
+ logger.log(`GCP ops starting: ${baseOpts.serviceContext.service} ${baseOpts.serviceContext.version}`);
29
+ if (serviceSuffix) {
30
+ logger.debug(`GCP ops config: ${JSON.stringify({ ...baseOpts, ignoreUrls })}`);
31
+ }
32
+ startGCPTrace({ ...baseOpts, ignoreUrls });
33
+ await startProfiler({ ...baseOpts }, startGCPProfiler);
34
+ }
35
+ catch (e) {
36
+ logger.error(`Failed to start GCP ops: ${e}`);
37
+ }
38
+ })();
39
+ }
40
+ async function startProfiler(config, startGCPProfiler) {
41
+ for (let i = 0; i < 3; i++) {
42
+ try {
43
+ await startGCPProfiler(config);
44
+ return;
45
+ }
46
+ catch (e) {
47
+ logger.error(`Failed to start GCP profiler: ${e}`);
48
+ }
49
+ await new Promise((r) => setTimeout(r, 1500));
50
+ }
51
+ }
52
+ //# sourceMappingURL=gcp-trace-and-profiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcp-trace-and-profiler.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-gcp/gcp-trace-and-profiler.ts"],"names":[],"mappings":";;AAAA,2CAAwC;AACxC,yBAAuB;AACvB,mCAAmC;AAEnC,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,wBAAwB,CAAC,CAAC;AAEpD,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AAEpD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,MAAM,CAAC;AAE3D,IAAI,CAAC,WAAW,EAAE,CAAC;IACjB,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AACxC,CAAC;AAED,IAAI,WAAW,EAAE,CAAC;IAChB,CAAC,KAAK,IAAI,EAAE;QACV,IAAI,CAAC;YACH,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,2CAAa,2BAA2B,EAAC,CAAC;YAC3E,MAAM,EAAE,KAA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CAAC,4BAA4B,CAAC,EAAE,CAAC,CAAC;QAChD,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;AACP,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,MAAkD,EAAE,gBAAqB;IACpG,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,IAAI,CAAC;YACH,MAAM,gBAAgB,CAAC,MAAM,CAAC,CAAC;YAE/B,OAAO;QACT,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,EAAE,CAAC,CAAC;QACrD,CAAC;QAED,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './gcp-trace-and-profiler';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./gcp-trace-and-profiler"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-gcp/index.ts"],"names":[],"mappings":";;;AAAA,mEAAyC"}
@@ -0,0 +1,7 @@
1
+ import { HealthCheckResult, HealthCheckService, HttpHealthIndicator } from '@nestjs/terminus';
2
+ export declare class GgHealthchecksController {
3
+ private readonly health;
4
+ private readonly httpCheck;
5
+ constructor(health: HealthCheckService, httpCheck: HttpHealthIndicator);
6
+ check(): Promise<HealthCheckResult>;
7
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GgHealthchecksController = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const swagger_1 = require("@nestjs/swagger");
7
+ const terminus_1 = require("@nestjs/terminus");
8
+ let GgHealthchecksController = class GgHealthchecksController {
9
+ constructor(health, httpCheck) {
10
+ this.health = health;
11
+ this.httpCheck = httpCheck;
12
+ }
13
+ check() {
14
+ return this.health.check([]);
15
+ }
16
+ };
17
+ exports.GgHealthchecksController = GgHealthchecksController;
18
+ tslib_1.__decorate([
19
+ (0, common_1.Get)(),
20
+ (0, terminus_1.HealthCheck)(),
21
+ tslib_1.__metadata("design:type", Function),
22
+ tslib_1.__metadata("design:paramtypes", []),
23
+ tslib_1.__metadata("design:returntype", Promise)
24
+ ], GgHealthchecksController.prototype, "check", null);
25
+ exports.GgHealthchecksController = GgHealthchecksController = tslib_1.__decorate([
26
+ (0, swagger_1.ApiExcludeController)(),
27
+ (0, common_1.Controller)({ path: '/health', version: common_1.VERSION_NEUTRAL }),
28
+ tslib_1.__metadata("design:paramtypes", [terminus_1.HealthCheckService,
29
+ terminus_1.HttpHealthIndicator])
30
+ ], GgHealthchecksController);
31
+ //# sourceMappingURL=gg-healthchecks.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gg-healthchecks.controller.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-healthchecks/gg-healthchecks.controller.ts"],"names":[],"mappings":";;;;AAAA,2CAAkE;AAClE,6CAAuD;AACvD,+CAA2G;AAIpG,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACnC,YACmB,MAA0B,EAC1B,SAA8B;QAD9B,WAAM,GAAN,MAAM,CAAoB;QAC1B,cAAS,GAAT,SAAS,CAAqB;IAC9C,CAAC;IAIG,KAAK;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;CACF,CAAA;AAXY,4DAAwB;AAQ5B;IAFN,IAAA,YAAG,GAAE;IACL,IAAA,sBAAW,GAAE;;;;qDAGb;mCAVU,wBAAwB;IAFpC,IAAA,8BAAoB,GAAE;IACtB,IAAA,mBAAU,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,wBAAe,EAAE,CAAC;6CAG7B,6BAAkB;QACf,8BAAmB;GAHtC,wBAAwB,CAWpC"}
@@ -0,0 +1,4 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ export declare class GgHealthchecksModule {
3
+ static forRoot(): DynamicModule;
4
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GgHealthchecksModule = void 0;
4
+ const terminus_1 = require("@nestjs/terminus");
5
+ const gg_healthchecks_controller_1 = require("./gg-healthchecks.controller");
6
+ class GgHealthchecksModule {
7
+ static forRoot() {
8
+ return {
9
+ module: GgHealthchecksModule,
10
+ global: true,
11
+ controllers: [gg_healthchecks_controller_1.GgHealthchecksController],
12
+ imports: [terminus_1.TerminusModule],
13
+ };
14
+ }
15
+ }
16
+ exports.GgHealthchecksModule = GgHealthchecksModule;
17
+ //# sourceMappingURL=gg-healthchecks.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gg-healthchecks.module.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-healthchecks/gg-healthchecks.module.ts"],"names":[],"mappings":";;;AACA,+CAAkD;AAClD,6EAAwE;AAExE,MAAa,oBAAoB;IACxB,MAAM,CAAC,OAAO;QACnB,OAAO;YACL,MAAM,EAAE,oBAAoB;YAC5B,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,CAAC,qDAAwB,CAAC;YACvC,OAAO,EAAE,CAAC,yBAAc,CAAC;SAC1B,CAAC;IACJ,CAAC;CACF;AATD,oDASC"}
@@ -0,0 +1,2 @@
1
+ export * from './kernel';
2
+ export * from './service-providers';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./kernel"), exports);
5
+ tslib_1.__exportStar(require("./service-providers"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-kernel/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,8DAAoC"}
@@ -0,0 +1,36 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node/http" />
3
+ /// <reference types="pino-http" />
4
+ import { ConfigType } from '@nestjs/config';
5
+ import { NestExpressApplication } from '@nestjs/platform-express';
6
+ import { appConfig } from '../gg-config';
7
+ import { GgMicroService } from '../gg-micro';
8
+ import { BaseServiceProvider } from './service-providers';
9
+ export declare class Kernel {
10
+ private readonly app;
11
+ private readonly appConf;
12
+ private static readonly serviceProviders;
13
+ private readonly logger;
14
+ constructor(app: NestExpressApplication, appConf: ConfigType<typeof appConfig>);
15
+ /**
16
+ * @param module
17
+ */
18
+ static init(module: unknown): Promise<Kernel>;
19
+ /**
20
+ * Add application providers that should be registered on start (app middlewares, side effect classes)
21
+ * @param providers
22
+ */
23
+ static use<T extends typeof BaseServiceProvider>(providers: T[]): typeof Kernel;
24
+ static useBaseServiceProviders(): typeof Kernel;
25
+ /**
26
+ * Instantiate all Service Providers, call hooks and register in system
27
+ * @protected
28
+ */
29
+ protected static registerServiceProviders(app: NestExpressApplication, appConf: ConfigType<typeof appConfig>): Promise<void>;
30
+ getAppInstance(): NestExpressApplication<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>>;
31
+ runMicroservice(queues: GgMicroService[]): Promise<this>;
32
+ /**
33
+ * Start the server
34
+ */
35
+ runApi(): Promise<void>;
36
+ }
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Kernel = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const core_1 = require("@nestjs/core");
6
+ const platform_express_1 = require("@nestjs/platform-express");
7
+ const lodash_1 = require("lodash");
8
+ const gg_config_1 = require("../gg-config");
9
+ const gg_errors_exception_filter_1 = require("../gg-errors/gg-errors-exception.filter");
10
+ const gg_micro_1 = require("../gg-micro");
11
+ const service_providers_1 = require("./service-providers");
12
+ class Kernel {
13
+ constructor(app, appConf) {
14
+ this.app = app;
15
+ this.appConf = appConf;
16
+ this.logger = new common_1.Logger(Kernel.name);
17
+ }
18
+ /**
19
+ * @param module
20
+ */
21
+ static async init(module) {
22
+ const app = await core_1.NestFactory.create(module, new platform_express_1.ExpressAdapter(), { bufferLogs: true });
23
+ const config = app.get(gg_config_1.appConfig.KEY);
24
+ await this.registerServiceProviders(app, config);
25
+ return new Kernel(app, config);
26
+ }
27
+ static use(provider) {
28
+ const isProvidersArray = (0, lodash_1.isArray)(provider);
29
+ if (isProvidersArray)
30
+ provider.forEach((p) => this.serviceProviders.push(p));
31
+ if (!isProvidersArray)
32
+ this.serviceProviders.push(provider);
33
+ return this;
34
+ }
35
+ static useBaseServiceProviders() {
36
+ return this.use([
37
+ service_providers_1.LoggerServiceProvider,
38
+ service_providers_1.ShutdownHooksServiceProvider,
39
+ service_providers_1.ValidationServiceProvider,
40
+ service_providers_1.GlobalPrefixServiceProvider,
41
+ service_providers_1.VersioningServiceProvider,
42
+ service_providers_1.SwaggerServiceProvider,
43
+ service_providers_1.HelmetServiceProvider,
44
+ ]);
45
+ }
46
+ /**
47
+ * Instantiate all Service Providers, call hooks and register in system
48
+ * @protected
49
+ */
50
+ static async registerServiceProviders(app, appConf) {
51
+ const providers = this.serviceProviders.map(async (sp) => {
52
+ const provider = new sp(app, appConf);
53
+ await provider.beforeRegistrationHook();
54
+ await provider.register();
55
+ await provider.afterRegistrationHook();
56
+ });
57
+ await Promise.all(providers);
58
+ }
59
+ getAppInstance() {
60
+ return this.app;
61
+ }
62
+ async runMicroservice(queues) {
63
+ const config = this.app.get(gg_micro_1.rmqConfig.KEY);
64
+ queues.forEach((queue) => {
65
+ const rmqConfigurator = new gg_micro_1.GgRmqConfigurator(queue, config);
66
+ this.app.connectMicroservice(rmqConfigurator.getServerOptions(), { inheritAppConfig: true });
67
+ });
68
+ await this.app.startAllMicroservices();
69
+ const exceptionFilter = this.app.get(gg_errors_exception_filter_1.GgErrorsExceptionFilter);
70
+ const microservices = this.app.getMicroservices();
71
+ for (const microservice of microservices) {
72
+ microservice.useGlobalFilters(exceptionFilter);
73
+ }
74
+ this.logger.log({ msg: 'Microservice agent started' });
75
+ return this;
76
+ }
77
+ /**
78
+ * Start the server
79
+ */
80
+ async runApi() {
81
+ await this.app.listen(this.appConf.port, () => this.logger.log(`"${this.appConf.name}" is running. Base API url: http://127.0.0.1:${this.appConf.port}/${this.appConf.prefix}/api`));
82
+ }
83
+ }
84
+ exports.Kernel = Kernel;
85
+ Kernel.serviceProviders = [];
86
+ //# sourceMappingURL=kernel.js.map