@rsdk/grpc.server 4.0.0-next.8 → 4.0.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.
- package/CHANGELOG.md +89 -13
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -0
- package/dist/controllers/health.controller.js.map +1 -1
- package/dist/controllers/reflection/v1.base.controller.js +1 -1
- package/dist/controllers/reflection/v1.base.controller.js.map +1 -1
- package/dist/grpc-errors.formatter.d.ts +1 -2
- package/dist/grpc-errors.formatter.js +2 -3
- package/dist/grpc-errors.formatter.js.map +1 -1
- package/dist/grpc-errors.sender.d.ts +1 -1
- package/dist/grpc-errors.sender.js +2 -3
- package/dist/grpc-errors.sender.js.map +1 -1
- package/dist/grpc-logger.interceptor.d.ts +12 -0
- package/dist/grpc-logger.interceptor.js +77 -0
- package/dist/grpc-logger.interceptor.js.map +1 -0
- package/dist/grpc.config.d.ts +1 -0
- package/dist/grpc.config.js +8 -0
- package/dist/grpc.config.js.map +1 -1
- package/dist/grpc.transport.d.ts +4 -3
- package/dist/grpc.transport.js +36 -12
- package/dist/grpc.transport.js.map +1 -1
- package/dist/reflection.service.js.map +1 -1
- package/jest.config.e2e.js +1 -0
- package/jest.config.js +1 -11
- package/jest.config.unit.js +1 -0
- package/package.json +9 -10
- package/src/constants.ts +1 -0
- package/src/controllers/reflection/v1.base.controller.ts +1 -1
- package/src/grpc-errors.formatter.ts +2 -5
- package/src/grpc-errors.sender.ts +2 -3
- package/src/grpc-logger.interceptor.ts +75 -0
- package/src/grpc.config.ts +6 -0
- package/src/grpc.transport.ts +44 -13
- package/tsconfig.json +12 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,11 +3,76 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.0.0](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.19...v4.0.0) (2023-12-04)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @rsdk/grpc.server
|
|
9
|
+
|
|
10
|
+
## [4.0.0-next.19](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.18...v4.0.0-next.19) (2023-12-02)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @rsdk/grpc.server
|
|
13
|
+
|
|
14
|
+
## [4.0.0-next.18](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.17...v4.0.0-next.18) (2023-12-02)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @rsdk/grpc.server
|
|
17
|
+
|
|
18
|
+
## [4.0.0-next.17](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.16...v4.0.0-next.17) (2023-12-01)
|
|
19
|
+
|
|
20
|
+
**Note:** Version bump only for package @rsdk/grpc.server
|
|
21
|
+
|
|
22
|
+
## [4.0.0-next.16](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.15...v4.0.0-next.16) (2023-11-30)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @rsdk/grpc.server
|
|
25
|
+
|
|
26
|
+
## [4.0.0-next.15](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.14...v4.0.0-next.15) (2023-11-30)
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* added protocol detector ([#166](https://github.com/R-Vision/rsdk/issues/166)) ([f348995](https://github.com/R-Vision/rsdk/commit/f348995f29648c7392b7375c5b2001197d60eb36))
|
|
31
|
+
|
|
32
|
+
## [4.0.0-next.14](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.13...v4.0.0-next.14) (2023-11-29)
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* **core:** PFM-601 Add support send trace id from client to server ([#164](https://github.com/R-Vision/rsdk/issues/164)) ([9e37243](https://github.com/R-Vision/rsdk/commit/9e372437fbb3d7d2b1167b99d07b0ac64cb4013d)), closes [#pfm-601](https://github.com/R-Vision/rsdk/issues/pfm-601) [#pfm-601](https://github.com/R-Vision/rsdk/issues/pfm-601)
|
|
37
|
+
|
|
38
|
+
## [4.0.0-next.13](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.12...v4.0.0-next.13) (2023-11-29)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @rsdk/grpc.server
|
|
41
|
+
|
|
42
|
+
## [4.0.0-next.12](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.11...v4.0.0-next.12) (2023-11-29)
|
|
43
|
+
|
|
44
|
+
**Note:** Version bump only for package @rsdk/grpc.server
|
|
45
|
+
|
|
46
|
+
## [4.0.0-next.11](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.10...v4.0.0-next.11) (2023-11-29)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @rsdk/grpc.server
|
|
49
|
+
|
|
50
|
+
## [4.0.0-next.10](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.9...v4.0.0-next.10) (2023-11-29)
|
|
51
|
+
|
|
52
|
+
## [3.8.0](https://github.com/R-Vision/rsdk/compare/v3.7.0...v3.8.0) (2023-11-15)
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
* added configuration for request logging and move to trace level all request
|
|
57
|
+
logging ([#158](https://github.com/R-Vision/rsdk/issues/158)) ([0304672](https://github.com/R-Vision/rsdk/commit/0304672c112fd626642a2d44b0384fbf188e71b4))
|
|
58
|
+
|
|
59
|
+
## [3.7.0](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.5...v3.7.0) (2023-11-15)
|
|
60
|
+
|
|
61
|
+
### Features
|
|
62
|
+
|
|
63
|
+
* added logging to rpc and http
|
|
64
|
+
transports ([#156](https://github.com/R-Vision/rsdk/issues/156)) ([7ebddb9](https://github.com/R-Vision/rsdk/commit/7ebddb97d2c30811eba9868b6d3ff9778708c957))
|
|
65
|
+
|
|
66
|
+
## [4.0.0-next.9](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.8...v4.0.0-next.9) (2023-11-29)
|
|
67
|
+
|
|
68
|
+
**Note:** Version bump only for package @rsdk/grpc.server
|
|
69
|
+
|
|
6
70
|
## [4.0.0-next.8](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.7...v4.0.0-next.8) (2023-11-29)
|
|
7
71
|
|
|
8
72
|
### Features
|
|
9
73
|
|
|
10
|
-
* Kafka batch
|
|
74
|
+
* Kafka batch
|
|
75
|
+
producer ([#150](https://github.com/R-Vision/rsdk/issues/150)) ([2faa2f4](https://github.com/R-Vision/rsdk/commit/2faa2f41ca0dbb6d8a92cbf0ab20cf5cefeaf4e9))
|
|
11
76
|
|
|
12
77
|
## [4.0.0-next.7](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.6...v4.0.0-next.7) (2023-11-21)
|
|
13
78
|
|
|
@@ -21,7 +86,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
21
86
|
|
|
22
87
|
### Features
|
|
23
88
|
|
|
24
|
-
* **PFM-126:** reflection
|
|
89
|
+
* **PFM-126:** reflection
|
|
90
|
+
added ([ffaaa99](https://github.com/R-Vision/rsdk/commit/ffaaa996e0a81f98be46b0b73badb59f3e680eac))
|
|
25
91
|
|
|
26
92
|
### Bug Fixes
|
|
27
93
|
|
|
@@ -35,7 +101,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
35
101
|
|
|
36
102
|
### Bug Fixes
|
|
37
103
|
|
|
38
|
-
* all yarn peers dependency
|
|
104
|
+
* all yarn peers dependency
|
|
105
|
+
issues ([e0db9ef](https://github.com/R-Vision/rsdk/commit/e0db9ef1ab8a4df4e1f8ff6f6a9e3728f497549b))
|
|
39
106
|
|
|
40
107
|
## [4.0.0-next.2](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.1...v4.0.0-next.2) (2023-11-10)
|
|
41
108
|
|
|
@@ -101,7 +168,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
101
168
|
|
|
102
169
|
### Features
|
|
103
170
|
|
|
104
|
-
* remove typeorm error
|
|
171
|
+
* remove typeorm error
|
|
172
|
+
hiding ([#126](https://github.com/R-Vision/rsdk/issues/126)) ([cef179b](https://github.com/R-Vision/rsdk/commit/cef179bfffcd2da72984f4a5a750f7ede5d8cfb7))
|
|
105
173
|
|
|
106
174
|
## [3.5.0-next.7](https://github.com/R-Vision/rsdk/compare/v3.5.0-next.6...v3.5.0-next.7) (2023-10-02)
|
|
107
175
|
|
|
@@ -175,7 +243,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
175
243
|
|
|
176
244
|
### Bug Fixes
|
|
177
245
|
|
|
178
|
-
* **grpc.server:** added message to `ClientError` in `cause` from mapped
|
|
246
|
+
* **grpc.server:** added message to `ClientError` in `cause` from mapped
|
|
247
|
+
errors ([da4ef10](https://github.com/R-Vision/rsdk/commit/da4ef10e21b7494791ba10a9068748ac0365a664))
|
|
179
248
|
|
|
180
249
|
## [3.3.0](https://github.com/R-Vision/rsdk/compare/v3.3.0-next.0...v3.3.0) (2023-08-10)
|
|
181
250
|
|
|
@@ -217,7 +286,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
217
286
|
|
|
218
287
|
### Features
|
|
219
288
|
|
|
220
|
-
* added exception code to
|
|
289
|
+
* added exception code to
|
|
290
|
+
payload ([#92](https://github.com/R-Vision/rsdk/issues/92)) ([6a9565b](https://github.com/R-Vision/rsdk/commit/6a9565b23746122676abb1f5166f9ef8b181864b))
|
|
221
291
|
|
|
222
292
|
## [3.0.2](https://github.com/R-Vision/rsdk/compare/v3.0.1...v3.0.2) (2023-08-07)
|
|
223
293
|
|
|
@@ -227,7 +297,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
227
297
|
|
|
228
298
|
### Bug Fixes
|
|
229
299
|
|
|
230
|
-
* **deps:** correctly
|
|
300
|
+
* **deps:** correctly
|
|
301
|
+
peerDependencies ([349628f](https://github.com/R-Vision/rsdk/commit/349628f10da46a30d6c8b9f9387e010869318212))
|
|
231
302
|
|
|
232
303
|
## [3.0.1-next.0](https://github.com/R-Vision/rsdk/compare/v3.0.0...v3.0.1-next.0) (2023-08-07)
|
|
233
304
|
|
|
@@ -253,7 +324,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
253
324
|
|
|
254
325
|
### Features
|
|
255
326
|
|
|
256
|
-
* **grpc.clients:** grpc rich
|
|
327
|
+
* **grpc.clients:** grpc rich
|
|
328
|
+
error ([#85](https://github.com/R-Vision/rsdk/issues/85)) ([be99f40](https://github.com/R-Vision/rsdk/commit/be99f408295bf1750f6f0c39e067cca971d973e3))
|
|
257
329
|
|
|
258
330
|
# [2.6.0-next.13](https://github.com/R-Vision/rsdk/compare/v2.6.0-next.12...v2.6.0-next.13) (2023-08-01)
|
|
259
331
|
|
|
@@ -355,12 +427,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
355
427
|
|
|
356
428
|
### Draft
|
|
357
429
|
|
|
358
|
-
* Pfm 303 static to meta
|
|
430
|
+
* Pfm 303 static to meta
|
|
431
|
+
migration ([#45](https://github.com/R-Vision/rsdk/issues/45)) ([d98e303](https://github.com/R-Vision/rsdk/commit/d98e3032f9b10446b478427d841b9209ed68fa2d))
|
|
359
432
|
|
|
360
433
|
### BREAKING CHANGES
|
|
361
434
|
|
|
362
435
|
* GrpcClientModule removed
|
|
363
|
-
new way for declaration with `GrpcServers.define()` and `@InjectGrpcClient`
|
|
436
|
+
new way for declaration with `GrpcServers.define()` and `@InjectGrpcClient`
|
|
364
437
|
|
|
365
438
|
* fix: rework interaction with metadata and generating modules from metadata
|
|
366
439
|
|
|
@@ -394,7 +467,8 @@ new way for declaration with `GrpcServers.define()` and `@InjectGrpcClient`
|
|
|
394
467
|
|
|
395
468
|
### Bug Fixes
|
|
396
469
|
|
|
397
|
-
* remove private dependencies from `peerDependencies`
|
|
470
|
+
* remove private dependencies from `peerDependencies`
|
|
471
|
+
section ([0bce6ff](https://github.com/R-Vision/rsdk/commit/0bce6ffb5b699e2ed1dc9aca77cbdbf085267ff7))
|
|
398
472
|
|
|
399
473
|
## 1.0.11 (2023-05-23)
|
|
400
474
|
|
|
@@ -404,7 +478,8 @@ new way for declaration with `GrpcServers.define()` and `@InjectGrpcClient`
|
|
|
404
478
|
|
|
405
479
|
### Bug Fixes
|
|
406
480
|
|
|
407
|
-
* add "access: public" to new
|
|
481
|
+
* add "access: public" to new
|
|
482
|
+
packages ([04d5983](https://github.com/R-Vision/rsdk/commit/04d5983cfa3e97c5d8219e07208a0499a8c6bc83))
|
|
408
483
|
|
|
409
484
|
## 1.0.9 (2023-05-21)
|
|
410
485
|
|
|
@@ -434,7 +509,8 @@ new way for declaration with `GrpcServers.define()` and `@InjectGrpcClient`
|
|
|
434
509
|
|
|
435
510
|
### Bug Fixes
|
|
436
511
|
|
|
437
|
-
* builtin make not private in
|
|
512
|
+
* builtin make not private in
|
|
513
|
+
npm ([50c83b6](https://github.com/R-Vision/rsdk/commit/50c83b6454f9a89f1e99d3b33a497ce2c029d8c6))
|
|
438
514
|
|
|
439
515
|
## 1.0.2 (2023-05-10)
|
|
440
516
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GRPC_PROTOCOL = "grpc";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.controller.js","sourceRoot":"","sources":["../../src/controllers/health.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,+EAGoD;AAEpD,qCAIoB;AAKb,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAEwB;IAChC;IAFnB,YACmD,MAAe,EAC/C,MAA2B;QADK,WAAM,GAAN,MAAM,CAAS;QAC/C,WAAM,GAAN,MAAM,CAAqB;IAC3C,CAAC;IAEJ;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,EAAsB;QACzC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,iDAAgC,CAAC;QAElE,IAAI;
|
|
1
|
+
{"version":3,"file":"health.controller.js","sourceRoot":"","sources":["../../src/controllers/health.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,+EAGoD;AAEpD,qCAIoB;AAKb,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAEwB;IAChC;IAFnB,YACmD,MAAe,EAC/C,MAA2B;QADK,WAAM,GAAN,MAAM,CAAS;QAC/C,WAAM,GAAN,MAAM,CAAqB;IAC3C,CAAC;IAEJ;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,EAAsB;QACzC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,iDAAgC,CAAC;QAElE,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAEjC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;QAC7B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAkB,CAAC,CAAC;YAE5D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;QACjC,CAAC;IACH,CAAC;IAED,KAAK;QACH,MAAM,IAAI,wBAAiB,CAAC,kCAAkC,CAAC,CAAC;IAClE,CAAC;CACF,CAAA;AAhCY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,kCAAiB,GAAE;IAGf,WAAA,IAAA,mBAAY,EAAC,gBAAgB,CAAC,CAAA;6CACN,0BAAmB;GAHnC,gBAAgB,CAgC5B"}
|
|
@@ -161,7 +161,7 @@ let BaseV1GrpcReflectionController = class BaseV1GrpcReflectionController {
|
|
|
161
161
|
$case: 'errorResponse',
|
|
162
162
|
errorResponse: {
|
|
163
163
|
errorCode: grpc.status.UNAVAILABLE,
|
|
164
|
-
errorMessage: `Reflection is disabled
|
|
164
|
+
errorMessage: `Reflection is disabled`,
|
|
165
165
|
},
|
|
166
166
|
});
|
|
167
167
|
return response$.next(response);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1.base.controller.js","sourceRoot":"","sources":["../../../src/controllers/reflection/v1.base.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AACtC,2CAAiE;AAMjE,qCAA0C;AAG1C,+BAA+B;AAE/B,mDAA+C;AAC/C,iEAA6D;AAE7D;;;;;;;;GAQG;AACH,IAAa,8BAA8B,GAA3C,MAAa,8BAA8B;IAItB;IACiC;IACN;IAH9C,YACmB,MAAkB,EACe,MAAe,EACrB,OAA0B;QAFrD,WAAM,GAAN,MAAM,CAAY;QACe,WAAM,GAAN,MAAM,CAAS;QACrB,YAAO,GAAP,OAAO,CAAmB;IACrE,CAAC;IAEJ;;;;;;OAMG;IACH,oBAAoB,CAClB,QAA6C;QAE7C,MAAM,SAAS,GAAG,IAAI,cAAO,EAA4B,CAAC;QAE1D,QAAQ,CAAC,SAAS,CAAC;YACjB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;gBAC1B,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC;gBACnC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC;YACxC,QAAQ,EAAE,GAAS,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE;SAC3C,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC,YAAY,EAAE,CAAC;IAClC,CAAC;IAEO,YAAY,CAClB,OAAgC;QAEhC,IAAI,OAAO,CAAC,cAAc,EAAE,KAAK,KAAK,cAAc,EAAE;
|
|
1
|
+
{"version":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BAC5D,KAAK,EAAE,eAAe;gBACtB,aAAa,EAAE;oBACb,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;oBAClC,YAAY,EAAE,wBAAwB;iBACvC;aACF,CAAC,CAAC;YAEH,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC,CAAC;IACJ,CAAC;CACF,CAAA;AApJY,wEAA8B;yCAA9B,8BAA8B;IAKtC,WAAA,IAAA,mBAAY,EAAC,sCAAiB,CAAC,CAAA;IAC/B,WAAA,IAAA,eAAM,EAAC,sCAAiB,CAAC,CAAA;qCAFD,wBAAU,UAEkB,sCAAiB;GAN7D,8BAA8B,CAoJ1C"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { ArgumentsHost } from '@nestjs/common';
|
|
2
1
|
import type { IErrorsFormatter } from '@rsdk/core';
|
|
3
2
|
import { ExceptionKind } from '@rsdk/core';
|
|
4
3
|
import type { FormattedGrpcError } from './types';
|
|
5
4
|
export declare class GrpcErrorsFormatter implements IErrorsFormatter {
|
|
6
5
|
static readonly defaultKind = ExceptionKind.UNKNOWN;
|
|
6
|
+
protocol: string;
|
|
7
7
|
private readonly statusMap;
|
|
8
|
-
match(host: ArgumentsHost): boolean;
|
|
9
8
|
format(ex: unknown, verboseErrors?: boolean): FormattedGrpcError;
|
|
10
9
|
}
|
|
@@ -26,8 +26,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.GrpcErrorsFormatter = void 0;
|
|
27
27
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
28
28
|
const core_1 = require("@rsdk/core");
|
|
29
|
+
const constants_1 = require("./constants");
|
|
29
30
|
class GrpcErrorsFormatter {
|
|
30
31
|
static defaultKind = core_1.ExceptionKind.UNKNOWN;
|
|
32
|
+
protocol = constants_1.GRPC_PROTOCOL;
|
|
31
33
|
statusMap = {
|
|
32
34
|
[core_1.ExceptionKind.AUTHENTICATION]: grpc.status.UNAUTHENTICATED,
|
|
33
35
|
[core_1.ExceptionKind.NOT_ALLOWED]: grpc.status.PERMISSION_DENIED,
|
|
@@ -40,9 +42,6 @@ class GrpcErrorsFormatter {
|
|
|
40
42
|
[core_1.ExceptionKind.UNAVAILABLE]: grpc.status.UNAVAILABLE,
|
|
41
43
|
[core_1.ExceptionKind.UNKNOWN]: grpc.status.UNKNOWN,
|
|
42
44
|
};
|
|
43
|
-
match(host) {
|
|
44
|
-
return host.getType() === 'rpc';
|
|
45
|
-
}
|
|
46
45
|
format(ex, verboseErrors) {
|
|
47
46
|
if (ex instanceof core_1.PipelineException) {
|
|
48
47
|
const message = verboseErrors
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc-errors.formatter.js","sourceRoot":"","sources":["../src/grpc-errors.formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;
|
|
1
|
+
{"version":3,"file":"grpc-errors.formatter.js","sourceRoot":"","sources":["../src/grpc-errors.formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,qCAA8D;AAE9D,2CAA4C;AAG5C,MAAa,mBAAmB;IAC9B,MAAM,CAAU,WAAW,GAAG,oBAAa,CAAC,OAAO,CAAC;IACpD,QAAQ,GAAG,yBAAa,CAAC;IACR,SAAS,GAAuC;QAC/D,CAAC,oBAAa,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe;QAC3D,CAAC,oBAAa,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB;QAC1D,CAAC,oBAAa,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,mBAAmB;QACzD,CAAC,oBAAa,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB;QACnD,CAAC,oBAAa,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,iB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YACpB,OAAO,EAAE,aAAa,CAAC,CAAC,CAAE,EAAU,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE;YAClD,IAAI,EAAG,EAAU,EAAE,IAAI,IAAI,mBAAmB,CAAC,WAAW;YAC1D,aAAa,EAAG,EAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC7C,CAAC;IACJ,CAAC;;AA1CH,kDA2CC"}
|
|
@@ -3,6 +3,6 @@ import type { IErrorsSender } from '@rsdk/core';
|
|
|
3
3
|
import type { EMPTY, Observable } from 'rxjs';
|
|
4
4
|
import type { FormattedGrpcError } from './types';
|
|
5
5
|
export declare class GrpcErrorsSender implements IErrorsSender {
|
|
6
|
-
|
|
6
|
+
protocol: string;
|
|
7
7
|
send(_host: ArgumentsHost, ex: FormattedGrpcError): Observable<any> | typeof EMPTY;
|
|
8
8
|
}
|
|
@@ -7,10 +7,9 @@ const nice_grpc_1 = require("nice-grpc");
|
|
|
7
7
|
// @ts-ignore потому что не добавили в тайпинги...
|
|
8
8
|
const convertMetadata_1 = require("nice-grpc/lib/utils/convertMetadata");
|
|
9
9
|
const rxjs_1 = require("rxjs");
|
|
10
|
+
const constants_1 = require("./constants");
|
|
10
11
|
class GrpcErrorsSender {
|
|
11
|
-
|
|
12
|
-
return host.getType() === 'rpc';
|
|
13
|
-
}
|
|
12
|
+
protocol = constants_1.GRPC_PROTOCOL;
|
|
14
13
|
send(_host, ex) {
|
|
15
14
|
const niceGrpcMetadata = (0, nice_grpc_1.Metadata)();
|
|
16
15
|
const status = grpc_error_v1_1.Status.fromPartial({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc-errors.sender.js","sourceRoot":"","sources":["../src/grpc-errors.sender.ts"],"names":[],"mappings":";;;AACA,6EAAmE;AAEnE,yCAAyD;AACzD,6DAA6D;AAC7D,kDAAkD;AAClD,yEAA8E;AAE9E,+BAAkC;
|
|
1
|
+
{"version":3,"file":"grpc-errors.sender.js","sourceRoot":"","sources":["../src/grpc-errors.sender.ts"],"names":[],"mappings":";;;AACA,6EAAmE;AAEnE,yCAAyD;AACzD,6DAA6D;AAC7D,kDAAkD;AAClD,yEAA8E;AAE9E,+BAAkC;AAElC,2CAA4C;AAG5C,MAAa,gBAAgB;IAC3B,QAAQ,GAAG,yBAAa,CAAC;IAEzB,IAAI,CACF,KAAoB,EACpB,EAAsB;QAEtB,MAAM,gBAAgB,GAAG,IAAA,oBAAgB,GAAE,CAAC;QAE5C,MAAM,MAAM,GAAG,sBAAM,CAAC,WAAW,CAAC;YAChC,IAAI,EAAE,EAAE,CAAC,IAAI;YACb,OAAO,EAAE,EAAE,CAAC,OAAO;YACnB,OAAO,EAAE,EAAE,CAAC,OAAO;YACnB,aAAa,EAAE,EAAE,CAAC,aAAa;SAChC,CAAC,CAAC;QAEH,gBAAgB,CAAC,GAAG,CAClB,yBAAyB,EACzB,sBAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAC/B,CAAC;QACF,MAAM,KAAK,GAAG;YACZ,IAAI,EAAE,EAAE,CAAC,IAAI;YACb,OAAO,EAAE,EAAE,CAAC,OAAO;YACnB,QAAQ,EAAE,IAAA,yCAAuB,EAAC,gBAAgB,CAAC;SACpD,CAAC;QAEF,OAAO,IAAA,iBAAU,EAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;CACF;AA5BD,4CA4BC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common/interfaces';
|
|
2
|
+
import { ProtocolDetector } from '@rsdk/core';
|
|
3
|
+
import { ILogger } from '@rsdk/logging';
|
|
4
|
+
import type { Observable } from 'rxjs';
|
|
5
|
+
import { GRPCConfig } from './grpc.config';
|
|
6
|
+
export declare class GrpcLoggerInterceptor implements NestInterceptor {
|
|
7
|
+
private logger;
|
|
8
|
+
private grpcConfig;
|
|
9
|
+
private detector;
|
|
10
|
+
constructor(logger: ILogger, grpcConfig: GRPCConfig, detector: ProtocolDetector);
|
|
11
|
+
intercept(context: ExecutionContext, next: CallHandler<any>): Observable<any> | Promise<Observable<any>>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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.GrpcLoggerInterceptor = void 0;
|
|
16
|
+
const core_1 = require("@rsdk/core");
|
|
17
|
+
const rxjs_1 = require("rxjs");
|
|
18
|
+
const grpc_config_1 = require("./grpc.config");
|
|
19
|
+
let GrpcLoggerInterceptor = class GrpcLoggerInterceptor {
|
|
20
|
+
logger;
|
|
21
|
+
grpcConfig;
|
|
22
|
+
detector;
|
|
23
|
+
constructor(logger, grpcConfig, detector) {
|
|
24
|
+
this.logger = logger;
|
|
25
|
+
this.grpcConfig = grpcConfig;
|
|
26
|
+
this.detector = detector;
|
|
27
|
+
}
|
|
28
|
+
intercept(context, next) {
|
|
29
|
+
if (!this.grpcConfig.requestLogging) {
|
|
30
|
+
return next.handle();
|
|
31
|
+
}
|
|
32
|
+
const protocol = this.detector.getProtocol(context);
|
|
33
|
+
const isRpc = protocol === 'grpc';
|
|
34
|
+
if (!isRpc) {
|
|
35
|
+
return next.handle();
|
|
36
|
+
}
|
|
37
|
+
const rpc = context.switchToRpc();
|
|
38
|
+
const startDate = Date.now();
|
|
39
|
+
const rpcContext = rpc.getContext();
|
|
40
|
+
const serializedCtx = rpcContext?.toJSON?.() ?? rpcContext;
|
|
41
|
+
const requestForLog = {
|
|
42
|
+
data: rpc.getData(),
|
|
43
|
+
ctx: serializedCtx,
|
|
44
|
+
};
|
|
45
|
+
this.logger.trace('received rpc request', {
|
|
46
|
+
request: requestForLog,
|
|
47
|
+
timestamp: startDate,
|
|
48
|
+
});
|
|
49
|
+
return next.handle().pipe((0, rxjs_1.catchError)((error) => {
|
|
50
|
+
const endDate = Date.now();
|
|
51
|
+
this.logger.trace('handled rpc request with error', {
|
|
52
|
+
request: requestForLog,
|
|
53
|
+
startDate,
|
|
54
|
+
endDate,
|
|
55
|
+
duration: endDate - startDate,
|
|
56
|
+
error,
|
|
57
|
+
});
|
|
58
|
+
return (0, rxjs_1.throwError)(() => error);
|
|
59
|
+
}), (0, rxjs_1.tap)((response) => {
|
|
60
|
+
const endDate = Date.now();
|
|
61
|
+
this.logger.trace('handled rpc request', {
|
|
62
|
+
request: requestForLog,
|
|
63
|
+
startDate,
|
|
64
|
+
endDate,
|
|
65
|
+
duration: endDate - startDate,
|
|
66
|
+
response,
|
|
67
|
+
});
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
exports.GrpcLoggerInterceptor = GrpcLoggerInterceptor;
|
|
72
|
+
exports.GrpcLoggerInterceptor = GrpcLoggerInterceptor = __decorate([
|
|
73
|
+
__param(0, (0, core_1.InjectLogger)(GrpcLoggerInterceptor)),
|
|
74
|
+
__metadata("design:paramtypes", [Object, grpc_config_1.GRPCConfig,
|
|
75
|
+
core_1.ProtocolDetector])
|
|
76
|
+
], GrpcLoggerInterceptor);
|
|
77
|
+
//# sourceMappingURL=grpc-logger.interceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grpc-logger.interceptor.js","sourceRoot":"","sources":["../src/grpc-logger.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,qCAA4D;AAG5D,+BAAmD;AAEnD,+CAA2C;AAE3C,IAAa,qBAAqB,GAAlC,MAAa,qBAAqB;IAEe;IACrC;IACA;IAHV,YAC+C,MAAe,EACpD,UAAsB,EACtB,QAA0B;QAFW,WAAM,GAAN,MAAM,CAAS;QACpD,eAAU,GAAV,UAAU,CAAY;QACtB,aAAQ,GAAR,QAAQ,CAAkB;IACjC,CAAC;IAEJ,SAAS,CACP,OAAyB,EACzB,IAAsB;QAEtB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,KAAK,GAAG,QAAQ,KAAK,MAAM,CAAC;QAClC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC;QAED,MAAM,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QAElC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;QACpC,MAAM,aAAa,GAAG,UAAU,EAAE,MAAM,EAAE,EAAE,IAAI,UAAU,CAAC;QAC3D,MAAM,aAAa,GAAG;YACpB,IAAI,EAAE,GAAG,CAAC,OAAO,EAAE;YACnB,GAAG,EAAE,aAAa;SACnB,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE;YACxC,OAAO,EAAE,aAAa;YACtB,SAAS,EAAE,SAAS;SACrB,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACvB,IAAA,iBAAU,EAAC,CAAC,KAAK,EAAE,EAAE;YACnB,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAE3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE;gBAClD,OAAO,EAAE,aAAa;gBACtB,SAAS;gBACT,OAAO;gBACP,QAAQ,EAAE,OAAO,GAAG,SAAS;gBAC7B,KAAK;aACN,CAAC,CAAC;YACH,OAAO,IAAA,iBAAU,EAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,CAAC,EACF,IAAA,UAAG,EAAC,CAAC,QAAQ,EAAE,EAAE;YACf,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAE3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,EAAE;gBACvC,OAAO,EAAE,aAAa;gBACtB,SAAS;gBACT,OAAO;gBACP,QAAQ,EAAE,OAAO,GAAG,SAAS;gBAC7B,QAAQ;aACT,CAAC,CAAC;QACL,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF,CAAA;AA9DY,sDAAqB;gCAArB,qBAAqB;IAE7B,WAAA,IAAA,mBAAY,EAAC,qBAAqB,CAAC,CAAA;6CAChB,wBAAU;QACZ,uBAAgB;GAJzB,qBAAqB,CA8DjC"}
|
package/dist/grpc.config.d.ts
CHANGED
package/dist/grpc.config.js
CHANGED
|
@@ -19,6 +19,7 @@ let GRPCConfig = class GRPCConfig extends core_1.Config {
|
|
|
19
19
|
maxRecv;
|
|
20
20
|
maxSend;
|
|
21
21
|
reflection;
|
|
22
|
+
requestLogging;
|
|
22
23
|
};
|
|
23
24
|
exports.GRPCConfig = GRPCConfig;
|
|
24
25
|
__decorate([
|
|
@@ -52,6 +53,13 @@ __decorate([
|
|
|
52
53
|
}),
|
|
53
54
|
__metadata("design:type", Boolean)
|
|
54
55
|
], GRPCConfig.prototype, "reflection", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, core_1.Property)('GRPC_REQUEST_LOGGING', new core_1.BoolParser(), {
|
|
58
|
+
defaultValue: false,
|
|
59
|
+
description: 'Enable trace logging all requests',
|
|
60
|
+
}),
|
|
61
|
+
__metadata("design:type", Boolean)
|
|
62
|
+
], GRPCConfig.prototype, "requestLogging", void 0);
|
|
55
63
|
exports.GRPCConfig = GRPCConfig = __decorate([
|
|
56
64
|
(0, core_1.ConfigSection)({
|
|
57
65
|
tags: [core_1.ConfigTag.infrastructure, core_1.ConfigTag.transport, core_1.ConfigTag.grpcServer],
|
package/dist/grpc.config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc.config.js","sourceRoot":"","sources":["../src/grpc.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAG2C;AAC3C,yCAAoC;AACpC,qCAOoB;AACpB,mDAAsD;AAK/C,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,aAAM;IAQ3B,OAAO,CAAU;IAMjB,OAAO,CAAU;IAMjB,OAAO,CAAU;IAMjB,UAAU,CAAW;
|
|
1
|
+
{"version":3,"file":"grpc.config.js","sourceRoot":"","sources":["../src/grpc.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAG2C;AAC3C,yCAAoC;AACpC,qCAOoB;AACpB,mDAAsD;AAK/C,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,aAAM;IAQ3B,OAAO,CAAU;IAMjB,OAAO,CAAU;IAMjB,OAAO,CAAU;IAMjB,UAAU,CAAW;IAMrB,cAAc,CAAW;CACnC,CAAA;AAjCY,gCAAU;AAQZ;IAPR,IAAA,eAAQ,EAAC,cAAc,EAAE,IAAI,+BAAiB,EAAE,EAAE;QACjD,YAAY,EAAE,eAAe;QAC7B,WAAW,EAAE,IAAA,aAAI,EAAA;;;KAGhB;KACF,CAAC;;2CACwB;AAMjB;IAJR,IAAA,eAAQ,EAAC,iCAAiC,EAAE,IAAI,gBAAS,EAAE,EAAE;QAC5D,YAAY,EAAE,8CAAkC;QAChD,WAAW,EAAE,iCAAiC;KAC/C,CAAC;;2CACwB;AAMjB;IAJR,IAAA,eAAQ,EAAC,8BAA8B,EAAE,IAAI,gBAAS,EAAE,EAAE;QACzD,YAAY,EAAE,2CAA+B;QAC7C,WAAW,EAAE,8BAA8B;KAC5C,CAAC;;2CACwB;AAMjB;IAJR,IAAA,eAAQ,EAAC,iBAAiB,EAAE,IAAI,iBAAU,EAAE,EAAE;QAC7C,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,mBAAmB;KACjC,CAAC;;8CAC4B;AAMrB;IAJR,IAAA,eAAQ,EAAC,sBAAsB,EAAE,IAAI,iBAAU,EAAE,EAAE;QAClD,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,mCAAmC;KACjD,CAAC;;kDACgC;qBAhCvB,UAAU;IAHtB,IAAA,oBAAa,EAAC;QACb,IAAI,EAAE,CAAC,gBAAS,CAAC,cAAc,EAAE,gBAAS,CAAC,SAAS,EAAE,gBAAS,CAAC,UAAU,CAAC;KAC5E,CAAC;GACW,UAAU,CAiCtB"}
|
package/dist/grpc.transport.d.ts
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import type { Controller } from '@nestjs/common/interfaces';
|
|
1
|
+
import type { Controller, ExecutionContext } from '@nestjs/common/interfaces';
|
|
2
2
|
import type { MicroserviceOptions } from '@nestjs/microservices';
|
|
3
3
|
import type { Constructor } from '@rsdk/common';
|
|
4
4
|
import type { ConfigContext, IErrorsFormatter, IErrorsSender, IErrorsTransformer, IMicroserviceTransport, NestModuleDefinitions } from '@rsdk/core';
|
|
5
5
|
import type { Package } from '@rsdk/grpc.loader';
|
|
6
6
|
export declare class GrpcTransport implements IMicroserviceTransport {
|
|
7
|
-
private readonly systemPackages;
|
|
8
7
|
private readonly logger;
|
|
9
8
|
private readonly packages;
|
|
10
9
|
private address?;
|
|
11
10
|
private maxRecv?;
|
|
12
11
|
private maxSend?;
|
|
13
12
|
private isInitialized;
|
|
13
|
+
private readonly systemPackages;
|
|
14
14
|
constructor(...packages: Package[]);
|
|
15
|
+
matchByContext(ctx: ExecutionContext): boolean;
|
|
15
16
|
getProtocol(): string;
|
|
16
17
|
getErrorsFormatter(): IErrorsFormatter;
|
|
17
18
|
getErrorsSender(): IErrorsSender;
|
|
18
19
|
getErrorTransformers(): IErrorsTransformer[];
|
|
19
20
|
getMetricsController(): Constructor<Controller>;
|
|
20
21
|
getHealthController(): Constructor<Controller>;
|
|
22
|
+
modules(): NestModuleDefinitions;
|
|
21
23
|
/**
|
|
22
24
|
* Unfortunally we can't access GRPCConfig in constructor because
|
|
23
25
|
* PlatformConfigModule is not initilalized yet
|
|
24
26
|
*/
|
|
25
27
|
init(configContext: ConfigContext): void;
|
|
26
28
|
createMicroserviceOptions(): MicroserviceOptions;
|
|
27
|
-
modules(): NestModuleDefinitions;
|
|
28
29
|
onStart(): void;
|
|
29
30
|
private checkIsInitialized;
|
|
30
31
|
/**
|
package/dist/grpc.transport.js
CHANGED
|
@@ -4,37 +4,50 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.GrpcTransport = void 0;
|
|
7
|
+
const server_call_1 = require("@grpc/grpc-js/build/src/server-call");
|
|
8
|
+
const core_1 = require("@nestjs/core");
|
|
7
9
|
const grpc_health_v1_1 = __importDefault(require("@rsdk/builtin-contract/dist/grpc.health.v1"));
|
|
8
10
|
const grpc_metrics_v1_1 = __importDefault(require("@rsdk/builtin-contract/dist/grpc.metrics.v1"));
|
|
9
11
|
const grpc_reflection_v1_1 = __importDefault(require("@rsdk/builtin-contract/dist/grpc.reflection.v1"));
|
|
10
12
|
const grpc_reflection_v1alpha_1 = __importDefault(require("@rsdk/builtin-contract/dist/grpc.reflection.v1alpha"));
|
|
11
|
-
const
|
|
13
|
+
const core_2 = require("@rsdk/core");
|
|
12
14
|
const grpc_loader_1 = require("@rsdk/grpc.loader");
|
|
13
15
|
const logging_1 = require("@rsdk/logging");
|
|
16
|
+
const constants_1 = require("./constants");
|
|
14
17
|
const controllers_1 = require("./controllers");
|
|
15
18
|
const grpc_config_1 = require("./grpc.config");
|
|
16
19
|
const grpc_utils_1 = require("./grpc.utils");
|
|
17
20
|
const grpc_errors_formatter_1 = require("./grpc-errors.formatter");
|
|
18
21
|
const grpc_errors_sender_1 = require("./grpc-errors.sender");
|
|
22
|
+
const grpc_logger_interceptor_1 = require("./grpc-logger.interceptor");
|
|
19
23
|
const reflection_module_1 = require("./reflection.module");
|
|
20
24
|
class GrpcTransport {
|
|
21
|
-
systemPackages = [
|
|
22
|
-
grpc_health_v1_1.default,
|
|
23
|
-
grpc_metrics_v1_1.default,
|
|
24
|
-
grpc_reflection_v1_1.default,
|
|
25
|
-
grpc_reflection_v1alpha_1.default,
|
|
26
|
-
];
|
|
27
25
|
logger = logging_1.LoggerFactory.create(GrpcTransport);
|
|
28
26
|
packages;
|
|
29
27
|
address;
|
|
30
28
|
maxRecv;
|
|
31
29
|
maxSend;
|
|
32
30
|
isInitialized = false;
|
|
31
|
+
systemPackages = [
|
|
32
|
+
grpc_health_v1_1.default,
|
|
33
|
+
grpc_metrics_v1_1.default,
|
|
34
|
+
grpc_reflection_v1_1.default,
|
|
35
|
+
grpc_reflection_v1alpha_1.default,
|
|
36
|
+
];
|
|
33
37
|
constructor(...packages) {
|
|
34
38
|
this.packages = packages;
|
|
35
39
|
}
|
|
40
|
+
matchByContext(ctx) {
|
|
41
|
+
const call = ctx.getArgByIndex(2);
|
|
42
|
+
const isGrpc = [
|
|
43
|
+
server_call_1.ServerUnaryCallImpl,
|
|
44
|
+
server_call_1.ServerDuplexStreamImpl,
|
|
45
|
+
server_call_1.ServerWritableStreamImpl,
|
|
46
|
+
].some((impl) => call instanceof impl);
|
|
47
|
+
return isGrpc;
|
|
48
|
+
}
|
|
36
49
|
getProtocol() {
|
|
37
|
-
return
|
|
50
|
+
return constants_1.GRPC_PROTOCOL;
|
|
38
51
|
}
|
|
39
52
|
getErrorsFormatter() {
|
|
40
53
|
return new grpc_errors_formatter_1.GrpcErrorsFormatter();
|
|
@@ -51,6 +64,20 @@ class GrpcTransport {
|
|
|
51
64
|
getHealthController() {
|
|
52
65
|
return controllers_1.HealthController;
|
|
53
66
|
}
|
|
67
|
+
modules() {
|
|
68
|
+
return [
|
|
69
|
+
reflection_module_1.ReflectionModule.forRoot(this.packages),
|
|
70
|
+
{
|
|
71
|
+
module: GrpcTransport,
|
|
72
|
+
providers: [
|
|
73
|
+
{
|
|
74
|
+
provide: core_1.APP_INTERCEPTOR,
|
|
75
|
+
useClass: grpc_logger_interceptor_1.GrpcLoggerInterceptor,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
}
|
|
54
81
|
/**
|
|
55
82
|
* Unfortunally we can't access GRPCConfig in constructor because
|
|
56
83
|
* PlatformConfigModule is not initilalized yet
|
|
@@ -79,16 +106,13 @@ class GrpcTransport {
|
|
|
79
106
|
maxSend: this.maxSend,
|
|
80
107
|
});
|
|
81
108
|
}
|
|
82
|
-
modules() {
|
|
83
|
-
return [reflection_module_1.ReflectionModule.forRoot(this.packages)];
|
|
84
|
-
}
|
|
85
109
|
onStart() {
|
|
86
110
|
this.checkIsInitialized();
|
|
87
111
|
this.logger.info(`Grpc server is listening on port ${this.address}`);
|
|
88
112
|
}
|
|
89
113
|
checkIsInitialized() {
|
|
90
114
|
if (!this.isInitialized) {
|
|
91
|
-
throw new
|
|
115
|
+
throw new core_2.SequenceException('You should call init() method first!');
|
|
92
116
|
}
|
|
93
117
|
}
|
|
94
118
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc.transport.js","sourceRoot":"","sources":["../src/grpc.transport.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"grpc.transport.js","sourceRoot":"","sources":["../src/grpc.transport.ts"],"names":[],"mappings":";;;;;;AAAA,qEAI6C;AAE7C,uCAA+C;AAE/C,gGAA2E;AAC3E,kGAA6E;AAC7E,wGAAqF;AACrF,kHAA+F;AAU/F,qCAA+C;AAE/C,mDAAsD;AACtD,2CAA8C;AAE9C,2CAA4C;AAC5C,+CAAoE;AACpE,+CAA2C;AAC3C,6CAAoD;AACpD,mEAA8D;AAC9D,6DAAwD;AACxD,uEAAkE;AAClE,2DAAuD;AAEvD,MAAa,aAAa;IACP,MAAM,GAAG,uBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC7C,QAAQ,CAAY;IAE7B,OAAO,CAAU;IACjB,OAAO,CAAU;IACjB,OAAO,CAAU;IAEjB,aAAa,GAAG,KAAK,CAAC;IAEb,cAAc,GAAc;QAC3C,wBAAiB;QACjB,yBAAkB;QAClB,4BAAuB;QACvB,iCAA4B;KAC7B,CAAC;IAEF,YAAY,GAAG,QAAmB;QAChC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,cAAc,CAAC,GAAqB;QAClC,MAAM,IAAI,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QAElC,MAAM,MAAM,GAAG;YACb,iCAAmB;YACnB,oCAAsB;YACtB,sCAAwB;SACzB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC;QAEvC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,WAAW;QACT,OAAO,yBAAa,CAAC;IACvB,CAAC;IAED,kBAAkB;QAChB,OAAO,IAAI,2CAAmB,EAAE,CAAC;IACnC,CAAC;IAED,eAAe;QACb,OAAO,IAAI,qCAAgB,EAAE,CAAC;IAChC,CAAC;IAED,oBAAoB;QAClB,OAAO,EAAE,CAAC;I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,MAAM,aAAa,GAAG,GAAG,QAAQ,GAAG,CAAC;YAErC,OAAO,CACL,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAClC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,CAAC,CAC7C;gBACD,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAChC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,CAAC,CAC7C,CACF,CAAC;QACJ,CAAC;QAED,IAAI,UAAU,YAAY,iCAAsB,EAAE,CAAC;YACjD,MAAM,aAAa,GAAG,GAAG,QAAQ,GAAG,CAAC;YAErC,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CACvC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,CAC/C,CAAC;QACJ,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAA;AA7LY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAME,WAAA,IAAA,eAAM,EAAC,eAAe,CAAC,CAAA;;GALzB,iBAAiB,CA6L7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('@rsdk/jest/jest.config.e2e');
|
package/jest.config.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const { resolve } = require('node:path');
|
|
3
|
-
|
|
4
|
-
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
5
|
-
module.exports = {
|
|
6
|
-
preset: 'ts-jest',
|
|
7
|
-
testEnvironment: 'node',
|
|
8
|
-
|
|
9
|
-
setupFiles: ['dotenv/config'],
|
|
10
|
-
rootDir: resolve(__dirname, 'src'),
|
|
11
|
-
};
|
|
1
|
+
module.exports = require('@rsdk/jest/jest.config');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('@rsdk/jest/jest.config.unit');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/grpc.server",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Grpc transport for platform, clients and common grpc stuff",
|
|
5
5
|
"license": "Apache License 2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,19 +18,18 @@
|
|
|
18
18
|
"@nestjs/common": "^10.0.0",
|
|
19
19
|
"@nestjs/core": "^10.0.0",
|
|
20
20
|
"@nestjs/microservices": "^10.0.0",
|
|
21
|
-
"@rsdk/builtin-contract": "^4.0.0
|
|
22
|
-
"@rsdk/common": "^4.0.0
|
|
23
|
-
"@rsdk/core": "^4.0.0
|
|
24
|
-
"@rsdk/grpc.common": "^4.0.0
|
|
25
|
-
"@rsdk/grpc.loader": "^4.0.0
|
|
26
|
-
"@rsdk/logging": "^4.0.0
|
|
21
|
+
"@rsdk/builtin-contract": "^4.0.0",
|
|
22
|
+
"@rsdk/common": "^4.0.0",
|
|
23
|
+
"@rsdk/core": "^4.0.0",
|
|
24
|
+
"@rsdk/grpc.common": "^4.0.0",
|
|
25
|
+
"@rsdk/grpc.loader": "^4.0.0",
|
|
26
|
+
"@rsdk/logging": "^4.0.0",
|
|
27
27
|
"nice-grpc": "^2.1.4",
|
|
28
28
|
"reflect-metadata": "^0.1.13",
|
|
29
29
|
"rxjs": "^7.8.1"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@bufbuild/protobuf": "^1.4.2"
|
|
33
|
-
"nice-grpc-opentelemetry": "^0.1.2"
|
|
32
|
+
"@bufbuild/protobuf": "^1.4.2"
|
|
34
33
|
},
|
|
35
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "e38e5b762d2c4aab277f0f65a5be5abcbccba8a8"
|
|
36
35
|
}
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const GRPC_PROTOCOL = 'grpc';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as grpc from '@grpc/grpc-js';
|
|
2
|
-
import type { ArgumentsHost } from '@nestjs/common';
|
|
3
2
|
import type { IErrorsFormatter } from '@rsdk/core';
|
|
4
3
|
import { ExceptionKind, PipelineException } from '@rsdk/core';
|
|
5
4
|
|
|
5
|
+
import { GRPC_PROTOCOL } from './constants';
|
|
6
6
|
import type { FormattedGrpcError } from './types';
|
|
7
7
|
|
|
8
8
|
export class GrpcErrorsFormatter implements IErrorsFormatter {
|
|
9
9
|
static readonly defaultKind = ExceptionKind.UNKNOWN;
|
|
10
|
+
protocol = GRPC_PROTOCOL;
|
|
10
11
|
private readonly statusMap: Record<ExceptionKind, grpc.status> = {
|
|
11
12
|
[ExceptionKind.AUTHENTICATION]: grpc.status.UNAUTHENTICATED,
|
|
12
13
|
[ExceptionKind.NOT_ALLOWED]: grpc.status.PERMISSION_DENIED,
|
|
@@ -20,10 +21,6 @@ export class GrpcErrorsFormatter implements IErrorsFormatter {
|
|
|
20
21
|
[ExceptionKind.UNKNOWN]: grpc.status.UNKNOWN,
|
|
21
22
|
};
|
|
22
23
|
|
|
23
|
-
match(host: ArgumentsHost): boolean {
|
|
24
|
-
return host.getType() === 'rpc';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
24
|
format(ex: unknown, verboseErrors?: boolean): FormattedGrpcError {
|
|
28
25
|
if (ex instanceof PipelineException) {
|
|
29
26
|
const message = verboseErrors
|
|
@@ -8,12 +8,11 @@ import { convertMetadataToGrpcJs } from 'nice-grpc/lib/utils/convertMetadata';
|
|
|
8
8
|
import type { EMPTY, Observable } from 'rxjs';
|
|
9
9
|
import { throwError } from 'rxjs';
|
|
10
10
|
|
|
11
|
+
import { GRPC_PROTOCOL } from './constants';
|
|
11
12
|
import type { FormattedGrpcError } from './types';
|
|
12
13
|
|
|
13
14
|
export class GrpcErrorsSender implements IErrorsSender {
|
|
14
|
-
|
|
15
|
-
return host.getType() === 'rpc';
|
|
16
|
-
}
|
|
15
|
+
protocol = GRPC_PROTOCOL;
|
|
17
16
|
|
|
18
17
|
send(
|
|
19
18
|
_host: ArgumentsHost,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CallHandler,
|
|
3
|
+
ExecutionContext,
|
|
4
|
+
NestInterceptor,
|
|
5
|
+
} from '@nestjs/common/interfaces';
|
|
6
|
+
import { InjectLogger, ProtocolDetector } from '@rsdk/core';
|
|
7
|
+
import { ILogger } from '@rsdk/logging';
|
|
8
|
+
import type { Observable } from 'rxjs';
|
|
9
|
+
import { catchError, tap, throwError } from 'rxjs';
|
|
10
|
+
|
|
11
|
+
import { GRPCConfig } from './grpc.config';
|
|
12
|
+
|
|
13
|
+
export class GrpcLoggerInterceptor implements NestInterceptor {
|
|
14
|
+
constructor(
|
|
15
|
+
@InjectLogger(GrpcLoggerInterceptor) private logger: ILogger,
|
|
16
|
+
private grpcConfig: GRPCConfig,
|
|
17
|
+
private detector: ProtocolDetector,
|
|
18
|
+
) {}
|
|
19
|
+
|
|
20
|
+
intercept(
|
|
21
|
+
context: ExecutionContext,
|
|
22
|
+
next: CallHandler<any>,
|
|
23
|
+
): Observable<any> | Promise<Observable<any>> {
|
|
24
|
+
if (!this.grpcConfig.requestLogging) {
|
|
25
|
+
return next.handle();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const protocol = this.detector.getProtocol(context);
|
|
29
|
+
const isRpc = protocol === 'grpc';
|
|
30
|
+
if (!isRpc) {
|
|
31
|
+
return next.handle();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const rpc = context.switchToRpc();
|
|
35
|
+
|
|
36
|
+
const startDate = Date.now();
|
|
37
|
+
const rpcContext = rpc.getContext();
|
|
38
|
+
const serializedCtx = rpcContext?.toJSON?.() ?? rpcContext;
|
|
39
|
+
const requestForLog = {
|
|
40
|
+
data: rpc.getData(),
|
|
41
|
+
ctx: serializedCtx,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
this.logger.trace('received rpc request', {
|
|
45
|
+
request: requestForLog,
|
|
46
|
+
timestamp: startDate,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return next.handle().pipe(
|
|
50
|
+
catchError((error) => {
|
|
51
|
+
const endDate = Date.now();
|
|
52
|
+
|
|
53
|
+
this.logger.trace('handled rpc request with error', {
|
|
54
|
+
request: requestForLog,
|
|
55
|
+
startDate,
|
|
56
|
+
endDate,
|
|
57
|
+
duration: endDate - startDate,
|
|
58
|
+
error,
|
|
59
|
+
});
|
|
60
|
+
return throwError(() => error);
|
|
61
|
+
}),
|
|
62
|
+
tap((response) => {
|
|
63
|
+
const endDate = Date.now();
|
|
64
|
+
|
|
65
|
+
this.logger.trace('handled rpc request', {
|
|
66
|
+
request: requestForLog,
|
|
67
|
+
startDate,
|
|
68
|
+
endDate,
|
|
69
|
+
duration: endDate - startDate,
|
|
70
|
+
response,
|
|
71
|
+
});
|
|
72
|
+
}),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
package/src/grpc.config.ts
CHANGED
|
@@ -43,4 +43,10 @@ export class GRPCConfig extends Config {
|
|
|
43
43
|
description: 'Enable reflection',
|
|
44
44
|
})
|
|
45
45
|
readonly reflection!: boolean;
|
|
46
|
+
|
|
47
|
+
@Property('GRPC_REQUEST_LOGGING', new BoolParser(), {
|
|
48
|
+
defaultValue: false,
|
|
49
|
+
description: 'Enable trace logging all requests',
|
|
50
|
+
})
|
|
51
|
+
readonly requestLogging!: boolean;
|
|
46
52
|
}
|
package/src/grpc.transport.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
ServerDuplexStreamImpl,
|
|
3
|
+
ServerUnaryCallImpl,
|
|
4
|
+
ServerWritableStreamImpl,
|
|
5
|
+
} from '@grpc/grpc-js/build/src/server-call';
|
|
6
|
+
import type { Controller, ExecutionContext } from '@nestjs/common/interfaces';
|
|
7
|
+
import { APP_INTERCEPTOR } from '@nestjs/core';
|
|
2
8
|
import type { MicroserviceOptions } from '@nestjs/microservices';
|
|
3
9
|
import HealthGrpcPackage from '@rsdk/builtin-contract/dist/grpc.health.v1';
|
|
4
10
|
import MetricsGrpcPackage from '@rsdk/builtin-contract/dist/grpc.metrics.v1';
|
|
@@ -18,21 +24,16 @@ import type { Package } from '@rsdk/grpc.loader';
|
|
|
18
24
|
import { createGrpcOptions } from '@rsdk/grpc.loader';
|
|
19
25
|
import { LoggerFactory } from '@rsdk/logging';
|
|
20
26
|
|
|
27
|
+
import { GRPC_PROTOCOL } from './constants';
|
|
21
28
|
import { HealthController, MetricsController } from './controllers';
|
|
22
29
|
import { GRPCConfig } from './grpc.config';
|
|
23
30
|
import { isPackageNotIncluded } from './grpc.utils';
|
|
24
31
|
import { GrpcErrorsFormatter } from './grpc-errors.formatter';
|
|
25
32
|
import { GrpcErrorsSender } from './grpc-errors.sender';
|
|
33
|
+
import { GrpcLoggerInterceptor } from './grpc-logger.interceptor';
|
|
26
34
|
import { ReflectionModule } from './reflection.module';
|
|
27
35
|
|
|
28
36
|
export class GrpcTransport implements IMicroserviceTransport {
|
|
29
|
-
private readonly systemPackages: Package[] = [
|
|
30
|
-
HealthGrpcPackage,
|
|
31
|
-
MetricsGrpcPackage,
|
|
32
|
-
ReflectionGrpcPackageV1,
|
|
33
|
-
ReflectionGrpcPackageV1alpha,
|
|
34
|
-
];
|
|
35
|
-
|
|
36
37
|
private readonly logger = LoggerFactory.create(GrpcTransport);
|
|
37
38
|
private readonly packages: Package[];
|
|
38
39
|
|
|
@@ -42,12 +43,31 @@ export class GrpcTransport implements IMicroserviceTransport {
|
|
|
42
43
|
|
|
43
44
|
private isInitialized = false;
|
|
44
45
|
|
|
46
|
+
private readonly systemPackages: Package[] = [
|
|
47
|
+
HealthGrpcPackage,
|
|
48
|
+
MetricsGrpcPackage,
|
|
49
|
+
ReflectionGrpcPackageV1,
|
|
50
|
+
ReflectionGrpcPackageV1alpha,
|
|
51
|
+
];
|
|
52
|
+
|
|
45
53
|
constructor(...packages: Package[]) {
|
|
46
54
|
this.packages = packages;
|
|
47
55
|
}
|
|
48
56
|
|
|
57
|
+
matchByContext(ctx: ExecutionContext): boolean {
|
|
58
|
+
const call = ctx.getArgByIndex(2);
|
|
59
|
+
|
|
60
|
+
const isGrpc = [
|
|
61
|
+
ServerUnaryCallImpl,
|
|
62
|
+
ServerDuplexStreamImpl,
|
|
63
|
+
ServerWritableStreamImpl,
|
|
64
|
+
].some((impl) => call instanceof impl);
|
|
65
|
+
|
|
66
|
+
return isGrpc;
|
|
67
|
+
}
|
|
68
|
+
|
|
49
69
|
getProtocol(): string {
|
|
50
|
-
return
|
|
70
|
+
return GRPC_PROTOCOL;
|
|
51
71
|
}
|
|
52
72
|
|
|
53
73
|
getErrorsFormatter(): IErrorsFormatter {
|
|
@@ -70,6 +90,21 @@ export class GrpcTransport implements IMicroserviceTransport {
|
|
|
70
90
|
return HealthController;
|
|
71
91
|
}
|
|
72
92
|
|
|
93
|
+
modules(): NestModuleDefinitions {
|
|
94
|
+
return [
|
|
95
|
+
ReflectionModule.forRoot(this.packages),
|
|
96
|
+
{
|
|
97
|
+
module: GrpcTransport,
|
|
98
|
+
providers: [
|
|
99
|
+
{
|
|
100
|
+
provide: APP_INTERCEPTOR,
|
|
101
|
+
useClass: GrpcLoggerInterceptor,
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
|
|
73
108
|
/**
|
|
74
109
|
* Unfortunally we can't access GRPCConfig in constructor because
|
|
75
110
|
* PlatformConfigModule is not initilalized yet
|
|
@@ -104,10 +139,6 @@ export class GrpcTransport implements IMicroserviceTransport {
|
|
|
104
139
|
});
|
|
105
140
|
}
|
|
106
141
|
|
|
107
|
-
modules(): NestModuleDefinitions {
|
|
108
|
-
return [ReflectionModule.forRoot(this.packages)];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
142
|
onStart(): void {
|
|
112
143
|
this.checkIsInitialized();
|
|
113
144
|
|
package/tsconfig.json
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
2
|
"extends": "@rsdk/tsconfig/base.json",
|
|
4
3
|
"compilerOptions": {
|
|
5
4
|
"declaration": true,
|
|
6
5
|
"outDir": "dist"
|
|
7
6
|
},
|
|
8
|
-
"include": [
|
|
9
|
-
|
|
7
|
+
"include": [
|
|
8
|
+
"src/**/*"
|
|
9
|
+
],
|
|
10
|
+
"exclude": [
|
|
11
|
+
"node_modules",
|
|
12
|
+
"dist",
|
|
13
|
+
"test",
|
|
14
|
+
"**/*.spec.ts",
|
|
15
|
+
"**/*.test.ts",
|
|
16
|
+
"**/*.spec.e2e.ts",
|
|
17
|
+
"**/*.test.e2e.ts"
|
|
18
|
+
]
|
|
10
19
|
}
|