@servicelabsco/nestjs-utility-services 1.1.36 → 1.1.37

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 (28) hide show
  1. package/dist/migrations/1675876187420-AddIsEncryptedSysPropertiesTable.ts.d.ts +5 -0
  2. package/dist/migrations/1675876187420-AddIsEncryptedSysPropertiesTable.ts.js +15 -0
  3. package/dist/migrations/1675876187420-AddIsEncryptedSysPropertiesTable.ts.js.map +1 -0
  4. package/dist/system/dtos/file.upload.spec.dto.d.ts +9 -0
  5. package/dist/system/dtos/file.upload.spec.dto.js +7 -0
  6. package/dist/system/dtos/file.upload.spec.dto.js.map +1 -0
  7. package/dist/system/dtos/index.d.ts +1 -0
  8. package/dist/system/dtos/index.js +1 -0
  9. package/dist/system/dtos/index.js.map +1 -1
  10. package/dist/system/entities/property.entity.d.ts +1 -0
  11. package/dist/system/entities/property.entity.js +4 -0
  12. package/dist/system/entities/property.entity.js.map +1 -1
  13. package/dist/system/jobs/index.d.ts +1 -0
  14. package/dist/system/jobs/index.js +1 -0
  15. package/dist/system/jobs/index.js.map +1 -1
  16. package/dist/system/jobs/property.job.js +5 -1
  17. package/dist/system/jobs/property.job.js.map +1 -1
  18. package/dist/system/jobs/refresh.property.cache.job.d.ts +10 -0
  19. package/dist/system/jobs/refresh.property.cache.job.js +44 -0
  20. package/dist/system/jobs/refresh.property.cache.job.js.map +1 -0
  21. package/dist/system/services/property.service.js +9 -10
  22. package/dist/system/services/property.service.js.map +1 -1
  23. package/dist/system/services/upload.service.d.ts +3 -3
  24. package/dist/system/services/upload.service.js.map +1 -1
  25. package/dist/system/subscribers/property.subscriber.d.ts +2 -0
  26. package/dist/system/subscribers/property.subscriber.js +9 -0
  27. package/dist/system/subscribers/property.subscriber.js.map +1 -1
  28. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ import { MigrationUtility } from '../common';
