@nmxjs/app 1.0.2 → 1.0.4
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.d.ts +2 -1
- package/dist/createNestApp.js +13 -4
- package/dist/createNestApp.js.map +1 -1
- package/dist/createNestHttpApp.d.ts +2 -1
- package/dist/createNestHttpApp.js +2 -2
- package/dist/createNestHttpApp.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/ICreateNestAppOptions.d.ts +4 -0
- package/dist/interfaces/ICreateNestAppOptions.js +3 -0
- package/dist/interfaces/ICreateNestAppOptions.js.map +1 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.js +18 -0
- package/dist/interfaces/index.js.map +1 -0
- package/package.json +4 -3
package/dist/createNestApp.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ICreateNestAppOptions } from './interfaces';
|
|
2
|
+
export declare function createNestApp({ service, module }: ICreateNestAppOptions): Promise<void>;
|
package/dist/createNestApp.js
CHANGED
|
@@ -1,24 +1,33 @@
|
|
|
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");
|
|
8
|
-
async function createNestApp(
|
|
10
|
+
async function createNestApp({ service, module }) {
|
|
9
11
|
const isWorker = (0, utils_1.isWorkerApp)();
|
|
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)(service);
|
|
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
|
}
|
|
18
27
|
else {
|
|
19
28
|
await app.init();
|
|
20
29
|
}
|
|
21
|
-
common_1.Logger.log(`Microservice "${
|
|
30
|
+
common_1.Logger.log(`Microservice "${service}${process.env.BOOT_MODE ? `-${process.env.BOOT_MODE}` : ''}" started!`);
|
|
22
31
|
}
|
|
23
32
|
exports.createNestApp = createNestApp;
|
|
24
33
|
//# sourceMappingURL=createNestApp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNestApp.js","sourceRoot":"","sources":["../src/createNestApp.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"createNestApp.js","sourceRoot":"","sources":["../src/createNestApp.ts"],"names":[],"mappings":";;;AAAA,0CAAmD;AACnD,oCAAsG;AACtG,0CAA+D;AAC/D,uCAA2C;AAE3C,2CAA0D;AAC1D,wCAA2C;AAGpC,KAAK,UAAU,aAAa,CAAC,EAAE,OAAO,EAAE,MAAM,EAAyB;IAC5E,MAAM,QAAQ,GAAG,IAAA,mBAAW,GAAE,CAAC;IAC/B,MAAM,GAAG,GAAqB,MAAM,kBAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,QAA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AuBC"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ICreateNestAppOptions } from './interfaces';
|
|
2
|
+
export declare function createNestHttpApp({ service, module }: ICreateNestAppOptions): Promise<void>;
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("@nmxjs/utils");
|
|
|
7
7
|
const types_1 = require("@nmxjs/types");
|
|
8
8
|
const core_1 = require("@nestjs/core");
|
|
9
9
|
const common_1 = require("@nestjs/common");
|
|
10
|
-
async function createNestHttpApp(
|
|
10
|
+
async function createNestHttpApp({ service, module }) {
|
|
11
11
|
const app = await core_1.NestFactory.create(module);
|
|
12
12
|
if ((0, utils_1.getEnvironment)() === types_1.EnvironmentEnum.PRODUCTION) {
|
|
13
13
|
app.use((0, helmet_1.default)());
|
|
@@ -15,7 +15,7 @@ async function createNestHttpApp(serviceName, module) {
|
|
|
15
15
|
app.use(compression());
|
|
16
16
|
const port = process.env.PORT || 3000;
|
|
17
17
|
await app.listen(port);
|
|
18
|
-
common_1.Logger.log(`Http service ${
|
|
18
|
+
common_1.Logger.log(`Http service ${service} started on port "${port}"!`);
|
|
19
19
|
}
|
|
20
20
|
exports.createNestHttpApp = createNestHttpApp;
|
|
21
21
|
//# sourceMappingURL=createNestHttpApp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNestHttpApp.js","sourceRoot":"","sources":["../src/createNestHttpApp.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,2CAA2C;AAC3C,wCAA8C;AAC9C,wCAA+C;AAC/C,uCAA2C;AAC3C,2CAAwC;
|
|
1
|
+
{"version":3,"file":"createNestHttpApp.js","sourceRoot":"","sources":["../src/createNestHttpApp.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,2CAA2C;AAC3C,wCAA8C;AAC9C,wCAA+C;AAC/C,uCAA2C;AAC3C,2CAAwC;AAGjC,KAAK,UAAU,iBAAiB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAyB;IAChF,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAE7C,IAAI,IAAA,sBAAc,GAAE,KAAK,uBAAe,CAAC,UAAU,EAAE,CAAC;QACpD,GAAG,CAAC,GAAG,CAAC,IAAA,gBAAM,GAAE,CAAC,CAAC;IACpB,CAAC;IAED,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACvB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC;IACtC,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEvB,eAAM,CAAC,GAAG,CAAC,gBAAgB,OAAO,qBAAqB,IAAI,IAAI,CAAC,CAAC;AACnE,CAAC;AAZD,8CAYC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./interfaces"), exports);
|
|
17
18
|
__exportStar(require("./createNestApp"), exports);
|
|
18
19
|
__exportStar(require("./getTypeOrmModule"), exports);
|
|
19
20
|
__exportStar(require("./getGraphQlModule"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,qDAAmC;AACnC,qDAAmC;AACnC,sDAAoC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,kDAAgC;AAChC,qDAAmC;AACnC,qDAAmC;AACnC,sDAAoC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICreateNestAppOptions.js","sourceRoot":"","sources":["../../src/interfaces/ICreateNestAppOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ICreateNestAppOptions';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ICreateNestAppOptions"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nmxjs/app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
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
|
}
|