@rsdk/core 3.1.0-next.2 → 3.2.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/app/platform.app.js +1 -1
- package/dist/app/platform.app.js.map +1 -1
- package/dist/platform.context.d.ts +2 -3
- package/dist/platform.context.js +5 -6
- package/dist/platform.context.js.map +1 -1
- package/dist/types/transports.d.ts +2 -3
- package/dist/types/transports.js.map +1 -1
- package/package.json +10 -10
- package/src/app/platform.app.ts +1 -1
- package/src/platform.context.ts +8 -9
- package/src/types/transports.ts +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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
|
+
## [3.2.0-next.0](https://github.com/R-Vision/rsdk/compare/v3.1.0...v3.2.0-next.0) (2023-08-09)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **http.server:** split to package by implementation @rsdk/http.server.{fastify,express} ([f3cdad1](https://github.com/R-Vision/rsdk/commit/f3cdad1c7372d2bfbaee21d91973d5354cebf46c))
|
|
11
|
+
|
|
12
|
+
## [3.1.0](https://github.com/R-Vision/rsdk/compare/v3.1.0-next.3...v3.1.0) (2023-08-09)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @rsdk/core
|
|
15
|
+
|
|
6
16
|
## [3.1.0-next.2](https://github.com/R-Vision/rsdk/compare/v3.1.0-next.1...v3.1.0-next.2) (2023-08-08)
|
|
7
17
|
|
|
8
18
|
### Features
|
package/dist/app/platform.app.js
CHANGED
|
@@ -39,7 +39,7 @@ class PlatformApp {
|
|
|
39
39
|
*/
|
|
40
40
|
async createApplication() {
|
|
41
41
|
const context = this.context;
|
|
42
|
-
const nestContext = context.getNestFactoryCreateOptions();
|
|
42
|
+
const nestContext = await context.getNestFactoryCreateOptions();
|
|
43
43
|
const app = await core_1.NestFactory.create(await context.getRoot(), ...nestContext);
|
|
44
44
|
await context.configureApp(app);
|
|
45
45
|
return app;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.app.js","sourceRoot":"","sources":["../../src/app/platform.app.ts"],"names":[],"mappings":";;;AACA,uCAA2C;AAE3C,0DAAsD;AAGtD;;;;;GAKG;AACH,MAAa,WAAW;IAGD;IAFZ,OAAO,CAAkB;IAElC,YAAqB,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QACzD,IAAI,CAAC,OAAO,GAAG,IAAI,kCAAe,CAAC,kBAAkB,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW;QACf,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,GAAG;QACP,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAE3C,MAAM,OAAO,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,iBAAiB;QAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"platform.app.js","sourceRoot":"","sources":["../../src/app/platform.app.ts"],"names":[],"mappings":";;;AACA,uCAA2C;AAE3C,0DAAsD;AAGtD;;;;;GAKG;AACH,MAAa,WAAW;IAGD;IAFZ,OAAO,CAAkB;IAElC,YAAqB,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QACzD,IAAI,CAAC,OAAO,GAAG,IAAI,kCAAe,CAAC,kBAAkB,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW;QACf,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,GAAG;QACP,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAE3C,MAAM,OAAO,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,iBAAiB;QAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,2BAA2B,EAAE,CAAC;QAChE,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAClC,MAAM,OAAO,CAAC,OAAO,EAAE,EACvB,GAAG,WAAW,CACf,CAAC;QAEF,MAAM,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AA1CD,kCA0CC"}
|
|
@@ -12,7 +12,6 @@ export declare class PlatformContext {
|
|
|
12
12
|
readonly logger: import("@rsdk/logging").ILogger;
|
|
13
13
|
private microservices;
|
|
14
14
|
private readonly httpTransport;
|
|
15
|
-
private readonly httpAdapter;
|
|
16
15
|
private aggregator;
|
|
17
16
|
private _extendedOptions?;
|
|
18
17
|
/**
|
|
@@ -52,9 +51,9 @@ export declare class PlatformContext {
|
|
|
52
51
|
* testingModuleRef.createApplication(...context.getNestFactoryCreateOptions())
|
|
53
52
|
* NestFactory.create(context.root, ...context.getNestFactoryCreateOptions())
|
|
54
53
|
*/
|
|
55
|
-
getNestFactoryCreateOptions(): [
|
|
54
|
+
getNestFactoryCreateOptions(): Promise<[
|
|
56
55
|
httpAdapter: AbstractHttpAdapter,
|
|
57
56
|
options?: NestApplicationOptions
|
|
58
|
-
]
|
|
57
|
+
]>;
|
|
59
58
|
private getConfigContext;
|
|
60
59
|
}
|
package/dist/platform.context.js
CHANGED
|
@@ -18,7 +18,6 @@ class PlatformContext {
|
|
|
18
18
|
logger = logging_1.LoggerFactory.create('App');
|
|
19
19
|
microservices = new Map();
|
|
20
20
|
httpTransport;
|
|
21
|
-
httpAdapter;
|
|
22
21
|
aggregator;
|
|
23
22
|
_extendedOptions;
|
|
24
23
|
/**
|
|
@@ -34,8 +33,6 @@ class PlatformContext {
|
|
|
34
33
|
PlatformContext.assertTransportCompatability(options);
|
|
35
34
|
PlatformContext.assertPluginCompatability(options);
|
|
36
35
|
this.httpTransport = options.transports?.find?.(types_1.isHttpTransport);
|
|
37
|
-
this.httpAdapter =
|
|
38
|
-
this.httpTransport?.getAdapter() ?? new noop_http_adapter_1.NoopHttpAdapter();
|
|
39
36
|
this.aggregator = new context_aggregator_1.ContextAggregator(this);
|
|
40
37
|
}
|
|
41
38
|
get extendedOptions() {
|
|
@@ -112,7 +109,7 @@ class PlatformContext {
|
|
|
112
109
|
*/
|
|
113
110
|
async configureApp(app) {
|
|
114
111
|
const configContext = await this.getConfigContext();
|
|
115
|
-
const awaiter = this.httpTransport?.
|
|
112
|
+
const awaiter = this.httpTransport?.configureApp(app, configContext);
|
|
116
113
|
if (awaiter instanceof Promise) {
|
|
117
114
|
await awaiter;
|
|
118
115
|
}
|
|
@@ -163,9 +160,11 @@ class PlatformContext {
|
|
|
163
160
|
* testingModuleRef.createApplication(...context.getNestFactoryCreateOptions())
|
|
164
161
|
* NestFactory.create(context.root, ...context.getNestFactoryCreateOptions())
|
|
165
162
|
*/
|
|
166
|
-
getNestFactoryCreateOptions() {
|
|
163
|
+
async getNestFactoryCreateOptions() {
|
|
164
|
+
const configContext = await this.getConfigContext();
|
|
165
|
+
const httpAdapter = await this.httpTransport?.createAdapter(configContext);
|
|
167
166
|
return [
|
|
168
|
-
|
|
167
|
+
httpAdapter ?? new noop_http_adapter_1.NoopHttpAdapter(),
|
|
169
168
|
{
|
|
170
169
|
// Leave body parser configuration to httpTransport implementation
|
|
171
170
|
bodyParser: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.context.js","sourceRoot":"","sources":["../src/platform.context.ts"],"names":[],"mappings":";;;AAKA,2CAA8C;AAE9C,mCAA+C;AAE/C,yFAAoF;AACpF,kDAA+C;AAE/C,6DAAyD;AACzD,6CAGsB;AACtB,uCAA8C;AAC9C,2DAAsD;AAQtD,mCAMiB;AAEjB;;GAEG;AACH,MAAa,eAAe;
|
|
1
|
+
{"version":3,"file":"platform.context.js","sourceRoot":"","sources":["../src/platform.context.ts"],"names":[],"mappings":";;;AAKA,2CAA8C;AAE9C,mCAA+C;AAE/C,yFAAoF;AACpF,kDAA+C;AAE/C,6DAAyD;AACzD,6CAGsB;AACtB,uCAA8C;AAC9C,2DAAsD;AAQtD,mCAMiB;AAEjB;;GAEG;AACH,MAAa,eAAe;IAiBL;IAhBZ,MAAM,GAAG,uBAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtC,aAAa,GAAG,IAAI,GAAG,EAA6C,CAAC;IAE5D,aAAa,CAA6B;IACnD,UAAU,CAAoB;IAE9B,gBAAgB,CAA2B;IAEnD;;;;;;;OAOG;IACH,YAAqB,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;QAC3C,eAAe,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;QACtD,eAAe,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;QAEnD,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,uBAAe,CAAC,CAAC;QACjE,IAAI,CAAC,UAAU,GAAG,IAAI,sCAAiB,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,eAAe;QACjB,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;SAC9B;QACD,MAAM,YAAY,GAAG,mBAAQ,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G,EAAE,CAChC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,IAAI,IAAI,IAAI,EAAE,CAAC,CAC3D,CAAC;aACH;iBAAM;gBACL,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;aAClB;YAED,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,EAAE;gBAC/B,KAAK,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE;oBAC1D,MAAM,YAAY,CAAC,MAAM,EAAE,CAAC;oBAC5B,SAAS,CAAC,OAAO,EAAE,CAAC;iBACrB;aACF;SACF;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAc,CAAC,CAAC;YAClC,mDAAmD;YACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,2BAA2B;QAG/B,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACpD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;QAE3E,OAAO;YACL,WAAW,IAAI,IAAI,mCAAe,EAAE;YACpC;gBACE,kEAAkE;gBAClE,UAAU,EAAE,KAAK;gBACjB,MAAM,EAAE,IAAI,2BAAiB,CAAC,IAAI,CAAC,MAAM,CAAC;aAC3C;SACF,CAAC;IACJ,CAAC;IAEO,gBAAgB;QACtB,OAAO,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;IAC5C,CAAC;CACF;AA/MD,0CA+MC"}
|
|
@@ -77,14 +77,13 @@ export interface IHttpTransport extends IPrimaryTransport {
|
|
|
77
77
|
* Most common are ExpressAdapter and FastifyAdater,
|
|
78
78
|
* but custom adapter can be implemented if needed
|
|
79
79
|
*/
|
|
80
|
-
|
|
80
|
+
createAdapter(configContext: ConfigContext): AbstractHttpAdapter;
|
|
81
81
|
/**
|
|
82
82
|
* Applies any configuration to Nest application instance:
|
|
83
83
|
* middleware, body parsers and other.
|
|
84
84
|
* @param app INestApplication
|
|
85
|
-
* @param configContext
|
|
86
85
|
*/
|
|
87
|
-
|
|
86
|
+
configureApp(app: INestApplication, configContext: ConfigContext): Promise<void> | void;
|
|
88
87
|
createHttpOptions(configContext: ConfigContext): HttpOptions;
|
|
89
88
|
}
|
|
90
89
|
export declare const isPrimaryTransport: (t: ITransport) => t is IPrimaryTransport;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports.js","sourceRoot":"","sources":["../../src/types/transports.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"transports.js","sourceRoot":"","sources":["../../src/types/transports.ts"],"names":[],"mappings":";;;AA8GO,MAAM,kBAAkB,GAAG,CAAC,CAAa,EAA0B,EAAE,CAC1E,OAAQ,CAAuB,CAAC,mBAAmB,KAAK,UAAU;IAClE,OAAQ,CAAuB,CAAC,oBAAoB,KAAK,UAAU,CAAC;AAFzD,QAAA,kBAAkB,sBAEuC;AAE/D,MAAM,eAAe,GAAG,CAAC,CAAa,EAAuB,EAAE,CACpE,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC;AADhB,QAAA,eAAe,mBACC;AAEtB,MAAM,uBAAuB,GAAG,CACrC,CAAa,EACgB,EAAE,CAC/B,OAAQ,CAA4B,CAAC,yBAAyB,KAAK,UAAU,CAAC;AAHnE,QAAA,uBAAuB,2BAG4C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0-next.0",
|
|
4
4
|
"description": "Nestjs based microservice chassis",
|
|
5
5
|
"license": "Apache License 2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,17 +31,17 @@
|
|
|
31
31
|
"@nestjs/common": "^10.1.3",
|
|
32
32
|
"@nestjs/core": "^10.1.3",
|
|
33
33
|
"@nestjs/microservices": "^10.1.3",
|
|
34
|
-
"@rsdk/autodoc.protocol": "^3.1.0
|
|
35
|
-
"@rsdk/common": "^3.1.0
|
|
36
|
-
"@rsdk/common.nestjs": "^3.1.0
|
|
37
|
-
"@rsdk/common.node": "^3.1.0
|
|
38
|
-
"@rsdk/decorators": "^3.1.0
|
|
39
|
-
"@rsdk/logging": "^3.1.0
|
|
40
|
-
"@rsdk/metadata": "^3.1.0
|
|
41
|
-
"@rsdk/nest-tools": "^3.1.0
|
|
34
|
+
"@rsdk/autodoc.protocol": "^3.1.0",
|
|
35
|
+
"@rsdk/common": "^3.1.0",
|
|
36
|
+
"@rsdk/common.nestjs": "^3.1.0",
|
|
37
|
+
"@rsdk/common.node": "^3.1.0",
|
|
38
|
+
"@rsdk/decorators": "^3.1.0",
|
|
39
|
+
"@rsdk/logging": "^3.1.0",
|
|
40
|
+
"@rsdk/metadata": "^3.1.0",
|
|
41
|
+
"@rsdk/nest-tools": "^3.1.0",
|
|
42
42
|
"axios": "^1.1.3",
|
|
43
43
|
"reflect-metadata": "^0.1.13",
|
|
44
44
|
"rxjs": "^7.0.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "3f8a9154e6c7a67dbf38b9985876e41717ed5117"
|
|
47
47
|
}
|
package/src/app/platform.app.ts
CHANGED
|
@@ -43,7 +43,7 @@ export class PlatformApp {
|
|
|
43
43
|
*/
|
|
44
44
|
private async createApplication(): Promise<INestApplication> {
|
|
45
45
|
const context = this.context;
|
|
46
|
-
const nestContext = context.getNestFactoryCreateOptions();
|
|
46
|
+
const nestContext = await context.getNestFactoryCreateOptions();
|
|
47
47
|
const app = await NestFactory.create(
|
|
48
48
|
await context.getRoot(),
|
|
49
49
|
...nestContext,
|
package/src/platform.context.ts
CHANGED
|
@@ -40,7 +40,6 @@ export class PlatformContext {
|
|
|
40
40
|
private microservices = new Map<INestMicroservice, IMicroserviceTransport>();
|
|
41
41
|
|
|
42
42
|
private readonly httpTransport: IHttpTransport | undefined;
|
|
43
|
-
private readonly httpAdapter: AbstractHttpAdapter;
|
|
44
43
|
private aggregator: ContextAggregator;
|
|
45
44
|
|
|
46
45
|
private _extendedOptions?: PlatformExtendedOptions;
|
|
@@ -58,8 +57,6 @@ export class PlatformContext {
|
|
|
58
57
|
PlatformContext.assertPluginCompatability(options);
|
|
59
58
|
|
|
60
59
|
this.httpTransport = options.transports?.find?.(isHttpTransport);
|
|
61
|
-
this.httpAdapter =
|
|
62
|
-
this.httpTransport?.getAdapter() ?? new NoopHttpAdapter();
|
|
63
60
|
this.aggregator = new ContextAggregator(this);
|
|
64
61
|
}
|
|
65
62
|
|
|
@@ -164,7 +161,7 @@ export class PlatformContext {
|
|
|
164
161
|
async configureApp(app: INestApplication): Promise<void> {
|
|
165
162
|
const configContext = await this.getConfigContext();
|
|
166
163
|
|
|
167
|
-
const awaiter = this.httpTransport?.
|
|
164
|
+
const awaiter = this.httpTransport?.configureApp(app, configContext);
|
|
168
165
|
if (awaiter instanceof Promise) {
|
|
169
166
|
await awaiter;
|
|
170
167
|
}
|
|
@@ -226,12 +223,14 @@ export class PlatformContext {
|
|
|
226
223
|
* testingModuleRef.createApplication(...context.getNestFactoryCreateOptions())
|
|
227
224
|
* NestFactory.create(context.root, ...context.getNestFactoryCreateOptions())
|
|
228
225
|
*/
|
|
229
|
-
getNestFactoryCreateOptions():
|
|
230
|
-
httpAdapter: AbstractHttpAdapter,
|
|
231
|
-
|
|
232
|
-
|
|
226
|
+
async getNestFactoryCreateOptions(): Promise<
|
|
227
|
+
[httpAdapter: AbstractHttpAdapter, options?: NestApplicationOptions]
|
|
228
|
+
> {
|
|
229
|
+
const configContext = await this.getConfigContext();
|
|
230
|
+
const httpAdapter = await this.httpTransport?.createAdapter(configContext);
|
|
231
|
+
|
|
233
232
|
return [
|
|
234
|
-
|
|
233
|
+
httpAdapter ?? new NoopHttpAdapter(),
|
|
235
234
|
{
|
|
236
235
|
// Leave body parser configuration to httpTransport implementation
|
|
237
236
|
bodyParser: false,
|
package/src/types/transports.ts
CHANGED
|
@@ -94,15 +94,14 @@ export interface IHttpTransport extends IPrimaryTransport {
|
|
|
94
94
|
* Most common are ExpressAdapter and FastifyAdater,
|
|
95
95
|
* but custom adapter can be implemented if needed
|
|
96
96
|
*/
|
|
97
|
-
|
|
97
|
+
createAdapter(configContext: ConfigContext): AbstractHttpAdapter;
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
100
|
* Applies any configuration to Nest application instance:
|
|
101
101
|
* middleware, body parsers and other.
|
|
102
102
|
* @param app INestApplication
|
|
103
|
-
* @param configContext
|
|
104
103
|
*/
|
|
105
|
-
|
|
104
|
+
configureApp(
|
|
106
105
|
app: INestApplication,
|
|
107
106
|
configContext: ConfigContext,
|
|
108
107
|
): Promise<void> | void;
|