@servicelabsco/nestjs-utility-services 1.1.30 → 1.1.32

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.
Files changed (40) hide show
  1. package/dist/platformUtility/commands/sqs.worker.command.d.ts +5 -13
  2. package/dist/platformUtility/commands/sqs.worker.command.js +9 -60
  3. package/dist/platformUtility/commands/sqs.worker.command.js.map +1 -1
  4. package/dist/platformUtility/es6.classes.d.ts +2 -1
  5. package/dist/platformUtility/es6.classes.js +2 -0
  6. package/dist/platformUtility/es6.classes.js.map +1 -1
  7. package/dist/platformUtility/jobs/test.job.d.ts +1 -0
  8. package/dist/platformUtility/jobs/test.job.js +1 -0
  9. package/dist/platformUtility/jobs/test.job.js.map +1 -1
  10. package/dist/platformUtility/libraries/common.sqs.polling.d.ts +24 -0
  11. package/dist/platformUtility/libraries/common.sqs.polling.js +71 -0
  12. package/dist/platformUtility/libraries/common.sqs.polling.js.map +1 -0
  13. package/dist/platformUtility/libraries/index.d.ts +1 -0
  14. package/dist/platformUtility/libraries/index.js +1 -0
  15. package/dist/platformUtility/libraries/index.js.map +1 -1
  16. package/dist/platformUtility/services/sqs.service.d.ts +1 -1
  17. package/dist/platformUtility/services/sqs.service.js +8 -2
  18. package/dist/platformUtility/services/sqs.service.js.map +1 -1
  19. package/dist/system/dtos/index.d.ts +3 -1
  20. package/dist/system/dtos/index.js +3 -1
  21. package/dist/system/dtos/index.js.map +1 -1
  22. package/dist/system/dtos/s3.object.info.dto.d.ts +4 -0
  23. package/dist/system/dtos/s3.object.info.dto.js +7 -0
  24. package/dist/system/dtos/s3.object.info.dto.js.map +1 -0
  25. package/dist/system/dtos/s3.upload.options.dto.d.ts +6 -0
  26. package/dist/system/dtos/s3.upload.options.dto.js +7 -0
  27. package/dist/system/dtos/s3.upload.options.dto.js.map +1 -0
  28. package/dist/system/es6.classes.d.ts +5 -2
  29. package/dist/system/es6.classes.js +6 -0
  30. package/dist/system/es6.classes.js.map +1 -1
  31. package/dist/system/services/aws.s3.service.d.ts +10 -0
  32. package/dist/system/services/aws.s3.service.js +96 -0
  33. package/dist/system/services/aws.s3.service.js.map +1 -0
  34. package/dist/system/services/index.d.ts +1 -0
  35. package/dist/system/services/index.js +1 -0
  36. package/dist/system/services/index.js.map +1 -1
  37. package/dist/system/services/upload.service.d.ts +5 -0
  38. package/dist/system/services/upload.service.js +30 -31
  39. package/dist/system/services/upload.service.js.map +1 -1
  40. package/package.json +1 -1
@@ -1,18 +1,10 @@
1
1
  import { QueueService } from '../../platformUtility/services/queue.service';
2
2
  import { MaintenanceService } from './../services/maintenance.service';
