@maioradv/nestjs-core 1.5.6 → 1.5.8

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.
@@ -5,7 +5,5 @@ export type CompressionOptions = {
5
5
  quality?: number;
6
6
  };
7
7
  export declare class ImageCompressionPipe implements PipeTransform<Express.Multer.File, Promise<Express.Multer.File>> {
8
- private readonly options;
9
- constructor(options?: CompressionOptions);
10
8
  transform(file: Express.Multer.File, metadata: ArgumentMetadata): Promise<Express.Multer.File>;
11
9
  }
@@ -5,9 +5,6 @@ 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
- };
11
8
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
9
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
10
  };
@@ -17,15 +14,12 @@ const common_1 = require("@nestjs/common");
17
14
  const path_1 = require("path");
18
15
  const sharp_1 = __importDefault(require("sharp"));
19
16
  let ImageCompressionPipe = class ImageCompressionPipe {
20
- //private readonly logger = LoggerFactory(this.constructor.name);
21
- constructor(options = {}) {
22
- this.options = options;
23
- }
17
+ //constructor(private readonly options?:CompressionOptions){}
24
18
  async transform(file, metadata) {
25
19
  try {
26
20
  const [resolutionCap, quality] = [
27
- this.options.resolutionCap ?? 2560,
28
- this.options.quality ?? 70
21
+ 2560, //this.options?.resolutionCap ?? 2560,
22
+ 70 //this.options?.quality ?? 70
29
23
  ];
30
24
  const compressedBuffer = await (0, sharp_1.default)(file.buffer, { failOn: 'error' })
31
25
  .resize({
@@ -45,15 +39,11 @@ let ImageCompressionPipe = class ImageCompressionPipe {
45
39
  return file;
46
40
  }
47
41
  catch (error) {
48
- /*const {buffer,stream, ...log} = file
49
- this.logger.error(log)
50
- this.logger.error(error)*/
51
42
  throw new common_1.BadRequestException(`Error processing the image: ${error?.message}`);
52
43
  }
53
44
  }
54
45
  };
55
46
  exports.ImageCompressionPipe = ImageCompressionPipe;
56
47
  exports.ImageCompressionPipe = ImageCompressionPipe = __decorate([
57
- (0, common_1.Injectable)(),
58
- __metadata("design:paramtypes", [Object])
48
+ (0, common_1.Injectable)()
59
49
  ], ImageCompressionPipe);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maioradv/nestjs-core",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "description": "NestJS helpers by MaiorADV",
5
5
  "repository": "https://github.com/maioradv/nestjs-core.git",
6
6
  "author": "Maior ADV Srl",