2
+ export declare class AddIsEncryptedSysPropertiesTable1675876187420 extends MigrationUtility {
3
+ constructor();
4
+ process(): void;
5
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AddIsEncryptedSysPropertiesTable1675876187420 = void 0;
4
+ const common_1 = require("../common");
5
+ class AddIsEncryptedSysPropertiesTable1675876187420 extends common_1.MigrationUtility {
6
+ constructor() {
7
+ super('sys_properties');
8
+ this.process();
9
+ }
10
+ process() {
11
+ this.boolean('is_encrypted', false);
12
+ }
13
+ }
14
+ exports.AddIsEncryptedSysPropertiesTable1675876187420 = AddIsEncryptedSysPropertiesTable1675876187420;
15
+ //# sourceMappingURL=1675876187420-AddIsEncryptedSysPropertiesTable.ts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1675876187420-AddIsEncryptedSysPropertiesTable.ts.js","sourceRoot":"","sources":["../../src/migrations/1675876187420-AddIsEncryptedSysPropertiesTable.ts.ts"],"names":[],"mappings":";;;AAAA,sCAA6C;AAE7C,MAAa,6CAA8C,SAAQ,yBAAgB;IAC/E;QACI,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACxB,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;IAED,OAAO;QACH,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;CACJ;AATD,sGASC"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="node" />
2
+ export declare class FileUploadSpecDto {
3
+ originalname?: string;
4
+ filename: string;
5
+ path?: string;
6
+ buffer: Buffer;
7
+ encoding?: string;
8
+ size?: number;
9
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileUploadSpecDto = void 0;
4
+ class FileUploadSpecDto {
5
+ }
6
+ exports.FileUploadSpecDto = FileUploadSpecDto;
7
+ //# sourceMappingURL=file.upload.spec.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.upload.spec.dto.js","sourceRoot":"","sources":["../../../src/system/dtos/file.upload.spec.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,iBAAiB;CAO7B;AAPD,8CAOC"}
@@ -1,4 +1,5 @@
1
1
  export * from './document.attributes.dto';
2
+ export * from './file.upload.spec.dto';
2
3
  export * from './job.record.param.dto';
3
4
  export * from './local.file.s3.upload.dto';
4
5
  export * from './menu.list.preference.creation.dto';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./document.attributes.dto"), exports);
18
+ __exportStar(require("./file.upload.spec.dto"), exports);
18
19
  __exportStar(require("./job.record.param.dto"), exports);
19
20
  __exportStar(require("./local.file.s3.upload.dto"), exports);
20
21
  __exportStar(require("./menu.list.preference.creation.dto"), exports);
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/dtos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,yDAAuC;AACvC,yDAAuC;AACvC,6DAA2C;AAC3C,sEAAoD;AACpD,6DAA2C;AAC3C,uEAAqD;AACrD,uDAAqC;AACrC,0DAAwC;AACxC,iEAA+C"}
@@ -3,5 +3,6 @@ export declare class PropertyEntity extends CommonEntity {
3
3
  name: string;
4
4
  value: string;
5
5
  is_caching_enabled: boolean;
6
+ is_encrypted: boolean;
6
7
  description: string;
7
8
  }
@@ -29,6 +29,10 @@ __decorate([
29
29
  (0, typeorm_1.Column)(),
30
30
  __metadata("design:type", Boolean)
31
31
  ], PropertyEntity.prototype, "is_caching_enabled", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.Column)(),
34
+ __metadata("design:type", Boolean)
35
+ ], PropertyEntity.prototype, "is_encrypted", void 0);
32
36
  __decorate([
33
37
  (0, class_validator_1.IsNotEmpty)(),
34
38
  (0, typeorm_1.Column)(),
@@ -1 +1 @@
1
- {"version":3,"file":"property.entity.js","sourceRoot":"","sources":["../../../src/system/entities/property.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA6C;AAC7C,qCAAyC;AACzC,wEAAoE;AAS7D,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,4BAAY;CAO/C,CAAA;AANG;IAAC,IAAA,4BAAU,GAAE;IAAE,IAAA,gBAAM,GAAE;;4CAAc;AACrC;IAAC,IAAA,4BAAU,GAAE;IAAE,IAAA,gBAAM,GAAE;;6CAAe;AACtC;IAAC,IAAA,gBAAM,GAAE;;0DAA6B;AACtC;IAAC,IAAA,4BAAU,GAAE;IAAE,IAAA,gBAAM,GAAE;;mDAAqB;AAJnC,cAAc;IAD1B,IAAA,gBAAM,EAAC,gBAAgB,CAAC;GACZ,cAAc,CAO1B;AAPY,wCAAc"}
1
+ {"version":3,"file":"property.entity.js","sourceRoot":"","sources":["../../../src/system/entities/property.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA6C;AAC7C,qCAAyC;AACzC,wEAAoE;AAS7D,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,4BAAY;CAQ/C,CAAA;AAPG;IAAC,IAAA,4BAAU,GAAE;IAAE,IAAA,gBAAM,GAAE;;4CAAc;AACrC;IAAC,IAAA,4BAAU,GAAE;IAAE,IAAA,gBAAM,GAAE;;6CAAe;AACtC;IAAC,IAAA,gBAAM,GAAE;;0DAA6B;AACtC;IAAC,IAAA,gBAAM,GAAE;;oDAAuB;AAChC;IAAC,IAAA,4BAAU,GAAE;IAAE,IAAA,gBAAM,GAAE;;mDAAqB;AALnC,cAAc;IAD1B,IAAA,gBAAM,EAAC,gBAAgB,CAAC;GACZ,cAAc,CAQ1B;AARY,wCAAc"}
@@ -2,6 +2,7 @@ export * from './clean.scheduled.event.job';
2
2
  export * from './column.mapper.job';
3
3
  export * from './model.scanner.job';
4
4
  export * from './property.job';
5
+ export * from './refresh.property.cache.job';
5
6
  export * from './relationship.mapper.job';
6
7
  export * from './report.column.sync.job';
7
8
  export * from './scheduled.event.job';
@@ -18,6 +18,7 @@ __exportStar(require("./clean.scheduled.event.job"), exports);
18
18
  __exportStar(require("./column.mapper.job"), exports);
19
19
  __exportStar(require("./model.scanner.job"), exports);
20
20
  __exportStar(require("./property.job"), exports);
21
+ __exportStar(require("./refresh.property.cache.job"), exports);
21
22
  __exportStar(require("./relationship.mapper.job"), exports);
22
23
  __exportStar(require("./report.column.sync.job"), exports);
23
24
  __exportStar(require("./scheduled.event.job"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/jobs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,sDAAoC;AACpC,sDAAoC;AACpC,iDAA+B;AAC/B,4DAA0C;AAC1C,2DAAyC;AACzC,wDAAsC;AACtC,yDAAuC;AACvC,0DAAwC;AACxC,8DAA4C;AAC5C,wDAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/jobs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,sDAAoC;AACpC,sDAAoC;AACpC,iDAA+B;AAC/B,+DAA6C;AAC7C,4DAA0C;AAC1C,2DAAyC;AACzC,wDAAsC;AACtC,yDAAuC;AACvC,0DAAwC;AACxC,8DAA4C;AAC5C,wDAAsC"}
@@ -15,6 +15,7 @@ const common_2 = require("../../common");
15
15
  const platformUtility_1 = require("../../platformUtility");
16
16
  const cache_service_1 = require("../../platformUtility/services/cache.service");
17
17
  const date_util_1 = require("../../common/libraries/date.util");
18
+ const custom_crypt_1 = require("../../common/libraries/custom.crypt");
18
19
  let PropertyJob = class PropertyJob extends common_2.CommonJob {
19
20
  constructor(queueService, cacheService) {
20
21
  super();
@@ -25,7 +26,10 @@ let PropertyJob = class PropertyJob extends common_2.CommonJob {
25
26
  const entity = event.entity;
26
27
  if (!entity.is_caching_enabled)
27
28
  return;
28
- return this.cacheService.set(`property.${entity.name}`, entity.value, date_util_1.DateUtil.getFutureDateTime(15));
29
+ let value = entity.value;
30
+ if (entity.is_encrypted)
31
+ value = custom_crypt_1.CustomCrypt.decrypt(value);
32
+ return this.cacheService.set(`property.${entity.name}`, value, date_util_1.DateUtil.getFutureDateTime(15));
29
33
  }
30
34
  };
31
35
  PropertyJob = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"property.job.js","sourceRoot":"","sources":["../../../src/system/jobs/property.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yCAA2D;AAC3D,2DAAqD;AAErD,gFAA4E;AAC5E,gEAA4D;AASrD,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,kBAAS;IAOtC,YAA+B,YAA0B,EAAmB,YAA0B;QAClG,KAAK,EAAE,CAAC;QADmB,iBAAY,GAAZ,YAAY,CAAc;QAAmB,iBAAY,GAAZ,YAAY,CAAc;IAEtG,CAAC;IAQD,KAAK,CAAC,MAAM,CAAC,KAAuC;QAChD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAE5B,IAAI,CAAC,MAAM,CAAC,kBAAkB;YAAE,OAAO;QAEvC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,KAAK,EAAE,oBAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1G,CAAC;CACJ,CAAA;AAxBY,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAQoC,8BAAY,EAAiC,4BAAY;GAP7F,WAAW,CAwBvB;AAxBY,kCAAW"}
1
+ {"version":3,"file":"property.job.js","sourceRoot":"","sources":["../../../src/system/jobs/property.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yCAA2D;AAC3D,2DAAqD;AAErD,gFAA4E;AAC5E,gEAA4D;AAC5D,sEAAkE;AAS3D,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,kBAAS;IAOtC,YAA+B,YAA0B,EAAmB,YAA0B;QAClG,KAAK,EAAE,CAAC;QADmB,iBAAY,GAAZ,YAAY,CAAc;QAAmB,iBAAY,GAAZ,YAAY,CAAc;IAEtG,CAAC;IAQD,KAAK,CAAC,MAAM,CAAC,KAAuC;QAChD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAE5B,IAAI,CAAC,MAAM,CAAC,kBAAkB;YAAE,OAAO;QAEvC,IAAI,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QACzB,IAAI,MAAM,CAAC,YAAY;YAAE,KAAK,GAAG,0BAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE5D,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,oBAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;IACnG,CAAC;CACJ,CAAA;AA3BY,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAQoC,8BAAY,EAAiC,4BAAY;GAP7F,WAAW,CA2BvB;AA3BY,kCAAW"}
@@ -0,0 +1,10 @@
1
+ import { CommonJob } from '../../common';
2
+ import { QueueService } from '../../platformUtility';
3
+ import { CacheService } from '../../platformUtility/services/cache.service';
4
+ export declare class RefreshPropertyCacheJob extends CommonJob {
5
+ protected readonly queueService: QueueService;
6
+ private readonly cacheService;
7
+ constructor(queueService: QueueService, cacheService: CacheService);
8
+ handle(): Promise<void>;
9
+ private setCache;
10
+ }
@@ -0,0 +1,44 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RefreshPropertyCacheJob = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const common_2 = require("../../common");
15
+ const custom_crypt_1 = require("../../common/libraries/custom.crypt");
16
+ const date_util_1 = require("../../common/libraries/date.util");
17
+ const platformUtility_1 = require("../../platformUtility");
18
+ const cache_service_1 = require("../../platformUtility/services/cache.service");
19
+ const property_entity_1 = require("../entities/property.entity");
20
+ let RefreshPropertyCacheJob = class RefreshPropertyCacheJob extends common_2.CommonJob {
21
+ constructor(queueService, cacheService) {
22
+ super();
23
+ this.queueService = queueService;
24
+ this.cacheService = cacheService;
25
+ }
26
+ async handle() {
27
+ const records = await property_entity_1.PropertyEntity.find({ where: { is_caching_enabled: true } });
28
+ for (const record of records)
29
+ await this.setCache(record);
30
+ }
31
+ async setCache(property) {
32
+ const index = `property.${property.name}`;
33
+ let value = property.value;
34
+ if (property.is_encrypted)
35
+ value = custom_crypt_1.CustomCrypt.decrypt(value);
36
+ await this.cacheService.set(index, value, date_util_1.DateUtil.getFutureDateTime(15));
37
+ }
38
+ };
39
+ RefreshPropertyCacheJob = __decorate([
40
+ (0, common_1.Injectable)(),
41
+ __metadata("design:paramtypes", [platformUtility_1.QueueService, cache_service_1.CacheService])
42
+ ], RefreshPropertyCacheJob);
43
+ exports.RefreshPropertyCacheJob = RefreshPropertyCacheJob;
44
+ //# sourceMappingURL=refresh.property.cache.job.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh.property.cache.job.js","sourceRoot":"","sources":["../../../src/system/jobs/refresh.property.cache.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yCAAyC;AACzC,sEAAkE;AAClE,gEAA4D;AAC5D,2DAAqD;AACrD,gFAA4E;AAC5E,iEAA6D;AAEtD,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,kBAAS;IAClD,YAA+B,YAA0B,EAAmB,YAA0B;QAClG,KAAK,EAAE,CAAC;QADmB,iBAAY,GAAZ,YAAY,CAAc;QAAmB,iBAAY,GAAZ,YAAY,CAAc;IAEtG,CAAC;IACD,KAAK,CAAC,MAAM;QACR,MAAM,OAAO,GAAG,MAAM,gCAAc,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QAEnF,KAAK,MAAM,MAAM,IAAI,OAAO;YAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9D,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,QAAwB;QAC3C,MAAM,KAAK,GAAG,YAAY,QAAQ,CAAC,IAAI,EAAE,CAAC;QAE1C,IAAI,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC3B,IAAI,QAAQ,CAAC,YAAY;YAAE,KAAK,GAAG,0BAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE9D,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,oBAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9E,CAAC;CACJ,CAAA;AAlBY,uBAAuB;IADnC,IAAA,mBAAU,GAAE;qCAEoC,8BAAY,EAAiC,4BAAY;GAD7F,uBAAuB,CAkBnC;AAlBY,0DAAuB"}
@@ -14,6 +14,8 @@ const common_1 = require("@nestjs/common");
14
14
  const cache_service_1 = require("../../platformUtility/services/cache.service");
15
15
  const date_util_1 = require("../../common/libraries/date.util");
16
16
  const property_entity_1 = require("../entities/property.entity");
17
+ const custom_crypt_1 = require("../../common/libraries/custom.crypt");
18
+ const class_transformer_1 = require("class-transformer");
17
19
  let PropertyService = class PropertyService {
18
20
  constructor(cacheService) {
19
21
  this.cacheService = cacheService;
@@ -27,23 +29,20 @@ let PropertyService = class PropertyService {
27
29
  const property = await property_entity_1.PropertyEntity.findOne({ where: { name: key } });
28
30
  if (!property)
29
31
  return defaultValue;
32
+ let pValue = property.value;
33
+ if (property.is_encrypted)
34
+ pValue = custom_crypt_1.CustomCrypt.decrypt(pValue);
30
35
  if (property.is_caching_enabled) {
31
- await this.cacheService.set(index, property.value, date_util_1.DateUtil.getFutureDateTime(15));
36
+ await this.cacheService.set(index, pValue, date_util_1.DateUtil.getFutureDateTime(15));
32
37
  }
33
- return property.value;
38
+ return pValue;
34
39
  }
35
40
  async set(property) {
36
- var _a;
37
41
  const record = await property_entity_1.PropertyEntity.firstOrNew({
38
42
  name: property.name,
39
43
  });
40
- record.value = property.value;
41
- record.is_caching_enabled = (_a = property.is_caching_enabled) !== null && _a !== void 0 ? _a : true;
42
- await record.save();
43
- if (record && record.is_caching_enabled) {
44
- await this.cacheService.set(`property.${property.name}`, property.value, date_util_1.DateUtil.getFutureDateTime(15));
45
- }
46
- return record;
44
+ const r = (0, class_transformer_1.plainToClassFromExist)(record, property, { exposeUnsetFields: false });
45
+ return r.save();
47
46
  }
48
47
  };
49
48
  PropertyService = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"property.service.js","sourceRoot":"","sources":["../../../src/system/services/property.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,gFAA4E;AAC5E,gEAA4D;AAC5D,iEAA6D;AAQtD,IAAM,eAAe,GAArB,MAAM,eAAe;IAM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,CAAC,KAAK,EAAE,MAAM,EAAE,oBAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;SAC9E;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAQD,KAAK,CAAC,GAAG,CAAC,QAAuC;QAC7C,MAAM,MAAM,GAAG,MAAM,gCAAc,CAAC,UAAU,CAAC;YAC3C,IAAI,EAAE,QAAQ,CAAC,IAAI;SACtB,CAAC,CAAC;QAEH,MAAM,CAAC,GAAG,IAAA,yCAAqB,EAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,CAAC;QAEhF,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;CACJ,CAAA;AApDY,eAAe;IAD3B,IAAA,mBAAU,GAAE;qCAOkC,4BAAY;GAN9C,eAAe,CAoD3B;AApDY,0CAAe"}
@@ -1,12 +1,12 @@
1
- /// <reference types="multer" />
2
1
  import { S3UploadOptionsDto } from '../dtos/s3.upload.options.dto';
3
2
  import { LocalFileS3UploadDto } from './../dtos/local.file.s3.upload.dto';
4
3
  import { AwsS3Service } from './aws.s3.service';
4
+ import { FileUploadSpecDto } from '../dtos/file.upload.spec.dto';
5
5
  export declare class UploadService {
6
6
  private readonly awsS3Service;
7
7
  constructor(awsS3Service: AwsS3Service);
8
- upload(file: Partial<Express.Multer.File>, options?: S3UploadOptionsDto): Promise<string>;
9
- uploadFile(file: Partial<Express.Multer.File>): Promise<string>;
8
+ upload(file: FileUploadSpecDto, options?: S3UploadOptionsDto): Promise<string>;
9
+ uploadFile(file: FileUploadSpecDto): Promise<string>;
10
10
  saveLocalFileOnS3(options: LocalFileS3UploadDto): Promise<string>;
11
11
  getParam(file: any): Promise<any>;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"upload.service.js","sourceRoot":"","sources":["../../../src/system/services/upload.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2BAAkC;AAClC,oDA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CAAC;IAC5C,CAAC;IAQD,KAAK,CAAC,UAAU,CAAC,IAAuB;QACpC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,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,MAAM,MAAM,GAAG,IAAA,iBAAY,EAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAEhD,MAAM,MAAM,GAAG;YACX,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,MAAM;YACZ,GAAG,EAAE,OAAO,CAAC,UAAU,IAAI,SAAS;SACvC,CAAC;QAEF,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,IAAS;QACpB,MAAM,MAAM,GAAG,UAAU,IAAI,CAAC,YAAY,EAAE,CAAC;QAC7C,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,MAAM;YACjB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,aAAa;SACrB,CAAC;IACN,CAAC;CACJ,CAAA;AApEY,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAEkC,6BAAY;GAD9C,aAAa,CAoEzB;AApEY,sCAAa"}
@@ -7,6 +7,8 @@ export declare class PropertySubscriber extends CommonSubscriber<PropertyEntity>
7
7
  private readonly propertyJob;
8
8
  constructor(dataSource: DataSource, propertyJob: PropertyJob);
9
9
  listenTo(): typeof PropertyEntity;
10
+ beforeInsert(event: InsertEvent<PropertyEntity>): Promise<void>;
10
11
  afterInsert(event: InsertEvent<PropertyEntity>): Promise<any>;
12
+ beforeUpdate(event: UpdateEvent<PropertyEntity>): Promise<void>;
11
13
  afterUpdate(event: UpdateEvent<PropertyEntity>): Promise<any>;
12
14
  }
@@ -14,6 +14,7 @@ const typeorm_1 = require("typeorm");
14
14
  const common_1 = require("../../common");
15
15
  const entities_1 = require("../entities");
16
16
  const property_job_1 = require("../jobs/property.job");
17
+ const custom_crypt_1 = require("../../common/libraries/custom.crypt");
17
18
  let PropertySubscriber = class PropertySubscriber extends common_1.CommonSubscriber {
18
19
  constructor(dataSource, propertyJob) {
19
20
  super();
@@ -24,9 +25,17 @@ let PropertySubscriber = class PropertySubscriber extends common_1.CommonSubscri
24
25
  listenTo() {
25
26
  return entities_1.PropertyEntity;
26
27
  }
28
+ async beforeInsert(event) {
29
+ if (event.entity.is_encrypted)
30
+ event.entity.value = custom_crypt_1.CustomCrypt.encrypt(event.entity.value);
31
+ }
27
32
  async afterInsert(event) {
28
33
  return this.propertyJob.dispatch(this.getInsertEventData(event));
29
34
  }
35
+ async beforeUpdate(event) {
36
+ if (event.entity.is_encrypted && event.entity.value !== event.databaseEntity.value)
37
+ event.entity.value = custom_crypt_1.CustomCrypt.encrypt(event.entity.value);
38
+ }
30
39
  async afterUpdate(event) {
31
40
  return this.propertyJob.dispatch(this.getUpdateEventData(event));
32
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"property.subscriber.js","sourceRoot":"","sources":["../../../src/system/subscribers/property.subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgF;AAChF,yCAAgD;AAChD,0CAA6C;AAC7C,uDAAmD;AAE5C,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,yBAAgC;IACpE,YAA6B,UAAsB,EAAmB,WAAwB;QAC1F,KAAK,EAAE,CAAC;QADiB,eAAU,GAAV,UAAU,CAAY;QAAmB,gBAAW,GAAX,WAAW,CAAa;QAE1F,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IACD,QAAQ;QACJ,OAAO,yBAAc,CAAC;IAC1B,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,KAAkC;QAChD,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,KAAkC;QAChD,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC;CACJ,CAAA;AAdY,kBAAkB;IAD9B,IAAA,yBAAe,GAAE;qCAE2B,oBAAU,EAAgC,0BAAW;GADrF,kBAAkB,CAc9B;AAdY,gDAAkB"}
1
+ {"version":3,"file":"property.subscriber.js","sourceRoot":"","sources":["../../../src/system/subscribers/property.subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgF;AAChF,yCAAgD;AAChD,0CAA6C;AAC7C,uDAAmD;AACnD,sEAAkE;AAE3D,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,yBAAgC;IACpE,YAA6B,UAAsB,EAAmB,WAAwB;QAC1F,KAAK,EAAE,CAAC;QADiB,eAAU,GAAV,UAAU,CAAY;QAAmB,gBAAW,GAAX,WAAW,CAAa;QAE1F,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IACD,QAAQ;QACJ,OAAO,yBAAc,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,KAAkC;QACjD,IAAI,KAAK,CAAC,MAAM,CAAC,YAAY;YAAE,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,0BAAW,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChG,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAkC;QAChD,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,KAAkC;QACjD,IAAI,KAAK,CAAC,MAAM,CAAC,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,cAAc,CAAC,KAAK;YAC9E,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,0BAAW,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAkC;QAChD,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC;CACJ,CAAA;AAzBY,kBAAkB;IAD9B,IAAA,yBAAe,GAAE;qCAE2B,oBAAU,EAAgC,0BAAW;GADrF,kBAAkB,CAyB9B;AAzBY,gDAAkB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicelabsco/nestjs-utility-services",
3
- "version": "1.1.36",
3
+ "version": "1.1.37",
4
4
  "description": "NestJS generic packages to support development",
5
5
  "author": "Hemant Kumar Sah <hemantanshu@gmail.com>",
6
6
  "license": "MIT",