@nmxjs/app 1.0.2 → 1.0.3
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/dist/createNestApp.js +11 -2
- package/dist/createNestApp.js.map +1 -1
- package/package.json +4 -3
package/dist/createNestApp.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNestApp = void 0;
|
|
4
|
+
const config_1 = require("@nmxjs/config");
|
|
4
5
|
const api_1 = require("@nmxjs/api");
|
|
6
|
+
const events_1 = require("@nmxjs/events");
|
|
5
7
|
const core_1 = require("@nestjs/core");
|
|
6
8
|
const common_1 = require("@nestjs/common");
|
|
7
9
|
const utils_1 = require("@nmxjs/utils");
|
|
@@ -10,8 +12,15 @@ async function createNestApp(serviceName, module) {
|
|
|
10
12
|
const app = await core_1.NestFactory[isWorker ? 'createApplicationContext' : 'create'](module);
|
|
11
13
|
if (!isWorker) {
|
|
12
14
|
app.useGlobalInterceptors(new api_1.RpcExceptionInterceptor());
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
+
const config = app.get(config_1.configKey);
|
|
16
|
+
const eventsOptions = config.event ? app.get(events_1.eventsClientKey).options : null;
|
|
17
|
+
const transporterOptions = app.get(api_1.getTransporterOptionsKey)(serviceName);
|
|
18
|
+
const microserviceApps = [
|
|
19
|
+
app.connectMicroservice(transporterOptions, { inheritAppConfig: true }),
|
|
20
|
+
...(eventsOptions && eventsOptions.transport !== transporterOptions.transport
|
|
21
|
+
? [app.connectMicroservice(eventsOptions, { inheritAppConfig: true })]
|
|
22
|
+
: []),
|
|
23
|
+
];
|
|
15
24
|
await app.init();
|
|
16
25
|
await Promise.all(microserviceApps.map(microserviceApp => microserviceApp.listen()));
|
|
17
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNestApp.js","sourceRoot":"","sources":["../src/createNestApp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AM,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACvF,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;IAED,eAAM,CAAC,GAAG,CAAC,iBAAiB,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AAClH,CAAC;AAvBD,sCAuBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nmxjs/app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,8 +28,9 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@apollo/server": "^4.9.5",
|
|
30
30
|
"@nestjs/apollo": "^12.0.11",
|
|
31
|
-
"@nmxjs/api": "^1.
|
|
32
|
-
"@nmxjs/config": "^1.0.
|
|
31
|
+
"@nmxjs/api": "^1.1.4",
|
|
32
|
+
"@nmxjs/config": "^1.0.4",
|
|
33
|
+
"@nmxjs/events": "^1.0.2",
|
|
33
34
|
"compression": "^1.7.4",
|
|
34
35
|
"helmet": "^7.1.0"
|
|
35
36
|
}
|