3
- export declare class SqsWorkerCommand {
4
- private readonly queueService;
5
- private readonly maintenanceService;
6
- private counter;
7
- private start_time;
8
- private sTime;
9
- private logger;
3
+ import { CommonSqsPolling } from '../libraries/common.sqs.polling';
4
+ export declare class SqsWorkerCommand extends CommonSqsPolling {
5
+ protected readonly queueService: QueueService;
6
+ protected readonly maintenanceService: MaintenanceService;
10
7
  constructor(queueService: QueueService, maintenanceService: MaintenanceService);
11
8
  process(): Promise<void>;
12
- private log;
13
- private processMessage;
14
- private dropMessage;
15
- private fetchMessages;
16
- private processMessages;
17
- private checkForSystem;
9
+ private processJob;
18
10
  }
@@ -13,76 +13,25 @@ exports.SqsWorkerCommand = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
14
  const config = require("config");
15
15
  const nestjs_command_1 = require("nestjs-command");
16
- const platform_utility_1 = require("../../common/libraries/platform.utility");
17
16
  const platform_constants_1 = require("../../config/platform.constants");
18
17
  const queue_service_1 = require("../../platformUtility/services/queue.service");
19
- const date_util_1 = require("./../../common/libraries/date.util");
20
18
  const maintenance_service_1 = require("./../services/maintenance.service");
21
- const sqsQueue = config.get('sqs.fifo');
22
- let SqsWorkerCommand = class SqsWorkerCommand {
19
+ const common_sqs_polling_1 = require("../libraries/common.sqs.polling");
20
+ let SqsWorkerCommand = class SqsWorkerCommand extends common_sqs_polling_1.CommonSqsPolling {
23
21
  constructor(queueService, maintenanceService) {
22
+ super();
24
23
  this.queueService = queueService;
25
24
  this.maintenanceService = maintenanceService;
26
- this.counter = 0;
27
- this.start_time = date_util_1.DateUtil.getDateTimeInFormat();
28
- this.sTime = date_util_1.DateUtil.now();
29
- this.logger = new common_1.Logger('SqsWorker');
30
25
  }
31
26
  async process() {
32
27
  await this.queueService.pause();
33
- this.log();
34
- while (true) {
35
- await this.checkForSystem();
36
- let record;
37
- try {
38
- record = await this.fetchMessages();
39
- }
40
- catch (error) {
41
- global.console.log('error', error);
42
- }
43
- if (!(record === null || record === void 0 ? void 0 : record.Messages))
44
- await platform_utility_1.PlatformUtility.sleep(1000);
45
- if ((record === null || record === void 0 ? void 0 : record.Messages) && Array.isArray(record.Messages)) {
46
- await this.processMessages(record.Messages);
47
- }
48
- }
28
+ this.logger = new common_1.Logger('SqsWorker Fifo');
29
+ this.sqsQueue = config.get('sqs.fifo');
30
+ this.logger.log(`logging queue ${this.sqsQueue}`);
31
+ await this.handle(this.processJob);
49
32
  }
50
- async log() {
51
- setInterval(() => {
52
- this.logger.log(`[sqs.fifo] [events] [${this.start_time}] events-processed : ${this.counter} ${((Date.now() - this.sTime) / 1000).toFixed(0)}s`);
53
- }, 30000);
54
- }
55
- async processMessage(message) {
56
- ++this.counter;
57
- const data = JSON.parse(message.Body);
58
- this.logger.log(`[sqs.fifo][ Processing] ${message.MessageId} : ${data.name} `);
59
- const startTime = date_util_1.DateUtil.now();
60
- try {
61
- await platform_constants_1.default.jobs[data.job].handle(data.payload);
62
- const timeTaken = date_util_1.DateUtil.now() - startTime;
63
- this.logger.log(`[sqs.fifo][ Processed] ${message.MessageId} : ${data.name} ${timeTaken} ms`);
64
- }
65
- catch (error) {
66
- this.logger.log(`[sqs.fifo][ failure] ${message.MessageId} : ${data.name} `);
67
- this.logger.log('failed-job', data);
68
- this.logger.log('error', error);
69
- }
70
- finally {
71
- this.dropMessage(message.ReceiptHandle);
72
- }
73
- }
74
- async dropMessage(id) {
75
- return this.queueService.sqsService.delete(sqsQueue, id);
76
- }
77
- async fetchMessages() {
78
- return this.queueService.sqsService.get(sqsQueue, 10);
79
- }
80
- async processMessages(messages) {
81
- for (const message of messages)
82
- await this.processMessage(message);
83
- }
84
- async checkForSystem() {
85
- await this.maintenanceService.checkForMaintenance('sqsInstance');
33
+ async processJob(data) {
34
+ await platform_constants_1.default.jobs[data.job].handle(data.payload);
86
35
  }
87
36
  };
88
37
  __decorate([
@@ -1 +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,8EAA0E;AAC1E,wEAAgE;AAChE,gFAA4E;AAC5E,kEAA8D;AAC9D,2EAAuE;AAEvE,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAQjC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAkBzB,YAA6B,YAA0B,EAAmB,kBAAsC;QAAnF,iBAAY,GAAZ,YAAY,CAAc;QAAmB,uBAAkB,GAAlB,kBAAkB,CAAoB;QAjBxG,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;IAOkE,CAAC;IAM9G,AAAN,KAAK,CAAC,OAAO;QACT,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,OAAO,IAAI,EAAE;YACT,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAE5B,IAAI,MAAM,CAAC;YAEX,IAAI;gBACA,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;aACvC;YAAC,OA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AN3G,gBAAgB,CAkC5B;AAlCY,4CAAgB"}
@@ -15,6 +15,7 @@ import { QueueOptionsDto } from './dtos/queue.options.dto';
15
15
  import { RemoteRawResponseDto } from './dtos/remote.raw.response.dto';
16
16
  import { RecordWatcherJob } from './jobs/record.watcher.job';
17
17
  import { TestJob } from './jobs/test.job';
18
+ import { CommonSqsPolling } from './libraries/common.sqs.polling';
18
19
  import { CreateEntityConstantsFile } from './libraries/create.entity.constants.file';
19
20
  import { CreateEs6ClassesFile } from './libraries/create.es6.classes.file';
20
21
  import { CreateEs6JobsFile } from './libraries/create.es6.jobs.file';
@@ -48,7 +49,7 @@ declare const es6Classes: {
48
49
  controllers: (typeof QueueController)[];
49
50
  dtos: (typeof JobPayloadDto | typeof QueueOptionsDto | typeof RemoteRawResponseDto | typeof MailOptionsDto | typeof CommonAttributesDto | typeof FcmResponseDto | typeof PushNotificationResponseDto | typeof PushNotificationTemplateDto)[];
50
51
  jobs: (typeof RecordWatcherJob | typeof TestJob)[];
51
- libraries: (typeof FileSystemUtility | typeof CreateEntityConstantsFile | typeof CreateEs6ClassesFile | typeof CreateEs6JobsFile | typeof CreateEs6ServiceFile | typeof CreateIndexFile | typeof ProcessCommonMail | typeof ProcessPostmarkMail)[];
52
+ libraries: (typeof FileSystemUtility | typeof CommonSqsPolling | typeof CreateEntityConstantsFile | typeof CreateEs6ClassesFile | typeof CreateEs6JobsFile | typeof CreateEs6ServiceFile | typeof CreateIndexFile | typeof ProcessCommonMail | typeof ProcessPostmarkMail)[];
52
53
  middlewares: (typeof MaintenanceMiddleware | typeof TrimPipe)[];
53
54
  services: (typeof RemoteRequestService | typeof CacheService | typeof SqlService | typeof MaintenanceService | typeof ShutdownService | typeof DynamoService | typeof AuditService | typeof DynamoMetaService | typeof Es6JobsService | typeof FcmNotificationService | typeof MailService | typeof StartupService | typeof Es6Service | typeof SqsService | typeof LocalPropertyService | typeof QueueService)[];
54
55
  subscribers: (typeof BaseSubscriber)[];
@@ -17,6 +17,7 @@ const queue_options_dto_1 = require("./dtos/queue.options.dto");
17
17
  const remote_raw_response_dto_1 = require("./dtos/remote.raw.response.dto");
18
18
  const record_watcher_job_1 = require("./jobs/record.watcher.job");
19
19
  const test_job_1 = require("./jobs/test.job");
20
+ const common_sqs_polling_1 = require("./libraries/common.sqs.polling");
20
21
  const create_entity_constants_file_1 = require("./libraries/create.entity.constants.file");
21
22
  const create_es6_classes_file_1 = require("./libraries/create.es6.classes.file");
22
23
  const create_es6_jobs_file_1 = require("./libraries/create.es6.jobs.file");
@@ -60,6 +61,7 @@ const es6Classes = {
60
61
  ],
61
62
  jobs: [record_watcher_job_1.RecordWatcherJob, test_job_1.TestJob],
62
63
  libraries: [
64
+ common_sqs_polling_1.CommonSqsPolling,
63
65
  create_entity_constants_file_1.CreateEntityConstantsFile,
64
66
  create_es6_classes_file_1.CreateEs6ClassesFile,
65
67
  create_es6_jobs_file_1.CreateEs6JobsFile,
@@ -1 +1 @@
1
- {"version":3,"file":"es6.classes.js","sourceRoot":"","sources":["../../src/platformUtility/es6.classes.ts"],"names":[],"mappings":";;AAAA,kFAA6E;AAC7E,wEAAoE;AACpE,sEAAiE;AACjE,sEAAiE;AACjE,+DAA2D;AAC3D,2DAAuD;AACvD,qEAAiE;AACjE,wEAAmE;AACnE,8DAAyD;AACzD,4DAAuD;AACvD,8DAAyD;AACzD,0FAAoF;AACpF,0FAAoF;AACpF,gEAA2D;AAC3D,4EAAsE;AACtE,kEAA6D;AAC7D,8CAA0C;AAC1C,2FAAqF;AACrF,iFAA2E;AAC3E,2EAAqE;AACrE,iFAA2E;AAC3E,qEAAgE;AAChE,yEAAoE;AACpE,yEAAoE;AACpE,6EAAwE;AACxE,iFAA6E;AAC7E,uDAAmD;AACnD,4DAAwD;AACxD,4DAAwD;AACxD,wEAAmE;AACnE,8DAA0D;AAC1D,kEAA6D;AAC7D,wDAAoD;AACpD,kFAA6E;AAC7E,8EAAyE;AACzE,0DAAsD;AACtD,wEAAoE;AACpE,4DAAwD;AACxD,8EAAyE;AACzE,kEAA8D;AAC9D,wDAAoD;AACpD,wDAAoD;AACpD,gEAA4D;AAC5D,mEAA+D;AAE/D,MAAM,UAAU,GAAG;IACf,QAAQ,EAAE,CAAC,iDAAsB,EAAE,wCAAkB,EAAE,qCAAgB,EAAE,qCAAgB,CAAC;IAC1F,SAAS,EAAE,CAAC,8BAAa,EAAE,0BAAW,CAAC;IACvC,WAAW,EAAE,CAAC,kCAAe,CAAC;IAC9B,IAAI,EAAE;QACF,2CAAmB;QACnB,iCAAc;QACd,+BAAa;QACb,iCAAc;QACd,4DAA2B;QAC3B,4DAA2B;QAC3B,mCAAe;QACf,8CAAoB;KACvB;IACD,IAAI,EAAE,CAAC,qCAAgB,EAAE,kBAAO,CAAC;IACjC,SAAS,EAAE;QACP,wDAAyB;QACzB,8CAAoB;QACpB,wCAAiB;QACjB,8CAAoB;QACpB,mCAAe;QACf,uCAAiB;QACjB,uCAAiB;QACjB,2CAAmB;KACtB;IACD,WAAW,EAAE,CAAC,8CAAqB,EAAE,oBAAQ,CAAC;IAC9C,QAAQ,EAAE;QACN,4BAAY;QACZ,4BAAY;QACZ,uCAAiB;QACjB,8BAAa;QACb,iCAAc;QACd,wBAAU;QACV,iDAAsB;QACtB,6CAAoB;QACpB,0BAAW;QACX,wCAAkB;QAClB,4BAAY;QACZ,6CAAoB;QACpB,kCAAe;QACf,wBAAU;QACV,wBAAU;QACV,gCAAc;KACjB;IACD,WAAW,EAAE,CAAC,gCAAc,CAAC;CAChC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"es6.classes.js","sourceRoot":"","sources":["../../src/platformUtility/es6.classes.ts"],"names":[],"mappings":";;AAAA,kFAA6E;AAC7E,wEAAoE;AACpE,sEAAiE;AACjE,sEAAiE;AACjE,+DAA2D;AAC3D,2DAAuD;AACvD,qEAAiE;AACjE,wEAAmE;AACnE,8DAAyD;AACzD,4DAAuD;AACvD,8DAAyD;AACzD,0FAAoF;AACpF,0FA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6CAAoB;QACpB,kCAAe;QACf,wBAAU;QACV,wBAAU;QACV,gCAAc;KACjB;IACD,WAAW,EAAE,CAAC,gCAAc,CAAC;CAChC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
@@ -2,6 +2,7 @@ import { CommonJob } from './../../common/libraries/common.job';
2
2
  import { QueueService } from './../services/queue.service';
3
3
  export declare class TestJob extends CommonJob {
4
4
  protected readonly queueService: QueueService;
5
+ protected mode: string;
5
6
  constructor(queueService: QueueService);
6
7
  handle(data: any): Promise<void>;
7
8
  }
@@ -17,6 +17,7 @@ let TestJob = class TestJob extends common_job_1.CommonJob {
17
17
  constructor(queueService) {
18
18
  super();
19
19
  this.queueService = queueService;
20
+ this.mode = 'fifo';
20
21
  }
21
22
  async handle(data) {
22
23
  for (let i = 0; i < 10; ++i) {
@@ -1 +1 @@
1
- {"version":3,"file":"test.job.js","sourceRoot":"","sources":["../../../src/platformUtility/jobs/test.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,oEAAgE;AAChE,+DAA2D;AAGpD,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,sBAAS;IAClC,YAA+B,YAA0B;QACrD,KAAK,EAAE,CAAC;QADmB,iBAAY,GAAZ,YAAY,CAAc;IAEzD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAS;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YACzB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;SACpC;IACL,CAAC;CACJ,CAAA;AAVY,OAAO;IADnB,IAAA,mBAAU,GAAE;qCAEoC,4BAAY;GADhD,OAAO,CAUnB;AAVY,0BAAO"}
1
+ {"version":3,"file":"test.job.js","sourceRoot":"","sources":["../../../src/platformUtility/jobs/test.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,oEAAgE;AAChE,+DAA2D;AAGpD,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,sBAAS;IAGlC,YAA+B,YAA0B;QACrD,KAAK,EAAE,CAAC;QADmB,iBAAY,GAAZ,YAAY,CAAc;QAF/C,SAAI,GAAW,MAAM,CAAC;IAIhC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAS;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YACzB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;SACpC;IACL,CAAC;CACJ,CAAA;AAZY,OAAO;IADnB,IAAA,mBAAU,GAAE;qCAIoC,4BAAY;GAHhD,OAAO,CAYnB;AAZY,0BAAO"}
@@ -0,0 +1,24 @@
1
+ import { Logger } from '@nestjs/common';
2
+ import { MaintenanceService } from '../services/maintenance.service';
3
+ import { QueueService } from '../services/queue.service';
4
+ export declare class CommonSqsPolling {
5
+ private counter;
6
+ private start_time;
7
+ private sTime;
8
+ protected preferences: {
9
+ idlingTime: number;
10
+ loggingTime: number;
11
+ messagesToReceive: number;
12
+ };
13
+ protected sqsQueue: string;
14
+ protected readonly queueService: QueueService;
15
+ protected readonly maintenanceService: MaintenanceService;
16
+ protected logger: Logger;
17
+ handle(callbackFn: any): Promise<void>;
18
+ private startLogging;
19
+ private processMessage;
20
+ private processMessages;
21
+ private dropMessage;
22
+ private fetchMessages;
23
+ private checkForSystem;
24
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommonSqsPolling = void 0;
4
+ const date_util_1 = require("../../common/libraries/date.util");
5
+ const platform_utility_1 = require("../../common/libraries/platform.utility");
6
+ class CommonSqsPolling {
7
+ constructor() {
8
+ this.counter = 0;
9
+ this.start_time = date_util_1.DateUtil.getDateTimeInFormat();
10
+ this.sTime = date_util_1.DateUtil.now();
11
+ this.preferences = { idlingTime: 1000, loggingTime: 30000, messagesToReceive: 10 };
12
+ }
13
+ async handle(callbackFn) {
14
+ this.startLogging();
15
+ while (true) {
16
+ await this.checkForSystem();
17
+ let record;
18
+ try {
19
+ record = await this.fetchMessages();
20
+ }
21
+ catch (error) {
22
+ global.console.log('error', error);
23
+ }
24
+ if (!(record === null || record === void 0 ? void 0 : record.Messages))
25
+ await platform_utility_1.PlatformUtility.sleep(this.preferences.idlingTime);
26
+ if ((record === null || record === void 0 ? void 0 : record.Messages) && Array.isArray(record.Messages)) {
27
+ await this.processMessages(record.Messages, callbackFn);
28
+ }
29
+ }
30
+ }
31
+ async startLogging() {
32
+ setInterval(() => {
33
+ this.logger.log(`[events] [${this.start_time}] events-processed : ${this.counter} ${((Date.now() - this.sTime) / 1000).toFixed(0)}s`);
34
+ }, this.preferences.loggingTime);
35
+ }
36
+ async processMessage(message, callbackFn) {
37
+ ++this.counter;
38
+ const data = JSON.parse(message.Body);
39
+ const name = (data === null || data === void 0 ? void 0 : data.name) || '';
40
+ this.logger.log(`[Processing] ${message.MessageId} : ${name} `);
41
+ const startTime = date_util_1.DateUtil.now();
42
+ try {
43
+ await callbackFn(data);
44
+ const timeTaken = date_util_1.DateUtil.now() - startTime;
45
+ this.logger.log(`[Processed] ${message.MessageId} : ${name} ${timeTaken} ms`);
46
+ }
47
+ catch (error) {
48
+ this.logger.log(`[failure] ${message.MessageId} : ${name} `);
49
+ this.logger.log('failed-job', data);
50
+ this.logger.log('error', error);
51
+ }
52
+ finally {
53
+ this.dropMessage(message.ReceiptHandle);
54
+ }
55
+ }
56
+ async processMessages(messages, callbackFn) {
57
+ for (const message of messages)
58
+ await this.processMessage(message, callbackFn);
59
+ }
60
+ async dropMessage(id) {
61
+ return this.queueService.sqsService.delete(this.sqsQueue, id);
62
+ }
63
+ async fetchMessages() {
64
+ return this.queueService.sqsService.get(this.sqsQueue, this.preferences.messagesToReceive);
65
+ }
66
+ async checkForSystem() {
67
+ await this.maintenanceService.checkForMaintenance('sqsInstance');
68
+ }
69
+ }
70
+ exports.CommonSqsPolling = CommonSqsPolling;
71
+ //# sourceMappingURL=common.sqs.polling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.sqs.polling.js","sourceRoot":"","sources":["../../../src/platformUtility/libraries/common.sqs.polling.ts"],"names":[],"mappings":";;;AACA,gEAA4D;AAC5D,8EAA0E;AAI1E,MAAa,gBAAgB;IAA7B;QACY,YAAO,GAAG,CAAC,CAAC;QACZ,eAAU,GAAG,oBAAQ,CAAC,mBAAmB,EAAE,CAAC;QAC5C,UAAK,GAAG,oBAAQ,CAAC,GAAG,EAAE,CAAC;QAErB,gBAAW,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,EAAE,CAAC;IAyH5F,CAAC;IA1GG,KAAK,CAAC,MAAM,CAAC,UAAe;QACxB,IAAI,CAAC,YAAY,EAAE,CAAC;QAEpB,OAAO,IAAI,EAAE;YACT,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAE5B,IAAI,MAAM,CAAC;YAEX,IAAI;gBACA,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;aACvC;YAAC,OAAO,KAAK,EAAE;gBACZ,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;aACtC;YAED,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAA;gBAAE,MAAM,kCAAe,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAEhF,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,KAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;gBACpD,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;aAC3D;SACJ;I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AAM,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SACnC;gBAAS;YACN,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;SAC3C;IACL,CAAC;IASO,KAAK,CAAC,eAAe,CAAC,QAAe,EAAE,UAAe;QAC1D,KAAK,MAAM,OAAO,IAAI,QAAQ;YAAE,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACnF,CAAC;IASO,KAAK,CAAC,WAAW,CAAC,EAAU;QAChC,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAClE,CAAC;IAQO,KAAK,CAAC,aAAa;QACvB,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAC/F,CAAC;IAQO,KAAK,CAAC,cAAc;QACxB,MAAM,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrE,CAAC;CACJ;AA9HD,4CA8HC"}
@@ -1,3 +1,4 @@
1
+ export * from './common.sqs.polling';
1
2
  export * from './create.entity.constants.file';
2
3
  export * from './create.es6.classes.file';
3
4
  export * from './create.es6.jobs.file';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./common.sqs.polling"), exports);
17
18
  __exportStar(require("./create.entity.constants.file"), exports);
18
19
  __exportStar(require("./create.es6.classes.file"), exports);
19
20
  __exportStar(require("./create.es6.jobs.file"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platformUtility/libraries/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,4DAA0C;AAC1C,yDAAuC;AACvC,4DAA0C;AAC1C,sDAAoC;AACpC,wDAAsC;AACtC,wDAAsC;AACtC,0DAAwC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platformUtility/libraries/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,iEAA+C;AAC/C,4DAA0C;AAC1C,yDAAuC;AACvC,4DAA0C;AAC1C,sDAAoC;AACpC,wDAAsC;AACtC,wDAAsC;AACtC,0DAAwC"}
@@ -3,7 +3,7 @@ export declare class SqsService {
3
3
  private logger;
4
4
  constructor();
5
5
  add(queue: string, message: any): Promise<unknown>;
6
- delete(queue: string, receiptHandle: string): Promise<void>;
6
+ delete(queue: string, receiptHandle: string): Promise<unknown>;
7
7
  get(queue: string, count?: number): Promise<any>;
8
8
  private sendMessage;
9
9
  private isFifo;
@@ -30,11 +30,17 @@ let SqsService = class SqsService {
30
30
  return this.sendMessage(params);
31
31
  }
32
32
  async delete(queue, receiptHandle) {
33
- const deleteParams = {
33
+ const params = {
34
34
  QueueUrl: queue,
35
35
  ReceiptHandle: receiptHandle,
36
36
  };
37
- this.client.deleteMessage(deleteParams);
37
+ return new Promise((resolve, reject) => {
38
+ this.client.deleteMessage(params, function (err, data) {
39
+ if (err)
40
+ console.log(err, err.stack);
41
+ resolve(data);
42
+ });
43
+ });
38
44
  }
39
45
  async get(queue, count = 10) {
40
46
  const params = {
@@ -1 +1 @@
1
- {"version":3,"file":"sqs.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/sqs.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAoD;AACpD,qCAA8B;AAC9B,oDAAoD;AAG7C,IAAM,UAAU,GAAhB,MAAM,UAAU;IAInB;QAFQ,WAAM,GAAW,IAAI,eAAM,CAAC,mBAAmB,CAAC,CAAC;QAGrD,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AAE,CAAC;SACrB,CAAC;QAEF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;gBAC7C,IAAI,GAAG;oBAAE,MAAM,CAAC,GAAG,CAAC,CAAC;;oBAChB,OAAO,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IASO,KAAK,CAAC,WAAW,CAAC,MAA8B;QACpD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;gBAC1C,IAAI,GAAG,EAAE;oBACL,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;oBACvC,MAAM,CAAC,GAAG,CAAC,CAAC;iBACf;qBAAM;oBACH,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBAC3B;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IASO,MAAM,CAAC,KAAa;QACxB,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1C,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC;QAE/C,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;AA3GY,UAAU;IADtB,IAAA,mBAAU,GAAE;;GACA,UAAU,CA2GtB;AA3GY,gCAAU"}
@@ -1,7 +1,9 @@
1
+ export * from './document.attributes.dto';
1
2
  export * from './job.record.param.dto';
2
3
  export * from './local.file.s3.upload.dto';
3
4
  export * from './menu.list.preference.creation.dto';
4
5
  export * from './model.allowed.column.dto';
5
6
  export * from './model.form.preference.creation.dto';
7
+ export * from './s3.object.info.dto';
8
+ export * from './s3.upload.options.dto';
6
9
  export * from './user.preference.creation.dto';
7
- export * from './document.attributes.dto';
@@ -14,11 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./document.attributes.dto"), exports);
17
18
  __exportStar(require("./job.record.param.dto"), exports);
18
19
  __exportStar(require("./local.file.s3.upload.dto"), exports);
19
20
  __exportStar(require("./menu.list.preference.creation.dto"), exports);
20
21
  __exportStar(require("./model.allowed.column.dto"), exports);
21
22
  __exportStar(require("./model.form.preference.creation.dto"), exports);
23
+ __exportStar(require("./s3.object.info.dto"), exports);
24
+ __exportStar(require("./s3.upload.options.dto"), exports);
22
25
  __exportStar(require("./user.preference.creation.dto"), exports);
23
- __exportStar(require("./document.attributes.dto"), exports);
24
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/dtos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,6DAA2C;AAC3C,sEAAoD;AACpD,6DAA2C;AAC3C,uEAAqD;AACrD,iEAA+C;AAC/C,4DAA0C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/dtos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,yDAAuC;AACvC,6DAA2C;AAC3C,sEAAoD;AACpD,6DAA2C;AAC3C,uEAAqD;AACrD,uDAAqC;AACrC,0DAAwC;AACxC,iEAA+C"}
@@ -0,0 +1,4 @@
1
+ export declare class S3ObjectInfoDto {
2
+ bucket: string;
3
+ key: string;
4
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.S3ObjectInfoDto = void 0;
4
+ class S3ObjectInfoDto {
5
+ }
6
+ exports.S3ObjectInfoDto = S3ObjectInfoDto;
7
+ //# sourceMappingURL=s3.object.info.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3.object.info.dto.js","sourceRoot":"","sources":["../../../src/system/dtos/s3.object.info.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;CAG3B;AAHD,0CAGC"}
@@ -0,0 +1,6 @@
1
+ export declare class S3UploadOptionsDto {
2
+ bucket?: string;
3
+ folder?: string;
4
+ file?: string;
5
+ acl?: string;
6
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.S3UploadOptionsDto = void 0;
4
+ class S3UploadOptionsDto {
5
+ }
6
+ exports.S3UploadOptionsDto = S3UploadOptionsDto;
7
+ //# sourceMappingURL=s3.upload.options.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3.upload.options.dto.js","sourceRoot":"","sources":["../../../src/system/dtos/s3.upload.options.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAkB;CAK9B;AALD,gDAKC"}
@@ -20,6 +20,8 @@ import { JobRecordParamDto } from './dtos/job.record.param.dto';
20
20
  import { LocalFileS3UploadDto } from './dtos/local.file.s3.upload.dto';
21
21
  import { ModelAllowedColumnDto } from './dtos/model.allowed.column.dto';
22
22
  import { ModelFormPreferenceCreationDto } from './dtos/model.form.preference.creation.dto';
23
+ import { S3ObjectInfoDto } from './dtos/s3.object.info.dto';
24
+ import { S3UploadOptionsDto } from './dtos/s3.upload.options.dto';
23
25
  import { UserPreferenceCreationDto } from './dtos/user.preference.creation.dto';
24
26
  import { BusinessRuleEntity } from './entities/business.rule.entity';
25
27
  import { BusinessRuleRoleEntity } from './entities/business.rule.role.entity';
@@ -87,6 +89,7 @@ import { SecurityRuleEvaluator } from './libraries/security.rule.evaluator';
87
89
  import { SyncDynamoTables } from './libraries/sync.dynamo.tables';
88
90
  import { MenuListModifier } from './modifiers/menu.list.modifier';
89
91
  import { ModuleListModifier } from './modifiers/module.list.modifier';
92
+ import { AwsS3Service } from './services/aws.s3.service';
90
93
  import { BusinessRuleService } from './services/business.rule.service';
91
94
  import { ClientScriptService } from './services/client.script.service';
92
95
  import { ColumnService } from './services/column.service';
@@ -119,12 +122,12 @@ import { UserGroupRoleSubscriber } from './subscribers/user.group.role.subscribe
119
122
  declare const es6Classes: {
120
123
  commands: (typeof DbScannerCommand | typeof DynamoScannerCommand | typeof EventQueueCommand | typeof JobsScannerCommand | typeof ModelScannerCommand | typeof ReportScannerCommand | typeof ServiceScannerCommand | typeof SyncAllCommand)[];
121
124
  controllers: (typeof BaseController | typeof DataController | typeof FormController | typeof JobController | typeof MenuController | typeof PreferenceController | typeof ReportController | typeof UploadController | typeof UserPreferenceController)[];
122
- dtos: (typeof DocumentAttributesDto | typeof JobRecordParamDto | typeof ModelFormPreferenceCreationDto | typeof LocalFileS3UploadDto | typeof UserPreferenceCreationDto | typeof ModelAllowedColumnDto)[];
125
+ dtos: (typeof DocumentAttributesDto | typeof JobRecordParamDto | typeof ModelFormPreferenceCreationDto | typeof S3UploadOptionsDto | typeof LocalFileS3UploadDto | typeof S3ObjectInfoDto | typeof UserPreferenceCreationDto | typeof ModelAllowedColumnDto)[];
123
126
  entities: (typeof LookupTypeEntity | typeof UserGroupRoleEntity | typeof UserGroupEntity | typeof UserGroupMemberEntity | typeof BusinessRuleRoleEntity | typeof BusinessRuleEntity | typeof ColumnDefinitionEntity | typeof ColumnEntity | typeof ModelEntity | typeof FormPreferenceEntity | typeof ModelColumnEntity | typeof RelationshipEntity | typeof ModelRelationshipEntity | typeof ModelRoleEntity | typeof FormColumnEntity | typeof SystemScriptEntity | typeof UiActionPermissionEntity | typeof UiActionEntity | typeof UiActionRoleEntity | typeof PrimaryAxisEntity | typeof ChartEntity | typeof ClientScriptEntity | typeof CommentEntity | typeof DocumentEntity | typeof DynamoTableEntity | typeof MailLogEntity | typeof ReportColumnEntity | typeof ReportEntity | typeof ReportRelationshipEntity | typeof ReportRoleEntity | typeof EventDetailEntity | typeof EventQueueEntity | typeof ServiceEntity | typeof SecurityRuleEntity | typeof MenuRoleEntity | typeof MenuEntity | typeof ModuleEntity | typeof ModuleMenuEntity | typeof PageDefinitionEntity | typeof ParentMenuEntity | typeof OpenPropertyEntity | typeof ScheduledEventEntity | typeof SmsTemplateEntity | typeof SmsMessageEntity | typeof UserGroupPermissionEntity | typeof UserPreferenceEntity | typeof WhatsappTemplateEntity)[];
124
127
  jobs: (typeof ModelScannerJob | typeof ReportColumnSyncJob | typeof ScheduledEventJob | typeof CleanScheduledEventJob | typeof ColumnMapperJob | typeof PropertyJob | typeof RelationshipMapperJob | typeof ScheduledEventsJob | typeof UserGroupMemberJob | typeof UserGroupPermissionJob | typeof UserGroupRoleJob)[];
125
128
  libraries: (typeof SyncDynamoTables | typeof ModelSync | typeof SecurityRuleEvaluator | typeof ColumnManager | typeof BusinessRuleFilterValidator | typeof BusinessRuleQueryEvaluator)[];
126
129
  modifiers: (typeof MenuListModifier | typeof ModuleListModifier)[];
127
- services: (typeof PropertyService | typeof EventQueueService | typeof EventDetailService | typeof SecurityRuleService | typeof UiActionService | typeof ModelService | typeof CommonService | typeof ClientScriptService | typeof PreferenceService | typeof BusinessRuleService | typeof ListService | typeof FormService | typeof MenuService | typeof UserPreferenceService | typeof ReportService | typeof UploadService | typeof ScheduledEventService | typeof ColumnService | typeof CommentService | typeof DocumentService | typeof Es6JobsService | typeof Es6Service)[];
130
+ services: (typeof PropertyService | typeof EventQueueService | typeof EventDetailService | typeof SecurityRuleService | typeof UiActionService | typeof ModelService | typeof CommonService | typeof ClientScriptService | typeof PreferenceService | typeof BusinessRuleService | typeof ListService | typeof FormService | typeof MenuService | typeof UserPreferenceService | typeof ReportService | typeof AwsS3Service | typeof UploadService | typeof ScheduledEventService | typeof ColumnService | typeof CommentService | typeof DocumentService | typeof Es6JobsService | typeof Es6Service)[];
128
131
  subscribers: (typeof ColumnSubscriber | typeof PropertySubscriber | typeof RelationshipSubscriber | typeof ScheduledEventSubscriber | typeof UserGroupMemberSubscriber | typeof UserGroupPermissionSubscriber | typeof UserGroupRoleSubscriber)[];
129
132
  };
130
133
  export default es6Classes;
@@ -23,6 +23,8 @@ const local_file_s3_upload_dto_1 = require("./dtos/local.file.s3.upload.dto");
23
23
  const menu_list_preference_creation_dto_1 = require("./dtos/menu.list.preference.creation.dto");
24
24
  const model_allowed_column_dto_1 = require("./dtos/model.allowed.column.dto");
25
25
  const model_form_preference_creation_dto_1 = require("./dtos/model.form.preference.creation.dto");
26
+ const s3_object_info_dto_1 = require("./dtos/s3.object.info.dto");
27
+ const s3_upload_options_dto_1 = require("./dtos/s3.upload.options.dto");
26
28
  const user_preference_creation_dto_1 = require("./dtos/user.preference.creation.dto");
27
29
  const business_rule_entity_1 = require("./entities/business.rule.entity");
28
30
  const business_rule_role_entity_1 = require("./entities/business.rule.role.entity");
@@ -97,6 +99,7 @@ const security_rule_evaluator_1 = require("./libraries/security.rule.evaluator")
97
99
  const sync_dynamo_tables_1 = require("./libraries/sync.dynamo.tables");
98
100
  const menu_list_modifier_1 = require("./modifiers/menu.list.modifier");
99
101
  const module_list_modifier_1 = require("./modifiers/module.list.modifier");
102
+ const aws_s3_service_1 = require("./services/aws.s3.service");
100
103
  const business_rule_service_1 = require("./services/business.rule.service");
101
104
  const client_script_service_1 = require("./services/client.script.service");
102
105
  const column_service_1 = require("./services/column.service");
@@ -155,6 +158,8 @@ const es6Classes = {
155
158
  menu_list_preference_creation_dto_1.MenuListPreferenceCreationDto,
156
159
  model_allowed_column_dto_1.ModelAllowedColumnDto,
157
160
  model_form_preference_creation_dto_1.ModelFormPreferenceCreationDto,
161
+ s3_object_info_dto_1.S3ObjectInfoDto,
162
+ s3_upload_options_dto_1.S3UploadOptionsDto,
158
163
  user_preference_creation_dto_1.UserPreferenceCreationDto,
159
164
  ],
160
165
  entities: [
@@ -229,6 +234,7 @@ const es6Classes = {
229
234
  libraries: [business_rule_filter_validator_1.BusinessRuleFilterValidator, business_rule_query_evaluator_1.BusinessRuleQueryEvaluator, column_manager_1.ColumnManager, model_sync_1.ModelSync, security_rule_evaluator_1.SecurityRuleEvaluator, sync_dynamo_tables_1.SyncDynamoTables],
230
235
  modifiers: [menu_list_modifier_1.MenuListModifier, module_list_modifier_1.ModuleListModifier],
231
236
  services: [
237
+ aws_s3_service_1.AwsS3Service,
232
238
  business_rule_service_1.BusinessRuleService,
233
239
  client_script_service_1.ClientScriptService,
234
240
  column_service_1.ColumnService,
@@ -1 +1 @@
1
- {"version":3,"file":"es6.classes.js","sourceRoot":"","sources":["../../src/system/es6.classes.ts"],"names":[],"mappings":";;AAAA,sEAAiE;AACjE,8EAAyE;AACzE,wEAAmE;AACnE,0EAAqE;AACrE,4EAAuE;AACvE,8EAAyE;AACzE,gFAA2E;AAC3E,kEAA6D;AAC7D,mEAA+D;AAC/D,mEAA+D;AAC/D,mEAA+D;AAC/D,iEAA6D;AAC7D,mEAA+D;AAC/D,+EAA2E;AAC3E,uEAAmE;AACnE,uEAAmE;AACnE,yFAAoF;AACpF,4EAAuE;AACvE,sEAAgE;AAChE,8EAAuE;AACvE,gGAAyF;AACzF,8EAAwE;AACxE,kGAA2F;AAC3F,sFAAgF;AAChF,0EAAqE;AACrE,oFAA8E;AAC9E,0DAAsD;AACtD,0EAAqE;AACrE,kFAA6E;AAC7E,4DAAwD;AACxD,8DAA0D;AAC1D,gEAA4D;AAC5D,wEAAmE;AACnE,4EAAuE;AACvE,wEAAmE;AACnE,sEAAiE;AACjE,sEAAiE;AACjE,wDAAoD;AACpD,8EAAyE;AACzE,8EAAyE;AACzE,sEAAiE;AACjE,wEAAmE;AACnE,gEAA2D;AAC3D,wDAAoD;AACpD,kEAA6D;AAC7D,wEAAmE;AACnE,0DAAsD;AACtD,oFAA+E;AAC/E,oEAA+D;AAC/D,4DAAwD;A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QAClB,kDAAsB;QACtB,sCAAgB;KACnB;IACD,SAAS,EAAE,CAAC,4DAA2B,EAAE,0DAA0B,EAAE,8BAAa,EAAE,sBAAS,EAAE,+CAAqB,EAAE,qCAAgB,CAAC;IACvI,SAAS,EAAE,CAAC,qCAAgB,EAAE,yCAAkB,CAAC;IACjD,QAAQ,EAAE;QACN,2CAAmB;QACnB,2CAAmB;QACnB,8BAAa;QACb,gCAAc;QACd,8BAAa;QACb,kCAAe;QACf,iCAAc;QACd,wBAAU;QACV,yCAAkB;QAClB,uCAAiB;QACjB,0BAAW;QACX,0BAAW;QACX,0BAAW;QACX,4BAAY;QACZ,sCAAiB;QACjB,kCAAe;QACf,8BAAa;QACb,+CAAqB;QACrB,2CAAmB;QACnB,mCAAe;QACf,8BAAa;QACb,+CAAqB;KACxB;IACD,WAAW,EAAE;QACT,oCAAgB;QAChB,wCAAkB;QAClB,gDAAsB;QACtB,qDAAwB;QACxB,wDAAyB;QACzB,gEAA6B;QAC7B,oDAAuB;KAC1B;CACJ,CAAC;AAEF,kBAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"es6.classes.js","sourceRoot":"","sources":["../../src/system/es6.classes.ts"],"names":[],"mappings":";;AAAA,sEAAiE;AACjE,8EAAyE;AACzE,wEAAmE;AACnE,0EAAqE;AACrE,4EAAuE;AACvE,8EAAyE;AACzE,gFAA2E;AAC3E,kEAA6D;AAC7D,mEAA+D;AAC/D,mEAA+D;AAC/D,mEAA+D;AAC/D,iEAA6D;AAC7D,mEAA+D;AAC/D,+EAA2E;AAC3E,uEAAmE;AACnE,uEAAmE;AACnE,yFAAoF;AACpF,4EAAuE;AACvE,sEAAgE;AAChE,8EAAuE;AACvE,gGAAyF;AACzF,8EAAwE;AACxE,kGAA2F;AAC3F,kEAA4D;AAC5D,wEAAkE;AAClE,sFAAgF;AAChF,0EAAqE;AACrE,oFAA8E;AAC9E,0DAAsD;AACtD,0EAAqE;AACrE,kFAA6E;AAC7E,4DAAwD;AACxD,8DAA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B;QAClB,8BAAa;QACb,qCAAgB;QAChB,uCAAiB;QACjB,yCAAkB;QAClB,iCAAc;QACd,sDAAwB;QACxB,0CAAkB;QAClB,mCAAe;QACf,gDAAqB;QACrB,wDAAyB;QACzB,4CAAmB;QACnB,6CAAoB;QACpB,iDAAsB;KACzB;IACD,IAAI,EAAE;QACF,kDAAsB;QACtB,mCAAe;QACf,mCAAe;QACf,0BAAW;QACX,+CAAqB;QACrB,4CAAmB;QACnB,uCAAiB;QACjB,yCAAkB;QAClB,0CAAkB;QAClB,kDAAsB;QACtB,sCAAgB;KACnB;IACD,SAAS,EAAE,CAAC,4DAA2B,EAAE,0DAA0B,EAAE,8BAAa,EAAE,sBAAS,EAAE,+CAAqB,EAAE,qCAAgB,CAAC;IACvI,SAAS,EAAE,CAAC,qCAAgB,EAAE,yCAAkB,CAAC;IACjD,QAAQ,EAAE;QACN,6BAAY;QACZ,2CAAmB;QACnB,2CAAmB;QACnB,8BAAa;QACb,gCAAc;QACd,8BAAa;QACb,kCAAe;QACf,iCAAc;QACd,wBAAU;QACV,yCAAkB;QAClB,uCAAiB;QACjB,0BAAW;QACX,0BAAW;QACX,0BAAW;QACX,4BAAY;QACZ,sCAAiB;QACjB,kCAAe;QACf,8BAAa;QACb,+CAAqB;QACrB,2CAAmB;QACnB,mCAAe;QACf,8BAAa;QACb,+CAAqB;KACxB;IACD,WAAW,EAAE;QACT,oCAAgB;QAChB,wCAAkB;QAClB,gDAAsB;QACtB,qDAAwB;QACxB,wDAAyB;QACzB,gEAA6B;QAC7B,oDAAuB;KAC1B;CACJ,CAAC;AAEF,kBAAe,UAAU,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { S3ObjectInfoDto } from '../dtos/s3.object.info.dto';
2
+ export declare class AwsS3Service {
3
+ upload(params: any): Promise<string>;
4
+ getPublicUrl(bucket: string, key: string, expiresIn?: number): Promise<unknown>;
5
+ getObject(bucket: string, key: string): Promise<unknown>;
6
+ listObjects(bucket: string): Promise<unknown>;
7
+ moveObject(source: S3ObjectInfoDto, destination: S3ObjectInfoDto): Promise<unknown>;
8
+ copyObject(source: S3ObjectInfoDto, destination: S3ObjectInfoDto): Promise<unknown>;
9
+ dropObject(object: S3ObjectInfoDto): Promise<void>;
10
+ }
@@ -0,0 +1,96 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AwsS3Service = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const AWS = require("aws-sdk");
12
+ const s3Config = require("../../config/aws.config");
13
+ const s3 = new AWS.S3({
14
+ accessKeyId: s3Config.key,
15
+ secretAccessKey: s3Config.secret,
16
+ signatureVersion: 'v4',
17
+ region: 'ap-south-1',
18
+ });
19
+ let AwsS3Service = class AwsS3Service {
20
+ async upload(params) {
21
+ return new Promise((resolve, reject) => {
22
+ s3.upload(params, function (error, res) {
23
+ if (error)
24
+ return reject(error);
25
+ return resolve(res.Location);
26
+ });
27
+ });
28
+ }
29
+ async getPublicUrl(bucket, key, expiresIn = 3600) {
30
+ const params = { Bucket: bucket, Key: key, Expires: expiresIn };
31
+ return new Promise((resolve) => {
32
+ s3.getSignedUrl('getObject', params, function (err, data) {
33
+ if (err)
34
+ throw err;
35
+ resolve(data);
36
+ });
37
+ });
38
+ }
39
+ async getObject(bucket, key) {
40
+ const params = { Bucket: bucket, Key: key };
41
+ return new Promise((resolve) => {
42
+ s3.getObject(params, function (err, data) {
43
+ if (err)
44
+ console.log(err, err.stack);
45
+ resolve(data);
46
+ });
47
+ });
48
+ }
49
+ async listObjects(bucket) {
50
+ const params = { Bucket: bucket };
51
+ return new Promise((resolve) => {
52
+ s3.listObjects(params, function (err, data) {
53
+ if (err)
54
+ console.log(err, err.stack);
55
+ resolve(data);
56
+ });
57
+ });
58
+ }
59
+ async moveObject(source, destination) {
60
+ const response = await this.copyObject(source, destination);
61
+ await this.dropObject(source);
62
+ return response;
63
+ }
64
+ async copyObject(source, destination) {
65
+ const params = {
66
+ Bucket: destination.bucket,
67
+ CopySource: `${source.bucket}/${source.key}`,
68
+ Key: destination.key,
69
+ };
70
+ return new Promise((resolve) => {
71
+ s3.copyObject(params, function (err, data) {
72
+ if (err)
73
+ console.log(err, err.stack);
74
+ resolve(data);
75
+ });
76
+ });
77
+ }
78
+ async dropObject(object) {
79
+ const params = {
80
+ Bucket: object.bucket,
81
+ Key: object.key,
82
+ };
83
+ await new Promise((resolve) => {
84
+ s3.deleteObject(params, function (err, data) {
85
+ if (err)
86
+ console.log(err, err.stack);
87
+ resolve(data);
88
+ });
89
+ });
90
+ }
91
+ };
92
+ AwsS3Service = __decorate([
93
+ (0, common_1.Injectable)()
94
+ ], AwsS3Service);
95
+ exports.AwsS3Service = AwsS3Service;
96
+ //# sourceMappingURL=aws.s3.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws.s3.service.js","sourceRoot":"","sources":["../../../src/system/services/aws.s3.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAE5C,+BAA+B;AAC/B,oDAAoD;AAEpD,MAAM,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC;IAClB,WAAW,EAAE,QAAQ,CAAC,GAAG;IACzB,eAAe,EAAE,QAAQ,CAAC,MAAM;IAChC,gBAAgB,EAAE,IAAI;IACtB,MAAM,EAAE,YAAY;CACvB,CAAC,CAAC;AAGI,IAAM,YAAY,GAAlB,MAAM,YAAY;IACrB,KAAK,CAAC,MAAM,CAAC,MAAW;QACpB,OAA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AM;YACrB,GAAG,EAAE,MAAM,CAAC,GAAG;SAClB,CAAC;QAEF,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC1B,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,EAAE,IAAI;gBACvC,IAAI,GAAG;oBAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AArHY,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAqHxB;AArHY,oCAAY"}
@@ -1,3 +1,4 @@
1
+ export * from './aws.s3.service';
1
2
  export * from './business.rule.service';
2
3
  export * from './client.script.service';
3
4
  export * from './column.service';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./aws.s3.service"), exports);
17
18
  __exportStar(require("./business.rule.service"), exports);
18
19
  __exportStar(require("./client.script.service"), exports);
19
20
  __exportStar(require("./column.service"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,0DAAwC;AACxC,mDAAiC;AACjC,oDAAkC;AAClC,mDAAiC;AACjC,qDAAmC;AACnC,yDAAuC;AACvC,wDAAsC;AACtC,iDAA+B;AAC/B,iDAA+B;AAC/B,iDAA+B;AAC/B,kDAAgC;AAChC,uDAAqC;AACrC,qDAAmC;AACnC,mDAAiC;AACjC,4DAA0C;AAC1C,0DAAwC;AACxC,sDAAoC;AACpC,mDAAiC;AACjC,4DAA0C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,0DAAwC;AACxC,0DAAwC;AACxC,mDAAiC;AACjC,oDAAkC;AAClC,mDAAiC;AACjC,qDAAmC;AACnC,yDAAuC;AACvC,wDAAsC;AACtC,iDAA+B;AAC/B,iDAA+B;AAC/B,iDAA+B;AAC/B,kDAAgC;AAChC,uDAAqC;AACrC,qDAAmC;AACnC,mDAAiC;AACjC,4DAA0C;AAC1C,0DAAwC;AACxC,sDAAoC;AACpC,mDAAiC;AACjC,4DAA0C"}
@@ -1,6 +1,11 @@
1
1
  /// <reference types="multer" />
2
+ import { S3UploadOptionsDto } from '../dtos/s3.upload.options.dto';
2
3
  import { LocalFileS3UploadDto } from './../dtos/local.file.s3.upload.dto';
4
+ import { AwsS3Service } from './aws.s3.service';
3
5
  export declare class UploadService {
6
+ private readonly awsS3Service;
7
+ constructor(awsS3Service: AwsS3Service);
8
+ upload(file: Express.Multer.File, options?: S3UploadOptionsDto): Promise<string>;
4
9
  uploadFile(file: Express.Multer.File): Promise<string>;
5
10
  saveLocalFileOnS3(options: LocalFileS3UploadDto): Promise<string>;
6
11
  getParam(file: any): Promise<any>;
@@ -5,47 +5,45 @@ 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.UploadService = void 0;
10
13
  const common_1 = require("@nestjs/common");
11
- const AWS = require("aws-sdk");
12
14
  const fs_1 = require("fs");
13
15
  const s3Config = require("../../config/aws.config");
14
- const s3 = new AWS.S3({
15
- accessKeyId: s3Config.key,
16
- secretAccessKey: s3Config.secret,
17
- });
16
+ const aws_s3_service_1 = require("./aws.s3.service");
18
17
  let UploadService = class UploadService {
18
+ constructor(awsS3Service) {
19
+ this.awsS3Service = awsS3Service;
20
+ }
21
+ async upload(file, options = {}) {
22
+ const folder = options.folder || 'public';
23
+ const fileName = options.file || file.originalname;
24
+ const urlkey = `${folder}/${fileName}`;
25
+ const params = {
26
+ Body: file.buffer,
27
+ Bucket: options.bucket || s3Config.bucket,
28
+ Key: urlkey,
29
+ ACL: options.acl || 'public-read',
30
+ };
31
+ return this.awsS3Service.upload(params);
32
+ }
19
33
  async uploadFile(file) {
20
34
  const params = await this.getParam(file);
21
- return s3
22
- .upload(params)
23
- .promise()
24
- .then((res) => {
25
- return res.Location;
26
- }, (err) => {
27
- return err.code;
28
- });
35
+ return this.awsS3Service.upload(params);
29
36
  }
30
37
  async saveLocalFileOnS3(options) {
31
38
  const file = options.local_file.split('/').at(-1);
32
- return new Promise((resolve, reject) => {
33
- (0, fs_1.readFile)(options.local_file, (err, data) => {
34
- if (err)
35
- throw err;
36
- const params = {
37
- Bucket: options.bucket,
38
- Key: file,
39
- Body: data,
40
- ACL: options.visibility || 'private',
41
- };
42
- s3.upload(params, function (error, res) {
43
- if (error)
44
- return reject(error);
45
- return resolve(res.Location);
46
- });
47
- });
48
- });
39
+ const buffer = (0, fs_1.readFileSync)(options.local_file);
40
+ const params = {
41
+ Bucket: options.bucket,
42
+ Key: file,
43
+ Body: buffer,
44
+ ACL: options.visibility || 'private',
45
+ };
46
+ return this.awsS3Service.upload(params);
49
47
  }
50
48
  async getParam(file) {
51
49
  const urlkey = `public/${file.originalname}`;
@@ -58,7 +56,8 @@ let UploadService = class UploadService {
58
56
  }
59
57
  };
60
58
  UploadService = __decorate([
61
- (0, common_1.Injectable)()
59
+ (0, common_1.Injectable)(),
60
+ __metadata("design:paramtypes", [aws_s3_service_1.AwsS3Service])
62
61
  ], UploadService);
63
62
  exports.UploadService = UploadService;
64
63
  //# sourceMappingURL=upload.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload.service.js","sourceRoot":"","sources":["../../../src/system/services/upload.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,+BAA+B;AAC/B,2BAA8B;AAC9B,oDAAoD;AAGpD,MAAM,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC;IAClB,WAAW,EAAE,QAAQ,CAAC,GAAG;IACzB,eAAe,EAAE,QAAQ,CAAC,MAAM;CACnC,CAAC,CAAC;AAGI,IAAM,aAAa,GAAnB,MAAM,aAAa;IACtB,KAAK,CAAC,UAAU,CAAC,IAAyB;QACtC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEzC,OAAO,EAAE;aACJ,MAAM,CAAC,MAAM,CAAC;aACd,OAAO,EAAE;aACT,IAAI,CAED,CAAC,GAAG,EAAE,EAAE;YACJ,OAAO,GAAG,CAAC,QAAQ,CAAC;QACxB,CAAC,EACD,CAAC,GAAG,EAAE,EAAE;YACJ,OAAO,GAAG,CAAC,IAAI,CAAC;QACpB,CAAC,CACJ,CAAC;IACV,CAAC;IAQD,KAAK,CAAC,iBAAiB,CAAC,OAA6B;QACjD,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAElD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,IAAA,aAAQ,EAAC,OAAO,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;gBACvC,IAAI,GAAG;oBAAE,MAAM,GAAG,CAAC;gBAEnB,MAAM,MAAM,GAAG;oBACX,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,GAAG,EAAE,IAAI;oBACT,IAAI,EAAE,IAAI;o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B;AA7DY,sCAAa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicelabsco/nestjs-utility-services",
3
- "version": "1.1.30",
3
+ "version": "1.1.32",
4
4
  "description": "NestJS generic packages to support development",
5
5
  "author": "Hemant Kumar Sah <hemantanshu@gmail.com>",
6
6
  "license": "MIT",