@nest-yalc-2/app 1.3.3 → 2.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/package.json +1 -1
- package/src/__tests__/base-app.controller.spec.ts +77 -59
- package/src/app-bootstrap-base.helper.js +2 -2
- package/src/app-bootstrap-base.helper.js.map +1 -1
- package/src/app-bootstrap-base.helper.ts +9 -2
- package/src/app-bootstrap-standalone.helper.js +4 -6
- package/src/app-bootstrap-standalone.helper.js.map +1 -1
- package/src/app-bootstrap-standalone.helper.ts +9 -2
- package/src/app-bootstrap.helper.js +5 -7
- package/src/app-bootstrap.helper.js.map +1 -1
- package/src/app-bootstrap.helper.ts +19 -3
- package/src/app-context.module.js +2 -7
- package/src/app-context.module.js.map +1 -1
- package/src/app-context.service.js +2 -7
- package/src/app-context.service.js.map +1 -1
- package/src/app-imports.factory.d.ts +1 -1
- package/src/app-imports.factory.js +3 -35
- package/src/app-imports.factory.js.map +1 -1
- package/src/app-imports.factory.ts +3 -3
- package/src/app.helper.d.ts +1 -1
- package/src/app.helper.ts +1 -1
- package/src/base-app-module.helper.d.ts +2 -2
- package/src/base-app-module.helper.js +5 -46
- package/src/base-app-module.helper.js.map +1 -1
- package/src/base-app-module.helper.ts +7 -1
- package/src/base-app.controller.js +11 -19
- package/src/base-app.controller.js.map +1 -1
- package/src/base-app.controller.ts +8 -0
- package/src/base-app.interface.d.ts +1 -1
- package/src/base-app.interface.ts +1 -1
- package/src/base-app.service.js +9 -53
- package/src/base-app.service.js.map +1 -1
- package/src/base-app.service.ts +4 -0
- package/src/cls.module.js +5 -8
- package/src/cls.module.js.map +1 -1
- package/src/cls.module.ts +9 -2
- package/src/conf.type.d.ts +1 -1
- package/src/conf.type.ts +1 -1
- package/src/life-cycle-handler.service.d.ts +1 -1
- package/src/life-cycle-handler.service.js +7 -18
- package/src/life-cycle-handler.service.js.map +1 -1
- package/src/life-cycle-handler.service.ts +9 -1
- package/src/unwrap-result.interceptor.js +2 -7
- package/src/unwrap-result.interceptor.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,72 +1,90 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ConfigService } from '@nestjs/config';
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing';
|
|
3
2
|
import { BaseAppController } from '../base-app.controller.js';
|
|
4
3
|
import { BaseAppService } from '../base-app.service.js';
|
|
4
|
+
import { ConfigService } from '@nestjs/config';
|
|
5
|
+
import { Controller } from '@nestjs/common';
|
|
5
6
|
|
|
7
|
+
@Controller()
|
|
6
8
|
class TestAppController extends BaseAppController {}
|
|
7
9
|
|
|
8
10
|
describe('BaseAppController', () => {
|
|
9
|
-
const getHello = jest.fn();
|
|
10
|
-
const appService = {
|
|
11
|
-
getHello,
|
|
12
|
-
} as unknown as BaseAppService;
|
|
13
|
-
|
|
14
|
-
const configGet = jest.fn();
|
|
15
|
-
const configService = {
|
|
16
|
-
get: configGet,
|
|
17
|
-
} as unknown as ConfigService;
|
|
18
|
-
|
|
19
11
|
let controller: TestAppController;
|
|
20
|
-
let
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
beforeEach(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.
|
|
29
|
-
|
|
12
|
+
let mockAppService: any;
|
|
13
|
+
let mockConfigService: any;
|
|
14
|
+
|
|
15
|
+
beforeEach(async () => {
|
|
16
|
+
mockAppService = {
|
|
17
|
+
getHello: jest.fn().mockReturnValue('Hello World'),
|
|
18
|
+
};
|
|
19
|
+
mockConfigService = {
|
|
20
|
+
get: jest.fn(),
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const module: TestingModule = await Test.createTestingModule({
|
|
24
|
+
controllers: [TestAppController],
|
|
25
|
+
providers: [
|
|
26
|
+
{ provide: BaseAppService, useValue: mockAppService },
|
|
27
|
+
{ provide: ConfigService, useValue: mockConfigService },
|
|
28
|
+
],
|
|
29
|
+
}).compile();
|
|
30
|
+
|
|
31
|
+
controller = module.get<TestAppController>(TestAppController);
|
|
30
32
|
});
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
describe('getHello', () => {
|
|
35
|
+
it('should return hello with app name', () => {
|
|
36
|
+
mockConfigService.get.mockReturnValue({ appName: 'test-app' });
|
|
37
|
+
expect(controller.getHello()).toBe('Hello World');
|
|
38
|
+
expect(mockAppService.getHello).toHaveBeenCalledWith('test-app');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should return hello with default name when conf is missing', () => {
|
|
42
|
+
mockConfigService.get.mockReturnValue(undefined);
|
|
43
|
+
expect(controller.getHello()).toBe('Hello World');
|
|
44
|
+
expect(mockAppService.getHello).toHaveBeenCalledWith('no-name');
|
|
45
|
+
});
|
|
35
46
|
});
|
|
36
47
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
48
|
+
describe('shutdown', () => {
|
|
49
|
+
let mockExit: jest.SpyInstance;
|
|
50
|
+
let mockLog: jest.SpyInstance;
|
|
51
|
+
|
|
52
|
+
beforeEach(() => {
|
|
53
|
+
mockExit = jest.spyOn(process, 'exit').mockImplementation((() => {}) as any);
|
|
54
|
+
mockLog = jest.spyOn(console, 'log').mockImplementation((() => {}) as any);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
afterEach(() => {
|
|
58
|
+
mockExit.mockRestore();
|
|
59
|
+
mockLog.mockRestore();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('should shutdown in dev mode', () => {
|
|
63
|
+
mockConfigService.get.mockReturnValue({ isDev: true });
|
|
64
|
+
controller.shutdown();
|
|
65
|
+
expect(mockExit).toHaveBeenCalledWith(0);
|
|
66
|
+
expect(mockLog).toHaveBeenCalledWith('Bye bye!');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('should shutdown in test mode', () => {
|
|
70
|
+
mockConfigService.get.mockReturnValue({ isTest: true });
|
|
71
|
+
controller.shutdown();
|
|
72
|
+
expect(mockExit).toHaveBeenCalledWith(0);
|
|
73
|
+
expect(mockLog).toHaveBeenCalledWith('Bye bye!');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('should not shutdown if neither dev nor test', () => {
|
|
77
|
+
mockConfigService.get.mockReturnValue({ isDev: false, isTest: false });
|
|
78
|
+
controller.shutdown();
|
|
79
|
+
expect(mockExit).not.toHaveBeenCalled();
|
|
80
|
+
expect(mockLog).not.toHaveBeenCalled();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('should not shutdown if conf is missing', () => {
|
|
84
|
+
mockConfigService.get.mockReturnValue(undefined);
|
|
85
|
+
controller.shutdown();
|
|
86
|
+
expect(mockExit).not.toHaveBeenCalled();
|
|
87
|
+
expect(mockLog).not.toHaveBeenCalled();
|
|
88
|
+
});
|
|
71
89
|
});
|
|
72
90
|
});
|
|
@@ -5,8 +5,8 @@ const common_1 = require("@nestjs/common");
|
|
|
5
5
|
const config_1 = require("@nestjs/config");
|
|
6
6
|
const def_const_js_1 = require("./def.const.js");
|
|
7
7
|
const base_app_module_helper_js_1 = require("./base-app-module.helper.js");
|
|
8
|
-
const logger_helper_js_1 = require("@
|
|
9
|
-
const promise_helper_js_1 = require("@
|
|
8
|
+
const logger_helper_js_1 = require("@node-yalc/logger/logger.helper.js");
|
|
9
|
+
const promise_helper_js_1 = require("@node-yalc/utils/promise.helper.js");
|
|
10
10
|
common_1.Logger.overrideLogger((0, logger_helper_js_1.getEnvLoggerLevels)());
|
|
11
11
|
const bootstrappedApps = new Set();
|
|
12
12
|
const getBootstrappedApps = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-bootstrap-base.helper.js","sourceRoot":"","sources":["app-bootstrap-base.helper.ts"],"names":[],"mappings":";;;AAAA,2CAMwB;AACxB,2CAA+C;AAI/C,iDAAuD;AACvD,2EAAmE;AAKnE,
|
|
1
|
+
{"version":3,"file":"app-bootstrap-base.helper.js","sourceRoot":"","sources":["app-bootstrap-base.helper.ts"],"names":[],"mappings":";;;AAAA,2CAMwB;AACxB,2CAA+C;AAI/C,iDAAuD;AACvD,2EAAmE;AAKnE,yEAAwE;AACxE,0EAA0E;AAK1E,eAAM,CAAC,cAAc,CAAC,IAAA,qCAAkB,GAAE,CAAC,CAAC;AAa5C,MAAM,gBAAgB,GAAa,IAAI,GAAG,EAAE,CAAC;AAEtC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEK,MAAM,sBAAsB,GAAG,GAIrB,EAAE;IACjB,IAAI,IAAA,2BAAmB,GAAE,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAA,2BAAmB,GAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;AACrD,CAAC,CAAC;AAVW,QAAA,sBAAsB,0BAUjC;AAEF,MAAsB,gBAAgB;IAQpC,YACY,QAAgB,EACP,SAAoB,EACvC,OAA6C;QAFnC,aAAQ,GAAR,QAAQ,CAAQ;QACP,cAAS,GAAT,SAAS,CAAW;QAJ/B,aAAQ,GAAG,KAAK,CAAC;QAOzB,IAAI,CAAC,MAAM,GAAG,gDAAoB,CAAC,OAAO,CACxC,IAA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yB;QACnD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,oCAAqB,CAAC,CAAC;QAC9D,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,2BAA2B,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5C,eAAM,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAvJD,4CAuJC"}
|
|
@@ -15,8 +15,8 @@ import { ICreateOptions, INestCreateOptions } from './app-bootstrap.helper.js';
|
|
|
15
15
|
import { EventModule } from '@nest-yalc-2/event-manager/event.module.js';
|
|
16
16
|
import { LoggerServiceFactory } from '@nest-yalc-2/logger/logger.service.js';
|
|
17
17
|
import { FastifyInstance } from 'fastify';
|
|
18
|
-
import { getEnvLoggerLevels } from '@
|
|
19
|
-
import { globalPromiseTracker } from '@
|
|
18
|
+
import { getEnvLoggerLevels } from '@node-yalc/logger/logger.helper.js';
|
|
19
|
+
import { globalPromiseTracker } from '@node-yalc/utils/promise.helper.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Side effect to be executed as soon as the module is imported
|
|
@@ -86,6 +86,7 @@ export abstract class BaseAppBootstrap<
|
|
|
86
86
|
getBootstrappedApps().add(this);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/* istanbul ignore next */
|
|
89
90
|
async initApp(options?: {
|
|
90
91
|
createOptions?: INestCreateOptions;
|
|
91
92
|
fastifyInstance?: FastifyInstance;
|
|
@@ -118,7 +119,9 @@ export abstract class BaseAppBootstrap<
|
|
|
118
119
|
try {
|
|
119
120
|
initRes = await originalInitFn();
|
|
120
121
|
} catch (error) {
|
|
122
|
+
/* istanbul ignore next */
|
|
121
123
|
this.closeCleanup();
|
|
124
|
+
/* istanbul ignore next */
|
|
122
125
|
throw error;
|
|
123
126
|
}
|
|
124
127
|
return initRes;
|
|
@@ -139,6 +142,7 @@ export abstract class BaseAppBootstrap<
|
|
|
139
142
|
return this.isClosed;
|
|
140
143
|
}
|
|
141
144
|
|
|
145
|
+
/* istanbul ignore next */
|
|
142
146
|
getAppAlias() {
|
|
143
147
|
return this.appAlias;
|
|
144
148
|
}
|
|
@@ -149,7 +153,9 @@ export abstract class BaseAppBootstrap<
|
|
|
149
153
|
}
|
|
150
154
|
|
|
151
155
|
getApp() {
|
|
156
|
+
/* istanbul ignore next */
|
|
152
157
|
if (!this.app) {
|
|
158
|
+
/* istanbul ignore next */
|
|
153
159
|
throw new Error('This app is not initialized yet');
|
|
154
160
|
}
|
|
155
161
|
|
|
@@ -177,6 +183,7 @@ export abstract class BaseAppBootstrap<
|
|
|
177
183
|
*
|
|
178
184
|
* @returns The main module of the business logic (the one that is passed in the constructor)
|
|
179
185
|
*/
|
|
186
|
+
/* istanbul ignore next */
|
|
180
187
|
getAppModule() {
|
|
181
188
|
return this.appModule;
|
|
182
189
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.StandaloneAppBootstrap = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
7
5
|
const core_1 = require("@nestjs/core");
|
|
8
|
-
const env_helper_js_1 = require("@
|
|
9
|
-
const cli_color_1 = __importDefault(require("cli-color"));
|
|
6
|
+
const env_helper_js_1 = require("@node-yalc/utils/env.helper.js");
|
|
7
|
+
const cli_color_1 = tslib_1.__importDefault(require("cli-color"));
|
|
10
8
|
const app_bootstrap_base_helper_js_1 = require("./app-bootstrap-base.helper.js");
|
|
11
|
-
const logger_helper_js_1 = require("@
|
|
9
|
+
const logger_helper_js_1 = require("@node-yalc/logger/logger.helper.js");
|
|
12
10
|
class StandaloneAppBootstrap extends app_bootstrap_base_helper_js_1.BaseAppBootstrap {
|
|
13
11
|
constructor(appAlias, module, options) {
|
|
14
12
|
super(appAlias, module, { globalsOptions: options });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-bootstrap-standalone.helper.js","sourceRoot":"","sources":["app-bootstrap-standalone.helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-bootstrap-standalone.helper.js","sourceRoot":"","sources":["app-bootstrap-standalone.helper.ts"],"names":[],"mappings":";;;;AACA,uCAA2C;AAG3C,kEAA2D;AAC3D,kEAA4B;AAC5B,iFAGwC;AAExC,yEAAwE;AAExE,MAAa,sBAEX,SAAQ,+CAAyC;IACjD,YAAY,QAAgB,EAAE,MAAW,EAAE,OAAwB;QACjE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAGb;QACC,MAAM,IAAI,CAAC,SAAS,CAAC;YACnB,aAAa,EAAE,OAAO,EAAE,aAAa;SACtC,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAEzD,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;QAG3B,IAAI,IAAA,yBAAS,EAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC;YAEhD,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,qBAAqB,CAAC,CAAC;YAE/C,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;YAE5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,QAGf;QACC,IAAI,GAA4B,CAAC;QACjC,IAAI,CAAC;YACH,GAAG,GAAG,MAAM,kBAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,MAAM,EAAE;gBAC5D,MAAM,EAAE,IAAA,qCAAkB,GAAE;aAC7B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YAEb,IAAI,CAAC,YAAY,EAAE,CAAC;YAGpB,OAAO,CAAC,KAAK,CAAC,mBAAG,CAAC,GAAG,CAAC,sBAAsB,CAAC,EAAE,mBAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YAE7D,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;CACF;AArDD,wDAqDC"}
|
|
@@ -2,14 +2,14 @@ import { INestApplicationContext } from '@nestjs/common';
|
|
|
2
2
|
import { NestFactory } from '@nestjs/core';
|
|
3
3
|
// import { GqlExceptionFilter } from '@nestjs/graphql';
|
|
4
4
|
import { FastifyInstance } from 'fastify';
|
|
5
|
-
import { envIsTrue } from '@
|
|
5
|
+
import { envIsTrue } from '@node-yalc/utils/env.helper.js';
|
|
6
6
|
import clc from 'cli-color';
|
|
7
7
|
import {
|
|
8
8
|
BaseAppBootstrap,
|
|
9
9
|
IGlobalOptions,
|
|
10
10
|
} from './app-bootstrap-base.helper.js';
|
|
11
11
|
import { INestCreateOptions } from './app-bootstrap.helper.js';
|
|
12
|
-
import { getEnvLoggerLevels } from '@
|
|
12
|
+
import { getEnvLoggerLevels } from '@node-yalc/logger/logger.helper.js';
|
|
13
13
|
|
|
14
14
|
export class StandaloneAppBootstrap<
|
|
15
15
|
TGlobalOptions extends IGlobalOptions = IGlobalOptions,
|
|
@@ -30,9 +30,13 @@ export class StandaloneAppBootstrap<
|
|
|
30
30
|
|
|
31
31
|
await this.getApp().init();
|
|
32
32
|
|
|
33
|
+
/* istanbul ignore next */
|
|
33
34
|
if (envIsTrue(process.env.APP_DRY_RUN) === true) {
|
|
35
|
+
/* istanbul ignore next */
|
|
34
36
|
this.loggerService?.log('Dry run, exiting...');
|
|
37
|
+
/* istanbul ignore next */
|
|
35
38
|
await this.getApp().close();
|
|
39
|
+
/* istanbul ignore next */
|
|
36
40
|
process.exit(0);
|
|
37
41
|
}
|
|
38
42
|
|
|
@@ -49,9 +53,12 @@ export class StandaloneAppBootstrap<
|
|
|
49
53
|
logger: getEnvLoggerLevels(),
|
|
50
54
|
});
|
|
51
55
|
} catch (err) {
|
|
56
|
+
/* istanbul ignore next */
|
|
52
57
|
this.closeCleanup();
|
|
53
58
|
// eslint-disable-next-line no-console
|
|
59
|
+
/* istanbul ignore next */
|
|
54
60
|
console.error(clc.red('Failed to create app'), clc.red(err));
|
|
61
|
+
/* istanbul ignore next */
|
|
55
62
|
throw new Error('Process aborted');
|
|
56
63
|
}
|
|
57
64
|
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.AppBootstrap = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
7
5
|
const index_js_1 = require("@nest-yalc-2/errors/filters/index.js");
|
|
8
6
|
const common_1 = require("@nestjs/common");
|
|
9
7
|
const core_1 = require("@nestjs/core");
|
|
10
8
|
const platform_fastify_1 = require("@nestjs/platform-fastify");
|
|
11
|
-
const cookie_1 = __importDefault(require("@fastify/cookie"));
|
|
9
|
+
const cookie_1 = tslib_1.__importDefault(require("@fastify/cookie"));
|
|
12
10
|
const swagger_1 = require("@nestjs/swagger");
|
|
13
11
|
const fastify_1 = require("fastify");
|
|
14
|
-
const env_helper_js_1 = require("@
|
|
12
|
+
const env_helper_js_1 = require("@node-yalc/utils/env.helper.js");
|
|
15
13
|
const class_validator_1 = require("class-validator");
|
|
16
|
-
const cli_color_1 = __importDefault(require("cli-color"));
|
|
14
|
+
const cli_color_1 = tslib_1.__importDefault(require("cli-color"));
|
|
17
15
|
const app_bootstrap_base_helper_js_1 = require("./app-bootstrap-base.helper.js");
|
|
18
|
-
const logger_helper_js_1 = require("@
|
|
16
|
+
const logger_helper_js_1 = require("@node-yalc/logger/logger.helper.js");
|
|
19
17
|
const unwrap_result_interceptor_js_1 = require("./unwrap-result.interceptor.js");
|
|
20
18
|
class AppBootstrap extends app_bootstrap_base_helper_js_1.BaseAppBootstrap {
|
|
21
19
|
constructor(appAlias, module, options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-bootstrap.helper.js","sourceRoot":"","sources":["app-bootstrap.helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-bootstrap.helper.js","sourceRoot":"","sources":["app-bootstrap.helper.ts"],"names":[],"mappings":";;;;AAAA,mEAA6E;AAC7E,2CAMwB;AACxB,uCAA2C;AAE3C,+DAGkC;AAClC,qEAA4C;AAC5C,6CAAiE;AACjE,qCAAmD;AACnD,kEAA2D;AAC3D,qDAA+C;AAC/C,kEAA4B;AAC5B,iFAGwC;AACxC,yEAAwE;AACxE,iFAAyE;AAoBzE,MAAa,YAEX,SAAQ,+CAAwC;IAKhD,YAAY,QAAgB,EAAE,MAAW,EAAE,OAAwB;QACjE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC;QAJ7C,qBAAgB,GAAY,KAAK,CAAC;QAClC,gBAAW,GAAG,KAAK,CAAC;IAI9B,CAAC;IAGD,KAAK,CAAC,WAAW,CAAC,OAGjB;QACC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAE5B,IAAI,IAAA,yBAAS,EAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC;YAChD,MA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AO,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,QAAQ;2BACnB,IAAI,GAAG,SAAS,IAAI,IAAI,CAAC,WAAW;2BACpC,IAAI,GAAG,SAAS,IAAI,IAAI,CAAC,WAAW;iBAC9C,MAAM,IAAI,IAAI,GAAG,SAAS,IAAI,IAAI,CAAC,WAAW;UACrD,OAAO,IAAI,IAAI,CAAC,WAAW;iCACJ,IAAI,GAAG,SAAS,IAAI,IAAI,CAAC,WAAW,OAAO,CAAC,CAAC;YACxE,CAAC;YAED,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QAKH,MAAM,GAAG,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAE,MAAc,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;QAC5E,IAAI,GAAG,EAAE,CAAC;YAER,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;YAClD,GAAG,CAAC,MAAM,EAAE,CAAC;YACb,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;CACF;AAnOD,oCAmOC;AAGD,SAAS,mBAAmB,CAAC,IAAa;IACxC,MAAM,UAAU,GAAG,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC3E,OAAO,UAAU,IAAI,KAAK,CAAC;AAC7B,CAAC"}
|
|
@@ -15,14 +15,14 @@ import {
|
|
|
15
15
|
import fastifyCookie from '@fastify/cookie';
|
|
16
16
|
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
|
17
17
|
import { fastify, FastifyInstance } from 'fastify';
|
|
18
|
-
import { envIsTrue } from '@
|
|
18
|
+
import { envIsTrue } from '@node-yalc/utils/env.helper.js';
|
|
19
19
|
import { useContainer } from 'class-validator';
|
|
20
20
|
import clc from 'cli-color';
|
|
21
21
|
import {
|
|
22
22
|
BaseAppBootstrap,
|
|
23
23
|
IGlobalOptions,
|
|
24
24
|
} from './app-bootstrap-base.helper.js';
|
|
25
|
-
import { getEnvLoggerLevels } from '@
|
|
25
|
+
import { getEnvLoggerLevels } from '@node-yalc/logger/logger.helper.js';
|
|
26
26
|
import { UnwrapResultInterceptor } from './unwrap-result.interceptor.js';
|
|
27
27
|
|
|
28
28
|
export interface ICreateOptions {
|
|
@@ -54,6 +54,7 @@ export class AppBootstrap<
|
|
|
54
54
|
super(appAlias, module, { globalsOptions: options });
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/* istanbul ignore next */
|
|
57
58
|
async startServer(options?: {
|
|
58
59
|
createOptions?: INestCreateOptions;
|
|
59
60
|
fastifyInstance?: FastifyInstance;
|
|
@@ -96,14 +97,21 @@ export class AppBootstrap<
|
|
|
96
97
|
|
|
97
98
|
await this.getApp().init();
|
|
98
99
|
} catch (err) {
|
|
100
|
+
/* istanbul ignore next */
|
|
99
101
|
console.error('App init failed:', err);
|
|
102
|
+
/* istanbul ignore next */
|
|
100
103
|
this.closeCleanup();
|
|
104
|
+
/* istanbul ignore next */
|
|
101
105
|
throw new Error('Process aborted');
|
|
102
106
|
}
|
|
103
107
|
|
|
108
|
+
/* istanbul ignore next */
|
|
104
109
|
if (envIsTrue(process.env.APP_DRY_RUN) === true) {
|
|
110
|
+
/* istanbul ignore next */
|
|
105
111
|
this.loggerService?.log('Dry run, exiting...');
|
|
112
|
+
/* istanbul ignore next */
|
|
106
113
|
await this.closeApp();
|
|
114
|
+
/* istanbul ignore next */
|
|
107
115
|
process.exit(0);
|
|
108
116
|
}
|
|
109
117
|
|
|
@@ -138,10 +146,13 @@ export class AppBootstrap<
|
|
|
138
146
|
return this.setApp(app);
|
|
139
147
|
}
|
|
140
148
|
|
|
149
|
+
/* istanbul ignore next */
|
|
150
|
+
/* istanbul ignore next */
|
|
141
151
|
getFastifyInstance() {
|
|
142
152
|
return this.fastifyInstance;
|
|
143
153
|
}
|
|
144
154
|
|
|
155
|
+
/* istanbul ignore next */
|
|
145
156
|
setSwaggerEnabled(enabled: boolean) {
|
|
146
157
|
this.isSwaggerEnabled = enabled;
|
|
147
158
|
}
|
|
@@ -154,11 +165,14 @@ export class AppBootstrap<
|
|
|
154
165
|
transform: true,
|
|
155
166
|
transformOptions: { enableImplicitConversion: false },
|
|
156
167
|
validateCustomDecorators: true,
|
|
157
|
-
exceptionFactory: (errors) => {
|
|
168
|
+
exceptionFactory: /* istanbul ignore next */ (errors) => {
|
|
169
|
+
/* istanbul ignore next */
|
|
158
170
|
const errorMessages: { [key: string]: any } = {};
|
|
171
|
+
/* istanbul ignore next */
|
|
159
172
|
errors.forEach((error) => {
|
|
160
173
|
errorMessages[error.property] = error;
|
|
161
174
|
});
|
|
175
|
+
/* istanbul ignore next */
|
|
162
176
|
return new BadRequestException(errorMessages);
|
|
163
177
|
},
|
|
164
178
|
...(options?.validationPipeOptions ?? {}),
|
|
@@ -209,6 +223,7 @@ export class AppBootstrap<
|
|
|
209
223
|
.setDescription(`${this.appAlias} rest api`);
|
|
210
224
|
}
|
|
211
225
|
|
|
226
|
+
/* istanbul ignore next */
|
|
212
227
|
async listen(callback?: {
|
|
213
228
|
(port: number, host: string, domain: string): void;
|
|
214
229
|
}) {
|
|
@@ -257,6 +272,7 @@ export class AppBootstrap<
|
|
|
257
272
|
}
|
|
258
273
|
}
|
|
259
274
|
|
|
275
|
+
/* istanbul ignore next */
|
|
260
276
|
function sanitizeSwaggerPath(path?: string): string {
|
|
261
277
|
const normalized = (path ?? 'api').replace(/^\/+/, '').replace(/\/+$/, '');
|
|
262
278
|
return normalized || 'api';
|
|
@@ -1,18 +1,13 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.AppContextModule = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
10
5
|
const common_1 = require("@nestjs/common");
|
|
11
6
|
const app_context_service_js_1 = require("./app-context.service.js");
|
|
12
7
|
let AppContextModule = class AppContextModule {
|
|
13
8
|
};
|
|
14
9
|
exports.AppContextModule = AppContextModule;
|
|
15
|
-
exports.AppContextModule = AppContextModule = __decorate([
|
|
10
|
+
exports.AppContextModule = AppContextModule = tslib_1.__decorate([
|
|
16
11
|
(0, common_1.Global)(),
|
|
17
12
|
(0, common_1.Module)({ providers: [app_context_service_js_1.AppContextService], exports: [app_context_service_js_1.AppContextService] })
|
|
18
13
|
], AppContextModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-context.module.js","sourceRoot":"","sources":["app-context.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-context.module.js","sourceRoot":"","sources":["app-context.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAgD;AAChD,qEAA6D;AAItD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAG,CAAA;AAAnB,4CAAgB;2BAAhB,gBAAgB;IAF5B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC,EAAE,SAAS,EAAE,CAAC,0CAAiB,CAAC,EAAE,OAAO,EAAE,CAAC,0CAAiB,CAAC,EAAE,CAAC;GAC5D,gBAAgB,CAAG"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.AppContextService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
10
5
|
const common_1 = require("@nestjs/common");
|
|
11
6
|
let AppContextService = class AppContextService {
|
|
12
7
|
constructor() {
|
|
@@ -20,7 +15,7 @@ let AppContextService = class AppContextService {
|
|
|
20
15
|
}
|
|
21
16
|
};
|
|
22
17
|
exports.AppContextService = AppContextService;
|
|
23
|
-
exports.AppContextService = AppContextService = __decorate([
|
|
18
|
+
exports.AppContextService = AppContextService = tslib_1.__decorate([
|
|
24
19
|
(0, common_1.Injectable)()
|
|
25
20
|
], AppContextService);
|
|
26
21
|
//# sourceMappingURL=app-context.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-context.service.js","sourceRoot":"","sources":["app-context.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-context.service.js","sourceRoot":"","sources":["app-context.service.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAIrC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAAvB;QACE,oBAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAU7C,CAAC;IAPQ,SAAS,CAAC,MAAqB;QACpC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;IAC9B,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;CACF,CAAA;AAXY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;GACA,iBAAiB,CAW7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModuleMetadata } from '@nestjs/common';
|
|
2
2
|
import { BuildSchemaOptions } from '@nestjs/graphql';
|
|
3
|
-
import { ClassType } from '@
|
|
3
|
+
import { ClassType } from '@node-yalc/types/globals.js';
|
|
4
4
|
import { ApolloFederationDriverConfig } from '@nestjs/apollo';
|
|
5
5
|
type ApolloServerPlugin = NonNullable<ApolloFederationDriverConfig['plugins']>[number];
|
|
6
6
|
export interface IAppImportsFactory {
|
|
@@ -1,39 +1,7 @@
|
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.AppDependencyFactory = AppDependencyFactory;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
37
5
|
const common_1 = require("@nestjs/common");
|
|
38
6
|
const axios_1 = require("@nestjs/axios");
|
|
39
7
|
const config_1 = require("@nestjs/config");
|
|
@@ -50,9 +18,9 @@ const typeorm_logger_js_1 = require("@nest-yalc-2/logger/typeorm-logger.js");
|
|
|
50
18
|
const def_const_js_1 = require("./def.const.js");
|
|
51
19
|
const app_events_js_1 = require("./app.events.js");
|
|
52
20
|
const gql_complexity_plugin_js_1 = require("@nest-yalc-2/graphql/plugins/gql-complexity.plugin.js");
|
|
53
|
-
const class_helper_js_1 = require("@
|
|
21
|
+
const class_helper_js_1 = require("@node-yalc/utils/class.helper.js");
|
|
54
22
|
const apollo_1 = require("@nestjs/apollo");
|
|
55
|
-
const dotenv = __importStar(require("dotenv"));
|
|
23
|
+
const dotenv = tslib_1.__importStar(require("dotenv"));
|
|
56
24
|
dotenv.config();
|
|
57
25
|
function AppDependencyFactory(_context, confs, dbConnNames, gqlModules, options) {
|
|
58
26
|
const { setupEvents = true, setupJwt = true, keepDBConnectionAlive = false, buildSchemaOptions = {}, disablePlayground = false, } = options ?? {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-imports.factory.js","sourceRoot":"","sources":["app-imports.factory.ts"],"names":[],"mappings":"
|
|
1
|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,CAAC;QACb,OAAO,CAAC,IAAI,CACV,eAAS,CAAC,aAAa,CAAC;YACtB,OAAO,EAAE,CAAC,YAAY,CAAC;YACvB,UAAU,EAAE,KAAK,EAAE,aAA4B,EAAE,EAAE,CAAC,CAAC;gBACnD,MAAM,EAAE,aAAa,CAAC,GAAG,CAAM,gCAAiB,CAAC,EAAE,gBAAgB;gBACnE,WAAW,EAAE;oBACX,SAAS,EAAE,IAAI;iBAChB;aACF,CAAC;YACF,MAAM,EAAE,CAAC,sBAAa,CAAC;SACxB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO;QACP,SAAS;QACT,OAAO,EAAE,EAAE;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
|
|
3
|
-
import { ImportType } from '@
|
|
3
|
+
import { ImportType } from '@node-yalc/interfaces/nestjs.type.js';
|
|
4
4
|
import { Logger, ModuleMetadata, Provider } from '@nestjs/common';
|
|
5
5
|
import { HttpModule } from '@nestjs/axios';
|
|
6
6
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
@@ -29,8 +29,8 @@ import { TypeORMLogger } from '@nest-yalc-2/logger/typeorm-logger.js';
|
|
|
29
29
|
import { CURAPP_CONF_ALIAS } from './def.const.js';
|
|
30
30
|
import { AppEvents } from './app.events.js';
|
|
31
31
|
import { GqlComplexityPlugin } from '@nest-yalc-2/graphql/plugins/gql-complexity.plugin.js';
|
|
32
|
-
import { ClassType } from '@
|
|
33
|
-
import { isClass } from '@
|
|
32
|
+
import { ClassType } from '@node-yalc/types/globals.js';
|
|
33
|
+
import { isClass } from '@node-yalc/utils/class.helper.js';
|
|
34
34
|
import {
|
|
35
35
|
ApolloFederationDriver,
|
|
36
36
|
ApolloFederationDriverConfig,
|