@rsdk/core 1.0.7 → 1.0.9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdk/core",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Nestjs based microservice chassis",
5
5
  "license": "Apache License 2.0",
6
6
  "publishConfig": {
@@ -27,13 +27,13 @@
27
27
  "@nestjs/common": "^9.0.0",
28
28
  "@nestjs/core": "^9.0.0",
29
29
  "@nestjs/microservices": "^9.0.0",
30
- "@rsdk/common": "^1.0.7",
31
- "@rsdk/decorators": "^1.0.7",
32
- "@rsdk/logging": "^1.0.7",
30
+ "@rsdk/common": "^1.0.9",
31
+ "@rsdk/decorators": "^1.0.9",
32
+ "@rsdk/logging": "^1.0.9",
33
33
  "axios": "^1.1.3",
34
34
  "lodash": "^4.17.21",
35
35
  "reflect-metadata": "^0.1.13",
36
36
  "rxjs": "^7.0.0"
37
37
  },
38
- "gitHead": "c007ea7f137e129eb3b70db0c8d650e28425a4c0"
38
+ "gitHead": "6bb1f85ba05ce2f0b1f724537a78d11eab072942"
39
39
  }
@@ -1,5 +1,7 @@
1
1
  import type { INestApplication } from '@nestjs/common/interfaces';
2
2
  import { NestFactory } from '@nestjs/core';
3
+ import { text } from '@rsdk/common';
4
+ import { LoggerFactory } from '@rsdk/logging';
3
5
 
4
6
  import { PlatformContext } from '../platform.context';
5
7
  import type { PlatformAppMetadata, PlatformAppOptions } from '../types';
@@ -11,8 +13,38 @@ import type { PlatformAppMetadata, PlatformAppOptions } from '../types';
11
13
  * ready to go!
12
14
  */
13
15
  export class PlatformApp {
16
+ private static logger = LoggerFactory.create(PlatformApp);
17
+
14
18
  private readonly context: PlatformContext;
15
19
 
20
+ static {
21
+ const { logger } = PlatformApp;
22
+ logger.info('Registering unhandled rejections handler...');
23
+
24
+ // This code enriches output if unhandled exceptions happen
25
+ process.on('unhandledRejection', (reason: any, promise) => {
26
+ logger.error(
27
+ text`
28
+ Unhandled promise rejection happened! Process is shutting down
29
+ with exit code 1. See: https://github.com/nodejs/node/issues/20392
30
+ and https://nodejs.org/api/process.html#event-unhandledrejection
31
+ `,
32
+ { promise, reason },
33
+ );
34
+
35
+ /**
36
+ * Additionally writes to standard console, because both <promise> and <reason>
37
+ * can be not serializable
38
+ */
39
+ console.error('Found unhandled rejection', {
40
+ promise,
41
+ reason,
42
+ });
43
+
44
+ process.exit(1);
45
+ });
46
+ }
47
+
16
48
  constructor(readonly platformAppOptions: PlatformAppOptions) {
17
49
  this.context = new PlatformContext(platformAppOptions);
18
50
  }
@@ -1,9 +1,4 @@
1
- import {
2
- Assert,
3
- text,
4
- Timespan,
5
- TIMESPAN_STRING_PATTERN,
6
- } from '@rsdk/common';
1
+ import { Assert, text, Timespan, TIMESPAN_STRING_PATTERN } from '@rsdk/common';
7
2
 
8
3
  import type { PropertyParser, RawConfigValue } from '../../types';
9
4
 
package/.eslintignore DELETED
@@ -1,4 +0,0 @@
1
- libs/contract
2
- **/*.d.ts
3
- **/*.js
4
- **/generated
package/.eslintrc.js DELETED
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: ["rsdk"],
4
- };
package/.prettierignore DELETED
@@ -1 +0,0 @@
1
- **/*.spec.ts
package/.prettierrc.json DELETED
@@ -1 +0,0 @@
1
- "@rsdk/prettier-config"