sim-node-lib 0.4.17 → 0.4.19

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.
@@ -10,5 +10,6 @@ export declare enum NotificacaoTipoEnum {
10
10
  enviarPorTipoCombustivelCidadeGD = 9,
11
11
  enviarPorTipoCombustivel = 10,
12
12
  enviarPorTipoCombustivelCidade = 11,
13
- enviarPorTipoCombustivelGD = 12
13
+ enviarPorTipoCombustivelGD = 12,
14
+ enviarPorCluster = 13
14
15
  }
@@ -15,4 +15,5 @@ var NotificacaoTipoEnum;
15
15
  NotificacaoTipoEnum[NotificacaoTipoEnum["enviarPorTipoCombustivel"] = 10] = "enviarPorTipoCombustivel";
16
16
  NotificacaoTipoEnum[NotificacaoTipoEnum["enviarPorTipoCombustivelCidade"] = 11] = "enviarPorTipoCombustivelCidade";
17
17
  NotificacaoTipoEnum[NotificacaoTipoEnum["enviarPorTipoCombustivelGD"] = 12] = "enviarPorTipoCombustivelGD";
18
+ NotificacaoTipoEnum[NotificacaoTipoEnum["enviarPorCluster"] = 13] = "enviarPorCluster";
18
19
  })(NotificacaoTipoEnum = exports.NotificacaoTipoEnum || (exports.NotificacaoTipoEnum = {}));
@@ -0,0 +1,3 @@
1
+ export default class ImageHelper {
2
+ static imageFromUrlToBase64(url: string, logger?: any): Promise<string | void>;
3
+ }
@@ -0,0 +1,34 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const axios_1 = __importDefault(require("axios"));
16
+ class ImageHelper {
17
+ static imageFromUrlToBase64(url, logger) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ return yield axios_1.default
20
+ .get(url, { responseType: 'arraybuffer' })
21
+ .then((response) => {
22
+ const base64Image = Buffer.from(response.data, 'binary').toString('base64');
23
+ return base64Image;
24
+ })
25
+ .catch((e) => {
26
+ if (typeof logger.error === 'function')
27
+ logger.error(e);
28
+ if (typeof logger.log === 'function')
29
+ logger.log(e);
30
+ });
31
+ });
32
+ }
33
+ }
34
+ exports.default = ImageHelper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim-node-lib",
3
- "version": "0.4.17",
3
+ "version": "0.4.19",
4
4
  "description": "Library from SIMLabs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",