@servicelabsco/nestjs-utility-services 1.0.146 → 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.controller.d.ts +1 -1
- package/dist/app.controller.js +3 -1
- package/dist/app.controller.js.map +1 -1
- package/dist/app.module.js +2 -2
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +32 -0
- package/dist/cli.js.map +1 -0
- package/dist/common/libraries/common.job.d.ts +1 -0
- package/dist/common/libraries/common.job.js +17 -2
- package/dist/common/libraries/common.job.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/index.d.ts +1 -0
- package/dist/platformUtility/commands/index.js +1 -0
- package/dist/platformUtility/commands/index.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 +15 -0
- package/dist/platformUtility/commands/sqs.worker.command.js +118 -0
- package/dist/platformUtility/commands/sqs.worker.command.js.map +1 -0
- 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 +8 -5
- package/dist/platformUtility/es6.classes.js +6 -2
- package/dist/platformUtility/es6.classes.js.map +1 -1
- package/dist/platformUtility/jobs/index.d.ts +1 -0
- package/dist/platformUtility/jobs/index.js +1 -0
- package/dist/platformUtility/jobs/index.js.map +1 -1
- package/dist/platformUtility/jobs/test.job.d.ts +8 -0
- package/dist/platformUtility/jobs/test.job.js +42 -0
- package/dist/platformUtility/jobs/test.job.js.map +1 -0
- package/dist/platformUtility/platform.utility.module.js +1 -2
- package/dist/platformUtility/platform.utility.module.js.map +1 -1
- package/dist/platformUtility/services/dynamo.service.js +4 -4
- package/dist/platformUtility/services/dynamo.service.js.map +1 -1
- package/dist/platformUtility/services/es6.jobs.service.d.ts +3 -1
- package/dist/platformUtility/services/es6.jobs.service.js +7 -2
- package/dist/platformUtility/services/es6.jobs.service.js.map +1 -1
- package/dist/platformUtility/services/index.d.ts +1 -0
- package/dist/platformUtility/services/index.js +1 -0
- package/dist/platformUtility/services/index.js.map +1 -1
- package/dist/platformUtility/services/queue.service.d.ts +7 -4
- package/dist/platformUtility/services/queue.service.js +23 -10
- package/dist/platformUtility/services/queue.service.js.map +1 -1
- package/dist/platformUtility/services/sqs.service.d.ts +8 -0
- package/dist/platformUtility/services/sqs.service.js +86 -0
- package/dist/platformUtility/services/sqs.service.js.map +1 -0
- 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 +5 -5
package/dist/app.controller.d.ts
CHANGED
package/dist/app.controller.js
CHANGED
@@ -39,7 +39,9 @@ let AppController = class AppController {
|
|
39
39
|
});
|
40
40
|
}
|
41
41
|
set() {
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
43
|
+
return this.queueService.addJob('b20ed62e97fbef22a56c84c4908996a6', 123);
|
44
|
+
});
|
43
45
|
}
|
44
46
|
};
|
45
47
|
__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAAiD;AACjD,+CAA2C;AAC3C,kDAA+C;AAE/C,4EAAwE;AAGxE,IAAa,aAAa,GAA1B,MAAa,aAAa;IACtB,YAA6B,UAAsB,EAAmB,YAA0B;QAAnE,eAAU,GAAV,UAAU,CAAY;QAAmB,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAG9F,GAAG;;YACL,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;QACvC,CAAC;KAAA;IAQK,iBAAiB;;YACnB,OAAO,WAAI,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;KAAA;IAGK,GAAG;
|
1
|
+
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAAiD;AACjD,+CAA2C;AAC3C,kDAA+C;AAE/C,4EAAwE;AAGxE,IAAa,aAAa,GAA1B,MAAa,aAAa;IACtB,YAA6B,UAAsB,EAAmB,YAA0B;QAAnE,eAAU,GAAV,UAAU,CAAY;QAAmB,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAG9F,GAAG;;YACL,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;QACvC,CAAC;KAAA;IAQK,iBAAiB;;YACnB,OAAO,WAAI,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;KAAA;IAGK,GAAG;;YACL,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,kCAAkC,EAAE,GAAG,CAAC,CAAC;QAE7E,CAAC;KAAA;CACJ,CAAA;AAnBG;IADC,IAAA,YAAG,GAAE;;;;wCAGL;AAQD;IADC,IAAA,YAAG,EAAC,UAAU,CAAC;;;;sDAGf;AAGD;IADC,IAAA,YAAG,EAAC,KAAK,CAAC;;;;wCAIV;AAtBQ,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAEgC,wBAAU,EAAiC,4BAAY;GADvF,aAAa,CAuBzB;AAvBY,sCAAa"}
|
package/dist/app.module.js
CHANGED
@@ -10,7 +10,7 @@ exports.AppModule = void 0;
|
|
10
10
|
const bull_1 = require("@nestjs/bull");
|
11
11
|
const common_1 = require("@nestjs/common");
|
12
12
|
const typeorm_1 = require("@nestjs/typeorm");
|
13
|
-
const
|
13
|
+
const nestjs_command_1 = require("nestjs-command");
|
14
14
|
const app_controller_1 = require("./app.controller");
|
15
15
|
const app_service_1 = require("./app.service");
|
16
16
|
const auth_module_1 = require("./auth/auth.module");
|
@@ -42,7 +42,7 @@ AppModule = __decorate([
|
|
42
42
|
system_module_1.SystemModule,
|
43
43
|
security_module_1.SecurityModule,
|
44
44
|
common_module_1.CommonModule,
|
45
|
-
|
45
|
+
nestjs_command_1.CommandModule,
|
46
46
|
],
|
47
47
|
controllers: [app_controller_1.AppController],
|
48
48
|
providers: [app_service_1.AppService],
|
package/dist/cli.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/dist/cli.js
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const core_1 = require("@nestjs/core");
|
13
|
+
const nestjs_command_1 = require("nestjs-command");
|
14
|
+
const app_module_1 = require("./app.module");
|
15
|
+
function bootstrap() {
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
17
|
+
const app = yield core_1.NestFactory.createApplicationContext(app_module_1.AppModule, {
|
18
|
+
logger: ['log', 'warn', 'error'],
|
19
|
+
});
|
20
|
+
try {
|
21
|
+
yield app.select(nestjs_command_1.CommandModule).get(nestjs_command_1.CommandService).exec();
|
22
|
+
yield app.close();
|
23
|
+
}
|
24
|
+
catch (error) {
|
25
|
+
global.console.error(error);
|
26
|
+
yield app.close();
|
27
|
+
process.exit(1);
|
28
|
+
}
|
29
|
+
});
|
30
|
+
}
|
31
|
+
bootstrap();
|
32
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
@@ -0,0 +1 @@
|
|
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"}
|
@@ -3,6 +3,7 @@ import { QueueOptionsDto } from '../../platformUtility/dtos/queue.options.dto';
|
|
3
3
|
import { QueueService } from '../../platformUtility/services/queue.service';
|
4
4
|
import { BaseJobInterface } from './base.job.interface';
|
5
5
|
export declare class CommonJob implements BaseJobInterface {
|
6
|
+
protected mode: string;
|
6
7
|
protected queueService: QueueService;
|
7
8
|
dispatch(data: any, options?: QueueOptionsDto): Promise<any>;
|
8
9
|
delayedDispatch(data: any, options?: QueueOptionsDto): Promise<any>;
|
@@ -10,8 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.CommonJob = void 0;
|
13
|
+
const operation_exception_1 = require("./../exceptions/operation.exception");
|
14
|
+
const config = require("config");
|
13
15
|
const hash_1 = require("./hash");
|
14
16
|
class CommonJob {
|
17
|
+
constructor() {
|
18
|
+
this.mode = 'redis';
|
19
|
+
}
|
15
20
|
dispatch(data, options) {
|
16
21
|
return __awaiter(this, void 0, void 0, function* () {
|
17
22
|
const payload = {
|
@@ -20,7 +25,12 @@ class CommonJob {
|
|
20
25
|
name: this.constructor.name,
|
21
26
|
};
|
22
27
|
options = options !== null && options !== void 0 ? options : {};
|
23
|
-
|
28
|
+
if (this.mode === 'redis')
|
29
|
+
return this.queueService.add('generic.job.trigger', payload, options);
|
30
|
+
const sqsQueue = config.get(`sqs.${this.mode}`);
|
31
|
+
if (!sqsQueue)
|
32
|
+
throw new operation_exception_1.OperationException(`Queue ${this.mode} is not defined in the system. please add is under sqs`);
|
33
|
+
return this.queueService.sqsService.add(sqsQueue, payload);
|
24
34
|
});
|
25
35
|
}
|
26
36
|
delayedDispatch(data, options) {
|
@@ -32,7 +42,12 @@ class CommonJob {
|
|
32
42
|
};
|
33
43
|
options = options !== null && options !== void 0 ? options : {};
|
34
44
|
options.delay = options.delay || 200;
|
35
|
-
|
45
|
+
if (this.mode === 'redis')
|
46
|
+
return this.queueService.add('generic.job.trigger', payload, options);
|
47
|
+
const sqsQueue = config.get(`sqs.${this.mode}`);
|
48
|
+
if (!sqsQueue)
|
49
|
+
throw new operation_exception_1.OperationException(`Queue ${this.mode} is not defined in the system. please add is under sqs`);
|
50
|
+
return this.queueService.sqsService.add(sqsQueue, payload);
|
36
51
|
});
|
37
52
|
}
|
38
53
|
handle(data, job) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.job.js","sourceRoot":"","sources":["../../../src/common/libraries/common.job.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"common.job.js","sourceRoot":"","sources":["../../../src/common/libraries/common.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6EAAyE;AAEzE,iCAAiC;AAIjC,iCAA8B;AAO9B,MAAa,SAAS;IAAtB;QAQc,SAAI,GAAW,OAAO,CAAC;IAoErC,CAAC;IApDS,QAAQ,CAAC,IAAS,EAAE,OAAyB;;YAC/C,MAAM,OAAO,GAAG;gBACZ,GAAG,EAAE,WAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;gBACxC,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI;aAC9B,CAAC;YAEF,OAAO,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;YAExB,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO;gBAAE,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YAC7B,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;CACJ;AA5ED,8BA4EC"}
|
@@ -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,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AE,MAAM,IAAI,wCAAkB,CAAC,4CAA4C,SAAS,EAAE,CAAC,CAAC;YAElG,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"}
|
@@ -13,4 +13,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./entity.generator.command"), exports);
|
14
14
|
__exportStar(require("./maintenance.command"), exports);
|
15
15
|
__exportStar(require("./sync.class.command"), exports);
|
16
|
+
__exportStar(require("./sqs.worker.command"), exports);
|
16
17
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platformUtility/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAA2C;AAC3C,wDAAsC;AACtC,uDAAqC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platformUtility/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAA2C;AAC3C,wDAAsC;AACtC,uDAAqC;AACrC,uDAAqC"}
|
@@ -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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orkerCommand {
|
3
|
+
private readonly queueService;
|
4
|
+
private counter;
|
5
|
+
private start_time;
|
6
|
+
private sTime;
|
7
|
+
private logger;
|
8
|
+
constructor(queueService: QueueService);
|
9
|
+
process(): Promise<void>;
|
10
|
+
private processMessage;
|
11
|
+
private dropMessage;
|
12
|
+
private fetchMessages;
|
13
|
+
private processMessages;
|
14
|
+
private checkForSystem;
|
15
|
+
}
|
@@ -0,0 +1,118 @@
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
18
|
+
});
|
19
|
+
};
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
21
|
+
exports.SqsWorkerCommand = void 0;
|
22
|
+
const common_1 = require("@nestjs/common");
|
23
|
+
const config = require("config");
|
24
|
+
const nestjs_command_1 = require("nestjs-command");
|
25
|
+
const platform_constants_1 = require("../../config/platform.constants");
|
26
|
+
const queue_service_1 = require("../../platformUtility/services/queue.service");
|
27
|
+
const date_util_1 = require("./../../common/libraries/date.util");
|
28
|
+
const sqsQueue = config.get('sqs.fifo');
|
29
|
+
let SqsWorkerCommand = class SqsWorkerCommand {
|
30
|
+
constructor(queueService) {
|
31
|
+
this.queueService = queueService;
|
32
|
+
this.counter = 0;
|
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');
|
36
|
+
}
|
37
|
+
process() {
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
39
|
+
yield this.queueService.pause();
|
40
|
+
while (true) {
|
41
|
+
yield this.checkForSystem();
|
42
|
+
let record;
|
43
|
+
try {
|
44
|
+
record = yield this.fetchMessages();
|
45
|
+
}
|
46
|
+
catch (error) {
|
47
|
+
global.console.log('error', error);
|
48
|
+
}
|
49
|
+
if (!(record === null || record === void 0 ? void 0 : record.Messages))
|
50
|
+
yield this.queueService.sleep(1000);
|
51
|
+
if ((record === null || record === void 0 ? void 0 : record.Messages) && Array.isArray(record.Messages)) {
|
52
|
+
yield this.processMessages(record.Messages);
|
53
|
+
}
|
54
|
+
this.logger.log(`[sqs.fifo] [events] [${this.start_time}] events-processed : ${this.counter} ${((Date.now() - this.sTime) / 1000).toFixed(0)}s`);
|
55
|
+
}
|
56
|
+
});
|
57
|
+
}
|
58
|
+
processMessage(message) {
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
60
|
+
++this.counter;
|
61
|
+
const data = JSON.parse(message.Body);
|
62
|
+
this.logger.log(`[sqs.fifo][ Processing] ${message.MessageId} : ${data.name} `);
|
63
|
+
const startTime = date_util_1.DateUtil.now();
|
64
|
+
try {
|
65
|
+
yield platform_constants_1.default.jobs[data.job].handle(data.payload);
|
66
|
+
const timeTaken = date_util_1.DateUtil.now() - startTime;
|
67
|
+
this.logger.log(`[sqs.fifo][ Processed] ${message.MessageId} : ${data.name} ${timeTaken} ms`);
|
68
|
+
}
|
69
|
+
catch (error) {
|
70
|
+
this.logger.log(`[sqs.fifo][ failure] ${message.MessageId} : ${data.name} `);
|
71
|
+
this.logger.log('failed-job', data);
|
72
|
+
this.logger.log('error', error);
|
73
|
+
}
|
74
|
+
finally {
|
75
|
+
this.dropMessage(message.ReceiptHandle);
|
76
|
+
}
|
77
|
+
});
|
78
|
+
}
|
79
|
+
dropMessage(id) {
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
81
|
+
return this.queueService.sqsService.delete(sqsQueue, id);
|
82
|
+
});
|
83
|
+
}
|
84
|
+
fetchMessages() {
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
86
|
+
return this.queueService.sqsService.get(sqsQueue, 10);
|
87
|
+
});
|
88
|
+
}
|
89
|
+
processMessages(messages) {
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
91
|
+
for (const message of messages)
|
92
|
+
yield this.processMessage(message);
|
93
|
+
});
|
94
|
+
}
|
95
|
+
checkForSystem() {
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
97
|
+
yield this.queueService.checkForMaintenance();
|
98
|
+
if (yield this.queueService.hasRestartFlagChanged()) {
|
99
|
+
process.exit(0);
|
100
|
+
}
|
101
|
+
});
|
102
|
+
}
|
103
|
+
};
|
104
|
+
__decorate([
|
105
|
+
(0, nestjs_command_1.Command)({
|
106
|
+
command: 'queue:sqs',
|
107
|
+
describe: 'run worker through sqs',
|
108
|
+
}),
|
109
|
+
__metadata("design:type", Function),
|
110
|
+
__metadata("design:paramtypes", []),
|
111
|
+
__metadata("design:returntype", Promise)
|
112
|
+
], SqsWorkerCommand.prototype, "process", null);
|
113
|
+
SqsWorkerCommand = __decorate([
|
114
|
+
(0, common_1.Injectable)(),
|
115
|
+
__metadata("design:paramtypes", [queue_service_1.QueueService])
|
116
|
+
], SqsWorkerCommand);
|
117
|
+
exports.SqsWorkerCommand = SqsWorkerCommand;
|
118
|
+
//# sourceMappingURL=sqs.worker.command.js.map
|
@@ -0,0 +1 @@
|
|
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,MAAM,CAAE,QAAQ,CAAA;oBAAE,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAE3D,IA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AAC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;gBACpC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;aACnC;oBAAS;gBACN,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;aAC3C;QACL,CAAC;KAAA;IASa,WAAW,CAAC,EAAU;;YAChC,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC7D,CAAC;KAAA;IAQa,aAAa;;YACvB,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC1D,CAAC;KAAA;IAEa,eAAe,CAAC,QAAe;;YACzC,KAAK,MAAM,OAAO,IAAI,QAAQ;gBAAE,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACvE,CAAC;KAAA;IAQa,cAAc;;YACxB,MAAM,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;YAE9C,IAAI,MAAM,IAAI,CAAC,YAAY,CAAC,qBAAqB,EAAE,EAAE;gBACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACnB;QACL,CAAC;KAAA;CACJ,CAAA;AA7FG;IAJC,IAAA,wBAAO,EAAC;QACL,OAAO,EAAE,WAAW;QACpB,QAAQ,EAAE,wBAAwB;KACrC,CAAC;;;;+CAuBD;AA9CQ,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAmBkC,4BAAY;GAlB9C,gBAAgB,CAqH5B;AArHY,4CAAgB"}
|
@@ -1,8 +1,6 @@
|
|
1
|
-
import { ConsoleService } from 'nestjs-console';
|
2
1
|
import { QueueService } 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,O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