@steroidsjs/nest 4.0.2 → 4.1.1
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/README.md +6 -12
- package/infrastructure/applications/BaseApplication.d.ts +7 -0
- package/infrastructure/applications/BaseApplication.js +37 -0
- package/infrastructure/applications/BaseApplication.js.map +1 -1
- package/infrastructure/applications/IAppModuleConfig.d.ts +4 -0
- package/infrastructure/applications/base/config.js +2 -5
- package/infrastructure/applications/base/config.js.map +1 -1
- package/infrastructure/applications/rest/IRestAppModuleConfig.d.ts +5 -0
- package/infrastructure/applications/rest/RestApplication.d.ts +4 -11
- package/infrastructure/applications/rest/RestApplication.js +13 -16
- package/infrastructure/applications/rest/RestApplication.js.map +1 -1
- package/infrastructure/applications/rest/SentryExceptionFilter.d.ts +2 -0
- package/infrastructure/applications/rest/SentryExceptionFilter.js +10 -3
- package/infrastructure/applications/rest/SentryExceptionFilter.js.map +1 -1
- package/infrastructure/applications/rest/config.d.ts +3 -3
- package/infrastructure/applications/rest/config.js +6 -1
- package/infrastructure/applications/rest/config.js.map +1 -1
- package/infrastructure/base/consts.d.ts +1 -0
- package/infrastructure/base/consts.js +5 -0
- package/infrastructure/base/consts.js.map +1 -0
- package/infrastructure/commands/MigrateCommand.d.ts +1 -0
- package/infrastructure/commands/MigrateCommand.js +34 -0
- package/infrastructure/commands/MigrateCommand.js.map +1 -1
- package/infrastructure/commands/entity-generator/EntityCodeGenerateCommand.d.ts +1 -1
- package/infrastructure/commands/entity-generator/EntityCodeGenerateCommand.js +9 -4
- package/infrastructure/commands/entity-generator/EntityCodeGenerateCommand.js.map +1 -1
- package/infrastructure/commands/entity-generator/EntityCodeGenerator.d.ts +3 -1
- package/infrastructure/commands/entity-generator/EntityCodeGenerator.js +24 -6
- package/infrastructure/commands/entity-generator/EntityCodeGenerator.js.map +1 -1
- package/infrastructure/commands/entity-generator/templates/{ServiceTemplate.txt → CrudServiceTemplate.txt} +4 -1
- package/infrastructure/commands/entity-generator/templates/ReadServiceTemplate.txt +18 -0
- package/infrastructure/commands/entity-generator/templates/TableTemplate.txt +1 -1
- package/infrastructure/commands/generate/index.d.ts +6 -1
- package/infrastructure/commands/generate/index.js +41 -2
- package/infrastructure/commands/generate/index.js.map +1 -1
- package/infrastructure/decorators/fields/ComputableField.d.ts +2 -0
- package/infrastructure/decorators/fields/ComputableField.js +1 -0
- package/infrastructure/decorators/fields/ComputableField.js.map +1 -1
- package/infrastructure/decorators/fields/DecimalField.js +3 -1
- package/infrastructure/decorators/fields/DecimalField.js.map +1 -1
- package/infrastructure/decorators/fields/DecimalNumberField.js +2 -1
- package/infrastructure/decorators/fields/DecimalNumberField.js.map +1 -1
- package/infrastructure/decorators/fields/EnumField.d.ts +3 -2
- package/infrastructure/decorators/fields/EnumField.js +2 -1
- package/infrastructure/decorators/fields/EnumField.js.map +1 -1
- package/infrastructure/decorators/fields/PasswordField.d.ts +9 -1
- package/infrastructure/decorators/fields/PasswordField.js +12 -4
- package/infrastructure/decorators/fields/PasswordField.js.map +1 -1
- package/infrastructure/decorators/fields/index.d.ts +2 -2
- package/infrastructure/decorators/fields/index.js.map +1 -1
- package/infrastructure/decorators/typeorm/fields/TypeOrmDecimalField/index.js +2 -1
- package/infrastructure/decorators/typeorm/fields/TypeOrmDecimalField/index.js.map +1 -1
- package/infrastructure/decorators/typeorm/fields/TypeOrmDecimalNumberField/index.js +2 -1
- package/infrastructure/decorators/typeorm/fields/TypeOrmDecimalNumberField/index.js.map +1 -1
- package/infrastructure/repositories/CrudRepository.d.ts +2 -2
- package/infrastructure/repositories/CrudRepository.js +4 -6
- package/infrastructure/repositories/CrudRepository.js.map +1 -1
- package/infrastructure/utils/getNewPermissions.d.ts +2 -0
- package/infrastructure/utils/getNewPermissions.js +18 -0
- package/infrastructure/utils/getNewPermissions.js.map +1 -0
- package/package.json +2 -4
- package/tsconfig.tsbuildinfo +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Steroids Nest
|
|
2
2
|
|
|
3
|
+
Steroids Nest — это библиотека инструментов и утилит для фреймворка NestJS, предоставляющая расширенные возможности
|
|
4
|
+
для разработки веб-приложений.
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
2. Replace `outDir` path to node_modules nest path in project
|
|
8
|
-
3. Run from this directory `yarn run watch`
|
|
9
|
-
|
|
10
|
-
## All scripts available
|
|
11
|
-
```
|
|
12
|
-
yarn script
|
|
13
|
-
```
|
|
14
|
-
|
|
6
|
+
Документация по библиотеке доступна:
|
|
7
|
+
- в папке [`docs` в этом репозитории](docs/README.md)
|
|
8
|
+
- на сайте [https://steroids.github.io/nest](https://steroids.github.io/nest)
|
|
@@ -27,6 +27,13 @@ export declare abstract class BaseApplication {
|
|
|
27
27
|
* @protected
|
|
28
28
|
*/
|
|
29
29
|
protected initConfig(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Initializes Sentry for error tracking and logging.
|
|
32
|
+
*
|
|
33
|
+
* Sentry also automatically configures `process.on('uncaughtException')` and `process.on('unhandledRejection')` to log and handle these events,
|
|
34
|
+
* only on `uncaughtException` the process will be exited, but on `unhandledRejection` it will continue to work.
|
|
35
|
+
*/
|
|
36
|
+
protected initSentry(): void;
|
|
30
37
|
/**
|
|
31
38
|
* Method for initializing application modules.
|
|
32
39
|
* It uses the `ModuleHelper` class.
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseApplication = void 0;
|
|
4
4
|
const dotenv = require("dotenv");
|
|
5
|
+
const Sentry = require("@sentry/nestjs");
|
|
5
6
|
const ModuleHelper_1 = require("../helpers/ModuleHelper");
|
|
7
|
+
const AppModule_1 = require("./AppModule");
|
|
6
8
|
/**
|
|
7
9
|
* Abstract class for creating application configuration classes.
|
|
8
10
|
*/
|
|
@@ -15,6 +17,7 @@ class BaseApplication {
|
|
|
15
17
|
async init() {
|
|
16
18
|
this.initEnv();
|
|
17
19
|
this.initConfig();
|
|
20
|
+
this.initSentry();
|
|
18
21
|
this.initModules();
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
@@ -37,6 +40,40 @@ class BaseApplication {
|
|
|
37
40
|
*/
|
|
38
41
|
initConfig() {
|
|
39
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Initializes Sentry for error tracking and logging.
|
|
45
|
+
*
|
|
46
|
+
* Sentry also automatically configures `process.on('uncaughtException')` and `process.on('unhandledRejection')` to log and handle these events,
|
|
47
|
+
* only on `uncaughtException` the process will be exited, but on `unhandledRejection` it will continue to work.
|
|
48
|
+
*/
|
|
49
|
+
initSentry() {
|
|
50
|
+
const config = ModuleHelper_1.ModuleHelper.getConfig(AppModule_1.AppModule);
|
|
51
|
+
if (!config.sentry) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
Sentry.init({
|
|
55
|
+
dsn: config.sentry.dsn,
|
|
56
|
+
environment: config.sentry.environment,
|
|
57
|
+
integrations: [
|
|
58
|
+
Sentry.onUncaughtExceptionIntegration({
|
|
59
|
+
onFatalError: async (err) => {
|
|
60
|
+
if (err.name === 'SentryError') {
|
|
61
|
+
console.log(err);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
Sentry.getCurrentScope()
|
|
65
|
+
.getClient()
|
|
66
|
+
.captureException(err);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
Sentry.onUnhandledRejectionIntegration({
|
|
72
|
+
mode: 'warn',
|
|
73
|
+
}),
|
|
74
|
+
],
|
|
75
|
+
});
|
|
76
|
+
}
|
|
40
77
|
/**
|
|
41
78
|
* Method for initializing application modules.
|
|
42
79
|
* It uses the `ModuleHelper` class.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseApplication.js","sourceRoot":"","sources":["../../../src/infrastructure/applications/BaseApplication.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,0DAAqD;
|
|
1
|
+
{"version":3,"file":"BaseApplication.js","sourceRoot":"","sources":["../../../src/infrastructure/applications/BaseApplication.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,yCAAyC;AACzC,0DAAqD;AACrD,2CAAsC;AAGtC;;GAEG;AACH,MAAsB,eAAe;IAOjC;;;;OAIG;IACO,KAAK,CAAC,IAAI;QAChB,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACO,OAAO;QACb,MAAM,CAAC,MAAM,EAAE,CAAC;QAEhB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE;YAC9B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;SAC/D;IACL,CAAC;IAED;;;;OAIG;IACO,UAAU;IAEpB,CAAC;IAED;;;;;OAKG;IACO,UAAU;QAChB,MAAM,MAAM,GAAG,2BAAY,CAAC,SAAS,CAAmB,qBAAS,CAAC,CAAC;QAEnE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAChB,OAAO;SACV;QAED,MAAM,CAAC,IAAI,CAAC;YACR,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG;YACtB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW;YACtC,YAAY,EAAE;gBACV,MAAM,CAAC,8BAA8B,CAAC;oBAClC,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;wBACxB,IAAI,GAAG,CAAC,IAAI,KAAK,aAAa,EAAE;4BAC5B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;yBACpB;6BAAM;4BACH,MAAM,CAAC,eAAe,EAAE;iCACnB,SAAS,EAAE;iCACX,gBAAgB,CAAC,GAAG,CAAC,CAAC;4BAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;yBACnB;oBACL,CAAC;iBACJ,CAAC;gBACF,MAAM,CAAC,+BAA+B,CAAC;oBACnC,IAAI,EAAE,MAAM;iBACf,CAAC;aACL;SACJ,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACO,WAAW;QACjB,2BAAY,CAAC,eAAe,EAAE,CAAC;IACnC,CAAC;CAMJ;AA5FD,0CA4FC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const nest_typeorm_1 = require("@steroidsjs/nest-typeorm");
|
|
4
|
-
const
|
|
4
|
+
const setup_1 = require("@sentry/nestjs/setup");
|
|
5
5
|
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
6
6
|
const ModuleHelper_1 = require("../../helpers/ModuleHelper");
|
|
7
7
|
const AppModule_1 = require("../AppModule");
|
|
@@ -28,10 +28,7 @@ exports.default = {
|
|
|
28
28
|
module: (config) => ({
|
|
29
29
|
imports: [
|
|
30
30
|
nest_typeorm_1.TypeOrmModule.forRoot(Object.assign(Object.assign({}, config.database), { entities: ModuleHelper_1.ModuleHelper.getEntities() })),
|
|
31
|
-
config.sentry &&
|
|
32
|
-
dsn: config.sentry.dsn,
|
|
33
|
-
environment: config.sentry.environment || process.env.APP_ENVIRONMENT,
|
|
34
|
-
}),
|
|
31
|
+
config.sentry && setup_1.SentryModule.forRoot(),
|
|
35
32
|
event_emitter_1.EventEmitterModule.forRoot(),
|
|
36
33
|
].filter(Boolean),
|
|
37
34
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/infrastructure/applications/base/config.ts"],"names":[],"mappings":";;AAAA,2DAA6E;AAE7E,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/infrastructure/applications/base/config.ts"],"names":[],"mappings":";;AA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olean;
|
|
26
|
+
/**
|
|
27
|
+
* Is listen on localhost only?
|
|
28
|
+
* (value from `process.env.APP_LISTEN_LOCALHOST`)
|
|
29
|
+
*/
|
|
30
|
+
isListenLocalhost?: boolean;
|
|
26
31
|
}
|
|
@@ -48,19 +48,12 @@ export declare class RestApplication extends BaseApplication {
|
|
|
48
48
|
protected initPipes(): void;
|
|
49
49
|
/**
|
|
50
50
|
* Initialize global exception filters
|
|
51
|
-
* (by default, `ValidationExceptionFilter` and `UserExceptionFilter` are used).
|
|
52
|
-
* @protected
|
|
53
|
-
*/
|
|
54
|
-
protected initFilters(): void;
|
|
55
|
-
/**
|
|
56
|
-
* Initializes Sentry for error tracking and logging.
|
|
57
|
-
* If the environment variable `APP_SENTRY_DSN` is set, the filter `SentryExceptionFilter` is added.
|
|
58
51
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
52
|
+
* (by default, `ValidationExceptionFilter` and `UserExceptionFilter` are used.
|
|
53
|
+
* If the environment variable `APP_SENTRY_DSN` is set, the filter `SentryExceptionFilter` is added).
|
|
61
54
|
* @protected
|
|
62
55
|
*/
|
|
63
|
-
protected
|
|
56
|
+
protected initFilters(): void;
|
|
64
57
|
/**
|
|
65
58
|
* Initialization of global interceptors (default is `SchemaSerializer`).
|
|
66
59
|
* @protected
|
|
@@ -84,7 +77,7 @@ export declare class RestApplication extends BaseApplication {
|
|
|
84
77
|
/**
|
|
85
78
|
* Starts the application. Calls the `init` method and then starts the server on the specified port.
|
|
86
79
|
*/
|
|
87
|
-
start(): Promise<
|
|
80
|
+
start(): Promise<any>;
|
|
88
81
|
/**
|
|
89
82
|
* Getter for `_app`
|
|
90
83
|
*/
|
|
@@ -106,27 +106,19 @@ class RestApplication extends BaseApplication_1.BaseApplication {
|
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
108
|
* Initialize global exception filters
|
|
109
|
-
*
|
|
109
|
+
*
|
|
110
|
+
* (by default, `ValidationExceptionFilter` and `UserExceptionFilter` are used.
|
|
111
|
+
* If the environment variable `APP_SENTRY_DSN` is set, the filter `SentryExceptionFilter` is added).
|
|
110
112
|
* @protected
|
|
111
113
|
*/
|
|
112
114
|
initFilters() {
|
|
115
|
+
if (this._config.sentry) {
|
|
116
|
+
this._app.useGlobalFilters(new SentryExceptionFilter_1.SentryExceptionFilter(this._config.sentry.exposeSentryErrorResponse));
|
|
117
|
+
}
|
|
113
118
|
// Validation
|
|
114
119
|
this._app.useGlobalFilters(new ValidationExceptionFilter_1.ValidationExceptionFilter());
|
|
115
120
|
this._app.useGlobalFilters(new UserExceptionFilter_1.UserExceptionFilter());
|
|
116
121
|
}
|
|
117
|
-
/**
|
|
118
|
-
* Initializes Sentry for error tracking and logging.
|
|
119
|
-
* If the environment variable `APP_SENTRY_DSN` is set, the filter `SentryExceptionFilter` is added.
|
|
120
|
-
*
|
|
121
|
-
* Sentry also automatically configures `process.on('uncaughtException')` and `process.on('unhandledRejection')` to log and handle these events,
|
|
122
|
-
* only on `uncaughtException` the process will be exited, but on `unhandledRejection` it will continue to work.
|
|
123
|
-
* @protected
|
|
124
|
-
*/
|
|
125
|
-
initSentry() {
|
|
126
|
-
if (process.env.APP_SENTRY_DSN) {
|
|
127
|
-
this._app.useGlobalFilters(new SentryExceptionFilter_1.SentryExceptionFilter());
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
122
|
/**
|
|
131
123
|
* Initialization of global interceptors (default is `SchemaSerializer`).
|
|
132
124
|
* @protected
|
|
@@ -164,7 +156,6 @@ class RestApplication extends BaseApplication_1.BaseApplication {
|
|
|
164
156
|
this.initCors();
|
|
165
157
|
this.initPipes();
|
|
166
158
|
this.initFilters();
|
|
167
|
-
this.initSentry();
|
|
168
159
|
this.initInterceptors();
|
|
169
160
|
this.initSettings();
|
|
170
161
|
this.initGraceful();
|
|
@@ -176,7 +167,13 @@ class RestApplication extends BaseApplication_1.BaseApplication {
|
|
|
176
167
|
await this.init();
|
|
177
168
|
// Start application
|
|
178
169
|
const port = parseInt(process.env.PORT, 10);
|
|
179
|
-
|
|
170
|
+
// eslint-disable-line no-console
|
|
171
|
+
const onStartCallback = () => console.log(`Server started http://localhost:${port}`);
|
|
172
|
+
const appListenArguments = this._config.isListenLocalhost
|
|
173
|
+
? [port, 'localhost', onStartCallback]
|
|
174
|
+
: [port, onStartCallback];
|
|
175
|
+
// @ts-ignore
|
|
176
|
+
return this._app.listen(...appListenArguments);
|
|
180
177
|
}
|
|
181
178
|
/**
|
|
182
179
|
* Getter for `_app`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RestApplication.js","sourceRoot":"","sources":["../../../../src/infrastructure/applications/rest/RestApplication.ts"],"names":[],"mappings":";;;AAAA,uCAAoD;AACpD,6CAA6C;AAC7C,6CAA+D;AAC/D,2CAAgE;AAChE,mEAA8D;AAC9D,yDAAoD;AAEpD,6DAAwD;AACxD,uFAAkF;AAClF,2EAAsE;AACtE,wDAAmD;AACnD,6DAAwD;AACxD,4CAAuC;AAEvC;;GAEG;AACH,MAAa,eAAgB,SAAQ,iCAAe;IAoBhD,YAAY,WAAW,GAAG,qBAAS;QAC/B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACO,UAAU;QAChB,MAAM,MAAM,GAAG,2BAAY,CAAC,SAAS,CAAuB,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,iCACR,gBAAgB,EAAE,MAAM,IACrB,MAAM,KACT,IAAI,kBACA,YAAY,EAAE;oBACV,QAAQ;oBACR,kBAAkB;oBAClB,cAAc;oBACd,QAAQ;oBACR,eAAe;oBACf,qBAAqB;oBACrB,cAAc;oBAEd,sBAAsB;oBACtB,eAAe;oBACf,mBAAmB;oBACnB,eAAe;oBACf,kBAAkB;oBAClB,qBAAqB;oBACrB,eAAe;iBAClB,EACD,YAAY,EAAE;oBACV,MAAM;oBACN,KAAK;oBACL,KAAK;oBACL,SAAS;oBACT,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AC,UAAU,CAAC;YACjB,WAAW,EAAE,IAAI;YACjB,MAAM;YACN,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY;YACvC,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY;SACjD,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACO,SAAS;QACf,aAAa;QACb,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,6BAAa,EAAE,CAAC,CAAC;IAClD,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"RestApplication.js","sourceRoot":"","sources":["../../../../src/infrastructure/applications/rest/RestApplication.ts"],"names":[],"mappings":";;;AAAA,uCAAoD;AACpD,6CAA6C;AAC7C,6CAA+D;AAC/D,2CAAgE;AAChE,mEAA8D;AAC9D,yDAAoD;AAEpD,6DAAwD;AACxD,uFAAkF;AAClF,2EAAsE;AACtE,wDAAmD;AACnD,6DAAwD;AACxD,4CAAuC;AAEvC;;GAEG;AACH,MAAa,eAAgB,SAAQ,iCAAe;IAoBhD,YAAY,WAAW,GAAG,qBAAS;QAC/B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACO,UAAU;QAChB,MAAM,MAAM,GAAG,2BAAY,CAAC,SAAS,CAAuB,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,iCACR,gBAAgB,EAAE,MAAM,IACrB,MAAM,KACT,IAAI,kBACA,YAAY,EAAE;oBACV,QAAQ;oBACR,kBAAkB;oBAClB,cAAc;oBACd,QAAQ;oBACR,eAAe;oBACf,qBAAqB;oBACrB,cAAc;oBAEd,sBAAsB;oBACtB,eAAe;oBACf,mBAAmB;oBACnB,eAAe;oBACf,kBAAkB;oBAClB,qBAAqB;oBACrB,eAAe;iBAClB,EACD,YAAY,EAAE;oBACV,MAAM;oBACN,KAAK;oBACL,KAAK;oBACL,SAAS;oBACT,QA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IAAI,CAAC;IACrB,CAAC;CACJ;AArND,0CAqNC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ExceptionFilter, ArgumentsHost } from '@nestjs/common';
|
|
2
2
|
export declare class SentryExceptionFilter implements ExceptionFilter {
|
|
3
|
+
private readonly exposeErrorResponse;
|
|
4
|
+
constructor(exposeErrorResponse: boolean);
|
|
3
5
|
catch(exception: Error, host: ArgumentsHost): void;
|
|
4
6
|
}
|
|
@@ -5,12 +5,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
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
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
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
|
+
};
|
|
8
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
12
|
exports.SentryExceptionFilter = void 0;
|
|
10
13
|
const common_1 = require("@nestjs/common");
|
|
11
|
-
const Sentry = require("@sentry/
|
|
14
|
+
const Sentry = require("@sentry/nestjs");
|
|
12
15
|
const uuid_1 = require("uuid");
|
|
13
16
|
let SentryExceptionFilter = class SentryExceptionFilter {
|
|
17
|
+
constructor(exposeErrorResponse) {
|
|
18
|
+
this.exposeErrorResponse = exposeErrorResponse;
|
|
19
|
+
}
|
|
14
20
|
catch(exception, host) {
|
|
15
21
|
var _a;
|
|
16
22
|
const ctx = host.switchToHttp();
|
|
@@ -44,7 +50,7 @@ let SentryExceptionFilter = class SentryExceptionFilter {
|
|
|
44
50
|
},
|
|
45
51
|
};
|
|
46
52
|
Sentry.captureException(exception, context);
|
|
47
|
-
exception.message = 'Внутренняя ошибка сервера. ' + exception.message || '';
|
|
53
|
+
exception.message = 'Внутренняя ошибка сервера. ' + (this.exposeErrorResponse ? exception.message || '' : '');
|
|
48
54
|
if (errorUid) {
|
|
49
55
|
exception.message += ` Ошибка #${errorUid}`;
|
|
50
56
|
}
|
|
@@ -58,7 +64,8 @@ let SentryExceptionFilter = class SentryExceptionFilter {
|
|
|
58
64
|
}
|
|
59
65
|
};
|
|
60
66
|
SentryExceptionFilter = __decorate([
|
|
61
|
-
(0, common_1.Catch)(Error)
|
|
67
|
+
(0, common_1.Catch)(Error),
|
|
68
|
+
__metadata("design:paramtypes", [Boolean])
|
|
62
69
|
], SentryExceptionFilter);
|
|
63
70
|
exports.SentryExceptionFilter = SentryExceptionFilter;
|
|
64
71
|
//# sourceMappingURL=SentryExceptionFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentryExceptionFilter.js","sourceRoot":"","sources":["../../../../src/infrastructure/applications/rest/SentryExceptionFilter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SentryExceptionFilter.js","sourceRoot":"","sources":["../../../../src/infrastructure/applications/rest/SentryExceptionFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAgG;AAEhG,yCAAyC;AACzC,+BAAkC;AAI3B,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAC9B,YAA6B,mBAA4B;QAA5B,wBAAmB,GAAnB,mBAAmB,CAAS;IAAG,CAAC;IAE7D,KAAK,CAAC,SAAgB,EAAE,IAAmB;;QACvC,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAE7C,IAAI,SAAS,YAAY,sBAAa,EAAE;YACpC,MAAM,iBAAiB,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;YAClD,IAAI,OAAO,GAAQ;gBACf,UAAU,EAAE,SAAS,CAAC,SAAS,EAAE;gBACjC,OAAO,EAAE,SAAS,CAAC,OAAO;aAC7B,CAAC;YACF,IAAI,OA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zDY,sDAAqB"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { IRestAppModuleConfig } from './IRestAppModuleConfig';
|
|
2
2
|
import { RequestExecutionExceptionFilter } from './filters/RequestExecutionExceptionFilter';
|
|
3
|
-
import { GracefulController } from
|
|
4
|
-
import { GracefulService } from
|
|
3
|
+
import { GracefulController } from './graceful/GracefulController';
|
|
4
|
+
import { GracefulService } from './graceful/GracefulService';
|
|
5
5
|
import { ValidationExceptionFilter } from '../../filters/ValidationExceptionFilter';
|
|
6
6
|
declare const _default: {
|
|
7
|
+
config: () => IRestAppModuleConfig;
|
|
7
8
|
module: (config: IRestAppModuleConfig) => {
|
|
8
9
|
providers: (typeof GracefulService | {
|
|
9
10
|
provide: string;
|
|
@@ -16,6 +17,5 @@ declare const _default: {
|
|
|
16
17
|
imports: import("@nestjs/common").DynamicModule[];
|
|
17
18
|
};
|
|
18
19
|
rootTarget: typeof import("../AppModule").AppModule;
|
|
19
|
-
config: () => import("../IAppModuleConfig").IAppModuleConfig;
|
|
20
20
|
};
|
|
21
21
|
export default _default;
|
|
@@ -6,7 +6,12 @@ const RequestExecutionExceptionFilter_1 = require("./filters/RequestExecutionExc
|
|
|
6
6
|
const GracefulController_1 = require("./graceful/GracefulController");
|
|
7
7
|
const GracefulService_1 = require("./graceful/GracefulService");
|
|
8
8
|
const ValidationExceptionFilter_1 = require("../../filters/ValidationExceptionFilter");
|
|
9
|
-
|
|
9
|
+
const BooleanField_1 = require("../../decorators/fields/BooleanField");
|
|
10
|
+
exports.default = Object.assign(Object.assign({}, config_1.default), { config: () => (Object.assign(Object.assign({}, config_1.default.config()), { sentry: {
|
|
11
|
+
dsn: process.env.APP_SENTRY_DSN,
|
|
12
|
+
environment: process.env.APP_ENVIRONMENT,
|
|
13
|
+
exposeSentryErrorResponse: (0, BooleanField_1.normalizeBoolean)(process.env.APP_ENVIRONMENT === 'dev' || process.env.SENTRY_EXPOSE_ERROR_RESPONSE),
|
|
14
|
+
}, isListenLocalhost: (0, BooleanField_1.normalizeBoolean)(process.env.APP_LISTEN_LOCALHOST) })), module: (config) => (Object.assign(Object.assign({}, config_1.default.module(config)), { providers: [
|
|
10
15
|
{
|
|
11
16
|
provide: core_1.APP_FILTER,
|
|
12
17
|
useClass: ValidationExceptionFilter_1.ValidationExceptionFilter,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/infrastructure/applications/rest/config.ts"],"names":[],"mappings":";;AAAA,uCAAwC;AACxC,2CAAwC;AAExC,+FAA0F;AAC1F,sEAAiE;AACjE,gEAA2D;AAC3D,uFAAkF;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/infrastructure/applications/rest/config.ts"],"names":[],"mappings":";;AAAA,uCAAwC;AACxC,2CAAwC;AAExC,+FAA0F;AAC1F,sEAAiE;AACjE,gEAA2D;AAC3D,uFAAkF;AAClF,uEAAsE;AAEtE,kDACO,gBAAU,KACb,MAAM,EAAE,GAAyB,EAAE,CAAC,iCAC7B,gBAAU,CAAC,MAAM,EAAE,KACtB,MAAM,EAAE;YACJ,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;YAC/B,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe;YACxC,yBAAyB,EAAE,IAAA,+BAAgB,EAAC,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC;SACjI,EACD,iBAAiB,EAAE,IAAA,+BAAgB,EAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,IACvE,EACF,MAAM,EAAE,CAAC,MAA4B,EAAE,EAAE,CAAC,iCACnC,gBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,KAC5B,SAAS,EAAE;YACP;gBACI,OAAO,EAAE,iBAAU;gBACnB,QAAQ,EAAE,qDAAyB;aACtC;YACD;gBACI,OAAO,EAAE,iBAAU;gBACnB,QAAQ,EAAE,iEAA+B;aAC5C;YACD,MAAM,CAAC,eAAe,IAAI,iCAAe;SAC5C,CAAC,MAAM,CAAC,OAAO,CAAC,EACjB,WAAW,EAAE;YACT,MAAM,CAAC,eAAe,IAAI,uCAAkB;SAC/C,CAAC,MAAM,CAAC,OAAO,CAAC,IACnB,IACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEFAULT_DECIMAL_SCALE = 2;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../../../src/infrastructure/base/consts.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG,CAAC,CAAC"}
|
|
@@ -52,6 +52,13 @@ let MigrateCommand = class MigrateCommand {
|
|
|
52
52
|
async generate() {
|
|
53
53
|
await (0, generate_1.generate)(this.dataSource);
|
|
54
54
|
}
|
|
55
|
+
async generatePermissions(permissionTable, permissionColumn, permissionModule) {
|
|
56
|
+
await (0, generate_1.generateMigrationsForPermissions)(this.dataSource, {
|
|
57
|
+
table: permissionTable,
|
|
58
|
+
column: permissionColumn,
|
|
59
|
+
module: permissionModule,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
55
62
|
};
|
|
56
63
|
__decorate([
|
|
57
64
|
(0, nestjs_command_1.Command)({
|
|
@@ -110,6 +117,33 @@ __decorate([
|
|
|
110
117
|
__metadata("design:paramtypes", []),
|
|
111
118
|
__metadata("design:returntype", Promise)
|
|
112
119
|
], MigrateCommand.prototype, "generate", null);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, nestjs_command_1.Command)({
|
|
122
|
+
command: 'migrate:generate-permissions',
|
|
123
|
+
describe: 'Create migrations for permissions, it is used to synchronize the current list of permissions between the code and the database.',
|
|
124
|
+
}),
|
|
125
|
+
__param(0, (0, nestjs_command_1.Option)({
|
|
126
|
+
name: 'permissionTable',
|
|
127
|
+
describe: 'Table name for permissions',
|
|
128
|
+
type: 'string',
|
|
129
|
+
default: 'auth_permission',
|
|
130
|
+
})),
|
|
131
|
+
__param(1, (0, nestjs_command_1.Option)({
|
|
132
|
+
name: 'permissionColumn',
|
|
133
|
+
describe: 'Column name of permission',
|
|
134
|
+
type: 'string',
|
|
135
|
+
default: 'name',
|
|
136
|
+
})),
|
|
137
|
+
__param(2, (0, nestjs_command_1.Option)({
|
|
138
|
+
name: 'permissionModule',
|
|
139
|
+
describe: 'Module where write migrations of permissions',
|
|
140
|
+
type: 'string',
|
|
141
|
+
default: 'auth',
|
|
142
|
+
})),
|
|
143
|
+
__metadata("design:type", Function),
|
|
144
|
+
__metadata("design:paramtypes", [String, String, String]),
|
|
145
|
+
__metadata("design:returntype", Promise)
|
|
146
|
+
], MigrateCommand.prototype, "generatePermissions", null);
|
|
113
147
|
MigrateCommand = __decorate([
|
|
114
148
|
(0, common_1.Injectable)(),
|
|
115
149
|
__param(0, (0, common_1.Inject)(typeorm_1.DataSource)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrateCommand.js","sourceRoot":"","sources":["../../../src/infrastructure/commands/MigrateCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"MigrateCommand.js","sourceRoot":"","sources":["../../../src/infrastructure/commands/MigrateCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAA2D;AAC3D,2CAAkD;AAClD,gDAA2C;AAC3C,yCAAsE;AACtE,iDAAqF;AACrF,wGAAmG;AACnG,gEAA2D;AAC3D,iFAA4E;AAE5E,qDAAyB,CAAC,SAAS,CAAC,eAAe,GAAG,KAAK,WAAW,UAA+B;IACjG,MAAM,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,GAAG,mBAAQ,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAC7F,MAAM,mBAAmB,GAAG,CAAC,GAAG,gBAAgB,EAAE,GAAG,CAAC,MAAM,IAAA,2DAA4B,EAAC,IAAI,CAAC,UAAU,CAAC,MAAM,E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WAAA,IAAA,uBAAM,EAAC;QACJ,IAAI,EAAE,kBAAkB;QACxB,QAAQ,EAAE,8CAA8C;QACxD,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,MAAM;KAClB,CAAC,CAAA;;;;yDAQL;AAxGQ,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAGJ,WAAA,IAAA,eAAM,EAAC,oBAAU,CAAC,CAAA;qCACC,oBAAU;GAHzB,cAAc,CAyG1B;AAzGY,wCAAc"}
|
|
@@ -21,16 +21,16 @@ let EntityCodeGenerateCommand = class EntityCodeGenerateCommand {
|
|
|
21
21
|
* Example:
|
|
22
22
|
* yarn cli entity:generate entity module
|
|
23
23
|
*/
|
|
24
|
-
async index(entityName, moduleName) {
|
|
24
|
+
async index(entityName, moduleName, onlyReadService) {
|
|
25
25
|
if (!entityName || !moduleName) {
|
|
26
26
|
throw new Error('Required parameters are not provided');
|
|
27
27
|
}
|
|
28
|
-
(new EntityCodeGenerator_1.EntityCodeGenerator(entityName, moduleName)).generate();
|
|
28
|
+
(new EntityCodeGenerator_1.EntityCodeGenerator(entityName, moduleName, null, onlyReadService)).generate();
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
__decorate([
|
|
32
32
|
(0, nestjs_command_1.Command)({
|
|
33
|
-
command: 'entity:generate <entityName> <moduleName>',
|
|
33
|
+
command: 'entity:generate <entityName> <moduleName> [onlyReadService]',
|
|
34
34
|
describe: 'Generate code for entity (model, repository, dtos and so on...)',
|
|
35
35
|
}),
|
|
36
36
|
__param(0, (0, nestjs_command_1.Positional)({
|
|
@@ -43,8 +43,13 @@ __decorate([
|
|
|
43
43
|
describe: 'A module to put the code in',
|
|
44
44
|
type: 'string',
|
|
45
45
|
})),
|
|
46
|
+
__param(2, (0, nestjs_command_1.Positional)({
|
|
47
|
+
name: 'onlyReadService',
|
|
48
|
+
describe: 'Generate only read service entities',
|
|
49
|
+
type: 'boolean',
|
|
50
|
+
})),
|
|
46
51
|
__metadata("design:type", Function),
|
|
47
|
-
__metadata("design:paramtypes", [String, String]),
|
|
52
|
+
__metadata("design:paramtypes", [String, String, Boolean]),
|
|
48
53
|
__metadata("design:returntype", Promise)
|
|
49
54
|
], EntityCodeGenerateCommand.prototype, "index", null);
|
|
50
55
|
EntityCodeGenerateCommand = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityCodeGenerateCommand.js","sourceRoot":"","sources":["../../../../src/infrastructure/commands/entity-generator/EntityCodeGenerateCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAmD;AACnD,2CAA0C;AAC1C,+DAA0D;AAInD,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAClC;;;OAGG;IAKG,AAAN,KAAK,CAAC,KAAK,CAMH,UAAkB,EAMlB,UAAkB;
|
|
1
|
+
{"version":3,"file":"EntityCodeGenerateCommand.js","sourceRoot":"","sources":["../../../../src/infrastructure/commands/entity-generator/EntityCodeGenerateCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAmD;AACnD,2CAA0C;AAC1C,+DAA0D;AAInD,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAClC;;;OAGG;IAKG,AAAN,KAAK,CAAC,KAAK,CAMH,UAAkB,EAMlB,UAAkB,EAMtB,eAAyB;QAEzB,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;SAC3D;QAED,CAAC,IAAI,yCAAmB,CACpB,UAAU,EACV,UAAU,EACV,IAAI,EACJ,eAAe,CAClB,CAAC,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;CACJ,CAAA;AA/BS;IAJL,IAAA,wBAAO,EAAC;QACL,OAAO,EAAE,6DAA6D;QACtE,QAAQ,EAAE,iEAAiE;KAC9E,CAAC;IAEG,WAAA,IAAA,2BAAU,EAAC;QACR,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,8BAA8B;QACxC,IAAI,EAAE,QAAQ;KACjB,CAAC,CAAA;IAED,WAAA,IAAA,2BAAU,EAAC;QACR,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,6BAA6B;QACvC,IAAI,EAAE,QAAQ;KACjB,CAAC,CAAA;IAED,WAAA,IAAA,2BAAU,EAAC;QACR,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,qCAAqC;QAC/C,IAAI,EAAE,SAAS;KAClB,CAAC,CAAA;;;;sDAaL;AAvCQ,yBAAyB;IADrC,IAAA,mBAAU,GAAE;GACA,yBAAyB,CAwCrC;AAxCY,8DAAyB"}
|
|
@@ -4,9 +4,11 @@ export declare class EntityCodeGenerator {
|
|
|
4
4
|
readonly tableName: string;
|
|
5
5
|
readonly projectRootPath: string;
|
|
6
6
|
readonly modulePath: string;
|
|
7
|
+
readonly onlyReadService: boolean;
|
|
7
8
|
readonly placeholdersValuesMap: Record<string, string>;
|
|
8
|
-
constructor(entityName: string, moduleName: string, rootPath?: string);
|
|
9
|
+
constructor(entityName: string, moduleName: string, rootPath?: string, onlyReadService?: boolean);
|
|
9
10
|
generate(): void;
|
|
11
|
+
private shouldSkipTemplate;
|
|
10
12
|
private generateFileByType;
|
|
11
13
|
private findModulePath;
|
|
12
14
|
private getTableName;
|
|
@@ -11,7 +11,8 @@ const resultPaths = {
|
|
|
11
11
|
repository: 'infrastructure/repositories/%entityName%Repository.ts',
|
|
12
12
|
repositoryInterface: 'domain/interfaces/I%entityName%Repository.ts',
|
|
13
13
|
table: 'infrastructure/tables/%entityName%Table.ts',
|
|
14
|
-
|
|
14
|
+
crudService: 'domain/services/%entityName%Service.ts',
|
|
15
|
+
readService: 'domain/services/%entityName%Service.ts',
|
|
15
16
|
saveDto: 'domain/dtos/%entityName%SaveDto.ts',
|
|
16
17
|
searchDto: 'domain/dtos/%entityName%SearchDto.ts',
|
|
17
18
|
};
|
|
@@ -20,12 +21,13 @@ const templates = {
|
|
|
20
21
|
repository: 'RepositoryTemplate.txt',
|
|
21
22
|
repositoryInterface: 'RepositoryInterfaceTemplate.txt',
|
|
22
23
|
table: 'TableTemplate.txt',
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
readService: 'ReadServiceTemplate.txt',
|
|
25
|
+
crudService: 'CrudServiceTemplate.txt',
|
|
25
26
|
searchDto: 'SearchDtoTemplate.txt',
|
|
27
|
+
saveDto: 'SaveDtoTemplate.txt',
|
|
26
28
|
};
|
|
27
29
|
class EntityCodeGenerator {
|
|
28
|
-
constructor(entityName, moduleName, rootPath = null) {
|
|
30
|
+
constructor(entityName, moduleName, rootPath = null, onlyReadService = false) {
|
|
29
31
|
this.placeholdersValuesMap = {};
|
|
30
32
|
// set first letter in upper case if it's not
|
|
31
33
|
if (entityName[0].toUpperCase() !== entityName[0]) {
|
|
@@ -35,6 +37,7 @@ class EntityCodeGenerator {
|
|
|
35
37
|
this.entityName = entityName;
|
|
36
38
|
}
|
|
37
39
|
this.moduleName = moduleName;
|
|
40
|
+
this.onlyReadService = onlyReadService;
|
|
38
41
|
this.projectRootPath = rootPath || process.cwd();
|
|
39
42
|
this.modulePath = this.findModulePath(moduleName);
|
|
40
43
|
this.tableName = this.getTableName();
|
|
@@ -46,24 +49,39 @@ class EntityCodeGenerator {
|
|
|
46
49
|
generate() {
|
|
47
50
|
const allFileTypes = Object.keys(templates);
|
|
48
51
|
for (const fileType of allFileTypes) {
|
|
52
|
+
if (this.shouldSkipTemplate(fileType)) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
49
55
|
this.generateFileByType(fileType);
|
|
50
56
|
}
|
|
51
57
|
}
|
|
58
|
+
shouldSkipTemplate(fileType) {
|
|
59
|
+
const entitiesToSkipIfReadOnly = ['crudService', 'saveDto'];
|
|
60
|
+
const entitiesToSkipIfNotReadOnly = ['readService'];
|
|
61
|
+
if (this.onlyReadService) {
|
|
62
|
+
return entitiesToSkipIfReadOnly.includes(fileType);
|
|
63
|
+
}
|
|
64
|
+
return entitiesToSkipIfNotReadOnly.includes(fileType);
|
|
65
|
+
}
|
|
52
66
|
generateFileByType(fileType) {
|
|
53
67
|
const templatePath = path.resolve(__dirname, 'templates');
|
|
54
68
|
let resultFileContent = fs.readFileSync(path.resolve(templatePath, templates[fileType]), 'utf8');
|
|
55
69
|
for (const placeholder in this.placeholdersValuesMap) {
|
|
56
70
|
resultFileContent = resultFileContent.replace(new RegExp(`${(0, lodash_1.escapeRegExp)(placeholder)}`, 'g'), this.placeholdersValuesMap[placeholder]);
|
|
57
71
|
}
|
|
58
|
-
|
|
72
|
+
const resultFilePath = path.resolve(this.modulePath, resultPaths[fileType].replace(ENTITY_NAME_PLACEHOLDER, this.entityName));
|
|
59
73
|
const resultFileDirPath = path.dirname(resultFilePath);
|
|
60
74
|
if (!fs.existsSync(resultFileDirPath)) {
|
|
61
75
|
fs.mkdirSync(resultFileDirPath, { recursive: true });
|
|
62
76
|
}
|
|
77
|
+
if (fs.existsSync(resultFilePath)) {
|
|
78
|
+
console.log(`File ${resultFilePath} already exists, skipping to avoid overwriting.`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
63
81
|
fs.writeFileSync(resultFilePath, resultFileContent);
|
|
64
82
|
}
|
|
65
83
|
findModulePath(moduleName) {
|
|
66
|
-
|
|
84
|
+
const possibleModulePaths = [
|
|
67
85
|
path.resolve(this.projectRootPath, 'src', moduleName),
|
|
68
86
|
path.resolve(this.projectRootPath, moduleName),
|
|
69
87
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityCodeGenerator.js","sourceRoot":"","sources":["../../../../src/infrastructure/commands/entity-generator/EntityCodeGenerator.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,6BAA6B;AAC7B,mCAA+C;AAE/C,MAAM,uBAAuB,GAAG,cAAc,CAAC;AAC/C,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAE7C,MAAM,WAAW,GAAG;IAChB,KAAK,EAAE,oCAAoC;IAC3C,UAAU,EAAE,uDAAuD;IACnE,mBAAmB,EAAE,8CAA8C;IACnE,KAAK,EAAE,4CAA4C;IACnD,
|
|
1
|
+
{"version":3,"file":"EntityCodeGenerator.js","sourceRoot":"","sources":["../../../../src/infrastructure/commands/entity-generator/EntityCodeGenerator.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,6BAA6B;AAC7B,mCAA+C;AAE/C,MAAM,uBAAuB,GAAG,cAAc,CAAC;AAC/C,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAE7C,MAAM,WAAW,GAAG;IAChB,KAAK,EAAE,oCAAoC;IAC3C,UAAU,EAAE,uDAAuD;IACnE,mBAAmB,EAAE,8CAA8C;IACnE,KAAK,EAAE,4CAA4C;IACnD,WAAW,EAAE,wCAAwC;IACrD,WAAW,EAAE,wCAAwC;IACrD,OAAO,EAAE,oCAAoC;IAC7C,SAAS,EAAE,sCAAsC;CACpD,CAAC;AAEF,MAAM,SAAS,GAAG;IACd,KAAK,EAAE,mBAAmB;IAC1B,UAAU,EAAE,wBAAwB;IACpC,mBAAmB,EAAE,iCAAiC;IACtD,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,yBAAyB;IACtC,SAAS,EAAE,uBAAuB;IAClC,OAAO,EAAE,qBAAqB;CACjC,CAAC;AAEF,MAAa,mBAAmB;IAe5B,YACI,UAAkB,EAClB,UAAkB,EAClB,WAAmB,IAAI,EACvB,eAAe,GAAG,KAAK;QANlB,0BAAqB,GAA2B,EAAE,CAAC;QAQxD,6CAA6C;QAC7C,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE;YAC/C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC9E;aAAM;YACH,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;SACh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