@builderbot/bot 1.1.2-alpha.2 → 1.1.2-alpha.3

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/index.cjs CHANGED
@@ -15,7 +15,6 @@ var require$$0$5 = require('os');
15
15
  var path = require('path');
16
16
  var ffmpegInstaller = require('@ffmpeg-installer/ffmpeg');
17
17
  var ffmpeg = require('fluent-ffmpeg');
18
- var sharp = require('sharp');
19
18
  var require$$4$2 = require('net');
20
19
  var require$$0$7 = require('events');
21
20
  var require$$3$2 = require('zlib');
@@ -13778,34 +13777,43 @@ const convertAudio = async (filePath, format = 'opus') => {
13778
13777
  };
13779
13778
 
13780
13779
  /**
13781
- * Agregar un borde alrededor para mejorar la lectura de QR
13782
- * @param FROM - La ruta del archivo de imagen a limpiar
13783
- * @returns Una promesa que se resuelve cuando la imagen ha sido procesada
13780
+ * Add a border around to improve QR readability
13781
+ * @param FROM - The path of the image file to clean up
13782
+ * @returns A promise to be resolved when the image has been processed
13784
13783
  */
13785
13784
  const cleanImage = async (FROM = null) => {
13786
13785
  if (!FROM) {
13787
- throw new Error('No se proporcionó una ruta de archivo válida.');
13786
+ throw new Error('A valid file path was not provided.');
13788
13787
  }
13789
13788
  const readBuffer = async () => {
13790
13789
  const data = await require$$3$1.promises.readFile(FROM);
13791
13790
  return Buffer.from(data);
13792
13791
  };
13793
13792
  const imgBuffer = await readBuffer();
13794
- return new Promise((resolve, reject) => {
13795
- sharp(imgBuffer)
13796
- .extend({
13797
- top: 15,
13798
- bottom: 15,
13799
- left: 15,
13800
- right: 15,
13801
- background: { r: 255, g: 255, b: 255, alpha: 1 },
13802
- })
13803
- .toFile(FROM, (err) => {
13804
- if (err)
13805
- reject(err);
13806
- resolve();
13793
+ try {
13794
+ return new Promise((resolve, reject) => {
13795
+ import('sharp').then(({ default: sharp }) => {
13796
+ sharp(imgBuffer)
13797
+ .extend({
13798
+ top: 15,
13799
+ bottom: 15,
13800
+ left: 15,
13801
+ right: 15,
13802
+ background: { r: 255, g: 255, b: 255, alpha: 1 },
13803
+ })
13804
+ .toFile(FROM, (err) => {
13805
+ if (err)
13806
+ reject(err);
13807
+ resolve();
13808
+ });
13809
+ });
13807
13810
  });
13808
- });
13811
+ }
13812
+ catch (e) {
13813
+ console.log(`******** npm install sharp *******`);
13814
+ console.log(`Error:`, e);
13815
+ return Promise.reject(e);
13816
+ }
13809
13817
  };
13810
13818
 
13811
13819
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Agregar un borde alrededor para mejorar la lectura de QR
3
- * @param FROM - La ruta del archivo de imagen a limpiar
4
- * @returns Una promesa que se resuelve cuando la imagen ha sido procesada
2
+ * Add a border around to improve QR readability
3
+ * @param FROM - The path of the image file to clean up
4
+ * @returns A promise to be resolved when the image has been processed
5
5
  */
6
6
  declare const cleanImage: (FROM?: string | null) => Promise<void>;
7
7
  export { cleanImage };
@@ -1 +1 @@
1
- {"version":3,"file":"cleanImage.d.ts","sourceRoot":"","sources":["../../src/utils/cleanImage.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,QAAA,MAAM,UAAU,UAAgB,MAAM,GAAG,IAAI,KAAU,QAAQ,IAAI,CA0BlE,CAAA;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
1
+ {"version":3,"file":"cleanImage.d.ts","sourceRoot":"","sources":["../../src/utils/cleanImage.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,QAAA,MAAM,UAAU,UAAgB,MAAM,GAAG,IAAI,KAAU,QAAQ,IAAI,CAkClE,CAAA;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builderbot/bot",
3
- "version": "1.1.2-alpha.2",
3
+ "version": "1.1.2-alpha.3",
4
4
  "description": "core typescript",
5
5
  "author": "Leifer Mendez <leifer33@gmail.com>",
6
6
  "homepage": "https://github.com/codigoencasa/bot-whatsapp#readme",
@@ -57,8 +57,10 @@
57
57
  "follow-redirects": "^1.15.6",
58
58
  "mime-types": "^2.1.35",
59
59
  "picocolors": "^1.0.0",
60
- "polka": "^0.5.2",
60
+ "polka": "^0.5.2"
61
+ },
62
+ "optionalDependencies": {
61
63
  "sharp": "0.33.3"
62
64
  },
63
- "gitHead": "b6406a8d2139532a93e499ac72889ae2fc9a8b9f"
65
+ "gitHead": "fe8abd6f4a59b244b0cc5de57328276448ff61f8"
64
66
  }