@servicelabsco/nestjs-utility-services 1.0.149 → 1.0.150
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/app.module.js +0 -2
- package/dist/app.module.js.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/platformUtility/commands/entity.generator.command.d.ts +3 -4
- package/dist/platformUtility/commands/entity.generator.command.js +24 -20
- package/dist/platformUtility/commands/entity.generator.command.js.map +1 -1
- package/dist/platformUtility/commands/maintenance.command.js +9 -10
- package/dist/platformUtility/commands/maintenance.command.js.map +1 -1
- package/dist/platformUtility/commands/sqs.worker.command.d.ts +3 -1
- package/dist/platformUtility/commands/sqs.worker.command.js +12 -11
- package/dist/platformUtility/commands/sqs.worker.command.js.map +1 -1
- package/dist/platformUtility/commands/sync.class.command.d.ts +2 -4
- package/dist/platformUtility/commands/sync.class.command.js +17 -12
- package/dist/platformUtility/commands/sync.class.command.js.map +1 -1
- package/dist/platformUtility/es6.classes.d.ts +3 -3
- package/dist/platformUtility/platform.utility.module.js +1 -2
- package/dist/platformUtility/platform.utility.module.js.map +1 -1
- package/dist/system/commands/db.scanner.command.d.ts +3 -4
- package/dist/system/commands/db.scanner.command.js +16 -12
- package/dist/system/commands/db.scanner.command.js.map +1 -1
- package/dist/system/commands/event.queue.command.d.ts +4 -4
- package/dist/system/commands/event.queue.command.js +20 -16
- package/dist/system/commands/event.queue.command.js.map +1 -1
- package/dist/system/commands/index.d.ts +0 -1
- package/dist/system/commands/index.js +0 -1
- package/dist/system/commands/index.js.map +1 -1
- package/dist/system/commands/jobs.scanner.command.d.ts +3 -5
- package/dist/system/commands/jobs.scanner.command.js +16 -13
- package/dist/system/commands/jobs.scanner.command.js.map +1 -1
- package/dist/system/commands/model.scanner.command.d.ts +2 -4
- package/dist/system/commands/model.scanner.command.js +15 -12
- package/dist/system/commands/model.scanner.command.js.map +1 -1
- package/dist/system/commands/report.scanner.command.d.ts +2 -4
- package/dist/system/commands/report.scanner.command.js +15 -12
- package/dist/system/commands/report.scanner.command.js.map +1 -1
- package/dist/system/commands/service.scanner.command.d.ts +3 -4
- package/dist/system/commands/service.scanner.command.js +17 -13
- package/dist/system/commands/service.scanner.command.js.map +1 -1
- package/dist/system/es6.classes.d.ts +1 -2
- package/dist/system/es6.classes.js +1 -10
- package/dist/system/es6.classes.js.map +1 -1
- package/dist/system/system.module.js +1 -2
- package/dist/system/system.module.js.map +1 -1
- package/package.json +2 -4
package/dist/app.module.js
CHANGED
@@ -11,7 +11,6 @@ const bull_1 = require("@nestjs/bull");
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
12
12
|
const typeorm_1 = require("@nestjs/typeorm");
|
13
13
|
const nestjs_command_1 = require("nestjs-command");
|
14
|
-
const nestjs_console_1 = require("nestjs-console");
|
15
14
|
const app_controller_1 = require("./app.controller");
|
16
15
|
const app_service_1 = require("./app.service");
|
17
16
|
const auth_module_1 = require("./auth/auth.module");
|
@@ -43,7 +42,6 @@ AppModule = __decorate([
|
|
43
42
|
system_module_1.SystemModule,
|
44
43
|
security_module_1.SecurityModule,
|
45
44
|
common_module_1.CommonModule,
|
46
|
-
nestjs_console_1.ConsoleModule,
|
47
45
|
nestjs_command_1.CommandModule,
|
48
46
|
],
|
49
47
|
controllers: [app_controller_1.AppController],
|
package/dist/app.module.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAA0C;AAC1C,2CAA2E;AAC3E,6CAAgD;AAChD,mDAA+C;AAC/C,
|
1
|
+
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAA0C;AAC1C,2CAA2E;AAC3E,6CAAgD;AAChD,mDAA+C;AAC/C,qDAAiD;AACjD,+CAA2C;AAC3C,oDAAgD;AAChD,oFAA+E;AAC/E,sEA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
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
const app_module_1 = require("./app.module");
|
13
12
|
const core_1 = require("@nestjs/core");
|
14
13
|
const nestjs_command_1 = require("nestjs-command");
|
14
|
+
const app_module_1 = require("./app.module");
|
15
15
|
function bootstrap() {
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
17
17
|
const app = yield core_1.NestFactory.createApplicationContext(app_module_1.AppModule, {
|
18
|
-
logger: ['error'],
|
18
|
+
logger: ['log', 'warn', 'error'],
|
19
19
|
});
|
20
20
|
try {
|
21
21
|
yield app.select(nestjs_command_1.CommandModule).get(nestjs_command_1.CommandService).exec();
|
package/dist/cli.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAA2C;AAC3C,mDAA+D;AAC/D,6CAAyC;AAEzC,SAAe,SAAS;;QACpB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,wBAAwB,CAAC,sBAAS,EAAE;YAC9D,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC;SACnC,CAAC,CAAC;QAEH,IAAI;YACA,MAAM,GAAG,CAAC,MAAM,CAAC,8BAAa,CAAC,CAAC,GAAG,CAAC,+BAAc,CAAC,CAAC,IAAI,EAAE,CAAC;YAC3D,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;SACrB;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC5B,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACnB;IACL,CAAC;CAAA;AACD,SAAS,EAAE,CAAC"}
|
@@ -1,15 +1,14 @@
|
|
1
|
-
import { ConsoleService } from 'nestjs-console';
|
2
1
|
import { QueueService } from '../../platformUtility/services/queue.service';
|
3
2
|
import { SqlService } from './../services/sql.service';
|
4
3
|
export declare class EntityGeneratorCommand {
|
5
4
|
private readonly queueService;
|
6
|
-
private readonly consoleService;
|
7
5
|
private readonly sqlService;
|
6
|
+
private logger;
|
8
7
|
private modules;
|
9
8
|
private lastInput;
|
10
9
|
private columnMapping;
|
11
|
-
constructor(queueService: QueueService,
|
12
|
-
|
10
|
+
constructor(queueService: QueueService, sqlService: SqlService);
|
11
|
+
process(): Promise<void>;
|
13
12
|
createFile(tableName: string): Promise<number>;
|
14
13
|
createEntityFile(moduleName: string, fileName: string, className: string, tableName: string): Promise<void>;
|
15
14
|
getModuleOfTable(tableName: string): any;
|
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.EntityGeneratorCommand = void 0;
|
22
22
|
const common_1 = require("@nestjs/common");
|
23
23
|
const fs = require("fs");
|
24
|
-
const
|
24
|
+
const nestjs_command_1 = require("nestjs-command");
|
25
25
|
const platform_constants_1 = require("../../config/platform.constants");
|
26
26
|
const queue_service_1 = require("../../platformUtility/services/queue.service");
|
27
27
|
const file_system_utility_1 = require("../libraries/file.system.utility");
|
@@ -32,10 +32,10 @@ const model_entity_1 = require("./../../system/entities/model.entity");
|
|
32
32
|
const sql_service_1 = require("./../services/sql.service");
|
33
33
|
const prompt = require('prompt-sync')();
|
34
34
|
let EntityGeneratorCommand = class EntityGeneratorCommand {
|
35
|
-
constructor(queueService,
|
35
|
+
constructor(queueService, sqlService) {
|
36
36
|
this.queueService = queueService;
|
37
|
-
this.consoleService = consoleService;
|
38
37
|
this.sqlService = sqlService;
|
38
|
+
this.logger = new common_1.Logger('EventQueue');
|
39
39
|
this.modules = [];
|
40
40
|
this.columnMapping = {
|
41
41
|
1: 'string',
|
@@ -44,22 +44,19 @@ let EntityGeneratorCommand = class EntityGeneratorCommand {
|
|
44
44
|
4: 'date',
|
45
45
|
5: 'boolean',
|
46
46
|
};
|
47
|
-
|
47
|
+
}
|
48
|
+
process() {
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
48
50
|
yield this.queueService.pause();
|
49
|
-
|
50
|
-
yield new db_scanner_command_1.DbScannerCommand(this.queueService, this.
|
51
|
+
this.logger.log(`Checking for all db columns and files that is to be synced for entity`);
|
52
|
+
yield new db_scanner_command_1.DbScannerCommand(this.queueService, this.sqlService).process();
|
51
53
|
const tables = yield this.getEligibleTables();
|
52
|
-
|
54
|
+
this.logger.log(`Total no of tables to sync up for entity : ${tables.length}`);
|
53
55
|
yield this.getAllModules();
|
54
56
|
for (const tableName of tables) {
|
55
57
|
yield this.createFile(tableName);
|
56
58
|
}
|
57
59
|
});
|
58
|
-
const cli = this.consoleService.getCli();
|
59
|
-
this.consoleService.createCommand({
|
60
|
-
command: 'sync:entity',
|
61
|
-
description: 'sync all entities and their definitions defined within the system',
|
62
|
-
}, this.syncEntity, cli);
|
63
60
|
}
|
64
61
|
createFile(tableName) {
|
65
62
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -70,14 +67,14 @@ let EntityGeneratorCommand = class EntityGeneratorCommand {
|
|
70
67
|
return;
|
71
68
|
const fileName = this.getEntityNameConfirmation(tableName);
|
72
69
|
const className = this.getEntityClassName(fileName);
|
73
|
-
|
70
|
+
this.logger.warn(`TableName : ${tableName} | Module : ${this.modules[moduleIndex]} | file: ${fileName}.entity.ts | EntityName: ${className}Entity`);
|
74
71
|
const input = prompt('To confirm the above, press y or any other to redo : ', 'n');
|
75
72
|
if (input === 'e')
|
76
73
|
this.terminate();
|
77
74
|
if (input === 'y') {
|
78
75
|
this.lastInput = moduleIndex;
|
79
76
|
yield this.createEntityFile(this.modules[moduleIndex], fileName, className, tableName);
|
80
|
-
|
77
|
+
this.logger.log('-----------------------------------------------------------------');
|
81
78
|
return moduleIndex;
|
82
79
|
}
|
83
80
|
}
|
@@ -108,7 +105,7 @@ let EntityGeneratorCommand = class EntityGeneratorCommand {
|
|
108
105
|
fs.mkdirSync(entityDirectory);
|
109
106
|
const file = `${entityDirectory}/${fileName}.entity.ts`;
|
110
107
|
fs.writeFileSync(file, data);
|
111
|
-
|
108
|
+
this.logger.log(`created file : ${file}`);
|
112
109
|
});
|
113
110
|
}
|
114
111
|
getModuleOfTable(tableName) {
|
@@ -183,8 +180,8 @@ let EntityGeneratorCommand = class EntityGeneratorCommand {
|
|
183
180
|
for (const [key, value] of Object.entries(this.modules)) {
|
184
181
|
text = `${text} ${key}:${value} `;
|
185
182
|
}
|
186
|
-
|
187
|
-
|
183
|
+
this.logger.log('Type e to exit, n to skip this table or type the number to match the module');
|
184
|
+
this.logger.log('modules: ', text);
|
188
185
|
});
|
189
186
|
}
|
190
187
|
getEntityClassName(fileName) {
|
@@ -214,11 +211,18 @@ let EntityGeneratorCommand = class EntityGeneratorCommand {
|
|
214
211
|
process.exit(1);
|
215
212
|
}
|
216
213
|
};
|
214
|
+
__decorate([
|
215
|
+
(0, nestjs_command_1.Command)({
|
216
|
+
command: 'sync:entity',
|
217
|
+
describe: 'sync all entities and their definitions defined within the system',
|
218
|
+
}),
|
219
|
+
__metadata("design:type", Function),
|
220
|
+
__metadata("design:paramtypes", []),
|
221
|
+
__metadata("design:returntype", Promise)
|
222
|
+
], EntityGeneratorCommand.prototype, "process", null);
|
217
223
|
EntityGeneratorCommand = __decorate([
|
218
224
|
(0, common_1.Injectable)(),
|
219
|
-
__metadata("design:paramtypes", [queue_service_1.QueueService,
|
220
|
-
nestjs_console_1.ConsoleService,
|
221
|
-
sql_service_1.SqlService])
|
225
|
+
__metadata("design:paramtypes", [queue_service_1.QueueService, sql_service_1.SqlService])
|
222
226
|
], EntityGeneratorCommand);
|
223
227
|
exports.EntityGeneratorCommand = EntityGeneratorCommand;
|
224
228
|
//# sourceMappingURL=entity.generator.command.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"entity.generator.command.js","sourceRoot":"","sources":["../../../src/platformUtility/commands/entity.generator.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,
|
1
|
+
{"version":3,"file":"entity.generator.command.js","sourceRoot":"","sources":["../../../src/platformUtility/commands/entity.generator.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,yBAAyB;AACzB,mDAAyC;AACzC,wEAAgE;AAChE,gFAA4E;AAC5E,0EAAqE;AACrE,uFAAmF;AACnF,gFAA4E;AAC5E,mFAA8E;AAC9E,uEAAmE;AACnE,2DAAuD;AAGvD,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;AASxC,IAAa,sBAAsB,GAAnC,MAAa,sBAAsB;IA0C/B,YAA6B,YAA0B,EAAmB,UAAsB;QAAnE,iBAAY,GAAZ,YAAY,CAAc;QAAmB,eAAU,GAAV,UAAU,CAAY;QAnCxF,WAAM,GAAW,IAAI,eAAM,CAAC,YAAY,CAAC,CAAC;QAO1C,YAAO,GAAG,EAAE,CAAC;QAeb,kBAAa,GAAG;YACpB,CAAC,EAAE,QAAQ;YACX,CAAC,EAAE,QAAQ;YACX,CAAC,EAAE,MAAM;YACT,CAAC,EAAE,MAAM;YACT,CAAC,EAAE,SAAS;SACf,CAAC;IAOiG,CAAC;IAU9F,OAAO;;YACT,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;YAEhC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uEAAuE,CAAC,CAAC;YACzF,MAAM,IAAI,qCAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;YAGzE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC9C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,8CAA8C,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;YAG/E,MAAM,IAA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,IAAI,IAAI,GAAG,EAAE,CAAC;YAGd,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBAC7B,IAAI,4BAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBAAE,OAAO;gBAErE,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC;gBAEzD,IAAI,GAAG,GAAG,IAAI,cAAc,MAAM,CAAC,IAAI,MAAM,IAAI,GAAG,CAAC;YACzD,CAAC,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;IAMD,SAAS;QACL,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;CACJ,CAAA;AA5RG;IARC,IAAA,wBAAO,EAAC;QACL,OAAO,EAAE,aAAa;QACtB,QAAQ,EAAE,mEAAmE;KAChF,CAAC;;;;qDAsBD;AArEQ,sBAAsB;IADlC,IAAA,mBAAU,GAAE;qCA2CkC,4BAAY,EAA+B,wBAAU;GA1CvF,sBAAsB,CAgVlC;AAhVY,wDAAsB"}
|
@@ -20,10 +20,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
21
21
|
exports.MaintenanceCommand = void 0;
|
22
22
|
const common_1 = require("@nestjs/common");
|
23
|
-
const nestjs_console_1 = require("nestjs-console");
|
24
23
|
const maintenance_service_1 = require("../services/maintenance.service");
|
25
24
|
const shutdown_service_1 = require("../services/shutdown.service");
|
26
25
|
const queue_service_1 = require("../services/queue.service");
|
26
|
+
const nestjs_command_1 = require("nestjs-command");
|
27
27
|
let MaintenanceCommand = class MaintenanceCommand {
|
28
28
|
constructor(maintenanceService, shutdownService, queueService) {
|
29
29
|
this.maintenanceService = maintenanceService;
|
@@ -59,36 +59,36 @@ let MaintenanceCommand = class MaintenanceCommand {
|
|
59
59
|
}
|
60
60
|
};
|
61
61
|
__decorate([
|
62
|
-
(0,
|
62
|
+
(0, nestjs_command_1.Command)({
|
63
63
|
command: 'up',
|
64
|
-
|
64
|
+
describe: 'bring up the system',
|
65
65
|
}),
|
66
66
|
__metadata("design:type", Function),
|
67
67
|
__metadata("design:paramtypes", []),
|
68
68
|
__metadata("design:returntype", Promise)
|
69
69
|
], MaintenanceCommand.prototype, "up", null);
|
70
70
|
__decorate([
|
71
|
-
(0,
|
71
|
+
(0, nestjs_command_1.Command)({
|
72
72
|
command: 'down',
|
73
|
-
|
73
|
+
describe: 'bring down the system',
|
74
74
|
}),
|
75
75
|
__metadata("design:type", Function),
|
76
76
|
__metadata("design:paramtypes", []),
|
77
77
|
__metadata("design:returntype", Promise)
|
78
78
|
], MaintenanceCommand.prototype, "down", null);
|
79
79
|
__decorate([
|
80
|
-
(0,
|
80
|
+
(0, nestjs_command_1.Command)({
|
81
81
|
command: 'status',
|
82
|
-
|
82
|
+
describe: 'status of the system',
|
83
83
|
}),
|
84
84
|
__metadata("design:type", Function),
|
85
85
|
__metadata("design:paramtypes", []),
|
86
86
|
__metadata("design:returntype", Promise)
|
87
87
|
], MaintenanceCommand.prototype, "status", null);
|
88
88
|
__decorate([
|
89
|
-
(0,
|
89
|
+
(0, nestjs_command_1.Command)({
|
90
90
|
command: 'queue:restart',
|
91
|
-
|
91
|
+
describe: 'restart the system',
|
92
92
|
}),
|
93
93
|
__metadata("design:type", Function),
|
94
94
|
__metadata("design:paramtypes", []),
|
@@ -96,7 +96,6 @@ __decorate([
|
|
96
96
|
], MaintenanceCommand.prototype, "restart", null);
|
97
97
|
MaintenanceCommand = __decorate([
|
98
98
|
(0, common_1.Injectable)(),
|
99
|
-
(0, nestjs_console_1.Console)(),
|
100
99
|
__metadata("design:paramtypes", [maintenance_service_1.MaintenanceService,
|
101
100
|
shutdown_service_1.ShutdownService,
|
102
101
|
queue_service_1.QueueService])
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"maintenance.command.js","sourceRoot":"","sources":["../../../src/platformUtility/commands/maintenance.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,
|
1
|
+
{"version":3,"file":"maintenance.command.js","sourceRoot":"","sources":["../../../src/platformUtility/commands/maintenance.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yEAAqE;AACrE,mEAA+D;AAC/D,6DAAyD;AACzD,mDAAyC;AAQzC,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IAM3B,YACqB,kBAAsC,EACtC,eAAgC,EAChC,YAA0B;QAF1B,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,oBAAe,GAAf,eAAe,CAAiB;QAChC,iBAAY,GAAZ,YAAY,CAAc;IAC5C,CAAC;IAWE,EAAE;;YACJ,IAAI,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,CAAC;YAChD,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAC3C,CAAC;KAAA;IAWK,IAAI;;YACN,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,CAAC;YAC3C,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QAC5D,CAAC;KAAA;IAWK,MAAM;;YACR,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,CAAC;YACzD,IAAI,MAAM;gBAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;;gBACxD,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC9C,CAAC;KAAA;IAWK,OAAO;;YACT,MAAM,IAAI,CAAC,YAAY,CAAC,sBAAsB,EAAE,CAAC;YACjD,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC;QACpC,CAAC;KAAA;CACJ,CAAA;AA/CG;IAJC,IAAA,wBAAO,EAAC;QACL,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,qBAAqB;KAClC,CAAC;;;;4CAID;AAWD;IAJC,IAAA,wBAAO,EAAC;QACL,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,uBAAuB;KACpC,CAAC;;;;8CAID;AAWD;IAJC,IAAA,wBAAO,EAAC;QACL,OAAO,EAAE,QAAQ;QACjB,QAAQ,EAAE,sBAAsB;KACnC,CAAC;;;;gDAKD;AAWD;IAJC,IAAA,wBAAO,EAAC;QACL,OAAO,EAAE,eAAe;QACxB,QAAQ,EAAE,oBAAoB;KACjC,CAAC;;;;iDAID;AAnEQ,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;qCAQgC,wCAAkB;QACrB,kCAAe;QAClB,4BAAY;GATtC,kBAAkB,CAoE9B;AApEY,gDAAkB"}
|
@@ -3,8 +3,10 @@ export declare class SqsWorkerCommand {
|
|
3
3
|
private readonly queueService;
|
4
4
|
private counter;
|
5
5
|
private start_time;
|
6
|
+
private sTime;
|
7
|
+
private logger;
|
6
8
|
constructor(queueService: QueueService);
|
7
|
-
|
9
|
+
process(): Promise<void>;
|
8
10
|
private processMessage;
|
9
11
|
private dropMessage;
|
10
12
|
private fetchMessages;
|
@@ -31,12 +31,13 @@ let SqsWorkerCommand = class SqsWorkerCommand {
|
|
31
31
|
this.queueService = queueService;
|
32
32
|
this.counter = 0;
|
33
33
|
this.start_time = date_util_1.DateUtil.getDateTimeInFormat();
|
34
|
+
this.sTime = date_util_1.DateUtil.now();
|
35
|
+
this.logger = new common_1.Logger('SqsWorker');
|
34
36
|
}
|
35
|
-
|
37
|
+
process() {
|
36
38
|
return __awaiter(this, void 0, void 0, function* () {
|
37
|
-
|
39
|
+
yield this.queueService.pause();
|
38
40
|
while (true) {
|
39
|
-
yield this.queueService.pause();
|
40
41
|
yield this.checkForSystem();
|
41
42
|
let record;
|
42
43
|
try {
|
@@ -50,7 +51,7 @@ let SqsWorkerCommand = class SqsWorkerCommand {
|
|
50
51
|
if ((record === null || record === void 0 ? void 0 : record.Messages) && Array.isArray(record.Messages)) {
|
51
52
|
yield this.processMessages(record.Messages);
|
52
53
|
}
|
53
|
-
|
54
|
+
this.logger.log(`[sqs.fifo] [events] [${this.start_time}] events-processed : ${this.counter} ${((Date.now() - this.sTime) / 1000).toFixed(0)}s`);
|
54
55
|
}
|
55
56
|
});
|
56
57
|
}
|
@@ -58,17 +59,17 @@ let SqsWorkerCommand = class SqsWorkerCommand {
|
|
58
59
|
return __awaiter(this, void 0, void 0, function* () {
|
59
60
|
++this.counter;
|
60
61
|
const data = JSON.parse(message.Body);
|
61
|
-
|
62
|
+
this.logger.log(`[sqs.fifo][ Processing] ${message.MessageId} : ${data.name} `);
|
62
63
|
const startTime = date_util_1.DateUtil.now();
|
63
64
|
try {
|
64
65
|
yield platform_constants_1.default.jobs[data.job].handle(data.payload);
|
65
66
|
const timeTaken = date_util_1.DateUtil.now() - startTime;
|
66
|
-
|
67
|
+
this.logger.log(`[sqs.fifo][ Processed] ${message.MessageId} : ${data.name} ${timeTaken} ms`);
|
67
68
|
}
|
68
69
|
catch (error) {
|
69
|
-
|
70
|
-
|
71
|
-
|
70
|
+
this.logger.log(`[sqs.fifo][ failure] ${message.MessageId} : ${data.name} `);
|
71
|
+
this.logger.log('failed-job', data);
|
72
|
+
this.logger.log('error', error);
|
72
73
|
}
|
73
74
|
finally {
|
74
75
|
this.dropMessage(message.ReceiptHandle);
|
@@ -103,12 +104,12 @@ let SqsWorkerCommand = class SqsWorkerCommand {
|
|
103
104
|
__decorate([
|
104
105
|
(0, nestjs_command_1.Command)({
|
105
106
|
command: 'queue:sqs',
|
106
|
-
describe: '
|
107
|
+
describe: 'run worker through sqs',
|
107
108
|
}),
|
108
109
|
__metadata("design:type", Function),
|
109
110
|
__metadata("design:paramtypes", []),
|
110
111
|
__metadata("design:returntype", Promise)
|
111
|
-
], SqsWorkerCommand.prototype, "
|
112
|
+
], SqsWorkerCommand.prototype, "process", null);
|
112
113
|
SqsWorkerCommand = __decorate([
|
113
114
|
(0, common_1.Injectable)(),
|
114
115
|
__metadata("design:paramtypes", [queue_service_1.QueueService])
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sqs.worker.command.js","sourceRoot":"","sources":["../../../src/platformUtility/commands/sqs.worker.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,
|
1
|
+
{"version":3,"file":"sqs.worker.command.js","sourceRoot":"","sources":["../../../src/platformUtility/commands/sqs.worker.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,iCAAiC;AACjC,mDAAyC;AACzC,wEAAgE;AAChE,gFAA4E;AAC5E,kEAA8D;AAE9D,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAQxC,IAAa,gBAAgB,GAA7B,MAAa,gBAAgB;IAkBzB,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;QAjB/C,YAAO,GAAG,CAAC,CAAC;QACZ,eAAU,GAAG,oBAAQ,CAAC,mBAAmB,EAAE,CAAC;QAC5C,UAAK,GAAG,oBAAQ,CAAC,GAAG,EAAE,CAAC;QAQvB,WAAM,GAAW,IAAI,eAAM,CAAC,WAAW,CAAC,CAAC;IAOS,CAAC;IAMrD,OAAO;;YACT,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;YAChC,OAAO,IAAI,EAAE;gBACT,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;gBAE5B,IAAI,MAAM,CAAC;gBAEX,IAAI;oBACA,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;iBACvC;gBAAC,OAAO,KAAK,EAAE;oBACZ,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;iBACtC;gBAED,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN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from '../../platformUtility/services/queue.service';
|
3
2
|
export declare class SyncClassCommand {
|
4
3
|
private readonly queueService;
|
5
|
-
|
6
|
-
|
7
|
-
syncClass: () => Promise<void>;
|
4
|
+
constructor(queueService: QueueService);
|
5
|
+
process(): Promise<void>;
|
8
6
|
}
|
@@ -19,20 +19,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
19
19
|
};
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
21
21
|
exports.SyncClassCommand = void 0;
|
22
|
-
const file_system_utility_1 = require("./../libraries/file.system.utility");
|
23
|
-
const create_index_file_1 = require("./../libraries/create.index.file");
|
24
22
|
const common_1 = require("@nestjs/common");
|
25
|
-
const
|
23
|
+
const nestjs_command_1 = require("nestjs-command");
|
26
24
|
const queue_service_1 = require("../../platformUtility/services/queue.service");
|
27
25
|
const libraries_1 = require("../libraries");
|
28
26
|
const create_es6_jobs_file_1 = require("../libraries/create.es6.jobs.file");
|
29
27
|
const create_entity_constants_file_1 = require("./../libraries/create.entity.constants.file");
|
30
28
|
const create_es6_service_file_1 = require("./../libraries/create.es6.service.file");
|
29
|
+
const create_index_file_1 = require("./../libraries/create.index.file");
|
30
|
+
const file_system_utility_1 = require("./../libraries/file.system.utility");
|
31
31
|
let SyncClassCommand = class SyncClassCommand {
|
32
|
-
constructor(queueService
|
32
|
+
constructor(queueService) {
|
33
33
|
this.queueService = queueService;
|
34
|
-
|
35
|
-
|
34
|
+
}
|
35
|
+
process() {
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
36
37
|
yield this.queueService.pause();
|
37
38
|
global.console.log('processing all jobs file');
|
38
39
|
new create_es6_jobs_file_1.CreateEs6JobsFile().process();
|
@@ -47,16 +48,20 @@ let SyncClassCommand = class SyncClassCommand {
|
|
47
48
|
new create_index_file_1.CreateIndexFile().process();
|
48
49
|
}
|
49
50
|
});
|
50
|
-
const cli = this.consoleService.getCli();
|
51
|
-
this.consoleService.createCommand({
|
52
|
-
command: 'sync:class',
|
53
|
-
description: 'sync all entities and their definitions defined within the system',
|
54
|
-
}, this.syncClass, cli);
|
55
51
|
}
|
56
52
|
};
|
53
|
+
__decorate([
|
54
|
+
(0, nestjs_command_1.Command)({
|
55
|
+
command: 'sync:class',
|
56
|
+
describe: 'sync all class from code to db',
|
57
|
+
}),
|
58
|
+
__metadata("design:type", Function),
|
59
|
+
__metadata("design:paramtypes", []),
|
60
|
+
__metadata("design:returntype", Promise)
|
61
|
+
], SyncClassCommand.prototype, "process", null);
|
57
62
|
SyncClassCommand = __decorate([
|
58
63
|
(0, common_1.Injectable)(),
|
59
|
-
__metadata("design:paramtypes", [queue_service_1.QueueService
|
64
|
+
__metadata("design:paramtypes", [queue_service_1.QueueService])
|
60
65
|
], SyncClassCommand);
|
61
66
|
exports.SyncClassCommand = SyncClassCommand;
|
62
67
|
//# sourceMappingURL=sync.class.command.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sync.class.command.js","sourceRoot":"","sources":["../../../src/platformUtility/commands/sync.class.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,
|
1
|
+
{"version":3,"file":"sync.class.command.js","sourceRoot":"","sources":["../../../src/platformUtility/commands/sync.class.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,mDAAyC;AACzC,gFAA4E;AAC5E,4CAAoD;AACpD,4EAAsE;AACtE,8FAAwF;AACxF,oFAA8E;AAC9E,wEAAmE;AACnE,4EAAuE;AAQvE,IAAa,gBAAgB,GAA7B,MAAa,gBAAgB;IAMzB,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAMrD,OAAO;;YACT,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;YAEhC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;YAC/C,IAAI,wCAAiB,EAAE,CAAC,OAAO,EAAE,CAAC;YAElC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;YACnD,IAAI,8CAAoB,EAAE,CAAC,OAAO,EAAE,CAAC;YAErC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;YACjD,IAAI,wDAAyB,EAAE,CAAC,OAAO,EAAE,CAAC;YAE1C,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;YAChD,IAAI,gCAAoB,EAAE,CAAC,OAAO,EAAE,CAAC;YAErC,IAAI,uCAAiB,CAAC,SAAS,EAAE,EAAE;gBAC/B,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;gBACjD,IAAI,mCAAe,EAAE,CAAC,OAAO,EAAE,CAAC;aACnC;QACL,CAAC;KAAA;CACJ,CAAA;AApBG;IAJC,IAAA,wBAAO,EAAC;QACL,OAAO,EAAE,YAAY;QACrB,QAAQ,EAAE,gCAAgC;KAC7C,CAAC;;;;+CAoBD;AA/BQ,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAOkC,4BAAY;GAN9C,gBAAgB,CAgC5B;AAhCY,4CAAgB"}
|
@@ -37,11 +37,11 @@ import { BaseSubscriber } from './subscribers/base.subscriber';
|
|
37
37
|
declare const es6Classes: {
|
38
38
|
commands: (typeof EntityGeneratorCommand | typeof MaintenanceCommand | typeof SqsWorkerCommand | typeof SyncClassCommand)[];
|
39
39
|
consumers: (typeof EventConsumer | typeof JobConsumer)[];
|
40
|
-
dtos: (typeof QueueOptionsDto | typeof
|
40
|
+
dtos: (typeof QueueOptionsDto | typeof FcmResponseDto | typeof PushNotificationResponseDto | typeof PushNotificationTemplateDto | typeof MailOptionsDto)[];
|
41
41
|
jobs: (typeof TestJob | typeof RecordWatcherJob)[];
|
42
|
-
libraries: (typeof FileSystemUtility | typeof
|
42
|
+
libraries: (typeof FileSystemUtility | typeof CreateEntityConstantsFile | typeof CreateEs6ClassesFile | typeof CreateEs6JobsFile | typeof CreateEs6ServiceFile | typeof CreateIndexFile)[];
|
43
43
|
middlewares: (typeof MaintenanceMiddleware)[];
|
44
|
-
services: (typeof CacheService | typeof LocalPropertyService | typeof MaintenanceService | typeof ShutdownService | typeof SqsService | typeof QueueService | typeof RemoteRequestService | typeof SqlService | typeof DynamoService | typeof
|
44
|
+
services: (typeof CacheService | typeof LocalPropertyService | typeof MaintenanceService | typeof ShutdownService | typeof SqsService | typeof QueueService | typeof RemoteRequestService | typeof SqlService | typeof DynamoService | typeof AuditService | typeof FcmNotificationService | typeof MailService | typeof StartupService | typeof Es6JobsService | typeof Es6Service)[];
|
45
45
|
subscribers: (typeof BaseSubscriber)[];
|
46
46
|
};
|
47
47
|
export default es6Classes;
|
@@ -10,7 +10,6 @@ exports.PlatformUtilityModule = void 0;
|
|
10
10
|
const bull_1 = require("@nestjs/bull");
|
11
11
|
const common_1 = require("@nestjs/common");
|
12
12
|
const config = require("config");
|
13
|
-
const nestjs_console_1 = require("nestjs-console");
|
14
13
|
const es6_classes_1 = require("./es6.classes");
|
15
14
|
const cacheConfig = require("../config/cache.config");
|
16
15
|
const name = process.env.QUEUE_NAME || config.get('queue.name');
|
@@ -18,7 +17,7 @@ let PlatformUtilityModule = class PlatformUtilityModule {
|
|
18
17
|
};
|
19
18
|
PlatformUtilityModule = __decorate([
|
20
19
|
(0, common_1.Module)({
|
21
|
-
imports: [bull_1.BullModule.registerQueue({ name }),
|
20
|
+
imports: [bull_1.BullModule.registerQueue({ name }), common_1.CacheModule.register(cacheConfig)],
|
22
21
|
providers: [...es6_classes_1.default.services, ...es6_classes_1.default.consumers, ...es6_classes_1.default.subscribers, ...es6_classes_1.default.commands, ...es6_classes_1.default.jobs],
|
23
22
|
exports: [...es6_classes_1.default.services],
|
24
23
|
})
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"platform.utility.module.js","sourceRoot":"","sources":["../../src/platformUtility/platform.utility.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAA0C;AAC1C,2CAAqD;AACrD,iCAAiC;AACjC
|
1
|
+
{"version":3,"file":"platform.utility.module.js","sourceRoot":"","sources":["../../src/platformUtility/platform.utility.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAA0C;AAC1C,2CAAqD;AACrD,iCAAiC;AACjC,+CAAuC;AACvC,sDAAuD;AAEvD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAOhE,IAAa,qBAAqB,GAAlC,MAAa,qBAAqB;CAAG,CAAA;AAAxB,qBAAqB;IALjC,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE,CAAC,iBAAU,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,oBAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAChF,SAAS,EAAE,CAAC,GAAG,qBAAU,CAAC,QAAQ,EAAE,GAAG,qBAAU,CAAC,SAAS,EAAE,GAAG,qBAAU,CAAC,WAAW,EAAE,GAAG,qBAAU,CAAC,QAAQ,EAAE,GAAG,qBAAU,CAAC,IAAI,CAAC;QACnI,OAAO,EAAE,CAAC,GAAG,qBAAU,CAAC,QAAQ,CAAC;KACpC,CAAC;GACW,qBAAqB,CAAG;AAAxB,sDAAqB"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { ConsoleService } from 'nestjs-console';
|
2
1
|
import { QueueService } from '../../platformUtility/services/queue.service';
|
3
2
|
import { SqlService } from './../../platformUtility/services/sql.service';
|
4
3
|
import { ColumnEntity } from './../entities/column.entity';
|
@@ -6,11 +5,11 @@ import { ModelEntity } from './../entities/model.entity';
|
|
6
5
|
import { RelationshipEntity } from './../entities/relationship.entity';
|
7
6
|
export declare class DbScannerCommand {
|
8
7
|
private readonly queueService;
|
9
|
-
private readonly consoleService;
|
10
8
|
private readonly sqlService;
|
9
|
+
private logger;
|
11
10
|
private columnDefinitionMapping;
|
12
|
-
constructor(queueService: QueueService,
|
13
|
-
|
11
|
+
constructor(queueService: QueueService, sqlService: SqlService);
|
12
|
+
process(): Promise<void>;
|
14
13
|
setAllTables(): Promise<ModelEntity[]>;
|
15
14
|
setModel(table: any): Promise<ModelEntity>;
|
16
15
|
setModelsColumn(models: ModelEntity[]): Promise<ColumnEntity[]>;
|
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.DbScannerCommand = void 0;
|
22
22
|
const common_1 = require("@nestjs/common");
|
23
23
|
const class_transformer_1 = require("class-transformer");
|
24
|
-
const
|
24
|
+
const nestjs_command_1 = require("nestjs-command");
|
25
25
|
const common_2 = require("../../common");
|
26
26
|
const queue_service_1 = require("../../platformUtility/services/queue.service");
|
27
27
|
const platform_utility_1 = require("./../../common/libraries/platform.utility");
|
@@ -32,12 +32,14 @@ const model_entity_1 = require("./../entities/model.entity");
|
|
32
32
|
const relationship_entity_1 = require("./../entities/relationship.entity");
|
33
33
|
const SOURCEHASH = require("../../config/source.hash");
|
34
34
|
let DbScannerCommand = class DbScannerCommand {
|
35
|
-
constructor(queueService,
|
35
|
+
constructor(queueService, sqlService) {
|
36
36
|
this.queueService = queueService;
|
37
|
-
this.consoleService = consoleService;
|
38
37
|
this.sqlService = sqlService;
|
38
|
+
this.logger = new common_1.Logger('SqsWorker');
|
39
39
|
this.columnDefinitionMapping = {};
|
40
|
-
|
40
|
+
}
|
41
|
+
process() {
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
41
43
|
yield this.queueService.pause();
|
42
44
|
yield this.loadDBColumnMapping();
|
43
45
|
yield this.setUserTable();
|
@@ -45,11 +47,6 @@ let DbScannerCommand = class DbScannerCommand {
|
|
45
47
|
yield this.setModelsColumn(models);
|
46
48
|
yield this.setModelsRelationship(models);
|
47
49
|
});
|
48
|
-
const cli = this.consoleService.getCli();
|
49
|
-
this.consoleService.createCommand({
|
50
|
-
command: 'sync:db',
|
51
|
-
description: 'sync all elements of db to the system',
|
52
|
-
}, this.syncDB, cli);
|
53
50
|
}
|
54
51
|
setAllTables() {
|
55
52
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -290,11 +287,18 @@ let DbScannerCommand = class DbScannerCommand {
|
|
290
287
|
return str;
|
291
288
|
}
|
292
289
|
};
|
290
|
+
__decorate([
|
291
|
+
(0, nestjs_command_1.Command)({
|
292
|
+
command: 'sync:db',
|
293
|
+
describe: 'sync all elements of db to the system',
|
294
|
+
}),
|
295
|
+
__metadata("design:type", Function),
|
296
|
+
__metadata("design:paramtypes", []),
|
297
|
+
__metadata("design:returntype", Promise)
|
298
|
+
], DbScannerCommand.prototype, "process", null);
|
293
299
|
DbScannerCommand = __decorate([
|
294
300
|
(0, common_1.Injectable)(),
|
295
|
-
__metadata("design:paramtypes", [queue_service_1.QueueService,
|
296
|
-
nestjs_console_1.ConsoleService,
|
297
|
-
sql_service_1.SqlService])
|
301
|
+
__metadata("design:paramtypes", [queue_service_1.QueueService, sql_service_1.SqlService])
|
298
302
|
], DbScannerCommand);
|
299
303
|
exports.DbScannerCommand = DbScannerCommand;
|
300
304
|
//# sourceMappingURL=db.scanner.command.js.map
|